KF PF
KF PF
and Prediction
2
1
1
1
2 12 , 2 22 2 12 2 1 2 12
2 12 22 1 2
Some Important Intuition
Information is good
Variance will always decrease
All information can and should be used
The worst case is to ignore totally uncertain
information
Information integration can be incremental
Interms of innovation
Properly weighed innovation
Not all data at once, not saving all past data
Linear Least Squares
Second simplest of all formulations
States (X) are not directly measured
Observation (B) or measurements relate to state linearly
Observation are equally reliable
gathered at the same time
A mn X n1 B m1 A T
nm A mn X n1 A T
nm B m1
1
X n1 (A T
nm A mn ) A T
nm B m1
m: number of constraints (observations)
n: number of parameters (states)
if m<n multiple solutions B m1 A mn X n1 em1
if m=n exact solution
if m>n least-squares solution
e: noise (assume white and Gaussian)
Weighted Least Square
Slightly more complicated
data are not equally reliable
gathered at the same time
Wmm A mn X n1 Wmm B m1
Wmm A mn T Wmm A mn X n1 Wmm A mn T Wmm B m1
X n1 ( Wmm A mn Wmm A mn ) 1 Wmm A mn Wmm B m1
T T
A mn W
T T
m m Wmm A mn 1 T
A mn W T mm Wmm B m1
A
T 1 T
m n Cmm A mn A mn Cmm B m1
Lmm B m1
X ˆ LB
Xn1 (A T nm A mn ) 1 A T nm B m1 (before)
Weighted Least Square (cont.)
Weights (W) do not appear directly but only
indirectly in C
What are the right choice of weights?
It can be shown that the right weights are
inversely proportional to the standard
deviation in the scalar case and covariance in
the vector case
Kind of make sense - the larger the
uncertainty the less you will trust the data
BLUE
(best linear unbiased estimator)
C=V-1givesBLUE (V: variance of “noise” in
the measurements)
Matrix operator is certainly linear
Unbiased means that expected error is neither
positive or negative E (X Xˆ)0
Or an unbiased estimator must be such as it is the
left inverse of A
ˆ ) E ( X LB ) E ( X LAX Le ) E[( I LA ) X] 0
E (X X
I LA
(L L o )V (V 1 )T A[( A T V 1A ) 1 ]T
(L L o )VV 1A ( A T V 1A ) 1
(L L o ) A ( A T V 1A ) 1 (LA L o A )( A T V 1A ) 1
(I I )( A T V 1A ) 1 0( A T V 1A ) 1 0
Final Equations
xˆ Lo B A V A T 1
1
A TV 1B
ˆ )( X X
P E[( X X ˆ )T ] E[( X LB )( X LB )T ]
E[( X L o AX L o e' )( X L o AX L oe' )T ]
E[L oe' (L o e' )T ] L o E[e' e'T ]L o L o VL o
T T
A
T 1 1
Po o Vo A o
V 0
V o If noise is uncorrelated over time
0 V1
T 1
1 A V 0 A o 1 1 1 1
o o
T T T
P1 A o Vo A o A 1 V1 A 1 P0 A 1 V1 A1
A1 0 V1 A 1
T
Ao 1 o
B 1 1
X1 P1 V P1 (A o Vo B o A 1 V1 B 1 )
T T
A1 B1
1 1 1
P1 (Po X o A 1 V1 B 1 ) X o Po A o Vo B o
T T
1 1 1 1 1 1
P1 (P1 X o A 1 V1 A 1 X o A 1 V1 B 1 ) P0 A 1 V1 A 1
T T T
P1
1
X o P1 A 1 V1 (B1 A 1 X o )
T
gain innovation
Final Equations
1 1 1
Pi 1 A i Vi A i
T
Pi
1
X i X i 1 Pi A i Vi (B i A i X i 1 )
T
Dynamic States
State evolves over time
Two mechanisms
Observation: noise white and Gaussian
State propagation: noise white and Gaussian
A i X i Bi A i X i e1 B i
Fi X i X i 1 Fi X i e 2 X i 1
A0 B 0 A0 B 0
F X 0 cF X 0
I cI 0
0 0 0
X 1 B1 A1 X1 B1
A1
cF1 cI X 2 0
F1 I X 2 0
A 2 B 2
A 2 B 2
Dynamic States
Each time instance
Add one column (xi)
Add one row Axi=Bi
Solution
Gauss said least square
Kalman said recursive
Kalman wins
Do remember that x_o, x_1, x_2, etc are affected by
new data b_2
x_o and x_1 given b_0, b_1, b_2 a smoothing problem
x_2 given b_o, b_1, b_2 a filtering problem
Kalman’s Iterative Formulation
Tounderstand it, you actually need to
remember just two things
Rule 1: Linear operations on Gaussian random
variables remain Gaussian
Rule 2: Linear combinations of jointly Gaussian
random variables are also Gaussian
Y AX Z AX BY C
m z Am x Bm y C
m y Am x
Pzz APxx A T APxy BT BPyx A T BPyy BT
Pyy APxx A T
X: states
Y: observations
Z: prediction based on states + observations
A, B, C: linear prediction mechanism (from X, Y to Z)
P: covariance matrix
More Rules
Rule3: Any portion of a Gaussian random
vector is still a Gaussian
X
Z
Y
m x
mz
m y
Pxx Pxy
Pzz
P
yx P yy
Intuition
Initialstate estimate is Gaussian
State propagation mechanism is linear
Propagation of state over time is corrupted
by Gaussian noise
Sensor measurement is linearly related to
state
Sensor measurement also corrupted by
Gaussian noise
Updated state estimate is again Gaussian
Kalman Filter Properties
For linear system and white Gaussian
errors, Kalman filter is “best” estimate
based on all previous measurements
For non-linear system optimality is
‘qualified’ (EKF, SKF, etc.)
Doesn’t need to store all previous
measurements and reprocess all data each
time step
Graphic Illustration
When noise is white and uncorrelated
Starting out as a Gaussian process the
evolution will stay a Gaussian process
FX BU Gw
X ˆ (t )
X
t ti t ti 1
i
ˆ (t )
X ˆ (t ) X
X ˆ (t )
i i 1 i 1
Xi X i 1 Ki (Zi Hi X )i
Starting Condition
X i 1 Φi X i w i
z i Hi X i v i
Qi i j
E (w i w )
T
i j
j
0
R i i j
E (v i v )
T
i j
j
0
E (w i vTj ) 0
State Propagation
ˆ Φ X
X ˆ
i 1 i i
ˆ )(X X
Pi1 E (X i 1 X i 1 i 1
ˆ )T
i 1
E (Φi X i w i Φi Xˆ )(Φ X w Φ X
i i i i i
ˆ )T
i
E (Φ ( X X
i
ˆ ) w )(Φ (X X
i i i
ˆ ) w )T
i i i i
E Φ (X
i
i
ˆ )(X X
X i i i i
ˆ )T ΦT E (w wT )
i j
Φi Pi ΦTi Qi
State Update
ˆ ˆ
X i 1 X i 1 Ki 1 (Zi Hi 1X i 1 )
1
Ki 1 P H i 1
T
i 1 (H P H
i 1 i 1
T
i 1 R i 1 )
Pi 1 (I Ki 1Hi 1 )P i 1
Conceptual Overview
y
Lost on the 1-dimensional line (imagine that you are
guessing your position by looking at the stars using
sextant)
Position – y(t)
Assume Gaussian distributed measurements
29
Conceptual Overview
0.16
0.14
Measurement - 0.1
position
0.08
0.06
0.04
0.02
0
0 10 20 30 40 50 60 70 80 90 100
0.14
0.08
0.06
0.04
0.02
0
0 10 20 30 40 50 60 70 80 90 100
0.02
(I would trust the
0
0 10 20 30 40 50 60 70 80 90 100 GPS more than the
sextant)
• Corrected mean is the new optimal estimate of position (basically
you’ve ‘updated’ the predicted position by Sextant using GPS
• New variance is smaller than either of the previous two variances
32
More Example
Suppose you have a hydrologic model that predicts river
water level every hour (using the usual inputs).
You know that your model is not perfect and you don’t
trust it 100%. So you want to send someone to check the
river level in person.
However, the river level can only be checked once a day
around noon and not every hour.
Furthermore, the person who measures the river level can
not be trusted 100% either.
So how do you combine both outputs of river level (from
model and from measurement) so that you get a ‘fused’
and better estimate? – Kalman filtering
Graphically speaking
34
Navigation using PF
Autonomous Land Vehicle (ALV), Google’s
Self-Driving Car, etc.
One important requirement: track the
position of the vehicle
Kalman Filter, loop of
(Re)initialization
Prediction
Observation
Correction
Interesting YouTube Videos
Introduction to Autonomous Vehicle
Introduction to Robot Localization
Introduction to Particle Filters
Example of Probabilistic Localization
Example of Probabilistic Localization Using
Particle Filters
Monte Carlo Localization Formulation for Vehicle
Localization
Particle Filters Algorithms
Navigation
Hypothesis and verification
Classic Approach like Kalman Filter maintains
a single hypothesis
Newer approach like particle filter maintains
multiple hypotheses (Monte Carlo sampling of
the state space)
Single Hypothesis
Ifthe “distraction” – noise – is white and
Gaussian
State-space probability profile remains
Gaussian (a single dominant mode)
Evolving and tracking the mean, not a
whole distribution
Multi-Hypotheses
The distribution can have multiple modes
Sample the probability distribution with
“importance” rating
Evolve the whole distribution, instead of
just the mean
Key – Baeys Rule
p(o, si ) p (o | si ) P( si )
P( si | o) p(o | si ) P( si )
p (o) p (o )
s : state
o : observatio n
Total weights
new particles
+ weights