ch2 Recursive State Estimation
ch2 Recursive State Estimation
Pierre-Paul TACHER
1
Let Xn the random variable indicating the state of the range sensor at the date n. More precisely,
(
0 if the sensor is faulty,
Xn =
1 if the sensor is working correctly.
Assuming the state of the sensor does not change, we have that
∀n ∈ N, Xn = X0
P (X0 = 0) = p = 0.01
P (X0 = 1) = 1 − p = 0.99
Let Zn ∈ [0, 3] the real valued random variable giving the range measured by the sensor. By the problem
statement,
∀n ∈ N, Zn = zn ∈ [0, 1]
numerical values:
n P (Xn = 0 | z1:n )
1 0.0294
2 0.0833
3 0.2143
4 0.4500
5 0.7105
6 0.8804
7 0.9567
8 0.9851
9 0.9950
10 0.9983
2
Let Xt be the random variable which is the wheather of day t. We define (”sunny”, ”cloudy”, ”rainy”) =
(1, 2, 3).
2.1.
P (X1 = 1 ∩ X2 = 2 ∩ X3 = 2 ∩ X4 = 3)
= P (X4 = 3 | X1 = 1 ∩ X2 = 2 ∩ X3 = 2) × P (X1 = 1 ∩ X2 = 2 ∩ X3 = 2)
= P (X4 = 3 | X3 = 2) × P (X3 = 2 | X1 = 1 ∩ X2 = 2) × P (X1 = 1 ∩ X2 = 2)
= P (X4 = 3 | X3 = 2) × P (X3 = 2 | X2 = 2) × P (X2 = 2 | X1 = 1) × P (X1 = 1)
= 0.2 × 0.4 × 0.2 × 1
= 0.016
2.2.
2.3.
2.4. Let
P (Xt = 1)
Yt = P (Xt = 2)
P (Xt = 3)
P (Xt+1 = 1 | Xt = 1) P (Xt+1 = 1 | Xt = 2) P (Xt+1 = 1 | Xt = 3)
A = P (Xt+1 = 2 | Xt = 1) P (Xt+1 = 2 | Xt = 2) P (Xt+1 = 2 | Xt = 3)
P (Xt+1 = 3 | Xt = 1) P (Xt+1 = 3 | Xt = 2) P (Xt+1 = 3 | Xt = 3)
0.8 0.4 0.2
= 0.2 0.4 0.6
0 0.2 0.2
We have
Yt = AYt−1
so that
∀t ∈ N, Yt = An Y0
The matrix A is diagonalizable
A = P DP −1
PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION 3
with
√ √
9 2√−1 − √2 − 1
P = 4 − 2 2
1 1 1
1 1 1
14 14 14
− 2(√2−4)
√ √ √
− 2( 2+10)
√ √
2(13 2+4)
P −1 =
56 56 56
√ √ √ √ √ √
− 2( 2+4) − 2( 2−10) 2(13 2−4)
56 56 56
1 0√ 0
1+ 2
D = 0 0√
5
1− 2
0 0 5
Since
1 0 0
lim Dn = 0 0 0
n→∞
0 0 0
we have
1 0 0
lim Y n = P 0 0 0 P −1 X0
n→∞
0 0 0
9
14
2
=
7
1
14
whatever the initial distribution X0 is.
The stationary distribution is
9
14
2
Π= 7
1
14
2.6. The markov property states the probability law of future state conditioned on the current state does
not depend on any other variables: the current state should be sufficient to compute the future stochastic
evolution. This implies the state transition function can not depend on the season. Therefore, in order to
restore the Markov property, we could incorporate the season into the state variable.
4 PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION
3
Let (Zt )t∈N∗ denote the sequence of random variables measuring the wheather of the day.
∀t ∈ N∗ , Zt ∈ J1, 3K
3.1. We know for a fact that day 1 is sunny, and we do the following observations from day 2 to day 5:
t zt
2 2
3 2
4 3
5 1
We compute the distributions for (Xt )t∈J2,5K , being given the observations from the past until the current
point of time:
1
η=
0.32 + 0.14
1
=
0.46
i P (X2 = i | z2 )
1 0.70
2 0.30
3 0
PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION 5
1
η=
0.183 + 0.271
1
=
0.4539
i P (X3 = i | z2:3 )
1 0.60
2 0.40
3 0
i P (X4 = i | z2:4 )
1 0
2 0
3 1
6 PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION
1
η=
0.18 + 0.12
1
=
0.30
i P (X5 = i | z2:5 )
1 0.40
2 0.60
3 0
3.2. We know for a fact that day 1 is sunny, and we do the following observations from day 2 to day 5:
t zt
2 1
3 1
4 3
We compute the distributions for (Xt )t∈J2,5K , being given the observations from the past until the current
point of time:
1
η=
0.48 + 0.06
1
=
0.54
PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION 7
i P (X2 = i | z2 )
1 0.89
2 0.11
3 0
i P (X3 = i | z2:3 )
1 0.87
2 0.13
3 0
i P (X4 = i | z2:4 )
1 0
2 0
3 1
8 PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION
We will now compute the distribution of random variables (Xt )t∈J2,4K , conditionned on both past and future
observations of the sensor. Let’s define the transition matrix
P (Zt = 1 | Xt = 1) P (Zt = 1 | Xt = 2) P (Zt = 1 | Xt = 3)
C = P (Zt = 2 | Xt = 1) P (Zt = 2 | Xt = 2) P (Zt = 2 | Xt = 3)
P (Zt = 3 | Xt = 1) P (Zt = 3 | Xt = 2) P (Zt = 3 | Xt = 3)
0.6 0.3 0
= 0.4 0.7 0
0 0 1
t zt
2 1
3 1
4 3
P (X2 = 1 | z2:4 )
= ηP (Z2 = 1 | X2 = 1, z3:4 ) × P (X2 = 1 | z3:4 )
= ηP (Z2 = 1 | X2 = 1) × P (Z3 = 1 | X2 = 1, z4 ) × P (X2 = 1 | z4 )
X3
= ηP (Z2 = 1 | X2 = 1) × ( P (Z3 = 1 | X3 = i, X2 = 1, z4 ) × P (X3 = i | X2 = 1, z4 ))
i=1
× P (X2 = 1 | z4 )
X3
= ηP (Z2 = 1 | X2 = 1) × ( P (Z3 = 1 | X3 = i) × P (X3 = i | X2 = 1))
i=1
× P (Z4 = 3 | X2 = 1) × P (X2 = 1)
X3
= ηP (Z2 = 1 | X2 = 1) × ( P (Z3 = 1 | X3 = i) × P (X3 = i | X2 = 1))
i=1
| {z }
À
X3
×( P (z4 = 3 | X4 = j, X2 = 1) × P (X4 = j | X2 = 1)) × P (X2 = 1)
j=1
| {z }
Á
À = 0.6 × 0.8 + 0.3 × 0.2
= 0.54
X3 3
X
Á= P (Z4 = 3 | X4 = j) × ( P (X4 = j | X3 = k) × P (X3 = k | X2 = 1))
j=1 k=1
3 X
X 3
= P (Z4 = 3 | X4 = j) ×P (X4 = j | X3 = k) × P (X3 = k | X2 = 1)
| {z }
j=1 k=1
δj,3
3
X
= P (X4 = 3 | X3 = k) × P (X3 = k | X2 = 1)
k=1
= 0.2 × 0.2 + 0.2 × 0 + 0
= 0.04
P (X2 = 1 | z2:4 ) = η × 0.6 × 0.54 × 0.04 × 0.8
= 0.0104η
PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION 9
We observe that
À = P (Z3 = 1 | X2 = 1, z4 )
= (CA)1,1
Á = P (Z4 = 3 | X2 = 1)
= (CAA)3,1
0.54 0.36 0.30
CA = 0.46 0.44 0.50
0 0.20 0.20
0.5040 0.42 0.3840
CAA = 0.456 0.46 456
0.04 0.12 0.16
Then,
P (X2 = 2 | z2:4 )
= ηP (Z2 = 1 | X2 = 2) × P (Z3 = 1 | X2 = 2, z4 ) × P (Z4 = 3 | X2 = 2) × P (X2 = 2)
= ηP (Z2 = 1 | X2 = 2) × (CA)1,2 × (CAA)3,2 × P (X2 = 2)
= η0.3 × 0.36 × 0.12 × 0.2
= 0.0026η
P (X2 = 3 | z2:4 )
= ηP (Z2 = 1 | X2 = 3) × P (Z3 = 1 | X2 = 3, z4 ) × P (Z4 = 3 | X2 = 3) × P (X2 = 2)
=0
1
η=
0.0104 + 0.0026
1
=
0.013
i P (X2 = i | z2:4 )
1 0.8
2 0.2
3 0
10 PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION
P (X3 = 1 ∩ Z4 = 3 | z2:3 )
P (X3 = 1 | z2:4 ) =
P (Z4 = 3 | z2:3 )
= ηP (Z4 | X3 = 1, z2:3 ) × P (X3 = 1 | z2:3 )
X 3
=η P (Z4 = 3 ∩ X4 = i | X3 = 1, z2:3 ) × P (X3 = 1 | z2:3 )
i=1
3
X
=η P (X4 = i | X3 = 1, z2:3 ) × P (Z4 = 3 | X4 = i, z2:3 ) × P (X3 = 1 | z2:3 )
i=1
X3
=η P (X4 = i | X3 = 1) × P (Z4 = 3 | X4 = i) ×P (X3 = 1 | z2:3 )
| {z }
i=1
δ3,i
= ηP (X4 = 3 | X3 = 1) × P (Z4 = 3 | X4 = 3) × P (X3 = 1 | z2:3 )
=0
P (X3 = 2 | z2:4 ) = ηP (X4 = 3 | X3 = 2) × P (Z4 = 3 | X4 = 3) × P (X3 = 2 | z2:3 )
= η × 0.2 × 1 × 0.21
= 0.042η
P (X3 = 3 | z2:4 ) = ηP (X4 = 3 | X3 = 3) × P (Z4 = 3 | X4 = 3) × P (X3 = 3 | z2:3 )
=0
i P (X3 = i | z2:4 )
1 0
2 1
3 0
i P (X4 = i | z2:4 )
1 0
2 0
3 1
4
4.1. Using the notation of the book for probability density functions,
2
(x−xinit )
1 −
2σ 2
p(x) = √ e init
2πσinit
(z−x)2
1 −
2σ 2
p(z | x) = √ e GP S
2πσGP S
4.2. We have the following property for conditional probability density functions:
p(z | x) × p(x)
p(x | z) =
p(z)
PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION 11
Thus,
(9z+xinit )2
− 9z 2 −x2
√
r
init +
1 18σ 2
10
9
p(z) = 2 e GP S × 2π σGP S
3 × 2πσGP S 10
− 9 z 2 − 9 x2 +2× 9 xinit
1 10 10 init
2×9σ 2
10
=√ √ e GP S
2π 10σGP S
(z−xinit )2
1 −
2×10σ 2
=√ √ e GP S
2π 10σGP S
2
This shows Z has a normal distribution Z ,→ N (xinit , 10σGP S ). It follows that
(9z+xinit ) 2
(z−xinit )2 (x−
10
)
− −
1 2×10σ 2 2× 9 σ 2
2
3×2πσGP
e GP S e 10 GP S
p(x | z) = S
(z−xinit )2
−
2×10σ 2
√ √1 e GP S
2π 10σGP S
(9z+xinit ) 2
(x− )
1 − 10
2× 9 σ 2
=√ e 10 GP S
2π √310 σGP S
5
Being sloppy on technical details,
p(x, y | z)
p(x | z, y) =
p(y | z)
p(x | z) × p(y | z)
=
p(y | z)
= p(x | z)
12 PROBABILISTIC ROBOTICS: RECURSIVE STATE ESTIMATION
6
Classical derivation. Z
E[X − E[X]]2 = (X − E[X])2 dP
ZΩ
= (X 2 − 2XE[X] + (E[X])2 ) dP
ZΩ Z Z
= X 2 dP − 2E[X] X dP + (E[X])2 1 dP
Ω Ω Ω
= E[X 2 ] − 2(E[X])2 + (E[X])2
E[X − E[X]]2 = E[X 2 ] − (E[X])2