The answersDownload the PDF
Worksheet

9.7 Project: the relay

Talking to each other · Robot club · about 25 min

BugBotLab
NameClassDate

What this lesson is about

Drive to the handover, then and only then say go.

Questions 6 marks in all

  1. [1 mark]Put the relay handover in order.

    Number the lines 1 to 5 to put them in the right order.

    1. wait(0.5) to settle
    2. send("go")
    3. Stay put and listen for finished
    4. stop()
    5. Drive into the handover zone
  2. [1 mark]The starter code sends go before driving. What happens?

    1. AThe Runner leaves before you arrive: a false start
    2. BNothing, the Runner waits for you anyway
    3. CThe message is queued until you reach the zone
    4. DThe Runner never leaves
  3. [1 mark]The handover zone starts 32 cm ahead and is 16 cm deep. How many cm ahead is its middle?

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

    def in_zone(y):
        return 32 <= y <= 48
    
    for y in [30, 40, 49]:
        print(y, in_zone(y))
  5. [1 mark]Why is there a wait(0.5) between stop() and send("go")?

    1. AIt lets the robot settle, so it is not still rolling when it hands over
    2. BThe radio needs half a second to switch on
    3. CThe Runner cannot hear sooner
    4. Dstop() only works after a wait
  6. [1 mark]You sent go and have heard nothing for two seconds. What is a sensible thing to do?

    1. ASend go again, in case the first was missed
    2. BDrive after the Runner
    3. CWait forever without sending
    4. DLeave the zone to look for the Runner

The task: the relay

Drive into the handover zone, stop, send go, and stay there until the Runner says finished.

# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# radio this to every other robot
send('go')
# drive forward at 60 for 40 cm, then stop
forward(60, distance=40)

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

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

Challenges

  1. Send go only when velocity() says you have stopped.
  2. Print how long the Runner took, from your go to its finished.
  3. Send go a second time if nothing is heard within two seconds, in case the first was missed.