Kalman Filters: CS 344R: Robotics Benjamin Kuipers
Kalman Filters: CS 344R: Robotics Benjamin Kuipers
Kalman Filters
CS 344R: Robotics
Benjamin Kuipers
Up To Higher Dimensions
• Our previous Kalman Filter discussion was
of a simple one-dimensional model.
• Now we go up to higher dimensions:
n
– State vector: x ∈ℜ
m
– Sense vector: z ∈ℜ
l
– Motor vector: u ∈ ℜ
• First, a little statistics.
Expectations
• Let x be a random variable.
• The expected value E[x] is the mean:
N
1
E[x] = ∫ x p(x) dx ≈ x = ∑ x i
N 1
– The probability-weighted mean of all possible
values. The sample mean approaches it.
• Expected value of a vector x is by
€ T
component.
E[x] = x = [x1,L x n ]
Variance and Covariance
• The variance is E[ (x-E[x])2 ]
N
1
σ = E[(x − x ) ] = ∑ (x i − x )
2 2 2
N 1
• Covariance matrix is E[ (x-E[x])(x-E[x])T ]
N
1
Cij =
N
∑(x ik − x i )(x jk − x j )
k =1
N 1
is a biased estimate of the population
variance. An unbiased estimator is:
N
1
2
s = ∑
N −1 1
(x i − x ) 2
⎡10.62 −7.93⎤
Ccd = ⎢ ⎥
⎣−7.93 8.84 ⎦
Discrete Kalman Filter
n
• Estimate the state x ∈ℜ of a linear
stochastic difference equation
x k = Axk −1 + Buk + wk −1
– process noise w is drawn from N(0,Q), with
covariance matrix Q.
• with a measurement z ∈ℜ m
z k = Hx k + vk
– measurement noise v is drawn from N(0,R), with
covariance matrix R.
• A, Q are nxn. B is nxl. R is mxm. H is mxn.
Estimates and Errors
n
ˆ
• x k ∈ℜ is the estimated state at time-step k.
− n
ˆ
• x k ∈ℜ after prediction, before observation.
• Errors: e −
k = x k − xˆ −
k
e k = x k − xˆ k
• Error covariance matrices:
T
− − −
P = E[e e ]
k k k
T
Pk = E[e k e ]k
− T − T −1
• Kalman gain: K k = P H (HP H + R)
k k
− −
• Corrector step: xˆ k = xˆ + K k (z k − h(xˆ ))
k k
−
Pk = (I − K kH) P k
“Catch The Ball” Assignment
• State evolution is linear (almost).
– What is A?
– B=0.
• Sensor equation is non-linear.
– What is y=h(x)?
– What is the Jacobian H(x) of h with respect to x?
• Errors are treated as additive. Is this OK?
– What are the covariance matrices Q and R?
TTD