The answersDownload the PDF
Worksheet

U8.7 Project: map the mat

Mapping · University · about 50 min

BugBotLab
NameClassDate

What this lesson is about

An unknown layout, a grid built from scratch, and a measurement taken off the map.

Questions 6 marks in all

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

    CELL = 5.0
    T, F = True, False
    band = [T, F, F, T, T, T, F, F, F, F, T, T, F, F]
    best = None
    c = 0
    while c < len(band):
        if not band[c]:
            start = c
            while c < len(band) and not band[c]:
                c += 1
            bounded = start > 0 and c < len(band)
            if bounded and (best is None or c - start > best[1] - best[0]):
                best = (start, c)
        else:
            c += 1
    print(best, (best[0] * CELL + best[1] * CELL) / 2)
    
  2. [1 mark]When searching the band for the doorway, why must a clear run have wall on both sides?

    1. ABeyond the ends of the wall there is also clear space, and it must not be mistaken for a door
    2. BDoorways are always narrower than the wall is thick
    3. CIt removes the half-cell bias from the answer
    4. DRuns at the edge of the grid are always unknown
  3. [1 mark]A program reports the wall at y = 0 on every run. What has it most likely found?

    1. AThe mat's own edge behind the robot, which is mapped as an obstacle
    2. BA timeout marked as a hit
    3. CThe half-cell bias
    4. DA shadow behind the wall
  4. [1 mark]The reported doorway is always off by exactly one cell. What should you check first?

    1. ARounding: whether you are reporting the edge of a cell or its centre
    2. BThe heading error on each scan
    3. CWhether the far side of the wall is unknown
    4. DThe value of L_OCC
  5. [1 mark]Why does the project sweep from a second viewpoint as well as the first?

    1. AIt fills in the first viewpoint's shadows and confirms the walls that both saw
    2. BOne rotation cannot cover 360 degrees of bearings
    3. CThe first sweep's cells are reset when the robot moves
    4. DThe clamp stops a single viewpoint from marking any cell
  6. [1 mark]After a full turn on the spot, the robot calls forward() and drives sideways across the mat. Why?

    1. AIt is left facing an arbitrary direction, and forward() is relative to the robot, not the mat
    2. BThe map has rotated the robot's coordinate frame
    3. CThe wheels slip after turning
    4. DThe inverse sensor model has changed the heading

The task: map the mat

The robot starts at (100, 25) facing up the mat. Map it, and print explored:, wall y: and gap x:. Do not touch anything.

from bugbot import *
import math
connect()

CELL, W = 5.0, 40
L_OCC, L_FREE, L_MAX, FAR = 0.85, -0.4, 8.0, 170.0
START_X, START_Y = 100.0, 25.0
grid = [0.0] * (W * W)

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

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

Challenges

  1. Report the width of the doorway as well as its middle, and say how accurate you expect that to be.
  2. Build the map twice, once from one viewpoint and once from three, and compare how many cells are still unknown.
  3. Add 5 degrees of error to every heading and measure how far the reported doorway moves.