CTRE generated code question

I’m looking at the CTRE generated swerve source code, and I came across this line in the SwerveModule constructor:

steerConfigs.MotionMagic.MotionMagicCruiseVelocity = 100.0 / constants.SteerMotorGearRatio;

I’m wondering if anyone knows the reason behind limiting the velocity of the steer motor to 100 / steer motor gear ratio. This would mean as the gear ratio increases, then the maximum velocity decreases, no? I feel like this is counterintuitive; if there is a higher gear ratio between the steer motor and the rotation of the wheel, the maximum velocity of the steer motor should be increased to compensate for that right?

Please let me know if I’m misinterpreting this math. Thanks!

100.0 rotations per second is the (approximate) maximum possible velocity of a Falcon 500 or a Kraken X60 before gear ratio. As your gear ratio increases, the maximum possible velocity of the azimuth output decreases with it. Since we set up the steer motor to operate in terms of azimuth rotations, that means that the Motion Magic® cruise velocity decreases as gear ratio increases.

Something else I’ll note, in 2025 our swerve API no longer uses regular Motion Magic®. Instead, we support Motion Magic® Expo and regular Position PID.

4 Likes

Is there a way to force the swerve API to use Motion Magic instead? The upgraded Motion Magic Expo had some problem in the simulation.

We are aware of the observed issue with Motion Magic® Expo, and it will be fixed in beta-3. Besides that, you can also use regular Position PID instead, which is also being improved in beta-3.
Our swerve API does not support using regular Motion Magic® anymore because it’s not really an appropriate control request for steer motors; Expo and regular Position PID are both better alternatives.

1 Like

Gotcha, and thanks for answering! :smile: