Sensing · Robot club · about 20 min
Why the robot wanders, and the first closed loop.
[1 mark]Which of these programs is closed loop?
[1 mark]Why does the robot slide sideways when it drives forward? Choose all that apply.
Tick every answer that is true.
[1 mark]After a 10 cm leg, position() says x is 2.5. What does the correcting program do?
x, y = position()
if x > 1:
left(40, distance=x)
elif x < -1:
right(40, distance=-x)[1 mark]What does this program print?
error = 355
if error > 180:
error = error - 360
print(error)[1 mark]In drive(70, -x * 15, 0), x is 2. What is the sideways value? Give a whole number.
[1 mark]You change -x * 15 to -x * 40. What do you expect?
[1 mark]Why is it worth correcting the heading as well as x?
Drive about 64 cm and finish inside the small square, still facing 0 within 6 degrees. Correct as you go.
# the two lines every program starts with: the commands, then the robot from bugbot import * connect() # drive forward at 70 for 64 cm, then stop forward(70, distance=64)
Plan your program here, then type it in and press Run.
x error you saw during the drive.