Extended Kalman Filter

The problem with standard Kalman filter is that it assumes linear state transitions and measurements. In reality, state transitions and measurements are rarely linear, e.g. a robot that moves with constant transnational and rotational velocity will move in a circular path, which is not linear. The extended Kalman filter relaxes the linearity assumption.

We suppose that state transition probability and measurement probability are governed by nonlinear functions.

xt=g(ut,xt1)+ϵt  zt=h(xt)+δtx_{t} = g(u_{t}, x_{t-1}) + \epsilon_{t} \\\;\\ z_{t} = h(x_{t}) + \delta_{t}

The function ggreplaces the matrices AtA_{t} and BtB_{t}, and the function hh replaces the matrix CtC_{t}. Unfortunately, with arbitrary non-linear functions, the belief is no longer a Gaussian. In fact, performing the belief update exactly is usually impossible in this case. The EKF (extended Kalman filter) needs to calculate a Gaussian approximation to the true belief via Monte Carlo methods.

Linearization

The key idea underlying the EKF approximation is called linearization. If we were to use Monte Carlo methods, we'd have to pass hundred thousands of points to ggfollowed by the computation of their mean and covariance. This is extremely inefficient. We need a way to hack around it and approximates gg and hh as linear functions using first order Taylor expansion.

Taylor Expansion

Taylor expansion constructs a linear approximation to a function gg from gg's value and slope. The slope is given by the following expression.

g(ut,xt1)=gxt1g\prime(u_{t}, x_{t-1}) = \frac{\partial g}{\partial x_{t-1}}

The value and slope of ggare dependent on the arguments utu_{t} and xt1x_{t-1}. We should choose the most probable states to perform Taylor expansion with. Since the most probable state of XtX_{t} is μt1\mu_{t-1}, gg is approximated by its values at μt1\mu_t{-1} and utu_{t}.

g(ut,xt1)g(ut,μt1)+g(ut,μt1)(xt1μt1)=g(ut,μt1)+Gt(xt1μt1)g(u_{t}, x_{t-1}) \approx g(u_{t}, \mu_{t-1}) + g\prime(u_{t}, \mu_{t-1})(x_{t-1} - \mu_{t-1}) = g(u_{t}, \mu_{t-1}) + G_{t}(x_{t-1} - \mu_{t-1})

Notice that GtG_{t} is a n by n matrix, with n denoting the dimension of the state. This matrix is often called the Jacobian. The value of Jacobian is dependent on utu_{t} and μt1\mu_{t-1}, hence the matrix is time dependent. EKF implements the exact same linearization for the measurement function hh. The calculation must perform after prediction state, hence μt\overline{\mu}_{t}.

h(xt)h(μt)+h(μt)(xtμt)=h(μt)+Ht(xtμt)h(x_{t}) \approx h(\overline{\mu}_{t}) + h\prime(\overline{\mu}_{t})(x_{t} - \overline{\mu}_{t}) = h(\overline{\mu}_{t}) + H_{t}(x_{t} - \overline{\mu}_{t})

EKF Algorithm

Now if we put everything together, we have the EKF algorithm. Equation (1) performs the prediction steps.

μt=g(ut,μt1)  Σt=GtΣt1GtT+Rrt(1)\tag{1} \overline{\mu}_{t} = g(u_{t}, \mu_{t-1}) \\\;\\ \overline{\Sigma}_{t} = G_{t}\Sigma_{t-1}G^{T}_{t} + R_{r}t

Equation (2) performs the Kalman gain calculation.

Kt=ΣtHtT(HtΣHtT+Qt)1(2)\tag{2} K_{t} = \overline{\Sigma}_{t}H_{t}^{T}(H_{t}\overline{\Sigma}H_{t}^{T} + Q_{t})^{-1}

Equation (3) performs the measurement incorporation steps.

μt=μt+Kt(zth(μt))  Σt=(IKtHt)Σt\mu_{t} = \overline{\mu}_{t} + K_{t}(z_{t} - h(\overline{\mu}_{t})) \\\;\\ \Sigma_{t} = (I - K_{t}H_{t})\overline{\Sigma}_{t}

Finally,

return  μt,Σt\text{return}\;\mu_{t}, \Sigma_{t}

Last updated

Was this helpful?