Kalman Filter
Background
Although this is simple to understand, it is important as a foundation to understand variations of the KF.
Primarily used in systems that follow a linear relationship i.e. monotonically increasing/decreasing.
The KF is an optimal filter i.e. it combines the prior state estimate with the measurement in a way that minimizes the uncertainty of the current state estimate.
Usually, measurement errors are distributed normally. Therefore, the Kalman Filter (KF) design assumes a Gaussian distribution of the measurement errors.
Goal is to ensure Kalman Filter convergence:
- Kalman Gain should gradually decrease until it reaches a steady state i.e. converges.
- When Kalman Gain is low, the weight of the noisy measurements is also low.
- A meaningful initialization value will achieve a faster convergence.
Note
At large values of , having to recalculate the estimate would be computationally expensive, therefore, by keeping in memory, we can use it to calculate .
The Algorithm
Step 0: Initialization
- Following Initialization (which only occurs once), is Prediction.
- Outputs:
- Initial System State
- Initial State Variance
Step 1: Measurement
- Outputs:
- Measured System State
- Measured Variance
Step 2: State Update
- Inputs:
- Measured Value
- A Measurement Variance
- Prior Predicted System State Estimate
- Prior Predicted System State Estimate Variance
- Outputs after Calculating :
- Current System State Estimate
- Current State Estimate Variance
Step 3: Prediction
- Extrapolates the current system state estimate and its variances to the next system state based on the dynamic model of the system.
The Five Kalman Filter Equations
Update
- State Update
- Covariance Update
- Kalman Gain
Predict
- State Extrapolation i.e. Dynamic Model/State Space Model
- Covariance Extrapolation i..e. Predictor Covariance Equation
The Kalman Gain
The Kalman Gain , is a factor/weight that provides information on whether to trust the measurement or prediction more.
- High - More trust in measurement step, less trust in prediction step.
- Low - More trust in prediction step, less trust in measurement step.
Process Noise
Process Noise, , is described as the uncertainty in the system dynamic model in the real world as there will always be some sort of error in measurements.
Process Noise Variance is denoted by the letter .