Unit 15 · lesson

Messages, Buses, Latency, and Failure

Communication is part of robot behavior.

A message that arrives too late can be functionally wrong even when every bit is correct.

Four questions for every interface

When one component sends data to another, ask:

  1. What is sent?
  2. How often or under what event?
  3. How old can it be before it becomes useless?
  4. What happens if it never arrives?

Those questions apply to a simple serial link, CAN bus, Ethernet message, or robotics middleware.

Latency and rate

Suppose a sensor publishes at 100 Hz, once every 10 ms.

If network and processing delay add 200 ms, the receiver may have many samples but still be acting on old information.

Rate and latency are different properties.

Bandwidth

A tiny encoder message and a high-resolution camera stream have different bandwidth needs.

If several devices share a network, heavy traffic can affect other communication.

The robot system should treat communication resources as finite.

Failure states

Interfaces can fail in several ways:

  • message never arrives;
  • duplicate message;
  • corrupted/invalid message;
  • stale message;
  • messages arrive out of order;
  • sender restarts;
  • receiver restarts.

The response should be defined.

Interface contract

Create one message definition for a robot subsystem.

Example:

message: wheel_speed
fields:
  left_mps
  right_mps
  timestamp

expected rate: 50 Hz
stale after: 100 ms
if stale: command controlled stop

Then create a second interface with different timing requirements.

Explain why using the same timeout for both would be a bad design.

Bandwidth and latency are different constraints

Bandwidth describes how much data a link can carry over time. Latency describes how long information takes to travel through the relevant path.

A camera stream can demand high bandwidth. A small emergency-stop message can use almost no bandwidth but still require extremely low, predictable latency.

Do not confuse the two.

Estimate a camera stream

A raw 640 × 480 RGB image contains roughly:

640 × 480 × 3 bytes
= 921,600 bytes
≈ 0.92 MB per frame

At 30 frames per second, uncompressed data would be roughly:

0.92 MB × 30 ≈ 27.6 MB/s

Compression changes the actual network load, but the estimate explains why vision traffic matters.

Every important message path needs a timeout policy.

last command age < 100 ms → accept
last command age ≥ 100 ms → reject / safe behavior

That policy belongs near the consumer because the consumer knows whether stale data is dangerous.

When documenting a robot bus or network, record message size/rate where useful, acceptable age, and failure response. A wiring line labeled "network" hides too much.