Jump to content

Kalman filter

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Forderud (talk | contribs) at 00:53, 5 April 2005 (corrected innovation typo). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The Kalman filter (named after its inventor, Rudolf E. Kalman) is an efficient recursive computational solution for tracking a time-dependent state vector with noisy equations of motion in real time by the least-squares method. It is used to separate signal from noise so as to optimally predict changes in a modeled system with time. Kalman filtering is an important topic in control theory and control systems engineering. It is in a wide range of engineering applications from radar to computer vision. The filter was developed in papers by Swerling (1958), Kalman (1960) and Kalman and Bucy (1961).

What makes the Kalman filter particularly unique is that it is purely a time domain filter. Most filters (for example, a low-pass filter) are formulated in the frequency domain and then transformed back to the time domain for implementation.

Peter Swerling actually developed a similar algorithm earlier. Stanley Schmidt is generally credited with developing the first implementation of a Kalman filter. It was during a visit of Kalman to the NASA Ames Research Center that he saw the applicability of his ideas to the problem of trajectory estimation for the Apollo program, leading to its incorporation in the Apollo navigation computer.

A wide variety of Kalman filters have now been developed, from Kalman's original formulation, now called the simple Kalman filter, to Schmidt's extended filter, the information filter, and a variety of square-root filters, developed by Bierman, Thornton and many others. Perhaps the most commonly used type of Kalman filter is the phase-locked loop now ubiquitous in radios, computers, and nearly any other type of video or communications equipment.

Kalman filter basics

The Kalman filter is used to estimate the state of a dynamic system from a series of noisy measurements.

In order to accomplish this the Kalman filter employs 3 (sometimes 4) models. The first model is called the state transition model. This model describes how the state is expected to change from one timestep to the next. This is necessary because the system is dynamic, which means its underlying state is always subject to change. In reality this model is an approximation to the true process which is driving the dynamics of system. Because the state transition model is an approximation, a second model called the process noise model, is used. This model is used to mask the errors caused by the approximation. The third model is called the observation model. This model describes how the estimation space maps into the observation space. For example, an estimate of a target being tracked may include the target's velocity even though only the target's position is measured, or perhaps the target's position is measured in polar co-ordinates, but the estimated position in cartesian co-ordinates. The last model describes how the state is expected to change in response to a given control input (the control-input model). Often the latter is not used, for example in target tracking applications, as the control inputs are obviously unknown in this case. As with the state transition model, this is generally an approximation.

The Kalman filter is a recursive estimator. This means that only estimated state from the previous time step and the current measurement are needed to compute the estimate for the current state. In contrast to batch estimation techniques, no history of observations and/or measurements are required. It has two phases: Predict and Update. The predict phase uses the estimate from the previous timestep to produce an estimate of the current state. In the update phase measurement information from the current timestep is used to refine this prediction to arrive at a new, more accurate (hopefully) estimate.

The Kalman filter assumes a linear state space whose state transition is of the following form

The state transition model

is applied to

the previous state.

The process noise

is the part of the state transition which is not modelled by the state transition model. The presence of process noise requires the use of a process noise model in the filter. The process noise at time k is assumed to be gaussian white noise with covariance

.

The control input,

is mapped into the estimation space by

the control-input model.

The observation, assumed to be of the form

is a function of the true state where

is the observation model and

is the observation noise at time k which is assumed to be gaussian white noise with covariance

Kalman filter equations

The Kalman filter is used to obtain an estimate of the of the true state using only measurements and control inputs .

Predict

Update

Scheme of the Kalman Filter

Numerically stable update

The covariance update equation assumes the gain is computed exactly as

If due to computational error the gain is inexact the following gives greater stability


Optimality

In the linear, gaussian case where the same linear models are used to drive the true and estimated states and where the noise parameters used in the filter are matched to the true noises perturbing the underlying state and observations, then the estimated covariance is a faithful representation of the true covariance of the state, that is,

Similary the following also holds this case

In this case the Kalman filter is an optimal estimator in a least squares sense of the true state.

Example

Tracking a 1D particle which is being perturbed with gaussian accelerations using a piece-wise constant process model. (Note: Time indices for F, G, R and Q have been dropped.)

The position and velocity of a point particle is described by the linear state space

where is the velocity, that is, the derivative of position.

Between the (k − 1)th and kth timestep the particle undergoes an acceleration ,

.

The updated position and velocity

where

and

follows logically from the Newtonian equations of motion. T is the time difference between the (k − 1)th and kth time step. (N.B. This process model requires that T is constant.)

At each time step, a noisy measurement of the true position of the particle is made.

where

and

is the observation model.

Using these measurements an estimate of the state can be computed.

The predicted state at the kth timestep using the estimated state from the (k − 1)th timestep is

and the predicted covariance is

The predicted state and covariance are updated with the measurement and measurement (co)variance.

The measurement innovation (or residual)

is the difference between the actual and predicted measurements, while the innovation (residual) covariance

is the sum of the predicted covariance and the measurement covariance. The Kalman gain

is the ratio between the predicted covariance and the residual covariance.

The updated state estimate

is the predicted state plus the measurement innovation weighted by the Kalman gain. The updated estimated covariance is

where

The Kalman gain will converge to a steady-state position if Q and R are time-invariant. The steady-state Kalman-gain can then be precomputed. This will reduce the Kalman-filter to an ordinary observer; which is computationally simpler.

Derivation

The Kalman filter can be derived in several ways. The one presented here uses probability theory. The true state is assumed to be an unobserved Markov process, and the measurements are the observed states of a hidden Markov model.

Hidden Markov Model

Because of the Markov assumption, the true state is conditionally dependant only on the previous state and is independent of all previous states.

Similarly the measurement a the k-th timestep is dependent only upon the current state and is independent of all other states.

Using these assumptions the probability distribution over all states of the HMM can be written simply as:

However, when the Kalman filter to estimate the state x the probability distribution of interest is that associated with the current states conditioned on the measurements upto the current timestep. (This is achieved by marginalising out the previous states and dividing by the probability of the measurement set.)

This leads to the predict and update steps of the Kalman filter written probabilistically. The probability distribution associated with the predicted state is product of the probability distribution associated with the transition from the (k - 1)th timestep to the kth and the probability distribution associated with the previous state, with the true state at (k - 1) integrated out.

The measurement set upto time t is

The probability distribution of updated is proportional to the product of the measurement likelihood and the predicted state.

The denominator

is an unimportant normalisation term.

The remaining probability density functions are PDF:

Note that the PDF at the previous timestep is inductively assumed to be the estimated state and covariance. This is justified because, as an optimal estimator, the Kalman filter makes best use of the measurements, therefore the PDF for given the measurements is the Kalman filter estimate.

Information filter

In the Information filter, or Inverse Convariance filter, the estimated covariance and estimated state are replaced by the information matrix and information vector respectively.

Similarly the predicted covariance and state have equivalent information forms,

as have the measurement covariance and measurement vector.

The information update now becomes a trivial sum.

The main advantage of the information filter is that N measurements can be filtered at each timestep simply by summing their information matrices and vectors.

To predict the information filter the information matrix and vector can be converted back to their state space equivalents, or alternatively the information space prediction can be used.

Note that if F and Q are time invariant these value can be cached. Note also that F and Q need to be invertible.

Non-linear filters

The basic Kalman filter is limited to a linear assumption. However most non-trivial systems are non-linear. The non-linearity can be associated either with the process model or with the observation model or with both.

Extended Kalman filter

In the Extended Kalman filter (EKF) the state transition and observation models need not be linear functions of the state but may instead be (differentiable) functions.

The function f can be used to compute the predicted state from the previous estimate and similarly the function h can be used to compute the predicted measurement from the predicted state. However f and h cannot be applied to the covariance directly. Instead a matrix of partial derivatives (the Jacobian) is computed.

At each timestep the Jacobian is evaluated with current predicted states. These matrices can be used in the Kalman filter equations. This process essentially linearises the non-linear function around the current estimate.

This results in the following extended Kalman filter equations:

Predict

Update

Unscented Kalman filter

The Extended Kalman filter gives particularly poor performance on highly non-linear functions because only the mean is propagated through the non-linearity. The Unscented Kalman filter (UKF) [JU97] uses a deterministic sampling technique to pick a minimal set of sample points (called sigma points) around the mean. These sigma points are then propagated through the non-linear functions and the estimated covariance is then recovered. The result is a filter which more accurately captures the true mean and covariance. (This can be verified using Monte Carlo sampling.) In addition, this technique removes the requirement to calculate Jacobians, which for complex functions can be a difficult task in-itself.

Predict

As with the EFK, the UKF prediction can be used independently from the UKF update, in combination with a linear (or indeed EKF) update, or visa versa.

The estimated state and covariance are augmented with the mean and covariance of the process noise.

A a set of 2L+1 sigma points is derived from the augmented state and covariance where L is the dimension of the augmented state.

The sigma points are propagated through the transition function f.

The weighted sigma points are recombined to produce the predicted state and covariance.

Where the weights for the state and covariance are given are:

Typical values for , , and are , 2 and 0 respectively. (These values should suffice for most purposes.)

Update

The predicted state and covariance are augmented as before, except now with the mean and covariance of the measurement noise.

As before, a set of 2L+1 sigma points is derived from the augmented state and covariance where L is the dimension of the augmented state.

Alternatively if the UKF prediction has been used the sigma points themselves can be augmented along the following lines

where

The sigma points are projected through the observation function h.

The weighted sigma points are recombined to produce the predicted measurement and predicted measurement covariance.

The state-measurement cross-correlation matrix,

is used to compute the UKF Kalman gain.

As with the Kalman filter, the updated state is the predicted state plus the innovation weighted by the Kalman gain,

And the updated covariance is the predicted covariance, minus the predicted measurement covariance, weighted by the Kalman gain.

Applications

References

  • Kalman, R. E. A New Approach to Linear Filtering and Prediction Problems, Transactions of the ASME - Journal of Basic Engineering Vol. 82: pp. 35-45 (1960)
  • Kalman, R. E., Bucy R. S., New Results in Linear Filtering and Prediction Theory, Transactions of the ASME - Journal of Basic Engineering Vol. 83: pp. 95-107 (1961)
  • [JU97] Julier, Simon J. and Jeffery K. Uhlmann. A New Extension of the Kalman Filter to nonlinear Systems. In The Proceedings of AeroSense: The 11th International Symposium on Aerospace/Defense Sensing,Simulation and Controls, Multi Sensor Fusion, Tracking and Resource Management II, SPIE, 1997.

See also

Compare with: Wiener filter, and the multimodal Particle filter estimator.