Skip to content
Tactiverge

School/○ Innovator/Week 31

The latency budget

At 1.5 m/s, a robot covers 9 cm in 60 ms. That is how far it travels after seeing an obstacle and before it even starts to brake.

About 30 min · 3 goals · Checked by automated tests

1.Why should I care?

A robot reacts to the world as it was, not as it is. Adding up every delay between sensing and acting tells you how stale that picture is, how fast the robot can safely move, and where to spend effort speeding things up.

  • ◇ Add the latencies of a sense-to-act pipeline and compare the total with a deadline.
  • ◇ Convert latency into distance travelled at a given speed.
  • ◇ Decide which stage to optimise first.

2.Discover

Start with the default stages and a 60 ms deadline. Raise the robot's speed and watch the reaction distance. Then set the deadline to 40 ms and get back within budget by changing as few stages as possible.

Loading the interactive…

Can't use the interactive? Read a description instead

The latency-budget lab shows five stages as a stacked bar against a dashed deadline line. Default stages add to 66 milliseconds, over a 60 millisecond deadline; at 1.5 metres per second that is about 10 centimetres travelled before reacting.

3.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1 · a fresh version every time

A robot must react to an obstacle within 60 ms. Camera exposure and readout take 16 ms, vision processing 10 ms, planning 8 ms, the message over the bus 4 ms and the motor driver 10 ms. How much slack is left, in ms? (Negative means over budget.)

ms

4.Predict

A pipeline has five stages: 16, 30, 8, 2 and 10 ms. Which single change saves the most time?

Guess first. Being wrong here is how the surprise works.

5.Understand

Latencies in series add

Sense-to-act latency is the sum of every stage: sensor exposure and readout, transfer, processing, planning, communication to the motor controller, and the actuator's own response. Slack = deadline − total. Negative slack means the robot cannot meet its reaction requirement.

Latency is distance

Distance travelled before reacting = speed × latency. At 1.5 m/s, 60 ms is 9 cm. A safety requirement such as 'stop within 30 cm of an obstacle' therefore limits speed, latency or both, and braking distance comes on top.

Jitter and margin

Real stages do not take the same time every cycle; some frames take much longer. Budget with worst-case or high-percentile timings and keep a margin, and timestamp data so a late result can be recognised rather than trusted.

Explain it another way

A relay race: the team's time is the sum of every leg, and the slowest runner costs the most.

Worked example 1

Stages 12, 25, 5, 2, 6 ms; deadline 50 ms; speed 2 m/s. Find slack and reaction distance.

Total = 50 ms, slack = 0 ms (just in budget, no margin). Distance = 2 × 0.05 = 0.1 m = 10 cm.

Common mix-ups

  • Making the fastest stage even faster is a good use of effort.
    ✓ Savings come from the largest stages; a 2 ms stage can save at most 2 ms.

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2 · a fresh version every time

A robot must react to an obstacle within 100 ms. Camera exposure and readout take 8 ms, vision processing 40 ms, planning 2 ms, the message over the bus 1 ms and the motor driver 10 ms. How much slack is left, in ms? (Negative means over budget.)

ms

Practice 3

Total latency is 80 ms and the robot moves at 1.2 m/s. How far does it travel before it starts to react, in cm?

cm

Practice 4

You must cut 10 ms. Stages: camera 16, vision 30, plan 8, bus 2, motor 10. Where do you look first?

Practice 5

Why budget with worst-case timings rather than averages?

7.Apply it

For a robot that must stop within 25 cm of an obstacle with 15 cm of braking distance, find the maximum safe speed for your default latency budget. Then say which stage you would optimise to allow 50 % more speed.

8.Reflect

Concepts: System integration and interface contracts · Real-time computing on robots