TinyEKF is a simple C/C++ implementation that I wrote primarily for running on a microcontroller like Arduino, Teensy, and the STM32 line used in popular flight controllers like Pixhawk, Multiwii32, and OpenPilot. Having looked over the EKF code in some of these flight controllers, I found the code difficult to relate to the understanding expressed in this tutorial. So I decided to write a simple EKF implementation that would be practical to use on an actual microcontroller, taking up a “tiny” amount of memory, while still being flexible enough to use on different projects. I also wrote a Python implementation, so you can prototype your EKF before running it on an actual microcontroller.
TinyEKF requires you to write only a single model function, filling in the values of the state-transition function $f(x)$, its Jacobian matrix $F(x)$, the sensor function $h(x)$, and its Jacobian $H(x)$. The prediction and update then handled automatically by passing the observation vector $z$ to the step function.
Three examples are provided:
Previous: The Jacobian