Swerve Odometry Tuning

Looking for some pointers on how to tune swerve odometry. When testing, the robot was consistently off ~5cm per meter of translation. Our lead programmer last night put in a factor to adjust the wheel size and we were able to get an error of ~1cm per 10 meters of translation.

We felt good. We rejoiced. And then…

We started to rotate the robot while translating and introduced a lateral error (error perpendicular to the direction of translation) of ~10cm per rotation. For example if the robot was set to travel 2m North while performing a 360 degree rotation, it would travel 2m North perfectly, but would also end up being ~10cm East of where it should have finished.

A couple of hypothesis’s:

  • Wheel headings aren’t true
  • Wheel diameters aren’t equal [tread wear?]
  • Serve module positions aren’t accurate [enough?] (the drive base is rectangular)

Any advice on what else to consider?
Any suggestions on test patterns that we can test to help find the root cause?

Thank you!

You should look at this thread for an in-depth explanation for the reasoning behind this and also potential fixes.

1 Like

Aren’t you using the CTRE Swerve code?

Yes we are using the CTRE Swerve code.

Progress on auto and odometry!

Last year’s robot with 2024 code.

What did you change?

Great question! When I asked it our of lead programmer he shrugged and said they made it go faster…

What do I think? Last night we tested and found our error to be very consistent and if rotating the robot clockwise introduced +lateral error, rotating the robot counterclockwise introduced -lateral error. Of the exact same amount.

So that path winds up the error and then unwinds it…. At least that is my guess until we have more time to look at it.