Control · Robot club · about 20 min
Heading and sideways controllers together on a holonomic robot.
[1 mark]The heading is held perfectly, but the robot still ends up to the left. Why?
[1 mark]In drive(70, x_error * 10, heading_error * 4), what does each number do?
[1 mark]target_x is 10, x is 4, and the sideways gain is 10. What sideways value does (target_x - x) * 10 give?
[1 mark]What does this program print?
def wrapped(h):
return (h + 180) % 360 - 180
target_x = 10
x = 13
heading = 355
print("sideways", (target_x - x) * 10)
print("rotation", wrapped(0 - heading) * 4)[1 mark]Why do the sideways and heading controllers not fight each other?
[1 mark]What is the right way to tune two gains?
The zone is only 6 cm wide. Finish inside it, facing 0 within 5 degrees, on the curving, leaking robot.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
def wrapped(h):
return (h + 180) % 360 - 180
while position()[1] < 65:
error = wrapped(0 - heading())
# forward, sideways, rotation: -100 to 100 each, until the next command
drive(70, 0, error * 4)
# pause 0.1 s (the robot keeps doing what it was told)
wait(0.1)
# all motors off
stop()Plan your program here, then type it in and press Run.
hold_line(target_x, until_y) as a function. You will want it in lesson 3.6.