The answersDownload the PDF
Worksheet

U10.1 A path and a trajectory

Following a trajectory · University · about 25 min

BugBotLab
NameClassDate

What this lesson is about

The same geometry with and without a clock attached, and why the clock changes what you can check.

Questions 6 marks in all

  1. [1 mark]What is the practical reason for keeping the path and the time law separate?

    1. AThe route can be re-timed for a low battery or a delicate payload without planning the geometry again
    2. BA trajectory cannot be checked for collisions, so the path must be kept for that
    3. CArc length only exists for a path, not for a trajectory
    4. DThe planner needs the time law before it can search the map
  2. [1 mark]What does this print? It is the lesson's route with a constant speed time law.

    import math
    WAYPOINTS = [(40, 40), (40, 140), (140, 140), (140, 60)]
    CRUISE = 12.0
    length = 0.0
    for (ax, ay), (bx, by) in zip(WAYPOINTS, WAYPOINTS[1:]):
        length += math.hypot(bx - ax, by - ay)
    print(round(length, 1), round(length / CRUISE, 1))
  3. [1 mark]Where does the reference say the robot should be 10 s into the route?

    import math
    WAYPOINTS = [(40, 40), (40, 140), (140, 140), (140, 60)]
    CRUISE = 12.0
    legs, length = [], 0.0
    for (ax, ay), (bx, by) in zip(WAYPOINTS, WAYPOINTS[1:]):
        d = math.hypot(bx - ax, by - ay)
        legs.append((ax, ay, bx, by, d))
        length += d
    
    def at(t):
        s = max(0.0, min(length, CRUISE * t))
        for ax, ay, bx, by, d in legs:
            if s <= d:
                u = s / d
                return ax + (bx - ax) * u, ay + (by - ay) * u
            s -= d
        return WAYPOINTS[-1]
    
    print(at(10.0))
  4. [1 mark]A robot drives at waypoint 1 until it is close, then at waypoint 2, and so on. Why does it stop and start at every waypoint?

    1. AIts demand is proportional to an error that collapses to nothing as it arrives at each waypoint
    2. BThe planner inserted a pause at every waypoint
    3. CThe drive cannot turn a corner while moving
    4. DThe arc length is reset to zero at each waypoint
  5. [1 mark]Which of these can be checked on a trajectory but not on the path alone?

    Tick every answer that is true.

    1. AWhether any part demands more speed than the robot has
    2. BWhether it demands more acceleration than the drive can produce
    3. CHow long the whole route will take
    4. DWhether the route passes through an obstacle
    5. EHow long the route is in centimetres
  6. [1 mark]Why does the lesson call the constant speed time law s(t) = v t a lie?

    1. AIt jumps from rest to cruise speed instantly, which would need infinite acceleration
    2. BIt gives the wrong total duration for the route
    3. CArc length cannot be proportional to time
    4. DIt only works on straight legs

The task: put a clock on a path

Print length:, the total length of the path through the four waypoints, and duration:, how long it takes at 12 cm/s. Then sample the trajectory every 0.1 s and plot ref x and ref y, with a wait(0.1) between samples so the chart spreads them out in time. The robot does not move in this task.

from bugbot import *
import math
connect()

WAYPOINTS = [(40, 40), (40, 140), (140, 140), (140, 60)]
CRUISE = 12.0

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

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

Challenges

  1. Re-time the same path at 6 cm/s. What changes, and what does not?
  2. Plot the reference speed in x and in y. What happens at a corner, and why is that a problem for a real drive?
  3. Add a fifth waypoint that doubles back on the path. Does your at(t) still behave?