Kalman filter gain parameter plays a very important role in kalman filter estimation, In the last blog I’ve given an introduction on what are Kalman filters and why to use them.
Kalman filter gain decides how much of the new measurement has to be considered for the estimation. Here is the formula for Kalman gain.
KalmanGain = Error In Estimation / (Error in estimation + Error in measurement) .
If the error in measurement in small then the value of Kalman Gain would be close to 1. If the error in estimation is large then value heads towards 0.
Here is the update equation for the state using the Kalman gain.
As you can see in the above equation, If the Kalman gain (KG) is close to 0, this implies that the error in the measured value from the sensor is really high and thus they are unstable. In this scenario we don’t want the contribution of the measured value to be notable on the prediction, this is controlled by the additive factor for the previous estimation, this quantity is meager when the KG value is close to 0, and thus it just slightly adds up to the previous estimation, so the Kalman gain(KG) helps invest better confidence on the estimation rather than on the measurement.
On the other hand, If the Kalman Gain is close to 1, that is in case where the error in estimation is really high compared to the error in the measurement from the sensors, The additive value for the previous estimate in the update equation above will be significant, thus the updated value will considerably different from the estimation since the contribution from the measurement will be higher.
Thus Kalman filter gain helps to weigh the contribution of the difference between the previous estimate and the current measurement to update the previous estimate to arrive at the new estimate.
Why to use Kalman filter ?
The sensor measurements are not generally accurate, they usually have unpredictable, random and uncertain error/variation in their measurements. What does that mean ? Consider a thermometer which reads/measures room temperature, In a room with steady/constant temperature the sensor outputs a varying temperature measurement within a given range, the readings will be scattered around the actual room temperature, this is because the sensors generally have a degree of uncertainty in their measurement.
In the image below the marked X’s demonstrates the sensor readings over a period of time. You can see the though the actual temperature of the room is constant, the readings are distributed over a range of values around the actual temperature.
If sensor measurements return uncertain measurements, how do we know the actual room temperature ?
We’ll, that’s where Kalman filters comes to your rescue. Kalman filter is an iterative mathematical approach which is used to quickly (with less number of actual readings and iterations) converge to a better estimation of the actual value (better than the sensor measurement itself). In this case using Kalman filter will quickly help us estimate the actual room temperature using the uncertain measurements. In the above you can see how Kalman filter technique helps to quickly approximate the actual room temperature by converging close to the actual value by making use of the uncertain sensor measurements.
The application of Kalman filters are wide, For example Similar issues too are found when Lidar or Radar measurements are used to object tracking in self driving cars, the right estimate of other vehicle on the road is critical for safe driving, Kalman filter are used here too for estimation the actual position and velocity of other vehicles on the road.