Bayes Filter Reminder -...

25

Transcript of Bayes Filter Reminder -...

Page 1: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed
Page 2: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Prediction

Correction

Bayes Filter Reminder

Bel(xt) p(xt |ut,xt1) Bel(xt1) dxt1

Bel(xt) p(zt | xt)Bel(xt)

Bel(xt) p(zt | xt) p(xt |ut,xt1) Bel(xt1) dxt1

Page 3: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Prediction

Correction

Bayes Filter Reminder

bel(xt) p(xt |ut, xt1) bel(xt1) dxt1

bel(xt) p(zt | xt)bel(xt)

bel(xt) p(zt | xt) p(xt |ut, xt1) bel(xt1) dxt1

Page 4: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Kalman Filter Bayes filter with Gaussians Developed in the late 1950's Most relevant Bayes filter variant in practice Applications range from economics, weather

forecasting, satellite navigation to robotics and many more.

The Kalman filter “algorithm” isa couple of matrix multiplications!

5

Page 5: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Gaussians

-

Univariate

Multivariate

2

2)(

2

1

2

2

1)(

:),(~)(

x

exp

Nxp

p(x) ~ N(,) :

p(x) 1

(2 )d/2 1/2 e1

2(x )t1(x )

Page 6: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed
Page 7: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Properties of Gaussians Univariate case

),(~),(~ 22

2

abaNY

baXY

NX

22

21

222

21

21

122

21

22

212222

2111 1

,~)()(),(~

),(~

NXpXpNX

NX

Page 8: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Multivariate case

(where division "–" denotes matrix inversion)

We stay Gaussian as long as we start with Gaussians and perform only linear transformations

Properties of Gaussians

),(~),(~ TAABANY

BAXY

NX

12

11

221

11

21

221

222

111 1,~)()(

),(~

),(~

NXpXpNX

NX

Page 9: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

10

Discrete Kalman Filter

Estimates the state x of a discrete-time controlled process that is governed by the linear stochastic difference equation

with a measurement

tttttt uBxAx 1

tttt xCz

Page 10: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

11

Components of a Kalman Filter

Matrix (n×n) that describes how the state evolves from t-1 to t without controls or noise.Matrix (n×l) that describes how the control ut changes the state from t-1 to t.

Matrix (k×n) that describes how to map the state xt to an observation zt.

Random variables representing the process and measurement noise that are assumed to be independent and normally distributed with covariance Qt and Rt respectively.

t

tA

tB

tC

t

Page 11: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed
Page 12: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

14

Kalman Filter Updates in 1D

How to get the blue one?Kalman correction step

bel(xt) t t K t(zt Ctt)

t (I K tCt)t

with K t tCtT (CttCt

T Rt)1

bel(xt) t t Kt(zt t)

t2 (1Kt) t

2

with Kt t

2

t2 obs,t

2

Page 13: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Kalman Filter Updates in 1D

How to get the magenta one?State prediction step

bel(xt) t Att1 Btut

t Att1AtT Qt

bel(xt) t att1 btut

t2 at

2 t2 act,t

2

Page 14: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Kalman Filter Updates

prediction

correctionmeasurement

Page 15: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Linear Gaussian Systems: Initialization

Initial belief is normally distributed:

0000 ,;)( xNxbel

Page 16: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Dynamics are linear functions of the state and the control plus additive noise:

Linear Gaussian Systems: Dynamics

xt Atxt1 Btut tp(xt |ut,xt1) N xt;Atxt1 Btut,Qt bel(xt) p(xt |ut,xt1) bel(xt1) dxt1

~ N xt;Atxt1 Btut,Qt ~ N xt1;t1, t1

Page 17: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Linear Gaussian Systems: Dynamics

bel(xt) p(xt |ut,xt1) bel(xt1) dxt1

~ N xt;Atxt1 Btut,Qt ~ N xt1;t1,t1

bel(xt) exp 1

2(xt Atxt1 Btut)

TQt1(xt Atxt1 Btut)

exp 1

2(xt1 t1)

T t11 (xt1 t1)

dxt1

bel(xt) t Att1 Btut

t Att1AtT Qt

Page 18: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Observations are a linear function of the state plus additive noise:

Linear Gaussian Systems: Observations

tttt xCz

p(zt | xt) N zt;Ctxt,Rt

bel(xt) p(zt | xt) bel(xt)

~ N zt;Ctxt,Rt ~ N xt;t,t

Page 19: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Linear Gaussian Systems: Observations

bel(xt) p(zt | xt) bel(xt)

~ N zt;Ctxt,Rt ~ N xt;t,t

bel(xt) exp 12

(zt Ctxt)TRt

1(zt Ctxt)

exp 12

(xt t)T t

1(xt t)

bel(xt) t t K t(zt Ctt)

t (I K tCt)t

with K t tCtT (CttCt

T Rt)1

Page 20: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Kalman Filter Algorithm

1. Algorithm Kalman_filter( t-1, t-1, ut, zt):

2. Prediction:3. 4.

5. Correction:6. 7. 8.

9. Return t, t

t Att1 Btut

t Att1AtT Qt

K t tCtT (CttCt

T Rt)1

t t K t(zt Ctt)

t (I K tCt)t

Page 21: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed
Page 22: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

25

The Prediction-Correction-Cycle

Prediction

bel(xt) t Att1 Btutt Att1At

T Qt

bel(xt) t att1 btutt

2 at2 t

2 act,t2

Page 23: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

26

The Prediction-Correction-Cycle

Correction

bel(xt) t t K t(zt Ctt)

t (I K tCt)t

,K t tCtT (CttCt

T Rt)1

bel(xt) t t K t(zt t)

t2 (1K t)t

2

, K t t2

t2 obs,t

2

Page 24: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

27

The Prediction-Correction-Cycle

Correction

Prediction

bel(xt) t t K t(zt Ctt)

t (I KtCt)t

,K t tCtT (CttCt

T Rt)1

bel(xt) t t K t(zt t)

t2 (1K t)t

2

, K t t2

t2 obs,t

2

bel(xt) t Att1 Btutt Att1At

T Qt

bel(xt) t att1 btutt

2 at2 t

2 act,t2

Page 25: Bayes Filter Reminder - ais.informatik.uni-freiburg.deais.informatik.uni-freiburg.de/teaching/ss18/robotics/slides/10-kalman.pdf · Kalman Filter Bayes filter with Gaussians Developed

Kalman Filter Summary

Only two parameters describe belief about the state of the system

Highly efficient: Polynomial in the measurement dimensionality k and state dimensionality n:

O(k2.376 + n2)

Optimal for linear Gaussian systems! However: Most robotics systems are

nonlinear! Can only model unimodal beliefs