Seeing more · Robot club · about 15 min
Tags from 100 up say who and how far; LEDs say what.
[1 mark]The camera reads a tag with id 101. What is it?
[1 mark]What does this program print?
seen = [['green', 60, 120, 55.0], ['red', 240, 110, 42.0]]
for colour, cx, cy, dist in seen:
print(colour, dist, round((cx - 160) * 120 / 320, 1))[1 mark]What does robots() give?
[colour, cx, cy, distance][1 mark]Which of these are true?
Tick every answer that is true.
robots()[1 mark]A robot's dome is at cx = 272. What is its bearing in degrees?
[1 mark]Your robot runs led("red"). What can the other robots see?
[1 mark]What does this program print?
seen = [['green', 90, 120, 30.0], ['red', 200, 115, 42.0], ['blue', 20, 110, 80.0]]
near = [r[0] for r in seen if r[3] < 50]
print("near:", near)
print("nearest:", seen[0][0])Print robot at <cm> cm, bearing <degrees> and dome: <colour>, both from robots(). Do not drive.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() # every robot in view, nearest first print(robots())
Plan your program here, then type it in and press Run.
math.sin and math.cos.