Swerve Drive Speeding Up While Turning

Our coding team has been having a problem with our swerve drives speed. When we move the swerve at an angle, the wheels move slightly faster than when we have it moving in other directions even though it is receiving a constant amount of voltage. Is there anyway we can fix this?

To clarify we are using MK4I model of swerve.

Are you running open loop? Or under some closed loop control? Is this your own code from scratch or based off someone else’s as a template?

When you say turning do you mean spinning the robot or driving diagonally, I suspect the former, but just checking.

In theory this sounds like an issue with the math, but because you framed it in terms of voltage vs rpm or ticks/second I am asking.

Whose swerve code are you using? Did you create it yourself?

Most likely your joystick command is greater in the diagonal because you are sending the hypotenuse of the max X and Y axis instead of just the x or y alone or some amount in between.

The solution is to normalize the joystick command.

1 Like

This is what @sthump is referring to, this could be on either joystick.