Following a trajectory · University · about 40 min
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 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] + pyPlan your program here, then type it in and press Run.