PathPlanner odometry question

I’m having a little trouble understanding a scenario in pathplanner. When loading a path, does pathplanner reset the odometry to the start of that path? If so what happens if you do something in between paths that make that starting pose no longer accurate (for example taking a limelight-corrected shot) in between travals? How would you model or accommodate this so odometry is always accurate? Preferably while still being able to use the PathPlanner gui.

1 Like

It does not. So, it’s actually up to you to reset the odometry to whatever value you want. For instance, you can retrieve the initial pose from the path you read and manually reset the odometry of your robot to that.
Moreover, you need to do periodic odometry updates on your own as well.
Make sure to handle IMU correctly, because the resetting odometry Rotation2d to something that your robot does not face will get corrected in the next iteration. In our case we update odometry ONLY for trajectories and not when we’re just running with the joystick. In this case if you want to “snap” the robot to trajectory, all you need to do is to “remember” what your Rotation2D was before starting the trajectory, then reset IMU to whatever angle is required by trajectory, and add that angle to the “final” angle per IMU at the end of the trajectory and reset the IMU back to that.

2 Likes

The best way of doing this is usually to get your pose via april tags before enabling in auto because pathplanner will drive from where it thinks it is to the first point. For example, if you default to 0,0 (red source on the blue side), and your first point is the red alliance’s spike, you will go across the field (assuming mirroring is on) and then begin your path.

That makes sense. Out of curiosity do you know why pathplanner asks for a method to reset the odometry if it does not do so?

It resets when running an auto if you have a preset starting pose in the auto (this is optional in case you want to just rely on apriltags). If running single paths, handling odom is up to you.

ok thanks