In working with autopilot systems like OpenPilot and Pixhawk I have frequently come across references to something called an Extended Kalman Filter (EKF). Googling this term led me to several different web pages and reference papers, most of which I found too difficult to follow. So I decided to create my own tutorial for teaching and learning about the EKF from first principles. This tutorial assumes only high-school-level math and introduces concepts from more advanced areas like linear algebra as needed, rather than assuming you already know them.
The tutorial is currently about 2/3 complete. I still need to introduce linear algebra concepts for sensor fusion, and then nonlinearity for the EKF. But in the open-source spirit of "release early, release often", I'm posting this now, in the hope that people will try it out and provide comments.
Comments
Thanks Fábio! I took your indexing suggestion -- hope you like it.
Hey Simon, nice job!
I really liked the tutorial style approach, and it's interactiveness is also great!
I've tried to understand Kalman Filters before, but only now I think I'm starting to grasp some of it.
If I may make one little suggestion. I believe an index on the first page, listing and linking to all the content pages, would greatly improve navigation.
Keep up the good work!
Fábio Teixeira
Thanks, Sam!
I've posted a couple more pages, introducing sensor fusion.
Simon,
I've only managed a quick look at this so far - I like your style.
Sam
Tobias: Thank you for pointing me to this paper -- it is a good intro to the KF that I never found myself.
In that paper, they are modeling a control signal representing a braking effect. In my tutorial slide (#11), I am ignoring the control signal temporarily in order to explain the basic linear algebra operation matrix * vector multiply.
It is important to realize that there is no "correct" formula for the Kalman Filter that works in every example. The KF is a general way of representing a system that takes many possible sources of variance into account: process noise, measurement noise, control signal, etc. To describe a particular system it is often convenient to assume default values like zero or one for certain elements, as I have done at some points in my tutorial. This is a common practice in physics and engineering exercises. You can learn a lot about physics without taking friction into account (coefficient of friction = zero), but modeling an actual system will most likely make it dangerous to ignore friction.
As one of my colleagues like to say, the really important equation in modeling is:
NEW_VALUE = OLD_VALUE + CHANGE
Other than that, there's no "magic formula": you have to think about the system you want to model, and what changes, and what doesn't change.
thank you so much, may your generous efforts pay you back in a nice way :)
I'm still a bit confused, but mainly because of this paper here:
http://www.cl.cam.ac.uk/~rmf25/papers/Understanding%20the%20Basis%2...
They define the A/F matrix as [[1, dt], [0, 1]] like you, but in the control matrix B they use [1/2 a dt ^ 2, dt] for the position & speed state update.
Thanks, guys! Tobias: The upper-rightmost entry is zero because this is a different set of equations from the ones in the paper you linked to. Equation (2) in that paper expresses current position x(t) in terms of INITIAL position, initial velocity, and acceleration:
x(t) = 1/2 a t^2 + v_0 t + x_0
The linear algebra formula I provided represents current position in terms of PREVIOUS position and velocity:
distance_k = distance_{k-1} + velocity_{k-1} * timestep.
Hi Simon, thanks for the great tutorial!
I think there is one mistake in the last matrix on this page: http://home.wlu.edu/~levys/kalman_tutorial/kalman_11.html
Shouldn't the uppermost, rightmost entry be "0.5 * timestep ^ 2" instead of 0?
(According to this: http://www.normalesup.org/~baglio/physique/acceleration.pdf, equation 2)
Cheers, Tobias