The answersDownload the PDF
Worksheet

8.1 See as numbers

Learning · Robot club · about 15 min

BugBotLab
NameClassDate

What this lesson is about

What a model gets: the sensor views as lists of numbers.

Questions 7 marks in all

  1. [1 mark]How many numbers are in the depth grid from tof_grid()?

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

    grid = list(range(64))
    level = grid[16:32]
    print(len(level), level[0], level[-1])
  3. [1 mark]Which rows of the depth grid look straight ahead, level with the robot?

    1. ARows 2 and 3
    2. BRows 0 and 1
    3. CRows 6 and 7
    4. DRows 4 and 5
  4. [1 mark]One cell of the depth grid reads 400. What does that mean?

    1. ANothing is in range in that direction
    2. BA wall exactly 4 m away
    3. CThe sensor is broken
    4. DSomething is touching the robot
  5. [1 mark]The camera image is 320 by 240 pixels, and each pixel is three numbers. How many numbers is one frame?

  6. [1 mark]A model has only seen the depth grid with the robot facing a wall straight on. The robot turns a little. What happens to the numbers?

    1. AMany of them change, and the model has never seen a view like the new one
    2. BNone change, because the wall has not moved
    3. COnly the middle column changes
    4. DThe model adjusts them automatically
  7. [1 mark]What is the name for the small set of numbers you choose to hand to a model, which still tell the situations apart?

The task: see as numbers

Print the level rows' nearest and farthest readings as depth: min <cm>, max <cm>. Do not drive.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# 64 distances, 8 rows of 8
grid = tof_grid()
print(grid)

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

QR code
Do it on the robot
www.bugbotlab.com/learn/8-1-see-as-numbers/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Print the level rows as two lines of eight.
  2. Print their mean, rounded to a whole number.
  3. Print which column (0 to 7) has the farthest reading. That is where the most room is.