Following a trajectory · University · about 30 min
Dead band, lag and loop period, measured as the centimetres the robot is behind its own plan.
[1 mark]On the accelerating ramp the first order lag holds the velocity about a x tau below the demand. With a = 12 cm/s/s and tau = 0.25 s, how far below, in cm/s?
[1 mark]The robot is 3 cm behind its reference while travelling at 15 cm/s. How far behind is that in seconds?
[1 mark]Put the phases of the tracking error on a trapezoidal move in the order they happen.
Number the lines 1 to 4 to put them in the right order.
It settles once the reference stands stillIt grows on the accelerating rampIt goes negative on the decelerating rampIt shrinks during the cruiseIt grows on the accelerating ramp It shrinks during the cruise It goes negative on the decelerating ramp It settles once the reference stands still
The error is built by the lag during the changes in the profile, not during the cruise, which is why a gentler acceleration shrinks it at both ends.
[1 mark]What does this print? It is the profile from the lesson.
D, A, V = 80.0, 12.0, 14.0 t_acc = V / A d_acc = 0.5 * A * t_acc * t_acc t_flat = (D - 2 * d_acc) / V print(round(t_acc, 2), round(t_flat, 2), round(2 * t_acc + t_flat, 2))
1.17 4.55 6.88
t_acc = 14 / 12 = 1.17 s and d_acc = 8.17 cm. The cruise covers 80 - 16.33 = 63.67 cm at 14 cm/s, 4.55 s, so the whole move is 6.88 s.
[1 mark]Why does pure pursuit degrade gracefully when the robot falls behind, and what does it give up?
[1 mark]Which of these add delay between the plan and the robot on the BugBot?
Tick every answer that is true.
[1 mark]A trajectory follower that slows its clock when the tracking error grows is using time scaling. What priority does that encode?
Build a trapezoid to 80 cm at 12 cm/s/s and 14 cm/s, follow it with feedforward and a correction, and keep holding the target for a few seconds afterwards. Plot ref, actual and error, and print duration:, what the profile says the move takes, and worst:, the furthest the robot ever fell behind the reference in centimetres.
from bugbot import * connect() DT = 0.1 DISTANCE, A_MAX, V_CRUISE, K = 80.0, 12.0, 14.0, 1.5
The hint students can ask for: Build a trapezoid to 80 cm at 12 cm/s/s and 14 cm/s, start a clock, and follow it with the reference speed fed forward and a correction on top. Keep the largest positive error you see, and hold the target for a few seconds afterwards so the run can be seen to have settled.
from bugbot import *
connect()
DT = 0.1
V_MAX = 20.0
DISTANCE, A_MAX, V_CRUISE, K = 80.0, 12.0, 14.0, 1.5
t_acc = V_CRUISE / A_MAX
d_acc = 0.5 * A_MAX * t_acc * t_acc
t_flat = (DISTANCE - 2 * d_acc) / V_CRUISE
duration = 2 * t_acc + t_flat
print("duration:", round(duration, 2))
def ref(t):
"""(position, speed) of the reference at time t"""
if t <= 0:
return (0.0, 0.0)
if t < t_acc:
return (0.5 * A_MAX * t * t, A_MAX * t)
if t < t_acc + t_flat:
return (d_acc + V_CRUISE * (t - t_acc), V_CRUISE)
if t < duration:
td = t - t_acc - t_flat
return (d_acc + V_CRUISE * t_flat + V_CRUISE * td - 0.5 * A_MAX * td * td,
V_CRUISE - A_MAX * td)
return (DISTANCE, 0.0)
def band(u):
if abs(u) < 5.0:
return 0.0
return max(17.0, min(100.0, u)) if u > 0 else min(-17.0, max(-100.0, u))
base = position()[1]
worst = 0.0
t0 = clock()
while clock() - t0 < 14.0:
t = clock() - t0
s, v = ref(t)
here = position()[1] - base
err = s - here # positive means the robot is behind the reference
drive(band(100 * (v + K * err) / V_MAX), 0, 0)
plot("ref", s)
plot("actual", here)
plot("error", err)
if t < duration:
worst = max(worst, err)
wait(DT)
stop()
print("worst:", round(worst, 2))
Any program that meets the task's checks is marked correct in the simulator; this is one way, not the only way.