Kalman Filter
Definition
Kalman filtering, also known as linear quadratic estimation (LQE), is an algorithm that uses a series of measurements observed over time, containing statistical noise and other inaccuracies, and produces estimates of unknown variables that tend to be more precise than those based on a single measurement alone, blah blah (according to Wikipedia)
Simply put, Kalman Filter is used when
- you have a series of measurements with noise or changing over time
- you want to find true states of something (usually a robot)
Flowchart of Kalman Filter
- By linear dynamics, we can predict the object's states(location, velocity, etc). For example,
- where is a location is time, say, in seconds
- Compute Kalman Gain, which is simply
- Kalman Gain tells us that if it is close to 1, there is nearly no error in measurement. Hence, we can trust measurement data. If it approaches 0, it means there is a huge error in measurement. So, we should not trust measurement
- By multiplying Kalman Gain to the difference between measurement and predicted states, we update the true states of the object
Pseudo-Code
There are 1) predict step and 2) update step.
Predict Step
where means the (predicted) states of the object at time . means external forces like constant acceleration or gravity or friction etc.
Update Step
Implementation
Although it is incomplete, I am working on creating Kalman filter examples in this repo.
References
I found the following references are good intro to Kalman Filter and Exmples.
[1] Michel van Biezen, Special Topics - The Kalman Filter [2] Wikipedia, Kalman Filter