Seeing more · Robot club · about 20 min
cx to rotation, the angle as a look-ahead, speed on the straights.
[1 mark]follow_step uses rotation (cx - 160) * 0.4. What rotation does a line at cx = 100 give?
[1 mark]The rotation for a line at cx = 100 is negative. What does the robot do?
[1 mark]A student writes drive(60, 0, (160 - cx) * 0.4). What happens?
[1 mark]What does this program print?
def rotation(cx, angle):
return (cx - 160) * 0.3 + angle * 1.5
print(rotation(160, 10))
print(rotation(200, -8))[1 mark]Adding angle * 1.5 to the rotation is the beginning of which kind of control?
[1 mark]At each bend the line swings well off-centre, up to 85 pixels, before the robot has turned. What does that mean?
[1 mark]What does this program print?
for angle in [0, 5, 20, -25]:
speed = 80 if abs(angle) < 10 else 40
print(angle, speed)Follow the line to the green zone, staying within 6 cm of it for at least 85% of the run.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() # drive forward at 60 for 90 cm, then stop forward(60, distance=90)
Plan your program here, then type it in and press Run.
cx error you saw during the run.