Kalman Filter - Terrapin-Rocket-Team/SRAD-Avionics GitHub Wiki
Home/Documentation/Kalman Filter
Source: https://github.com/Terrapin-Rocket-Team/Kalman-Filter
The Kalman Filter is a state estimation algorithm that we use to estimate the rocket's position and velocity. It is used to fuse data from multiple sensors to provide a more accurate estimate of the rocket's state.
To learn more about how a Kalman filter works, check out this site.
The library was mostly written by Avi Komarlingam and Abhi Senthilkumar.

Example of the Kalman Filter (red) smooting noisy barometer data (blue). It's not perfect, and we continue to tune it to get better results.
Note: The Kalman Filter has a support file that it needs to ho help it generate the proper matrices. When this page was written, that file was called AprilFilter.h
. This file outlines the dynamic matrices that the Kalman filter uses to estimate the state of the rocket. It also handles iterating and initializing the filter. When you interact with the Kalman Filter, you will really be interacting with this class and letting it handle the rest.
In state, we include the Kalman Filter library:
#include <Kalman_Filter.h>
#include <AprilFilter.h>
State
has a LinearKalmanFilter
pointer that it holds on to. It's initialized with kfilter = initializeFilter();
in State.init()
, using the AprilFilter
class.
When the state is updated, we do
predictions = iterateFilter(kfilter, timeAbsolute - lastTimeAbsolute, inputs, measurements);
iterateFilter()
returns an array of doubles that holds the estimated state of the rocket. It gets passed the kfilter object, the time since the last update, the "inputs" (acceleration measurement), and the "measurements" (GPS and barometer data).
Checkout State.cpp
to get a better idea of how we use the Kalman Filter in the code.