Class Meeting 04: Monte Carlo Localization Exercise Solutions


This page contains solutions for the Monte Carlo localization exercise in Class Meeting 04.


Start


To start, we have the following map of particles

four particles time 0

with the following locations:

Additionally, our robot's sensors measurements \(z_t\) are represented as an array of 3 values representing the front, right and left sensor measurements.


\(t = 1\)


For \(t = 1\), our robot movement & sensor updates are:

Move: First, we must move each particle according to the robot's moment update. After moving forward each particle by 1.0, our map looks like

four particles time 1

with the following locations and orientations of our particles:

Compute Weights: To compute the particle weights, we must first calculate what the sensor measurements of the robot would be if it were in the position of each particle:

Next, we compute the weights for each particle for \(t=1\):

Resample: We'll first normalize the particle weights so that \(\sum_m w_1^{[m]} = 1 \). The current sum of the particles is \(2.42\).

The selection of particles will be specific to your group. A likely result would be having 2 pink particles and 2 blue particles survive this resampling step. Another possible result would be having 1 particle that's either green or purple and 3 particles that are either pink or blue. For the purposes of the solutions, we will assume that you choose 1 of each color particle, so that we have a full solution set. However, it is expected that you will not keep each color particle around for each iteration of the algorithm.


\(t = 2\)


For \(t = 2\), our robot movement & sensor updates are:

Move: Again, our first step is to move each particle according to the robot's moment update. After rotating each particle clockwise by 90°, our map looks like

four particles time 2

with the following locations and orientations of our particles:

Compute Weights: To compute the particle weights, we must first calculate what the sensor measurements of the robot would be if it were in the position of each particle:

Next, we compute the weights for each particle for \(t=2\):

Resample: We'll first normalize the particle weights so that \(\sum_m w_2^{[m]} = 1 \). The current sum of the particles is \(2.97\).

Note: If you have a different particle set at this point, your resampling step will be different. Use this as a guide/example as opposed to the answer you should be getting. The same is true for the resample step for \(t = 3\).


\(t = 3\)


For \(t = 3\), our robot movement & sensor updates are:

Move: For our \(t = 3\) movement update, we must again move each particle according to the robot's moment update. After moving forward each particle by 1.5, our map looks like

four particles time 3

with the following locations and orientations of our particles:

Compute Weights: To compute the particle weights, we must first calculate what the sensor measurements of the robot would be if it were in the position of each particle:

Next, we compute the weights for each particle for \(t=3\):

Resample: We'll first normalize the particle weights so that \(\sum_m w_3^{[m]} = 1 \). The current sum of the particles is \(3.17\).


End of the exercise


At this point, it should be clear that the pink particle, out of the four, is the best guess to the true location of the robot. If you were wondering, the robot was actually located originally at [1.5, 3.5, 90°].