Skip to content

Commit

Permalink
changed preferences values to be from rotations, since that's how the…
Browse files Browse the repository at this point in the history
… offsets are.
2491NoMythic committed Feb 7, 2024
1 parent fe163a7 commit ebeb1d3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/frc/robot/subsystems/DrivetrainSubsystem.java
Original file line number Diff line number Diff line change
@@ -132,28 +132,28 @@ public DrivetrainSubsystem(Lights lights, Boolean lightsExist) {
FL_DRIVE_MOTOR_ID,
FL_STEER_MOTOR_ID,
FL_STEER_ENCODER_ID,
new Rotation2d(Preferences.getDouble("FL offset", 0)),
Rotation2d.fromRotations(Preferences.getDouble("FL offset", 0)),
CANIVORE_DRIVETRAIN);
modules[1] = new SwerveModule(
"FR",
FR_DRIVE_MOTOR_ID,
FR_STEER_MOTOR_ID,
FR_STEER_ENCODER_ID,
new Rotation2d(Preferences.getDouble("FR offset", 0)),
Rotation2d.fromRotations(Preferences.getDouble("FR offset", 0)),
CANIVORE_DRIVETRAIN);
modules[2] = new SwerveModule(
"BL",
BL_DRIVE_MOTOR_ID,
BL_STEER_MOTOR_ID,
BL_STEER_ENCODER_ID,
new Rotation2d(Preferences.getDouble("BL offset", 0)),
Rotation2d.fromRotations(Preferences.getDouble("BL offset", 0)),
CANIVORE_DRIVETRAIN);
modules[3] = new SwerveModule(
"BR",
BR_DRIVE_MOTOR_ID,
BR_STEER_MOTOR_ID,
BR_STEER_ENCODER_ID,
new Rotation2d(Preferences.getDouble("BR offset", 0)),
Rotation2d.fromRotations(Preferences.getDouble("BR offset", 0)),
CANIVORE_DRIVETRAIN);

odometer = new SwerveDrivePoseEstimator(
@@ -203,8 +203,8 @@ public SwerveModuleState[] getModuleStates() {
public void setEncoderOffsets() {
Preferences.setDouble("FL offset", modules[0].findOffset());
Preferences.setDouble("FR offset", modules[1].findOffset());
Preferences.setDouble("BR offset", modules[2].findOffset());
Preferences.setDouble("BL offset", modules[3].findOffset());
Preferences.setDouble("BL offset", modules[2].findOffset());
Preferences.setDouble("BR offset", modules[3].findOffset());
}
public Pose2d getPose() {
return odometer.getEstimatedPosition();

0 comments on commit ebeb1d3

Please sign in to comment.