Skip to content

Commit 9ab52b5

Browse files
author
NoahAndrews
committed
Remove magic numbers, fix precision loss
1 parent 51b504c commit 9ab52b5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/frc/robot/Constants.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,11 @@ public static final class ModuleConstants {
7272
public static final boolean kTurningEncoderInverted = true;
7373

7474
// Calculations required for driving motor conversion factors and feed forward
75-
public static final double kDrivingMotorFreeSpeedRps = 5676 / 60;
76-
public static final double kDrivingMotorReduction = 990 / (kMotorPinionTeeth * 15);
75+
public static final double kDrivingMotorFreeSpeedRps = NeoMotorConstants.kFreeSpeedRpm / 60;
7776
public static final double kWheelDiameterMeters = 0.0762;
7877
public static final double kWheelCircumferenceMeters = kWheelDiameterMeters * Math.PI;
78+
// 45 teeth on the wheel's bevel gear, 22 teeth on the first-stage spur gear, 15 teeth on the bevel pinion
79+
public static final double kDrivingMotorReduction = (45.0 * 22) / (kMotorPinionTeeth * 15);
7980
public static final double kDriveWheelFreeSpeedRps = (kDrivingMotorFreeSpeedRps * kWheelCircumferenceMeters)
8081
/ kDrivingMotorReduction;
8182

@@ -129,4 +130,8 @@ public static final class AutoConstants {
129130
public static final TrapezoidProfile.Constraints kThetaControllerConstraints = new TrapezoidProfile.Constraints(
130131
kMaxAngularSpeedRadiansPerSecond, kMaxAngularSpeedRadiansPerSecondSquared);
131132
}
133+
134+
public static final class NeoMotorConstants {
135+
public static final double kFreeSpeedRpm = 5676;
136+
}
132137
}

0 commit comments

Comments
 (0)