CS685 Discrete Particle Filter - George Mason University

62
SA-1 Probabilistic Robotics Discrete Filters and Particle Filters Models Some slides adopted from: Wolfram Burgard, Cyrill Stachniss, Maren Bennewitz, Kai Arras and Probabilistic Robotics Book

Transcript of CS685 Discrete Particle Filter - George Mason University

Page 1: CS685 Discrete Particle Filter - George Mason University

SA-1

Probabilistic Robotics

Discrete Filters and Particle Filters Models

Some slides adopted from: Wolfram Burgard, Cyrill Stachniss,

Maren Bennewitz, Kai Arras and Probabilistic Robotics Book

Page 2: CS685 Discrete Particle Filter - George Mason University

2

Probabilistic Localization

Page 3: CS685 Discrete Particle Filter - George Mason University

3

Piecewise Constant

Page 4: CS685 Discrete Particle Filter - George Mason University

4

Discrete Bayes Filter Algorithm

1.  Algorithm Discrete_Bayes_filter( Bel(x),d ): 2.  η=0

3.  If d is a perceptual data item z then 4.  For all x do 5.  6.  7.  For all x do 8. 

9.  Else if d is an action data item u then

10.  For all x do 11.  12.  Return Bel’(x)

Page 5: CS685 Discrete Particle Filter - George Mason University

5

Piecewise Constant Representation

Page 6: CS685 Discrete Particle Filter - George Mason University

6

Implementation (1) •  To update the belief upon sensory input and to carry out

the normalization one has to iterate over all cells of the grid.

•  Especially when the belief is peaked (which is generally the case during position tracking), one wants to avoid updating irrelevant aspects of the state space.

•  One approach is not to update entire sub-spaces of the state space.

•  This, however, requires to monitor whether the robot is de-localized or not.

•  To achieve this, one can consider the likelihood of the observations given the active components of the state space.

Page 7: CS685 Discrete Particle Filter - George Mason University

7

Implementation (2) •  To efficiently update the belief upon robot motions, one typically

assumes a bounded Gaussian model for the motion uncertainty. •  This reduces the update cost from O(n2) to O(n), where n is the

number of states. •  The update can also be realized by shifting the data in the grid

according to the measured motion. •  In a second step, the grid is then convolved using a separable

Gaussian Kernel. •  Two-dimensional example:

1/4

1/4

1/2 1/4 1/2 1/4 + ≅

1/16

1/16

1/8

1/8

1/8

1/4

1/16

1/16

1/8

  Fewer arithmetic operations

  Easier to implement

Page 8: CS685 Discrete Particle Filter - George Mason University

8

Grid-based Localization

Page 9: CS685 Discrete Particle Filter - George Mason University

Application Example: Rhino

9

Page 10: CS685 Discrete Particle Filter - George Mason University

10

Sonars and Occupancy Grid Map

Page 11: CS685 Discrete Particle Filter - George Mason University

14

  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 12: CS685 Discrete Particle Filter - George Mason University

Sample-based Localization (sonar)

Page 13: CS685 Discrete Particle Filter - George Mason University

16

  Set of weighted samples

Mathematical Description

  The samples represent the posterior

State hypothesis Importance weight

Page 14: CS685 Discrete Particle Filter - George Mason University

17

  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 15: CS685 Discrete Particle Filter - George Mason University

18

  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 16: CS685 Discrete Particle Filter - George Mason University

19

  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 17: CS685 Discrete Particle Filter - George Mason University

Particle Filters

Page 18: CS685 Discrete Particle Filter - George Mason University

Sensor Information: Importance Sampling

Page 19: CS685 Discrete Particle Filter - George Mason University

Robot Motion

Page 20: CS685 Discrete Particle Filter - George Mason University

Sensor Information: Importance Sampling

Page 21: CS685 Discrete Particle Filter - George Mason University

Robot Motion

Page 22: CS685 Discrete Particle Filter - George Mason University

31

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 23: CS685 Discrete Particle Filter - George Mason University

32

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

Page 24: CS685 Discrete Particle Filter - George Mason University

draw xit-1 from Bel(xt-1)

draw xit from p(xt | xi

t-1,ut-1)

Importance factor for xit:

Particle Filter Algorithm

Page 25: CS685 Discrete Particle Filter - George Mason University

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 26: CS685 Discrete Particle Filter - George Mason University

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 27: CS685 Discrete Particle Filter - George Mason University

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

u1 ~U[0,n−1], i =1

Also called stochastic universal sampling

Page 28: CS685 Discrete Particle Filter - George Mason University

37

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 29: CS685 Discrete Particle Filter - George Mason University

Start

Motion Model Reminder

Page 30: CS685 Discrete Particle Filter - George Mason University

Proximity Sensor Model Reminder

Laser sensor Sonar sensor

Page 31: CS685 Discrete Particle Filter - George Mason University

40

Page 32: CS685 Discrete Particle Filter - George Mason University

41

Page 33: CS685 Discrete Particle Filter - George Mason University

42

Page 34: CS685 Discrete Particle Filter - George Mason University

43

Page 35: CS685 Discrete Particle Filter - George Mason University

44

Page 36: CS685 Discrete Particle Filter - George Mason University

45

Page 37: CS685 Discrete Particle Filter - George Mason University

46

Page 38: CS685 Discrete Particle Filter - George Mason University

47

Page 39: CS685 Discrete Particle Filter - George Mason University

48

Page 40: CS685 Discrete Particle Filter - George Mason University

49

Page 41: CS685 Discrete Particle Filter - George Mason University

50

Page 42: CS685 Discrete Particle Filter - George Mason University

51

Page 43: CS685 Discrete Particle Filter - George Mason University

52

Page 44: CS685 Discrete Particle Filter - George Mason University

53

Page 45: CS685 Discrete Particle Filter - George Mason University

54

Page 46: CS685 Discrete Particle Filter - George Mason University

55

Page 47: CS685 Discrete Particle Filter - George Mason University

56

Page 48: CS685 Discrete Particle Filter - George Mason University

57

Page 49: CS685 Discrete Particle Filter - George Mason University

58

Sample-based Localization (sonar)

Page 50: CS685 Discrete Particle Filter - George Mason University

59

Initial Distribution

Page 51: CS685 Discrete Particle Filter - George Mason University

60

After Incorporating Ten Ultrasound Scans

Page 52: CS685 Discrete Particle Filter - George Mason University

61

After Incorporating 65 Ultrasound Scans

Page 53: CS685 Discrete Particle Filter - George Mason University

62

Estimated Path

Page 54: CS685 Discrete Particle Filter - George Mason University

Vision-based Localization

P(z|x)

h(x)

z

Page 55: CS685 Discrete Particle Filter - George Mason University

Under a Light

Measurement z: P(z|x):

Page 56: CS685 Discrete Particle Filter - George Mason University

Next to a Light

Measurement z: P(z|x):

Page 57: CS685 Discrete Particle Filter - George Mason University

Elsewhere

Measurement z: P(z|x):

Page 58: CS685 Discrete Particle Filter - George Mason University

Global Localization Using Vision

Page 59: CS685 Discrete Particle Filter - George Mason University

70

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 60: CS685 Discrete Particle Filter - George Mason University

71

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 61: CS685 Discrete Particle Filter - George Mason University

72

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 62: CS685 Discrete Particle Filter - George Mason University

73

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.