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.8 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. Use the corner of the velocity box instead: work out which way to face so that the robot's fastest direction points at the corner, turn to face it, and go. 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. Once it steers, the steering also soaks up a few degrees of error in the aim, so the data sheet's speeds will do nearly as well as your own. They matter if you drive open loop, without steering: they put the corner of the box at 37 degrees rather than this robot's 41, and a few degrees of aim is 10 to 15 cm at two metres. 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.