Skip to content

Improving accuracy Troubleshooting

ErikCald edited this page Apr 24, 2021 · 1 revision

Not doing what it should

I highly recommend going through the WPILib recommended troubleshooting first. https://docs.wpilib.org/en/stable/docs/software/advanced-controls/trajectories/troubleshooting.html#troubleshooting

Improving Ramsete to drive more accurately

This is assuming you've planned a path correctly and no extremely sharp turns (sharp turns are generally fine).

Just to cross it off the list of possibilities, do a push test. Push the robot forward by a distance measured from a tape measure and make sure odometry reports that it moved by that amount.

The most important thing to check is how much error there is between the path you planned and what odometry reports. This repo's RamseteControllerLogging already puts this error into network tables. (table called "RamseteAutoError"). This is the most important thing to improve first (before changing the pose's feed into TrajectoryGenerator to accommodate inaccuracy) since it affects other things.

I found I could just watch the X, Y, and Rot values on network tables while the path was running and observe the highest number I saw and the general median. Alternatively, the RamseteControllerLogging will output all error values into a spreadsheet on a USB stick put into the RoboRio.

If there is a significant poseError not caused by some underlying issue, you need to tune the frc-characterization values. (ks, kv & ka) When doing the paths for frc2021-atHome challenges, I saw an error of around 0.5m (meters) in x or y, compared the values of the comp bot to the values of the prac bot and old DeepSpace chassis, I changed the numbers a bit, and reduced that error to 0.3m, later to 0.2m. I found it gained 0.3m of error in sharp turns but correctly for it after a 1m straight section.

If you are seeing a poseError during turns another option to try is changing the track width. I found that frc-characterization calculated track widths that were 0.1m different than the actual measured distance. So this constant could be a way to improve Ramsete.

This poseError between odometry and planned trajectory is super significant since it's saying, you're asking the robot to go here but it's driving it wrong by that amount. Once you are happy with the tunings (less than 0.25m from what I saw), freeze these tunings and don't change them. (Hopefully, you can tune/test on carpet similar to competition carpet).

I also found that increasing the maxVelocity & maxAcceleration will increase the poseError so it's also crucial to freeze these numbers as high as you can get them without having too much poseError.