Moved Maximum Speed to constants.java and added a comment to AbsoluteFieldDriveAdv.
I would also love to move this block of code out of swerve subsystem as I imagine most teams find it a bit confusing as it is already in the JSON files, but I understand why it is there.
// Angle conversion factor is 360 / (GEAR RATIO * ENCODER RESOLUTION) // In this case the gear ratio is 12.8 motor revolutions per wheel rotation. // The encoder resolution per motor revolution is 1 per motor revolution. double angleConversionFactor = SwerveMath.calculateDegreesPerSteeringRotation(12.8); // Motor conversion factor is (PI * WHEEL DIAMETER IN METERS) / (GEAR RATIO * ENCODER RESOLUTION). // In this case the wheel diameter is 4 inches, which must be converted to meters to get meters/second. // The gear ratio is 6.75 motor revolutions per wheel rotation. // The encoder resolution per motor revolution is 1 per motor revolution. double driveConversionFactor = SwerveMath.calculateMetersPerRotation(Units.inchesToMeters(4), 6.75); System.out.println("\"conversionFactor\": {"); System.out.println("\t\"angle\": " + angleConversionFactor + ","); System.out.println("\t\"drive\": " + driveConversionFactor); System.out.println("}");
Moved Maximum Speed to constants.java and added a comment to AbsoluteFieldDriveAdv.
I would also love to move this block of code out of swerve subsystem as I imagine most teams find it a bit confusing as it is already in the JSON files, but I understand why it is there.
// Angle conversion factor is 360 / (GEAR RATIO * ENCODER RESOLUTION) // In this case the gear ratio is 12.8 motor revolutions per wheel rotation. // The encoder resolution per motor revolution is 1 per motor revolution. double angleConversionFactor = SwerveMath.calculateDegreesPerSteeringRotation(12.8); // Motor conversion factor is (PI * WHEEL DIAMETER IN METERS) / (GEAR RATIO * ENCODER RESOLUTION). // In this case the wheel diameter is 4 inches, which must be converted to meters to get meters/second. // The gear ratio is 6.75 motor revolutions per wheel rotation. // The encoder resolution per motor revolution is 1 per motor revolution. double driveConversionFactor = SwerveMath.calculateMetersPerRotation(Units.inchesToMeters(4), 6.75); System.out.println("\"conversionFactor\": {"); System.out.println("\t\"angle\": " + angleConversionFactor + ","); System.out.println("\t\"drive\": " + driveConversionFactor); System.out.println("}");