Skip to content

Commit db6f168

Browse files
Merge pull request #66 from DeepBlueRobotics/merge-actual-dt-characterization
Merge actual-dt-characterization, dt-characterization, and swim-shady-dt
2 parents 7fb295c + aee3463 commit db6f168

File tree

4 files changed

+490
-31
lines changed

4 files changed

+490
-31
lines changed

simgui.json

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"types": {
3838
"/FMSInfo": "FMSInfo",
3939
"/Shuffleboard/Auto Chooser Tab/SendableChooser[0]": "String Chooser",
40+
"/Shuffleboard/Auto Chooser Tab/SendableChooser[1]": "String Chooser",
4041
"/Shuffleboard/arm SysID/dynamic backward": "Command",
4142
"/Shuffleboard/arm SysID/dynamic forward": "Command",
4243
"/Shuffleboard/arm SysID/quasistatic backward": "Command",
@@ -45,6 +46,7 @@
4546
"/SmartDashboard/Field": "Field2d",
4647
"/SmartDashboard/Intake Shooter": "Subsystem",
4748
"/SmartDashboard/SendableChooser[0]": "String Chooser",
49+
"/SmartDashboard/SendableChooser[1]": "String Chooser",
4850
"/SmartDashboard/moveClimber": "Command"
4951
},
5052
"windows": {
@@ -59,22 +61,38 @@
5961
"left": 150,
6062
"right": 2961,
6163
"top": 79,
62-
"width": 16.541748046875
64+
"width": 16.541748046875,
65+
"window": {
66+
"visible": true
67+
}
6368
}
6469
}
6570
},
6671
"NetworkTables": {
72+
"persistent": {
73+
"SmartDashboard": {
74+
"open": true
75+
}
76+
},
77+
"retained": {
78+
"Shuffleboard": {
79+
"open": true
80+
}
81+
},
6782
"transitory": {
83+
"Shuffleboard": {
84+
"open": true
85+
},
6886
"SmartDashboard": {
69-
"Arm": {
70-
"open": true
71-
},
7287
"BL": {
7388
"open": true
7489
},
7590
"BR": {
7691
"open": true
7792
},
93+
"CONFIG overrides": {
94+
"open": true
95+
},
7896
"FL": {
7997
"open": true
8098
},

src/main/java/org/carlmontrobotics/Config.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,24 @@ public abstract class Config implements Sendable {
2222

2323
// Add additional config settings by declaring a protected field, and...
2424
protected boolean exampleFlagEnabled = false;
25+
protected boolean swimShady = false;
26+
protected boolean setupSysId = false;
2527

2628
// ...a public getter starting with "is" for booleans or "get" for other types.
2729
// Do NOT remove this example. It is used by unit tests.
30+
2831
public boolean isExampleFlagEnabled() {
2932
return exampleFlagEnabled;
3033
}
3134

35+
public boolean isSwimShady() {
36+
return swimShady;
37+
}
38+
39+
public boolean isSysIdTesting() {
40+
return setupSysId;
41+
}
42+
3243
// --- For clarity, place additional config settings ^above^ this line ---
3344

3445
private static class MethodResult {

src/main/java/org/carlmontrobotics/Constants.java

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package org.carlmontrobotics;
77

88
import org.carlmontrobotics.lib199.swerve.SwerveConfig;
9+
import static org.carlmontrobotics.Config.CONFIG;
910

1011
import com.pathplanner.lib.path.PathConstraints;
1112
import com.pathplanner.lib.util.ReplanningConfig;
@@ -194,8 +195,10 @@ public static final class Drivetrainc {
194195

195196
// #region Subsystem Constants
196197

197-
public static final double wheelBase = Units.inchesToMeters(16.75);
198-
public static final double trackWidth = Units.inchesToMeters(23.75);
198+
public static final double wheelBase = CONFIG.isSwimShady() ? Units.inchesToMeters(19.75)
199+
: Units.inchesToMeters(16.75);
200+
public static final double trackWidth = CONFIG.isSwimShady() ? Units.inchesToMeters(28.75)
201+
: Units.inchesToMeters(23.75);
199202
// "swerveRadius" is the distance from the center of the robot to one of the
200203
// modules
201204
public static final double swerveRadius = Math.sqrt(Math.pow(wheelBase / 2, 2) + Math.pow(trackWidth / 2, 2));
@@ -232,7 +235,8 @@ public static final class Drivetrainc {
232235
// public static final boolean[] reversed = {true, true, true, true};
233236
// Determine correct turnZero constants (FL, FR, BL, BR)
234237
public static final double[] turnZeroDeg = RobotBase.isSimulation() ? new double[] {-90.0, -90.0, -90.0, -90.0 }
235-
: new double[] { -48.6914, 63.3691, 94.1309, -6.7676 };/* real values here */
238+
: (CONFIG.isSwimShady() ? new double[] { 85.7812, 85.0782, -96.9433, -162.9492 }
239+
: new double[] { -48.6914, 63.3691, 94.1309, -6.7676 });/* real values here */
236240

237241
// kP, kI, and kD constants for turn motor controllers in the order of
238242
// front-left, front-right, back-left, back-right.
@@ -254,11 +258,14 @@ public static final class Drivetrainc {
254258
// Forward: 1.72, 1.71, 1.92, 1.94
255259
// Backward: 1.92, 1.92, 2.11, 1.89
256260
// Order of modules: (FL, FR, BL, BR)
257-
public static final double[] drivekP = { 1.75, 1.75, 1.75, .75 }; // {1.82/100, 1.815/100, 2.015/100,
261+
public static final double[] drivekP = CONFIG.isSwimShady() ? new double[] { 2.8, 2.8, 2.8, 2.8 }
262+
: new double[] { 1.75, 1.75, 1.75, .75 }; // {1.82/100, 1.815/100, 2.015/100,
258263
// 1.915/100};
259264
public static final double[] drivekI = { 0, 0, 0, 0 };
260265
public static final double[] drivekD = { 0, 0, 0, 0 };
261-
public static final boolean[] driveInversion = { true, false, true, false };
266+
public static final boolean[] driveInversion = (CONFIG.isSwimShady()
267+
? new boolean[] { false, false, false, false }
268+
: new boolean[] { true, false, true, false });
262269
public static final boolean[] turnInversion = { true, true, true, true };
263270
// kS
264271
public static final double[] kForwardVolts = { 0.26744, 0.31897, 0.27967, 0.2461 };
@@ -280,9 +287,11 @@ public static final class Drivetrainc {
280287
public static final boolean isGyroReversed = true;
281288

282289
// PID values are listed in the order kP, kI, and kD
283-
public static final double[] xPIDController = { 2, 0.0, 0.0 };
284-
public static final double[] yPIDController = { 2, 0.0, 0.0 };
285-
public static final double[] thetaPIDController = { 0.05, 0.0, 0.00 };
290+
public static final double[] xPIDController = CONFIG.isSwimShady() ? new double[] { 4, 0.0, 0.0 }
291+
: new double[] { 2, 0.0, 0.0 };
292+
public static final double[] yPIDController = xPIDController;
293+
public static final double[] thetaPIDController = CONFIG.isSwimShady() ? new double[] { 0.10, 0.0, 0.001 }
294+
: new double[] { 0.05, 0.0, 0.00 };
286295

287296
public static final SwerveConfig swerveConfig = new SwerveConfig(wheelDiameterMeters, driveGearing, mu,
288297
autoCentripetalAccel, kForwardVolts, kForwardVels, kForwardAccels, kBackwardVolts, kBackwardVels,
@@ -296,20 +305,20 @@ public static final class Drivetrainc {
296305

297306
// #region Ports
298307

299-
public static final int driveFrontLeftPort = 11; //
300-
public static final int driveFrontRightPort = 19; //
301-
public static final int driveBackLeftPort = 14; //
302-
public static final int driveBackRightPort = 17; // correct
308+
public static final int driveFrontLeftPort = CONFIG.isSwimShady() ? 8 : 11; //
309+
public static final int driveFrontRightPort = CONFIG.isSwimShady() ? 13 : 19; //
310+
public static final int driveBackLeftPort = CONFIG.isSwimShady() ? 5 : 14; //
311+
public static final int driveBackRightPort = CONFIG.isSwimShady() ? 11 : 17; // correct
303312

304-
public static final int turnFrontLeftPort = 12; //
305-
public static final int turnFrontRightPort = 20; // 20
306-
public static final int turnBackLeftPort = 15; //
307-
public static final int turnBackRightPort = 16; // correct
313+
public static final int turnFrontLeftPort = CONFIG.isSwimShady() ? 7 : 12; //
314+
public static final int turnFrontRightPort = CONFIG.isSwimShady() ? 14 : 20; // 20
315+
public static final int turnBackLeftPort = CONFIG.isSwimShady() ? 6 : 15; //
316+
public static final int turnBackRightPort = CONFIG.isSwimShady() ? 12 : 16; // correct
308317

309-
public static final int canCoderPortFL = 0;
310-
public static final int canCoderPortFR = 3;
311-
public static final int canCoderPortBL = 2;
312-
public static final int canCoderPortBR = 1;
318+
public static final int canCoderPortFL = CONFIG.isSwimShady() ? 4 : 0;
319+
public static final int canCoderPortFR = CONFIG.isSwimShady() ? 2 : 3;
320+
public static final int canCoderPortBL = CONFIG.isSwimShady() ? 3 : 2;
321+
public static final int canCoderPortBR = CONFIG.isSwimShady() ? 1 : 1;
313322

314323
// #endregion
315324

0 commit comments

Comments
 (0)