The answersDownload the PDF
Worksheet

U10.8 Time scaling a path

Following a trajectory · University · about 40 min

BugBotLab
NameClassDate

What this lesson is about

Cubic and quintic time laws and what smoothness costs, the speed limit that depends on direction (this robot is fastest on the diagonal), and the time-optimal speed along a path.

The task: dash to the corner

The far corner of the mat is about two metres away, on the diagonal. Be in it by 8.5 seconds and stay there until the clock passes 11, then let the program end; the run is cut off at 12. Facing the corner and driving flat out gets there after about 11 seconds on this robot, which is too slow. Work out which way to face so that the robot's fastest direction points at the corner, turn to face it, and go. Two things will pull it off the line. Aim with your own measured speeds, not the data sheet's: they put the corner of the box at 41 degrees rather than 37, and a few degrees of aim is 10 to 15 cm at two metres. And even a perfect aim will not stay perfect, because the vibration drive turns the robot slowly as it goes, and leaks a little of its forward push sideways. So steer as you drive: compare the direction the robot is actually moving with the direction to the target, and turn a little to close the gap. The figure shows the two runs against the clock.

from bugbot import *
import math
connect()

V_FWD, V_SIDE = 20.0, 15.0                   # replace with the speeds you measured
START, TARGET = (30.0, 30.0), (170.0, 170.0)

def here():
    px, py = position()
    return START[0] + px, START[1] + py

Plan your program here, then type it in and press Run.

QR code
Do it on the robot
www.bugbotlab.com/learn/u10-8-time-scaling-a-path/
The simulator checks it and tells you when it passes. Nothing to install, no account.

Challenges

  1. Add the last cell's acceleration limit to the dash, so the robot follows a trapezoid along the diagonal instead of going flat out at once. How much time does 15 cm/s² cost, and does it still make 8.5 s?
  2. Drive the whole route from the third cell with the heading held at zero, following the time-optimal speed leg by leg as the last cell did for one. Does the time the robot takes match the prediction?
  3. The diagonal lost on that route because its turns cost more than it saved. Make the legs longer, or the acceleration limit higher, in the third cell: at what point does the fast diagonal start to pay for its turns?