Introduction to Mobile Robotics Bayes Filter – Particle Filter and...

61
1 Wolfram Burgard, Cyrill Stachniss, Maren Bennewitz, Kai Arras Bayes Filter – Particle Filter and Monte Carlo Localization Introduction to Mobile Robotics

Transcript of Introduction to Mobile Robotics Bayes Filter – Particle Filter and...

Page 1: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

1

Wolfram Burgard, Cyrill Stachniss,

Maren Bennewitz, Kai Arras

Bayes Filter – Particle Filter and Monte Carlo Localization

Introduction to Mobile Robotics

Page 2: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

2

§  Recall: Discrete filter §  Discretize the continuous state space §  High memory complexity §  Fixed resolution (does not adapt to the belief)

§  Particle filters are a way to efficiently represent non-Gaussian distribution

§  Basic principle §  Set of state hypotheses (“particles”) §  Survival-of-the-fittest

Motivation

Page 3: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Sample-based Localization (sonar)

Page 4: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

4

§  Set of weighted samples

Mathematical Description

§  The samples represent the posterior

State hypothesis Importance weight

Page 5: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

5

§  Particle sets can be used to approximate functions

Function Approximation

§  The more particles fall into an interval, the higher the probability of that interval

§  How to draw samples form a function/distribution?

Page 6: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

6

§  Let us assume that f(x)<1 for all x §  Sample x from a uniform distribution §  Sample c from [0,1] §  if f(x) > c keep the sample

otherwise reject the sampe

Rejection Sampling

c

xf(x)

c’

x’

f(x’)

OK

Page 7: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

7

§  We can even use a different distribution g to generate samples from f

§  By introducing an importance weight w, we can account for the “differences between g and f ”

§  w = f / g §  f is often called

target §  g is often called

proposal §  Pre-condition:

f(x)>0 à g(x)>0

Importance Sampling Principle

Page 8: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Importance Sampling with Resampling: Landmark Detection Example

Page 9: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Distributions

Page 10: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

10

Distributions

Wanted: samples distributed according to p(x| z1, z2, z3)

Page 11: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

This is Easy! We can draw samples from p(x|zl) by adding noise to the detection parameters.

Page 12: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Importance Sampling

),...,,(

)()|(),...,,|( :fon distributiTarget

2121

n

kk

n zzzp

xpxzpzzzxp

∏=

)()()|()|( :gon distributi Sampling

l

ll zp

xpxzpzxp =

),...,,(

)|()(

)|(),...,,|( : w weightsImportance

21

21

n

lkkl

l

n

zzzp

xzpzp

zxpzzzxp

gf ∏

≠==

Page 13: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Importance Sampling with Resampling

Weighted samples After resampling

Page 14: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Particle Filters

Page 15: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

)|()(

)()|()()|()(

xzpxBel

xBelxzpw

xBelxzpxBel

ααα

=←

Sensor Information: Importance Sampling

Page 16: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then insert it again.

∫←− 'd)'()'|()( , xxBelxuxpxBel

Robot Motion

Page 17: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

)|()(

)()|()()|()(

xzpxBel

xBelxzpw

xBelxzpxBel

ααα

=←

Sensor Information: Importance Sampling

Page 18: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Robot Motion

∫←− 'd)'()'|()( , xxBelxuxpxBel

Page 19: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

19

Particle Filter Algorithm

§  Sample the next generation for particles using the proposal distribution

§  Compute the importance weights : weight = target distribution / proposal distribution

§  Resampling: “Replace unlikely samples by more likely ones”

§  [Derivation of the MCL equations on the blackboard]

Page 20: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

20

1.  Algorithm particle_filter( St-1, ut-1 zt): 2. 

3.  For Generate new samples 4.  Sample index j(i) from the discrete distribution given by wt-1

5.  Sample from using and

6.  Compute importance weight 7.  Update normalization factor

8.  Insert 9.  For

10.  Normalize weights

Particle Filter Algorithm

0, =∅= ηtSni …1=

},{ ><∪= it

ittt wxSS

itw+=ηη

itx ),|( 11 −− ttt uxxp )(

1ij

tx − 1−tu

)|( itt

it xzpw =

ni …1=

η/itit ww =

Page 21: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

draw xit-1 from Bel(xt-1)

draw xit from p(xt | xi

t-1,ut-1)

Importance factor for xit:

)|()(),|(

)(),|()|(ondistributi proposal

ondistributitarget

111

111

tt

tttt

tttttt

it

xzpxBeluxxp

xBeluxxpxzp

w

=

=

−−−

−−−η

1111 )(),|()|()( −−−−∫= tttttttt dxxBeluxxpxzpxBel η

Particle Filter Algorithm

Page 22: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Resampling

§  Given: Set S of weighted samples.

§  Wanted : Random sample, where the probability of drawing xi is given by wi.

§  Typically done n times with replacement to generate new sample set S’.

Page 23: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

w2

w3

w1 wn

Wn-1

Resampling

w2

w3

w1 wn

Wn-1

§  Roulette wheel §  Binary search, n log n

§  Stochastic universal sampling §  Systematic resampling

§  Linear time complexity §  Easy to implement, low variance

Page 24: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

1.  Algorithm systematic_resampling(S,n):

2.  3.  For Generate cdf 4.  5.  Initialize threshold

6.  For Draw samples … 7.  While ( ) Skip until next threshold reached 8.  9.  Insert 10.  Increment threshold

11.  Return S’

Resampling Algorithm

11,' wcS =∅=

ni …2=i

ii wcc += −1

1],,0]~ 11 =− inUu

nj …1=

11

−+ += nuu jj

ij cu >

{ }><∪= −1,'' nxSS i1+= ii

Also called stochastic universal sampling

Page 25: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

25

Mobile Robot Localization

§ Each particle is a potential pose of the robot

§  Proposal distribution is the motion model of the robot (prediction step)

§  The observation model is used to compute the importance weight (correction step)

[For details, see PDF file on the lecture web page]

Page 26: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Start

Motion Model Reminder

Page 27: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Proximity Sensor Model Reminder

Laser sensor Sonar sensor

Page 28: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

28

Page 29: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

29

Page 30: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

30

Page 31: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

31

Page 32: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

32

Page 33: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

33

Page 34: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

34

Page 35: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

35

Page 36: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

36

Page 37: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

37

Page 38: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

38

Page 39: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

39

Page 40: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

40

Page 41: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

41

Page 42: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

42

Page 43: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

43

Page 44: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

44

Page 45: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

45

Page 46: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

46

Sample-based Localization (sonar)

Page 47: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

47

Initial Distribution

Page 48: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

48

After Incorporating Ten Ultrasound Scans

Page 49: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

49

After Incorporating 65 Ultrasound Scans

Page 50: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

50

Estimated Path

Page 51: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

51

Localization for AIBO robots

Page 52: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Using Ceiling Maps for Localization

[Dellaert et al. 99]

Page 53: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Vision-based Localization

P(z|x)

h(x)

z

Page 54: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Under a Light

Measurement z: P(z|x):

Page 55: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Next to a Light

Measurement z: P(z|x):

Page 56: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Elsewhere

Measurement z: P(z|x):

Page 57: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

Global Localization Using Vision

Page 58: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

58

Limitations

§  The approach described so far is able to §  track the pose of a mobile robot and to §  globally localize the robot.

§  How can we deal with localization errors (i.e., the kidnapped robot problem)?

Page 59: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

59

Approaches

§  Randomly insert samples (the robot can be teleported at any point in time).

§  Insert random samples proportional to the average likelihood of the particles (the robot has been teleported with higher probability when the likelihood of its observations drops).

Page 60: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

60

Summary – Particle Filters

§  Particle filters are an implementation of recursive Bayesian filtering

§  They represent the posterior by a set of weighted samples

§  They can model non-Gaussian distributions §  Proposal to draw new samples §  Weight to account for the differences

between the proposal and the target §  Monte Carlo filter, Survival of the fittest,

Condensation, Bootstrap filter

Page 61: Introduction to Mobile Robotics Bayes Filter – Particle Filter and …ais.informatik.uni-freiburg.de/.../slides/11-pf-mcl.ppt.pdf · 2011. 6. 9. · Summary – PF Localization

61

Summary – PF Localization

§  In the context of localization, the particles are propagated according to the motion model.

§  They are then weighted according to the likelihood of the observations.

§  In a re-sampling step, new particles are drawn with a probability proportional to the likelihood of the observation.