### The Topic

For this drilldown, we will take a very high-level look at a technique used in robotics, control systems, and any other applications involving sensors: the Kalman Filter.

NOTE: No math will be covered in this article. There are plenty of great resources for learning the math behind the Kalman Filter. Think of this article as a primer.

### The Q&A

What is a Kalman Filter (KF)?

The KF is an algorithm used to estimate the state of a system (e.g. vehicle speed) based on periodic predictions and sensor measurements. The estimation is a weighted average of the predictions/measurements while also factoring in the uncertainty associated with each. The goal of the KF is to provide the best possible estimate with the least amount of uncertainty by using all available state information.

What applications are well suited for a KF?

The KF works well for applications where the system’s future state can be reasonably predicted and at least one measurement of the state is made periodically. The sensors and state predictor are not expected to be perfect and include a quantifiable amount of uncertainty in the values they produce. The KF will help reduce state estimation uncertainty in situations where predictions can be made or when multiple sensor readings can be fused together. Additionally, the KF is well suited for memory constrained applications as it only requires the previous state estimate to be stored.

How does the future state prediction work?

This highly depends on the system of interest. For a vehicle, the future speed can be estimated reasonably well if the current speed and acceleration are known; perhaps the acceleration is measured or perhaps the acceleration is even managed using a control system. In either case, the future speed could be estimated with fairly low uncertainty. In some situations, it may be necessary to simply use the previous estimate as the prediction; in this case, the uncertainty would be based on the maximum amount of possible state change between iterations of the algorithm loop. The model used to predict the future state and its associated uncertainty are important inputs to the KF.

How is uncertainty handled?

Uncertainty is modeled using Gaussian distributions. For example, the value returned by a sensor would be represented by the distribution mean and the possible error range in the reading would be represented by the distribution variance. The prediction model and each sensor has an associated Gaussian distribution which represents the uncertainty for each.

How are the predictions, measurements, and uncertainties used by the KF?

The KF weighs all available state information based on the associated uncertainty; this is called the Kalman Gain. Since the KF is essentially a weighted average, the Kalman Gain is used as the weights; for example, a sensor reading with a large amount of uncertainty will be weighted less than a prediction/measurement with lower uncertainty.

### The Recap

The KF is an algorithm used to estimate system state.

The KF combines state information from predictions and measurements.

The predictions/measurements have an associated amount of uncertainty.

The uncertainty is modeled as Gaussian distributions.

The KF estimate is calculated by averaging the predictions/measurements with weights based on the uncertainty associated with each.

### The Resources

There are a lot of resources available on this subject but I found the following to be the best:

Hi, I am Jeff Rimko!
A computer engineer and software developer in the greater Pittsburgh, Pennsylvania area.