Kalman Filter for XRP IMU

I’ve noticed that my XRP robot has significant drift after some autonomous routines and would like to use a Kalman Filter to fix the drift. However, I am not that familiar with matrices and don’t understand most of the documentation or math, and also don’t understand how to implement everything in code.

So far I have a Kalman Filter initialized in my robots drivetrain (although likely done wrong) and don’t know where to go from here. Any help or suggestions would greatly appreciated.

A good place to start might be wpilib’s SwerveDrivePoseEstimator class. It handles all the linear filtering stuff for you; you just have to feed it your measurements. If you are just interested in learning more about filtering, here is a very clearly written derivation/explanation of Kalman Filters (it does require some linear algebra). Sensor fusion, though a good idea, probably won’t fix your issues with gyro drift. Our team solves the drift issue by slamming up against some known field element and zeroing the gyro. Hope that helps.

1 Like

thanks, ill look into these

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