FixTheRobot Explore Robotics / Navigation / M5 / M5-L2

This lab works on phones, but writing code is much easier on a laptop.

Navigation · Trajectories and Path Following · M5-L2 · Intermediate

Build a Velocity Profile

11:15. Scout delivers a tray of sterile instruments to theatre 2. It takes the corridor bends at full speed, the tray tips, and then Scout rolls past the door by a metre before it stops. The route is right. Nobody told the robot how fast to drive at each point.

You will give a route a speed at every point: slow for the bends, no faster than the motors can speed up, slow enough to brake in time for the door, and then put times on it so that a controller knows when each point is due.

Your task

    Simulation
    solution.pyLoading Python…
    Ctrl+Enter runs
    What Python can I use?

    Plain Python with math and heapq. Your code runs in a background worker: an endless loop is stopped after a few seconds and the page stays usable. It runs in your browser and is never sent anywhere.

    Hints

    What this lab teaches

    Stage 1 turns the shape of the route into a speed limit: a bend of radius R needs a sideways acceleration of v squared over R, so the speed must stay below the square root of the allowed sideways acceleration divided by the curvature. Stage 2 makes the limits reachable. A forward pass limits how fast Scout can speed up, and a backward pass from the door limits how fast it may be going and still stop. Stage 3 turns the profile into a trajectory by giving every point an arrival time.

    Grading is result-based on the practice route and on freshly generated hidden routes with different bends, limits and lengths.

    Theory for this lab

    Trajectories and Path Following labs

    1. M5-L1: Smooth a Jagged Path
    2. M5-L2: Build a Velocity Profile: this lab.
    3. M5-L3: Tune Pure Pursuit
    4. M5-L4: Compare Pure Pursuit and Stanley

    Educational simplification: a route of straight lines and circular arcs sampled every 0.25 m, a point-mass speed limit from sideways acceleration, constant acceleration and braking between samples, and a route that starts and ends at rest. Wheel-speed limits and jerk limits are left out (lesson M5-T3).

    Get the next lab

    Get notified when new robotics labs are released. One email per new lab, nothing else.