Kalman filter

Term 2 of the Udacity self-driving car nanodegree has started. A bit heavy on math and C++, this term seems to be an even bigger challenge than the first one.

The main objective here is to learn about the Kalman filter.


In short, the Kalman filter is an algorithm that is used to estimate the position (and other unkown variables, which consitute its state) of an object based on a prediction from a series of previous measurements, and a current measurement.


It consist of two distinct phases: the predict and the update steps.

The prediction step estimates the current state by making use of previous measurements. The update step updates this estimated state with the actual current measurments.

For the Kalman filter to work, it is necessary to know the dynamics model of the system (for instance, the physical laws that govern the movement of a car), control inputs to the system (acceleration, deceleration) and it has to possess a series of measurements from a sensor or from multiple sensors. It uses a weighted average of the predicted state (based on previous measurements) and the measured current state to give an accurate estimate of the current state.

By tuning the relative weight given to predictions versus the estimate from current measurments, we can either have a smoother function (less noise), but with more lag, or a more noisy curve, but which is more responsive. This relative weight is called the Kalman gain.

One of the great qualities of the Kalman filter is that it is possible to use measurements from different data sources in order to predict the state. This means that in the domain of self-driving cars, we can aggregate data from LIDAR, RADAR and other sensors, to maximize precision. This application is called sensor fusion. Pretty cool stuff if you ask me.

I cannot give an accurate mathematical description of how the filter works - so I have gathered the best resources out there that I have found.

  • As an introduction, I recommend Harveen Singh’s superbly written and beginner-friendly articles most of all:

  • Of course the Wikipedia article is also a great resource to learn about it, including its history and uses (hint: during the Apollo program, it was incorporated in the navigation computer).

  • You can find the notes for the Udacity course on the topic here

  • And last but not least, there is an excellent interactive, step-by-step tutorial of the Kalman filter by Simon D. Levy here (or all one PDF).


Edit:

Written on April 28, 2018

If you notice anything wrong with this post (factual error, rude tone, bad grammar, typo, etc.), and you feel like giving feedback, please do so by contacting me at samubalogh@gmail.com. Thank you!