@@ -155,16 +155,82 @@ public enum Mode {
155155 double mu = 1 ;
156156 double autoCentripetalAccel = mu * g * 2 ;
157157
158+
159+ //Extra
160+ double wheelBase ;
161+ double trackWidth ;
162+
163+ int driveFrontLeftPort ;
164+ int turnFrontLeftPort ;
165+ int canCoderPortFL ;
166+
167+ int driveFrontRightPort ;
168+ int turnFrontRightPort ;
169+ int canCoderPortFR ;
170+
171+ int driveBackLeftPort ;
172+ int turnBackLeftPort ;
173+ int canCoderPortBL ;
174+
175+ int driveBackRightPort ;
176+ int turnBackRightPort ;
177+ int canCoderPortBR ;
178+
179+ double secsPer12Volts ;
180+ double wheelDiameterMeters ;
181+ double driveGearing ;
182+ double turnGearing ;
183+
184+ boolean isGyroReversed ;
185+ double maxSpeed ;
186+
187+ RobotConfig robotConfig ;
188+
189+ double COLLISION_ACCELERATION_THRESHOLD ;
190+
191+
192+
158193 /**
159194 *
160195 * @param wheelBase in meters
161196 * @param trackWidth in meters
162197 */
163198 public SimpleDrivetrain (
164- SwerveConfig swerveconfig
199+ SwerveConfig swerveConfig ,
200+ double wheelBase , double trackWidth ,
201+ int driveFrontLeftPort , int turnFrontLeftPort , int canCoderPortFL ,
202+ int driveFrontRightPort , int turnFrontRightPort , int canCoderPortFR ,
203+ int driveBackLeftPort , int turnBackLeftPort , int canCoderPortBL ,
204+ int driveBackRightPort , int turnBackRightPort , int canCoderPortBR ,
205+ double secsPer12Volts , double wheelDiameterMeters , double driveGearing , double turnGearing ,
206+ boolean isGyroReversed , double maxSpeed ,
207+ RobotConfig robotConfig ,
208+ double COLLISION_ACCELERATION_THRESHOLD
165209 )
166210 {
167211 this .swerveConfig = swerveConfig ;
212+ this .wheelBase = wheelBase ;
213+ this .trackWidth = trackWidth ;
214+ this .driveFrontLeftPort = driveFrontLeftPort ;
215+ this .turnFrontLeftPort = turnFrontLeftPort ;
216+ this .canCoderPortFL = canCoderPortFL ;
217+ this .driveFrontRightPort = driveFrontRightPort ;
218+ this .turnFrontRightPort = turnFrontRightPort ;
219+ this .canCoderPortFR = canCoderPortFR ;
220+ this .driveBackLeftPort = driveBackLeftPort ;
221+ this .turnBackLeftPort = turnBackLeftPort ;
222+ this .canCoderPortBL = canCoderPortBL ;
223+ this .driveBackRightPort = driveBackRightPort ;
224+ this .turnBackRightPort = turnBackRightPort ;
225+ this .canCoderPortBR = canCoderPortBR ;
226+ this .secsPer12Volts = secsPer12Volts ;
227+ this .wheelDiameterMeters = wheelDiameterMeters ;
228+ this .driveGearing = driveGearing ;
229+ this .turnGearing = turnGearing ;
230+ this .isGyroReversed = isGyroReversed ;
231+ this .maxSpeed = maxSpeed ;
232+ this .robotConfig = robotConfig ;
233+ this .COLLISION_ACCELERATION_THRESHOLD = COLLISION_ACCELERATION_THRESHOLD ;
168234
169235 AutoBuilder ();
170236
@@ -214,22 +280,22 @@ public SimpleDrivetrain(
214280 moduleFL = new SwerveModule (swerveConfig , SwerveModule .ModuleType .FL ,
215281 driveMotors [0 ] = MotorControllerFactory .createSparkFlex (driveFrontLeftPort ),
216282 turnMotors [0 ] = MotorControllerFactory .createSparkMax (turnFrontLeftPort , MotorConfig .NEO ),
217- turnEncoders [0 ] = SensorFactory .createCANCoder (Constants . Drivetrainc . canCoderPortFL ), 0 , pitchSupplier , rollSupplier );
283+ turnEncoders [0 ] = SensorFactory .createCANCoder (canCoderPortFL ), 0 , pitchSupplier , rollSupplier );
218284 //SmartDashboard.putNumber("FL Motor Val", turnMotors[0].getEncoder().getPosition());
219- moduleFR = new SwerveModule (Constants . Drivetrainc . swerveConfig , SwerveModule .ModuleType .FR ,
285+ moduleFR = new SwerveModule (swerveConfig , SwerveModule .ModuleType .FR ,
220286 driveMotors [1 ] = MotorControllerFactory .createSparkFlex (driveFrontRightPort ),
221287 turnMotors [1 ] = MotorControllerFactory .createSparkMax (turnFrontRightPort , MotorConfig .NEO ),
222- turnEncoders [1 ] = SensorFactory .createCANCoder (Constants . Drivetrainc . canCoderPortFR ), 1 , pitchSupplier , rollSupplier );
288+ turnEncoders [1 ] = SensorFactory .createCANCoder (canCoderPortFR ), 1 , pitchSupplier , rollSupplier );
223289
224- moduleBL = new SwerveModule (Constants . Drivetrainc . swerveConfig , SwerveModule .ModuleType .BL ,
290+ moduleBL = new SwerveModule (swerveConfig , SwerveModule .ModuleType .BL ,
225291 driveMotors [2 ] = MotorControllerFactory .createSparkFlex (driveBackLeftPort ),
226292 turnMotors [2 ] = MotorControllerFactory .createSparkMax (turnBackLeftPort , MotorConfig .NEO ),
227- turnEncoders [2 ] = SensorFactory .createCANCoder (Constants . Drivetrainc . canCoderPortBL ), 2 , pitchSupplier , rollSupplier );
293+ turnEncoders [2 ] = SensorFactory .createCANCoder (canCoderPortBL ), 2 , pitchSupplier , rollSupplier );
228294
229- moduleBR = new SwerveModule (Constants . Drivetrainc . swerveConfig , SwerveModule .ModuleType .BR ,
295+ moduleBR = new SwerveModule (swerveConfig , SwerveModule .ModuleType .BR ,
230296 driveMotors [3 ] = MotorControllerFactory .createSparkFlex (driveBackRightPort ),
231297 turnMotors [3 ] = MotorControllerFactory .createSparkMax (turnBackRightPort , MotorConfig .NEO ),
232- turnEncoders [3 ] = SensorFactory .createCANCoder (Constants . Drivetrainc . canCoderPortBR ), 3 , pitchSupplier , rollSupplier );
298+ turnEncoders [3 ] = SensorFactory .createCANCoder (canCoderPortBR ), 3 , pitchSupplier , rollSupplier );
233299 modules = new SwerveModule [] { moduleFL , moduleFR , moduleBL , moduleBR };
234300 turnPidControllers [0 ] = turnMotors [0 ].getClosedLoopController ();
235301 turnPidControllers [1 ] = turnMotors [1 ].getClosedLoopController ();
@@ -588,7 +654,7 @@ public void drive(SwerveModuleState[] moduleStates) {
588654 * Configures PathPlanner AutoBuilder
589655 */
590656 public void AutoBuilder () {
591- RobotConfig config = Constants . Drivetrainc . Autoc . robotConfig ;
657+ RobotConfig config = robotConfig ;
592658 AutoBuilder .configure (
593659 //Supplier<Pose2d> poseSupplier,
594660 this ::getPose , // Robot pose supplier
0 commit comments