Uses of the kalman filter in FRC

I’m studying the kalman filter and I’m wondering if teams can provide examples of how they used it in competition as well as the code if you’re willing to share. I’m primarily interested in seeing examples of how it was used for estimating the position of the robot, although other use cases are welcome too.

I actually wrote a thing recently that paraphrases the course I took at university on Kalman filter theory. See the “Stochastic control theory” chapter of https://file.tavsys.net/control/state-space-guide.pdf. Basically all the things I would have written here are already there. It has an example of a robot driving between two walls. The Kalman filter estimates the position of the robot from noisy range measurements ahead of and behind the robot.

The plots of the robot position etc. over time are generated using Python and the relevant Kalman filter equations. The Python source is in https://github.com/calcmogul/state-space-guide/tree/master/code.

For FRC purposes, you typically find the steady-state Kalman gain and plug the matrices into a Luenberger observer instead, so it estimates states for a state-space controller. The controller isn’t necessary though if you just want odometry.

If you want to jump on the ROS train, there are existing nodes which implement Kalman filters to estimate robot position and orientation: http://wiki.ros.org/robot_pose_ekf

I’ve been dabbling in kfs this off season and have found this open source book to be a really easy read. The interactive nature of the notebooks is also a beneficial.

https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python

The Udacity Artificial Intelligence for Robots is also a good free resource and has an entire unit on kfs.

https://www.udacity.com/course/artificial-intelligence-for-robotics–cs373

There’s an extensive discuss of the use of Kalman filters for control in this thread: https://www.chiefdelphi.com/forums/showthread.php?t=165579

1 Like