Class Meeting 05: Measurement Models for Range Finders and SLAM


Today's Class Meeting



What You'll Need for Today's Class


For today's class, you'll need the following tools/applications ready and running:


Beam Models of Range Finders


Here, we detail a beam model for range finders algorithm.

\(\textrm{Algorithm beam_range_finder_model}(z_t, x_t, m):\)
\( \qquad q = 1 \)
\( \qquad \textrm{for} \: k = 1 \: \textrm{to} \: K \: \textrm{do} \)
\( \qquad\qquad \textrm{compute} \: z_t^{k*} \: \textrm{for the measurement} \: z_t^{k} \: \textrm{using ray casting} \)
\( \qquad\qquad p = z_{hit} \cdot p_{hit}(z_t^k|x_t,m) + z_{short} \cdot p_{short}(z_t^k|x_t,m) + z_{max} \cdot p_{max}(z_t^k|x_t,m) + z_{rand} \cdot p_{rand}(z_t^k|x_t,m) \)
\( \qquad\qquad q = q \cdot p\)
\( \qquad \textrm{return} \: q \)

Here, we provide additional details on the algorithm above:


Accounting for possible measurement error in beam models


The beam model of range finders accounts for 4 types of possible measurement error: measurement noise, unexpected objects, failure to detect obstacles, and random measurements.

Measurement noise is accounted for through \( p_{hit}(z_t^k | x_t, m) \) according to: $$p_{hit}(z_t^k | x_t, m) = \{ \: \eta \mathcal{N}(z_t^k;z_t^{k*},\sigma_{hit}^2), \:\: \textrm{if} \: 0 \le z_t^k \le z_{max} \: ; \: 0, \: \textrm{otherwise} \}$$ where \(\mathcal{N}(z_t^k;z_t^k*,\sigma_{hit}^2)\) denotes the univariate normal distribution with mean \(z_t^{k*}\) and standard deviation \(\sigma_{hit}\), and \(\eta\) is a normalizing constant.

Unexpected objects (e.g., a person walking through the space that isn't captured in our static map) is accounted for through \( p_{short}(z_t^k | x_t, m)\) according to: $$p_{short}(z_t^k | x_t, m) = \{ \: \eta \lambda_{short} e^{-\lambda_{short}z_t^k}, \:\: \textrm{if} \: 0 \le z_t^k \le z_t^{k*} \: ; \: 0, \: \textrm{otherwise} \} $$ where \(\lambda_{short}\) is an intrinsic parameter of the measurement model, and \(\eta\) is a normalizing constant.

We account for a possible failure to detect obstacles assuming that failures result in a max-range measurement (due to, for example, sensing black light-absorbing objects or measuring objects in bright sunlights) according to: $$p_{max}(z_t^k | x_t, m) = \{ \: 1 \: \textrm{if} \: z = z_{max}, \: 0 \: \textrm{otherwise} \: \}$$

Finally, we account for random measurements according to: $$p_{rand}(z_t^k | x_t, m) = \{ \: \frac{1}{z_{max}} \textrm{if} \: 0 \le z_t^k \le z_{max}, \: 0 \: \textrm{otherwise} \: \}$$


Likelihood Fields for Range Finders


Here, we detail a likelihood field for range finders algorithm.

\( \textrm{Algorithm likelihood_field_range_finder_model}(z_t, x_t, m): \)
\( \qquad q = 1 \)
\( \qquad \textrm{for} \: k = 1 \: \textrm{to} \: K \: \textrm{do} \)
\( \qquad \qquad \textrm{if} \: z_t^k \ne z_{max} \)
\( \qquad \qquad \qquad x_{z_t^k} = x + x_{k,sens} cos \theta - y_{k,sens} sin \theta + z_t^k cos \big( \theta + \theta_{k,sens} \big) \)
\( \qquad \qquad \qquad y_{z_t^k} = y + y_{k,sens} cos \theta - x_{k,sens} sin \theta + z_t^k sin \big( \theta + \theta_{k,sens} \big) \)
\( \qquad \qquad \qquad dist = \textrm{min}_{x', y'} \: \Big\{ \sqrt{(x_{z_t^k} - x')^2 + (y_{z_t^k} - y')^2} \Big| \langle x', y' \rangle \: \textrm{occupied in } m \Big\} \)
\( \qquad \qquad \qquad q = q \cdot \bigg( z_{hit} \: \textrm{prob}(dist,\sigma_{hit}) + \frac{z_{random}}{z_{max}} \bigg) \)
\( \qquad \textrm{return} \: q \)

Here, we provide additional details on the algorithm above:

Note: For your particle filter project, you don't need to necessarily "skip" \( z_{max} \) values as this \( \textrm{likelihood_field_range_finder_model}\) algorithm specifies. What you want to do is think carefully about the scenarios where you may encounter \( z_{max} \) values, and then multiply \( q \) by a value that makes sense.

Class Exercise: Using a Likelihood Field Approach for a Measurement Model for Monte Carlo Localization


We are going to repeat the exercise from Class Meeting 04, but instead of completing the measurement model using a ray casting approach, we'll use a likelihood field approach.


Exercise Setup


We'll use the same 2D grid world that we did before (pictured below on the left) as well as the likelihood field for this grid world (pictured below on the right).

four particles time 0
likelihood field

Again, our particles are located at the following positions represented as [x, y, Θ]:

We represent sensor measurement \(z_t\) as an array of 3 values representing the left, front, and sensor measurements in that order. For example, if our robot were at the location and direction [1.0, 2.0, 90°], our robot's sensor readings would be \(z_t = \) [1.0, 3.0, 1.0].

In order to determine which of these guesses corresponds with our robot's true location in the 2D world, we will again iterate through the following process:

  1. Move: Our robot will move in the environment. We must move our particles the same amount that the robot moved, computing their new [x, y, Θ] locations.

  2. Compute Weights: This is the component that is unique and distinct from last class, since we'll be using a likelihood field approach for the measurement model instead of ray casting. This will allow us to compute particle weights, where high weights values indicate higher similarity with the robot's sensor readings.

    • Our robot will receive readings from its 3 sensors. Using these sensor readings and the likelihood field provided above, you'll need to compute \(dist_{closest\_obs}\), the distance to the closest obstacle based on the likelihood field algorithm, for each robot sensor reading.
    • For this exercise, we will use the following measurement model to compute the importance weights for each particle (\(m\)): $$w_t^{[m]} = \frac{1}{\sum_{i = 0}^2 dist_{closest\_obs}[i]}$$

  3. Resample: Proportional to the weights you just computed for each of the particles, sample with replacement (resample), a new set of particles.
    • First, you'll need to normalize your particle importance weights such that \(\sum_m w_t^{[m]} = 1 \).
    • Then, you'll need to sample with replacement a new set of 4 particles with probability proportional to the importance weights \(w_t^{[m]}\). For the purposes of this class exercise, please pretend one of you is a random sampling algorithm and select 4 particles approximately proportional to their normalized importance weights. Please do not use code to do this, this exercise is intended to be completed with pen and paper.

For each of the following time steps (with its corresponding robot movements and sensor readings), go through the three steps above to execute this simplified version of a particle filter to localize the robot:

Once you finish calculating going through the move, compute weights, and resample steps for each of the three timesteps you can check your solutions on this Likelihood Field exercise solutions page.


Acknowledgments


This page and the content for today's lecture were informed by Probabilistic Robotics by Sebastian Thrun, Wolfram Burgard, and Dieter Fox.