Kalman filter

History

  • Named by Rudolf E. Kálmán (*1930 Hungary)
  • First described in 1958-1961

 

  • Trajectory estimation for Apollo (NASA)
  • Navigation of nuclear ballistic missile submarines (US Navy)
  • Navigation systems of cruise missiles
  • Navigation systems of modern spacecrafts (Space Shuttle 2011)
  • Attitude control and navigation systems of the International Space Station (ISS)

G-H Filter

estimate = prediction + G(residual)
estimate=prediction+G(residual)
newG = oldG + H (\frac{residual}{timestep})
newG=oldG+H(timestepresidual)
residual = measurement - prediction
residual=measurementprediction

G-H Filter

G-H Filter

estimates = [measurement]
predictions = []

for m in measurements:
    # prediction step
    prediction = prediction + behavior_model*time_step
    behavior_model=behavior_model

    predictions.append(prediction)
    
    # update step    
    residual = m - prediction    
    behavior_model = behavior_model + H * (residual/time_step)
    prediction    = prediction    + G * residual
  
    estimates.append(prediction)

Bad initial condition

Acceleration

Choosing of G

Choosing of H

Kalman filter

Main idea

  • Assume imperfect sensor measurements.
  • We need Object motion model
  • Our measurements contains measurement noise
  • Process noise describes imperfect object motion model

Kalman filter

How to describe measurement?

f(x,\mu,\sigma) = \frac{1}{{\sigma \sqrt {2\pi } }}e^{-\frac{(x - \mu)^2}{2 \sigma^2}}
f(x,μ,σ)=σ2π1e2σ2(xμ)2
(\mu,\sigma^2)
(μ,σ2)

X ~ N

Kalman filter - 1D

Initial conditions

  • First expected values can be random
  • Describe confidence with big variance
N({\mu}_1, {{\sigma}_1}^2)+N({\mu}_2, {{\sigma}_2}^2) = N({\mu}_1 + {\mu}_2, {{\sigma}_1}^2 + {{\sigma}_2}^2)
N(μ1,σ12)+N(μ2,σ22)=N(μ1+μ2,σ12+σ22)

Prediction step

  • Sum of gaussians

Kalman filter - 1D

Correction step

  • Multiplication of gaussians
\mu=\frac{\sigma_1^2 \mu_2 + \sigma_2^2 \mu_1} {\sigma_1^2 + \sigma_2^2}
μ=σ12+σ22σ12μ2+σ22μ1
\sigma^2 = \frac{1}{\frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}}
σ2=σ121+σ2211

Kalman filter - 1D

Example for understanding

Kalman filter - 1D

Kalman filter - 1D

Relationship to G-H filter

g_n = \frac{\sigma^2_{x'}}{\sigma^2_{y}}
gn=σy2σx2
h_n = \frac{COV (x,\dot{x})}{\sigma^2_{y}}
hn=σy2COV(x,x˙)
\mu_{x'}=\frac{\sigma_1^2 \mu_2 + \sigma_2^2 \mu_1} {\sigma_1^2 + \sigma_2^2} = \frac{ya + xb} {a+b}
μx=σ12+σ22σ12μ2+σ22μ1=a+bya+xb
{\sigma_{x'}^2} = \frac{1}{ \frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}} = \frac{1}{ \frac{1}{a} + \frac{1}{b}}
σx2=σ121+σ2211=a1+b11

Kalman filter - 1D

Kalman filter - 1D

Kalman filter - 1D

Extreme amount of noise

Kalman filter - 1D

Bad Initial Estimate

Kalman filter - 1D

Nonlinear Systems

Terrible!

Kalman filter - 1D

Noisy Nonlinear Systems

Terrible!

Multivariate Kalman filter 

What is different?

N(\mu,\,\Sigma) = (2\pi)^{-\frac{n}{2}}|\Sigma|^{-\frac{1}{2}}\, e^{ -\frac{1}{2}(x-\mu)^T\Sigma^{-1}(x-\mu) }
N(μ,Σ)=(2π)2nΣ21e21(xμ)TΣ1(xμ)

Multivariate Kalman filter 

What is different?

Multivariate Kalman filter 

The superposition of the two covariances is where all the magic happens.

Velocity is unobserved variable

Multivariate Kalman filter 

Algorithm

Prediction step

x^- = F x + B u
x=Fx+Bu
P^- = {FP{F}}^T + Q
P=FPFT+Q

Update step

y = z - H x^-
y=zHx
S = {HP^-H}^T + R
S=HPHT+R
K = {P^-H}^T {S}^{-1}
K=PHTS1
x = x^- Ky
x=xKy
P = (I-KH)P^-
P=(IKH)P

Legend

  • x - state

  • P - uncertainty covariance

  • Q - process uncertainty

  • u - motion vector

  • B - control transition matrix

  • F - state transition matrix

  • H - measurement function

  • R - state uncertainty

  • S - measurement space

  • K - kalman gain

Multivariate Kalman filter 

Algorithm

Prediction step

x^- = F x + B u
x=Fx+Bux^- = F x + B u
P^- = {FP{F}}^T + Q
P=FPFT+Q P^- = {FP{F}}^T + Q

Update step

y = z - H x^-
y=zHxy = z - H x^-
S = {HP^-H}^T + R
S=HPHT+RS = {HP^-H}^T + R
K = {P^-H}^T {S}^{-1}
K=PHTS1 K = {P^-H}^T {S}^{-1}
x = x^- Ky
x=xKyx = x^- Ky
P = (I-KH)P^-
P=(IKH)PP = (I-KH)P^-
Innovation or measurement residual
Innovation (or residual) covariance
Map system uncertainty into optimal kalman gain
Updated (a posteriori) state estimate
Predicted (a priori) state estimate
Predicted (a priori) estimate covariance
Updated (a posteriori) estimate covariance

Multivariate Kalman filter 

Algorithm

  1. predict the next value for x

  2. adjust covariance for x for uncertainty caused by prediction

  3. get measurement for x

  4. compute residual as: "x - x_prediction"

  5. compute kalman gain based on noise levels

  6. compute new position as "residual * kalman gain"

  7. compute covariance for x to account for additional information the measurement provides

Multivariate Kalman filter 

Algorithm

Kalman filter - step by step

1. Initialization

  • initialize state x and covariance matrix P

 

2. Design transition function

  • encode object motion model to transition function matrix
  • e.g.: 
x^- = \dot{x}\Delta t + x
x=x˙Δt+xx^- = \dot{x}\Delta t + x

3. Design the Motion Function

  • Design control input  and state function
  • Optional (u = 0)

Kalman filter - step by step

4. Design the Measurement Function

  • Design measurement function in matrix form 
  • Residual need to be from same measurement space, otherwise it's  nonsense

 

5. Design the Measurement Noise Matrix

  • The measurement noise matrix models the noise of sensors as a covariance matrix.
  • e.g. White noise

6. Design the Process Noise Matrix

  • quite demanging, out of scope this presentation

Plots

Plots

1D vs 2D

Plots

Process noise

Plots

Measurement noise and bad init

Plots

Progress

Plots

Animated progress

Related filters

  • Extended Kalman filter - solves problem of the nonlinear model

 

  • Unscented Kalman filter - better than EKF if the model is highly nonlinear

 

  • Kalman–Bucy filter - continuous time version of the Kalman filter

 

  • Hybrid Kalman filter - continuous-time models, discrete-time measurements

Summary

Disadvantages:

  • Nonlinear models
  • Initialization
  • Discrete time

Advantages:

  • Disadvantages can be solved by related filters. E.g.: Extended Kalman filter, Unscented Kalman filter ....
  • The process noise or the measurement noise can be described in some specific problems
  • Its recursive structure allows its real-time execution without storing observations or past estimates.
  • Can be used in multidimensional space

Applications

  • Attitude and Heading Reference Systems
  • Autopilot
  • Battery state of charge estimation
  • Tracking of objects in computer vision
  • Dynamic positioning
  • Economics
  • Inertial guidance system
  • Orbit Determination
  • Power system state estimation
  • Radar tracker
  • Satellite navigation systems
  • Seismology
  • Simultaneous localization and mapping
  • Speech enhancement
  • Visual odometry
  • Weather forecasting
  • Navigation system
  • Structural health monitoring
  • Human sensorimotor processing

Applications

References

deck

By Tomáš Šabata