Skip to content

Commit

Permalink
Merge pull request #32 from jbko6/practiceBot
Browse files Browse the repository at this point in the history
Add support for new practice drivebase
  • Loading branch information
jbko6 authored Feb 13, 2024
2 parents 397a49c + df48d5c commit d69cfdc
Show file tree
Hide file tree
Showing 18 changed files with 217 additions and 48 deletions.
8 changes: 8 additions & 0 deletions src/main/deploy/bonkswerve/controllerproperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"angleJoystickRadiusDeadband": 0.05,
"heading": {
"p": 1.0,
"i": 0,
"d": 0
}
}
27 changes: 27 additions & 0 deletions src/main/deploy/bonkswerve/modules/backleft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"location": {
"front": -8.5,
"left": 8.5
},
"absoluteEncoderOffset": 342.24609375,
"absoluteEncoderInverted": false,
"drive": {
"type": "falcon",
"id": 7,
"canbus": null
},
"angle": {
"type": "falcon",
"id": 8,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 9,
"canbus": null
},
"inverted": {
"drive": true,
"angle": false
}
}
27 changes: 27 additions & 0 deletions src/main/deploy/bonkswerve/modules/backright.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"location": {
"front": -8.5,
"left": -8.5
},
"absoluteEncoderOffset": 143.876953125,
"absoluteEncoderInverted": false,
"drive": {
"type": "falcon",
"id": 10,
"canbus": null
},
"angle": {
"type": "falcon",
"id": 11,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 12,
"canbus": null
},
"inverted": {
"drive": true,
"angle": false
}
}
27 changes: 27 additions & 0 deletions src/main/deploy/bonkswerve/modules/frontleft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"location": {
"front": 8.5,
"left": 8.5
},
"absoluteEncoderOffset": 347.6953125,
"absoluteEncoderInverted": false,
"drive": {
"type": "falcon",
"id": 1,
"canbus": null
},
"angle": {
"type": "falcon",
"id": 2,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 3,
"canbus": null
},
"inverted": {
"drive": true,
"angle": false
}
}
27 changes: 27 additions & 0 deletions src/main/deploy/bonkswerve/modules/frontright.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"location": {
"front": 8.5,
"left": -8.5
},
"absoluteEncoderOffset": 288.544921875,
"absoluteEncoderInverted": false,
"drive": {
"type": "falcon",
"id": 4,
"canbus": null
},
"angle": {
"type": "falcon",
"id": 5,
"canbus": null
},
"encoder": {
"type": "cancoder",
"id": 6,
"canbus": null
},
"inverted": {
"drive": true,
"angle": false
}
}
16 changes: 16 additions & 0 deletions src/main/deploy/bonkswerve/modules/physicalproperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"optimalVoltage": 12,
"wheelGripCoefficientOfFriction": 1.19,
"currentLimit": {
"drive": 40,
"angle": 20
},
"conversionFactor": {
"angle": 28.125,
"drive": 0.0392120164133
},
"rampRate": {
"drive": 0.25,
"angle": 0.25
}
}
16 changes: 16 additions & 0 deletions src/main/deploy/bonkswerve/modules/pidfproperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"drive": {
"p": 20.0,
"i": 0,
"d": 0,
"f": 0,
"iz": 0
},
"angle": {
"p": 35.0,
"i": 0,
"d": 0,
"f": 0,
"iz": 0
}
}
14 changes: 14 additions & 0 deletions src/main/deploy/bonkswerve/swervedrive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"imu": {
"type": "navx",
"id": 0,
"canbus": null
},
"invertedIMU": false,
"modules": [
"frontleft.json",
"frontright.json",
"backleft.json",
"backright.json"
]
}
4 changes: 2 additions & 2 deletions src/main/deploy/practiceswerve/controllerproperties.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"angleJoystickRadiusDeadband": 0.05,
"angleJoystickRadiusDeadband": 0.5,
"heading": {
"p": 1.0,
"p": 0.4,
"i": 0,
"d": 0
}
Expand Down
15 changes: 7 additions & 8 deletions src/main/deploy/practiceswerve/modules/backleft.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{
"location": {
"front": -8.5,
"left": 8.5
"front": -12.5,
"left": 12.5
},
"absoluteEncoderOffset": 342.24609375,
"absoluteEncoderInverted": false,
"absoluteEncoderOffset": 176.30859375,
"drive": {
"type": "falcon",
"id": 7,
"canbus": null
"canbus": "Drivebase"
},
"angle": {
"type": "falcon",
"id": 8,
"canbus": null
"canbus": "Drivebase"
},
"encoder": {
"type": "cancoder",
"id": 9,
"canbus": null
"canbus": "Drivebase"
},
"inverted": {
"drive": true,
"drive": false,
"angle": false
}
}
15 changes: 7 additions & 8 deletions src/main/deploy/practiceswerve/modules/backright.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{
"location": {
"front": -8.5,
"left": -8.5
"front": -12.5,
"left": -12.5
},
"absoluteEncoderOffset": 143.876953125,
"absoluteEncoderInverted": false,
"absoluteEncoderOffset": 161.01562500000003,
"drive": {
"type": "falcon",
"id": 10,
"canbus": null
"canbus": "Drivebase"
},
"angle": {
"type": "falcon",
"id": 11,
"canbus": null
"canbus": "Drivebase"
},
"encoder": {
"type": "cancoder",
"id": 12,
"canbus": null
"canbus": "Drivebase"
},
"inverted": {
"drive": true,
"drive": false,
"angle": false
}
}
15 changes: 7 additions & 8 deletions src/main/deploy/practiceswerve/modules/frontleft.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{
"location": {
"front": 8.5,
"left": 8.5
"front": 12.5,
"left": 12.5
},
"absoluteEncoderOffset": 347.6953125,
"absoluteEncoderInverted": false,
"absoluteEncoderOffset": 314.47109375000002,
"drive": {
"type": "falcon",
"id": 1,
"canbus": null
"canbus": "Drivebase"
},
"angle": {
"type": "falcon",
"id": 2,
"canbus": null
"canbus": "Drivebase"
},
"encoder": {
"type": "cancoder",
"id": 3,
"canbus": null
"canbus": "Drivebase"
},
"inverted": {
"drive": true,
"drive": false,
"angle": false
}
}
15 changes: 7 additions & 8 deletions src/main/deploy/practiceswerve/modules/frontright.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
{
"location": {
"front": 8.5,
"left": -8.5
"front": 12.5,
"left": -12.5
},
"absoluteEncoderOffset": 288.544921875,
"absoluteEncoderInverted": false,
"absoluteEncoderOffset": 208.47476562500003,
"drive": {
"type": "falcon",
"id": 4,
"canbus": null
"canbus": "Drivebase"
},
"angle": {
"type": "falcon",
"id": 5,
"canbus": null
"canbus": "Drivebase"
},
"encoder": {
"type": "cancoder",
"id": 6,
"canbus": null
"canbus": "Drivebase"
},
"inverted": {
"drive": true,
"drive": false,
"angle": false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"angle": 20
},
"conversionFactor": {
"angle": 28.125,
"drive": 0.0392120164133
"angle": 19.2,
"drive": 0.059108484
},
"rampRate": {
"drive": 0.25,
Expand Down
4 changes: 2 additions & 2 deletions src/main/deploy/practiceswerve/modules/pidfproperties.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"drive": {
"p": 20.0,
"p": 20,
"i": 0,
"d": 0,
"f": 0,
"iz": 0
},
"angle": {
"p": 35.0,
"p": 35,
"i": 0,
"d": 0,
"f": 0,
Expand Down
6 changes: 3 additions & 3 deletions src/main/deploy/practiceswerve/swervedrive.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"imu": {
"type": "navx",
"id": 0,
"canbus": null
"type": "pigeon2",
"id": 13,
"canbus": "Drivebase"
},
"invertedIMU": false,
"modules": [
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/frc/team2412/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public class Robot extends TimedRobot {

public enum RobotType {
COMPETITION,
PRACTICE,
CRANE,
PRACTICE;
BONK;
}

public static Robot getInstance() {
Expand All @@ -47,12 +48,14 @@ protected Robot() {
}

public static final MACAddress COMPETITION_ADDRESS = MACAddress.of(0x00, 0x00, 0x00);
public static final MACAddress PRACTICE_ADDRESS = MACAddress.of(0x33, 0x9d, 0xD1);
public static final MACAddress BONK_ADDRESS = MACAddress.of(0x33, 0x9D, 0xE7);
public static final MACAddress CRANE_ADDRESS = MACAddress.of(0x22, 0xB0, 0x92);
public static final MACAddress PRACTICE_ADDRESS = MACAddress.of(0x33, 0x9D, 0xE7);

private static RobotType getTypeFromAddress() {
if (PRACTICE_ADDRESS.exists()) return RobotType.PRACTICE;
if (CRANE_ADDRESS.exists()) return RobotType.CRANE;
if (BONK_ADDRESS.exists()) return RobotType.BONK;
if (!COMPETITION_ADDRESS.exists())
DriverStation.reportWarning(
"Code running on unknown MAC Address! Running competition code anyways", false);
Expand Down
Loading

0 comments on commit d69cfdc

Please sign in to comment.