# Kalman Filter¶

Contents

The solution described in this document is based on a Kalman Filter that generates estimates of attitude, position, and velocity from noisy sensor readings. The classic Kalman Filter works well for linear models, but not for non-linear models. Therefore, an Extended Kalman Filter (EKF) is used due to the nonlinear nature of the process and measurements model.

Kalman filters operate on a predict/update cycle[1]. The system state at the next time-step is estimated from current states and system inputs. For attitude calculations, this input is the angular rate-sensor signal; velocity and position calculations use the accelerometer signal. The update stage corrects the state estimates for errors inherent in the measurement signals (such as sensor bias and drift) using measurements of the true attitude, position, and velocity estimated from the accelerometer, magnetometer, and GPS readings. As these signals are typically noisier[2] or provided at a significantly lower rate than the rate-sensor, they are not used to propagate the attitude, instead their information is used to correct the errors in the estimate.

For a discrete-time system the prediction and update equations are:

## Prediction (High Dynamic Range (DR) Process)¶

In this stage of the EKF, the attitude, velocity, and acceleration are propagated forward in time from sensor readings.

The first equation (\(\vec{x}_{k|k-1}\)) is the State Prediction Model and the second (\(P_{k|k-1}\)) is the Covariance Estimate.

## Innovation (Measurement Error)¶

In this stage, the errors between the predicted states and the measurements are computed.

## Update (Low DR Process)¶

The final stage of the EKF generates updates (corrections) to the predictions based on the quality of the process models, process inputs, and measurements.

In the order listed, the above equations relate to:

- Innovation Covariance
- Kalman Gain
- State Error
- State Update
- Covariance Error
- Covariance Update

These terms will be defined in the sections that follow.

[1] | Kalman Filtering: Theory and Practice Using MATLAB, 3rd Edition, Mohinder S. Grewal, Angus P. Andrews |

[2] | In this case, noisier means that the sensor signals are corrupted, not just by electrical noise, but by external influences as well. In the case of the accelerometer, the device picks up vehicle motion in addition to gravity information. The magnetometer signal is affected by external magnetic sources, such as iron in passing vehicles and in roadways. |