66package org .carlmontrobotics ;
77
88import org .carlmontrobotics .lib199 .swerve .SwerveConfig ;
9+ import static org .carlmontrobotics .Config .CONFIG ;
910
1011import com .pathplanner .lib .path .PathConstraints ;
1112import 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