The answersDownload the PDF
Worksheet

6.7 Where will it be

Seeing more · Robot club · about 20 min

BugBotLab
NameClassDate

What this lesson is about

Two sightings give a velocity: give way to a robot crossing your path.

Questions 7 marks in all

  1. [1 mark]Robot 102's bearing sweeps from -36 to 33 degrees while its distance only goes from 58 cm down to 40 cm and back out. What is it doing?

    1. ACrossing in front of you
    2. BDriving straight at you
    3. CDriving away from you
    4. DStanding still
  2. [1 mark]What does this program print?

    last = None
    for bearing in [-30.0, -20.0, -8.0, 5.0, 18.0]:
        if last is not None:
            print(bearing, "coming" if abs(bearing) < abs(last) else "leaving")
        last = bearing
  3. [1 mark]The first give way rule stops whenever robot 102 is close and in front. What is wrong with it?

    1. AIt also stops for a robot that is already moving away from its path
    2. BIt never stops at all
    3. CIt drives into the robot
    4. DIt only works on the left side
  4. [1 mark]The rule is tags and tags[0][3] < 30 and abs(bearing_of(tags[0][1])) < 35. Robot 102 is 25 cm away at a bearing of -40. Does the robot stop?

    1. ANo: 40 degrees is outside the 35 degree window
    2. BYes: it is closer than 30 cm
    3. CYes: the bearing is negative
    4. DNo: abs makes the bearing 0
  5. [1 mark]When robot 102 is out of view, the prediction code sets last = None. Why?

    1. AAn old bearing from before it was lost would give a wrong comparison next time
    2. BNone makes the robot stop
    3. COtherwise the tag detector switches off
    4. DTo count how long it was lost
  6. [1 mark]waited goes up by 1 on every tick the robot stops, at ten ticks a second. At the end waited is 23. What does waited / 10 print?

  7. [1 mark]What does the general version of prediction, used by cars and ships, do?

    Tick every answer that is true.

    1. AKeep the last few positions of the other robot
    2. BWork out its velocity from them
    3. CCheck whether the two paths cross in the next second or two
    4. DStop for every robot it can see

The task: give way

Reach the green zone without touching the red robot.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()

# drive forward at 50 for 80 cm, then stop
forward(50, distance=80)

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

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

Challenges

  1. Print coming or leaving each time you see the robot.
  2. Instead of stopping, slow down to 20 when the robot is coming across, and see whether it still passes safely.
  3. Work out the robot's position on the mat from your position and its bearing and distance, keep the last two, and print its speed in cm per second.