Seeing more · Robot club · about 15 min
The line detector: cx and angle, and the empty list.
[1 mark]With set_cv("line") on, what does line() give when a line is in view?
[cx, angle][cx, cy, distance][id, cx, cy, distance][cx, cy, area, x0, y0, x1, y1, aspect][1 mark]The robot turns right by 20 degrees while looking at a line that runs straight ahead. What happens to the line's angle?
[][1 mark]Ten centimetres ahead, one pixel is about 0.108 cm. A line has cx = 197. About how many cm to the right of centre is it, to one decimal place?
[1 mark]The detector sees about 35 cm across the strip 10 cm ahead. About how many cm to the side can the line be before it drops out of view?
[1 mark]What does this program print?
for seen in [[197, 5], []]:
if seen:
cx, angle = seen
print(f"line at cx {cx}, angle {angle}")
else:
print("no line")[1 mark]The task starter just calls print(line()). What is it missing?
set_cv("line"), to switch on the line detectorset_cv("apriltag")forward(50), because the line detector only works when movingline() always worksPrint line at cx <cx>, angle <angle> from the detector. Do not drive.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() print(line())
Plan your program here, then type it in and press Run.
cx as a distance in centimetres. Ten centimetres ahead, one pixel is about 0.108 cm.