Desaturating SwerveModuleState[]
after ChassisSpeeds.discretize
introduces translational drift
#7332
Labels
SwerveModuleState[]
after ChassisSpeeds.discretize
introduces translational drift
#7332
If you discretize a
ChassisSpeeds
, convert the speeds to module states, and then desaturate the module states, translational drift will be introduced to the resulting robot twist. This is how most users currently implement swerve kinematics.Note
Removing the
SwerveDriveKinematics.desaturateWheelSpeeds(states, maxSpeed)
does not fix the problem, it simply creates module states that are not achievable, which introduces other issues (including translational drift).A Java example is shown below:
If you instead do desaturate -> discretize -> desaturate, the error is reduced significantly (50x in my testing), but is still less than optimal:
I'm not sure what direction WPILib wants to take to address this issue, but at a minimum it should be documented.
The text was updated successfully, but these errors were encountered: