Vision · Robot club · about 20 min
Spin until it is in view; find and approach as functions; list comprehensions.
[1 mark]What does while not apriltags(): mean?
[1 mark]What does this program print?
tags = [[2, 60, 120, 35.0], [5, 210, 118, 60.0], [8, 300, 125, 90.0]] mine = [t for t in tags if t[0] == 5] print(mine) print(len(mine))
[1 mark]The spin loop ends the moment a tag appears. Why do stop() and wait(0.3) come next?
apriltags() only works when the robot is still[1 mark]What is a heuristic search?
[1 mark]The camera sees 120 degrees. How many degrees of the full circle around the robot are out of view?
[1 mark]In approach, what happens if the tag goes out of view on the way in?
turn_right(30) until the tag is back[1 mark]Put the hide and seek program in order.
Number the lines 1 to 4 to put them in the right order.
`print("found 5")``set_cv("apriltag")``find(5)``approach(5, 14)`Find marker 5, print found 5, then drive up and stop about 14 cm in front of it.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
# camera: the tag detector
set_cv("apriltag")
print(apriltags())Plan your program here, then type it in and press Run.
find give up and return False after a full turn with nothing seen, and print a message instead of spinning forever.