Following a trajectory · University · about 35 min
Splitting the error into along and across the path, and a controller for the half that matters.
[1 mark]A leg runs from (0, 0) to (30, 40) and the robot is at (10, 20). What does this print?
import math ax, ay, bx, by = 0.0, 0.0, 30.0, 40.0 x, y = 10.0, 20.0 length = math.hypot(bx - ax, by - ay) ux, uy = (bx - ax) / length, (by - ay) / length nx, ny = -uy, ux along = (x - ax) * ux + (y - ay) * uy cross = (x - ax) * nx + (y - ay) * ny print(round(along, 2), round(cross, 2))
[1 mark]The line runs from (60, 30) to (60, 170) and the robot, facing +y, is at (70, 50). With correction = clamp(-0.9 x cross, 12) along the left normal, and drive()'s sideways term positive to the robot's right at 15 cm/s for 100, what sideways term should be sent?
[1 mark]The holonomic cross-track loop has gain k = 0.9 per second and the robot moves along the path at 11 cm/s. Over how many centimetres of travel is one time constant of the correction spread? Give 1 decimal place.
[1 mark]The robot sits 1 cm off the path with k = 0.9. What percentage command does the correction ask for, given 100 percent is 15 cm/s sideways?
[1 mark]The holonomic cross-track loop is first order and cannot oscillate on its own. Why can it still wobble in practice?
[1 mark]What happens as the cross-track gain k is raised well above 0.9?
Tick every answer that is true.
[1 mark]Why does the Stanley controller for a car divide the cross-track term by the speed?
The taped line runs from (60, 30) to (60, 170). The robot starts at (85, 30), which is 25 cm to the right of it. Get onto the line, drive along it to the far end, plot cross track the whole way, and stop near (60, 163).
from bugbot import * import math connect() DT = 0.1 START = (85.0, 30.0) AX, AY, BX, BY = 60.0, 30.0, 60.0, 170.0
Plan your program here, then type it in and press Run.
k at 0.2 and at 4.0 and describe both. Which one is the lag showing?