Learn Robotics
Module: Making Parts Talk

Latency & Real-Time

What real-time means in robotics, why latency matters, and how fast different communication systems actually are.

8 min read

Latency & Real-Time

Your robot's camera captures an image. The detector finds an obstacle. The controller generates a "stop" command. How long does this chain take? And is that fast enough?

What Is Latency?

Latency is the time delay between a cause and its effect. In robotics, we care about several types:

TypeMeasuresTypical Range
Sensor latencyTime from physical event to data arriving in software1-50ms
Communication latencyTime to pass a message between nodes0.001-10ms
Processing latencyTime to compute a result (detection, planning)1-500ms
End-to-end latencyTotal time from sensor event to actuator response10-1000ms

For our ball-following robot, the chain might look like:

Camera capture:     10ms
Image transmission:  1ms
Ball detection:     15ms
Command transmission: 1ms
Motor response:      5ms
─────────────────────────
Total:              32ms

32ms means the robot's behavior lags reality by about 1/30th of a second. For a slow-moving indoor robot, that's fine. For a drone flying at 20 m/s, that's 64cm of travel — enough to miss a turn.

What Does "Real-Time" Mean?

"Real-time" doesn't mean "really fast." It means deterministic — you can guarantee that something will happen within a fixed time window.

There are two levels:

Hard Real-Time

The deadline must never be missed. If the motor controller promises to update at 1kHz (every 1ms), it must deliver every single cycle. Missing one could mean an industrial arm overshoots its target or a drone falls from the sky.

Hard real-time requires:

  • Special operating systems (RTOS) or Linux with RT patches
  • No garbage collection pauses
  • No unbounded memory allocation
  • Careful thread scheduling

Soft Real-Time

Most deadlines are met, occasional misses are tolerable. A camera processing pipeline at 30fps is soft real-time — dropping a frame occasionally is fine, dropping half the frames is not.

Most robot nodes run at soft real-time. Only the lowest-level control loops (motor drivers, safety systems) need hard real-time.

Note

A common misconception: "real-time" ≠ "low latency." A system that responds in 100ms every time, consistently, is real-time. A system that responds in 1ms usually but occasionally takes 500ms is not — even though it's typically faster.

Communication Speed Comparison

How fast are different communication methods?

MethodLatencyBandwidthUse Case
Shared memory0.05-1 μsMemory speed (~10 GB/s)Same-machine, high-performance
Unix socket5-50 μs~1 GB/sSame-machine, traditional
UDP (local)50-200 μs~100 MB/sSame-network
TCP (local)100-500 μs~100 MB/sReliable same-network
TCP (internet)1-100 msVariesCloud, remote
DDS (same machine)50-500 μs~500 MB/sDDS-based middleware
HTTP REST1-50 msLowWeb APIs

Notice the huge gap: shared memory is 1000x faster than traditional network communication. For a robot with 10 sensors publishing at 100Hz each, communication overhead matters.

Jitter: The Hidden Enemy

Latency is the average delay. Jitter is the variation in delay. A system with 5ms average latency but 0-50ms jitter is worse for control than a system with 10ms average and 9-11ms jitter.

Why? Control algorithms assume regular timing. If the motor controller expects new commands every 10ms and they arrive at 5ms, 15ms, 3ms, 20ms — the robot jerks and oscillates.

Tip

When evaluating a communication system, look at both the median latency (typical case) and the 99th percentile (worst case). For real-time control, the 99th percentile matters more than the median.

Practical Guidelines

Here's what latency requirements look like for common robot subsystems:

SubsystemRequired RateMax LatencyReal-Time?
Motor control loop1-10 kHz0.1-1 msHard
Safety/emergency stop1 kHz1 msHard
IMU integration200-1000 Hz1-5 msHard
LiDAR processing10-40 Hz25-100 msSoft
Camera processing15-60 Hz33-66 msSoft
Path planning1-10 Hz100-1000 msSoft
Map updates0.1-1 Hz1-10 sNo
User interface30-60 Hz16-33 msNo

The lesson: different parts of your robot have very different timing needs. A good architecture lets each subsystem run at its own rate without blocking others.

What's Next?

Module 2 is complete! You now understand how robot nodes communicate: the pub/sub pattern, when to use services, how messages are structured, and why latency matters. In Module 3, we'll tackle one of robotics' most important questions: "Where am I?" — the world of coordinate frames and transforms.

Got questions? Join the community

Discuss this lesson, get help, and connect with other learners on Discord.

Join Discord

Discussion

Sign in to join the discussion.