Month: December 2014

State Estimation with Kalman Filter

Kalman Filter (aka linear quadratic estimation (LQE)) is an algorithm which can be used to estimate precise states of a moving object by feeding a series of noisy sensor inputs over time.

The Kalman Filter and its derivatives namely, “Extended Kalman Filter (EKF)” and “Unscented Kalman Filter” are highly reputed in the field of information processing. The most famous early use of the Kalman filter was in the Apollo navigation computer that took Neil Armstrong to the moon, and (most importantly) brought him back. Today, Kalman filters are at work in every satellite navigation device, every smart phone, and many computer games.

The Kalman filter requires a dynamic model of the system to predict next states of the system. The dynamic model can be motion laws or other equations that has ability to calculate the next state with use of correct coordinates.

Kalman Filter performs on two main operations. They are,

Estimating the next state of the machine

Correcting the estimated state with actual measurements

The following picture shows estimated location (after the correction) against measured location and the true location.

Modeling Kalman Filter

To model the scenario with Kalman filter, it requires to model two equations.

Process model (State Equation)

xt is the state vector containing the terms of interest for the system (e.g., position, velocity, heading) at time t

Ft is the state transition matrix which applies the effect of each system state parameter at time t-1 on the system state at time t (e.g., the position and velocity at time t-1 both affect the position at time t)

Bt is the control input matrix which applies the effect of each control input parameter in the vector ut on the state vector (e.g., applies the effect of the throttle setting on the system velocity and position)

w(t) is the vector containing the process noise terms (unknown) for each parameter in the state vector. The process noise is assumed to be drawn from a zero mean multivariate normal distribution with covariance given by the covariance matrix Q(t ).

Measurement model (measurement equation)

zt is the vector of measurements

Ht is the transformation matrix that maps the state vector parameters into the measurement domain

vt is the vector containing the measurement noise terms (known) for each observation in the measurement vector. Like the process noise, the measurement noise is assumed to be zero mean Gaussian white noise with covariance Rt.

For a simpler example let’s consider a scenario of a car, moving on X- axis with a constant acceleration (a). Suppose car emits its X coordinate periodically. But due to the measurement noises, the measurement can be vary from the actual location.

State vector contains the location and the velocity of the car over the X axis.

Using motion equations,

Now this is the state equation in matrix form using 1 and 2,

Suppose we are reading speed and the location and the speed with white measurement noises. This is the measurement model in matrix form.

With 3 and 4, we can estimate the states of the machine. If you are using a Kalman implementation library, it will do the rest of the calculation given 3 and 4 models. i.e Apache Commons Math Kalman Filter implementation.

Kalman Filter equations

Kalman Filter maintains the estimates of the state and the error covariance matrix of the state estimation.

Search

Search for:

About Me

I am a PhD student from IU Bloomington and my areas of interests lie within Robotics and Machine Learning. I have previously worked at WSO2 as a Software Engineer and also served as the Sectional Student Representative for IEEE Sri Lanka Section in 2014.