Kinematics or Odometry of Swerve Drive being Inconsistent

I am using PathPlanner for trajectory following on a swerve drivetrain. I have noticed that the robot follows the trajectory perfectly according to the real-time pose outputted to Field2D. However, each time the robot ends up in a slightly different place physically on the field. We are starting the robot very consistently in the same place each time, so I know that is not the issue. I think it has something to do with the robot odometry or kinematics being inaccurate, but I am not sure. Any help would be greatly appreciated.

It would be helpful to be able to see your code; do you have a github repository or something?

When you say “slightly different place”, what do you mean, exactly? It would be helpful to know:

  • How far your robot is travelling (e.g. 15 feet)
  • How much error you are seeing in the final position (e.g. 6 inches)

A lot of things can cause variability in your trajectory. The biggest culprit could be battery. Are you running autos over and over trying to tune without changing batteries every few runs?

Consider that there are 3 values:

  1. How far the robot went
  2. How far the encoder count says the robot went
  3. How far the odometery (which for a swerve using wpilib is an integrated measurement of the differentiated encoder count) says the robot went

How off is 2 from 1? You can adjust by nudging the “empirical wheel diameter” larger or smaller until it’s correct.

How off is 3 from 2?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.