Feedback control · University · about 45 min
Three loops at once: x, y and heading, all settling together in a tight box.
[1 mark]The angle wrap from the parking controller. What does it print?
def wrapped(a):
return (a + 180) % 360 - 180
print(wrapped(90 - 350), wrapped(270), wrapped(-190))[1 mark]The world-frame velocity is turned into drive commands at heading 90. What does it print?
import math V_MAX, V_LAT = 20.0, 15.0 wx, wy, h = 13.0, 0.0, 90.0 a = math.radians(h) fwd = 100 * (wx * math.sin(a) + wy * math.cos(a)) / V_MAX lat = 100 * (wx * math.cos(a) - wy * math.sin(a)) / V_LAT print(round(fwd, 1), round(lat, 1))
[1 mark]The heading is read once, before the loop, and used for all the maths while the heading controller turns the robot 130 degrees. What does the lesson say happens?
[1 mark]Why should the position gain and the heading gain not simply be equal?
[1 mark]The robot steers by odometry() instead of position() and heading(). Over one short park it ends a couple of centimetres further out, and over a long run it drifts much further. What is needed?
[1 mark]Rotating while translating moves the position errors even when the position controller has done nothing new. What does the lesson call this?
Stop within 6 cm of the target and within 8 degrees of heading 90, and be settled there by twenty seconds. The target is 80 across and 90 up from where the robot starts.
from bugbot import * import math connect() V_MAX, V_LAT, W_MAX = 20.0, 15.0, 120.0 TX, TY, TH = 80.0, 90.0, 90.0
Plan your program here, then type it in and press Run.
odometry() instead of position() and heading(). It counts from where the robot started, facing 0, so turn it into the mat's frame first: this robot starts facing 220. How far off is the parking now, and how far would it be after a long run?