Intro to Kalman filter
- Jiatong Zhang
- Sep 20, 2016
- 2 min read
Kalman filter is a well designed "optimal recursive data processing algorithm" that often being implemented on the field of data processing, robot guiding and radar tracking. In the recent year, people also find it's really helpful in computer vision and object tracking. So in this article, we will get into some basics of the Kalman filter.
Before we get into the well-known 5 equations of the Kalman filter, let's see a simple example of how Kalman filter will work to solve some real life problem.
Let's say we want to measure the distance between you and a spider. According to your past experiences the spider doesn't usually move, so it says the next minute distance (predictive value) is suppose to be the same as the current distance value. However, you are not 100% sure about your experience, the spider may move a couple inches, and we consider these as white Gaussian noise, which means these movements is not related to past and future value and meets the Gaussian distribution. And to measure the distance between you and the spider, let's say you are holding a distance sensor but it's not accurate, the error is still considered as white Gaussian noise.
Now in every minute we have two values about where the spider is, one is your predictive value based on your experience, and the other one is your inaccurate distance sensor measurement. And so we need to determine where the spider is based on those two values.
Let's say we want to find where the spider is at time k. First we need the position of the spider at time k-1. Since we believe the spider is not moving, so the predictive value of the spider at time k is the same as time k-1, let's say it's 30 inches and Gaussian noise deviation is 5 (at time k-1 if the difference between the optimal value and predictive value is 3, and the error from the distance sensor is 4, then we squire both of them and take the squire root of their sum which is 5). And at time k the distance sensor reading is 32 inches and the Gaussian noise deviation is 4 inches.
The values we have right now to calculate the actual distance is 32 inches and 30 inches, but which one should we believe? So we need to find the covariance. Since Kg^2 = 5^2/(5^2+4^2), Kg = 0.78, we can estimate the actual distance by 30+0.78*(32-30) = 31.56 inches.
As we can see, the deviation of the distance sensor is smaller than our predictive value, so we trust more on the distance and the result is closer to the distance sensor measurement.
Finally we also need the deviation of the optimal value at time k to be able to let this process autoregression. So the deviation is sqrt(5^2*(1-Kg)) = 2.35 which is the difference between the optimal value and predictive value when you enter the time k+1.
In this way Kalman filter will keep recursion the covariance to give the optimal distance of the spider and the value Kg is the Kalman Gain.
Comments