The answersDownload the PDF
Worksheet

U7.7 Project: the kidnapped robot

Localisation · University · about 50 min

BugBotLab
NameClassDate

What this lesson is about

No idea where it starts. Work it out, then drive somewhere on purpose.

Questions 7 marks in all

  1. [1 mark]What does this program print?

    import math
    SIGMA = 3.5
    particles = [40.0, 42.0, 44.0, 150.0, 152.0]
    measured = 157.0
    w = [math.exp(-(((200 - y) - measured) ** 2) / (2 * SIGMA * SIGMA)) + 1e-12 for y in particles]
    total = sum(w)
    weights = [v / total for v in w]
    print(round(sum(v * y for v, y in zip(weights, particles)), 1))
    
  2. [1 mark]The depth sensor faces the far wall, so its readings pin down y. The robot turns ninety degrees to the left. What does a cloud weighed against the new readings pin down?

    1. Ax
    2. By again, more precisely
    3. CThe heading
    4. DBoth x and y at once
  3. [1 mark]In phase one the robot faces the far wall, and the cloud finds y but stays a stripe across the mat. What cuts the stripe down to a spot?

    1. AA reading from a different direction, such as the left wall once a ninety degree turn has finished
    2. BShuffling sideways and reading the far wall again
    3. CAveraging more readings of the far wall
    4. DUsing a smaller sigma
  4. [1 mark]A project filter weighs its x cloud against every reading, including those taken during the ninety degree turn towards the left wall. It ends 58 cm from the robot with a spread of 5 cm. Why?

    1. AThe readings during the turn were at a slant, so the cloud collapsed where they seemed to point, and once no guess was near the right x it could not come back
    2. BThe turn made the odometry heading drift by 2 to 3 degrees
    3. CFive cm of spread is too much jitter
    4. DThe left wall is further away than the far wall
  5. [1 mark]During the run the estimate suddenly jumps by 60 cm. What has most likely happened?

    1. AThe cloud had two clusters and has just resampled onto one of them
    2. BThe motion noise is too large
    3. CThe effective sample size has risen to N
    4. DThe robot has driven into a wall
  6. [1 mark]In phase two the spread starts climbing steadily. What does that mean?

    1. AThe measurements have stopped being informative and the filter is effectively dead reckoning
    2. BThe filter is converging on the true position
    3. CToo many particles are being injected
    4. DThe resampling threshold is too low
  7. [1 mark]Which defence specifically lets the filter recover if the robot is picked up and moved mid-run?

    1. AInjecting a small percentage of particles scattered over the whole mat every tick
    2. BAdding jitter to each resampled copy
    3. CResampling only when neff is below N/2
    4. DUsing a larger number of particles at the start

The task: the kidnapped robot

Work out where the robot woke up, print it as found:, and then drive into the green corner. position() is not allowed anywhere.

from bugbot import *
import math, random
connect()

DT, N, SIGMA = 0.1, 400, 3.5
particles = [random.uniform(0, 200) for i in range(N)]

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/u7-7-project-the-kidnapped-robot/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Shuffle 20 cm sideways during phase one, still facing the far wall, and keep weighing. Does the cloud collapse any faster, or learn anything about x? Why not?
  2. Inject 2 percent random particles every tick, and half way through the run, pick the robot up in your head: set the true position somewhere else by driving it there with the filter off. Does it recover?
  3. Track heading as well as position in each particle. What breaks, and what does it cost?