RobotGuide

Systems & software · topic D8 · 40 hours

Robot software architecture

The architecture track interviews exactly this: who can organize dozens of modules, multiple frequencies, and multiple real-time levels into a system that can evolve for ten years without falling apart.

Engineering stage · Hardcore
Algorithm · Aware System software · Proficient Embedded & controls · Aware

Tools
Tools

What to learn

  • Layering: the frequency and real-time level of each of perception / decision / control / actuation, and where to draw the boundaries
  • Module boundaries and interface contracts, dependency governance (who may call whom, and how to prevent chaotic calls)
  • Failure isolation and degradation strategy: when one node dies, how the machine as a whole should survive
  • Split of duties between the high-level board and the low-level board, OTA and version management, layering of configuration and parameters

The lesson · plain words

Software architecture is not drawing block diagrams; it is deciding «who may be late, and who cannot be late by even one millisecond». Layering in robot software has one core principle: physically separate the hard real-time parts from the compute-hungry parts.

This page drives that principle home with one frequency table.

The frequency pyramid: the lower, the faster

Watch the figure: the sensing/drive/control layers start at 1 kHz with latency budgets of a few tenths of a millisecond; planning runs at 100 Hz; perception runs at tens of Hz with tens of milliseconds per frame. Any architecture that pushes perception into the control loop makes the 1 kHz servo loop wait for a 20 ms detection — a disaster.

The right move is «separate fast from slow»: the real-time layer (RTOS or RT kernel) does only sampling–control–output; the Linux layer does perception and planning; the two connect asynchronously via shared memory/DDS, so slower perception never disturbs the servo loop's beat.

Interactive figure · drag it and see

What this figure shows: a layered architecture chart giving each layer a frequency budget and a role — sensing 30 Hz · 20 ms (vision/lidar, heavy compute), planning 100 Hz · 2 ms (Linux), control 1 kHz · 0.3 ms (servo loops on an RTOS), and drive/encoder/IMU sampling at 1 kHz with sub-millisecond budgets; the two columns contrast the frequency budget with each layer's role, bottom-up frequency rising as budgets tighten. Takeaway: the architecture question is one — separate «cannot be late» from «computes slowly»; one robot with an RTOS side and a Linux side is the mainstream answer.

Three typical architectures

① Monolithic real-time: everything inside one MCU — simple and controllable, low compute ceiling — lab rovers and drone flight controllers. ② Layered hybrid: an RTOS control layer + a Linux intelligence layer — the mainstream product form (robot-arm controllers, AGVs). ③ Cloud–edge collaboration: the edge does real time, the cloud does compute — service robots and fleet scheduling.

One-line selection rule: first count how long your hard-real-time checklist is, then decide whether you need a second computer. The classic team mistake is going straight to an «all-Linux stack» and then paying the debt back in real-time performance.

Interface design: what the layers say to each other

Between the real-time layer and the intelligence layer only «state» and «commands» cross — never raw data; raw data (images, point clouds) takes a separate bypass. This one discipline guarantees that when the intelligence layer dies, the real-time layer can still shut the machine down safely.

Define state and commands as versioned structures (adding fields must not break old parsers); make error semantics explicit (a STATUS field, not guessed from timeouts). Interfaces are the skeleton of the architecture — changing an interface costs ten times more than changing an algorithm.

Evolution: architecture is iterated into shape

No architecture is right on the first draft. A workable path: get the monolith running first → split the slow parts into separate processes → move the real-time parts into an RT kernel/RTOS → accept each layer against the frequency pyramid. Every step has standalone value; do not try to leap to the summit in one go.

Acceptance method: one frequency report per process (actual Hz vs expected) and one resource report (CPU/memory). Pin both reports in the repo README, and the health of the architecture is visible at a glance.

Three questions — do you really get it?

1. You put a 30 Hz vision detection into a 1 kHz control loop and wait synchronously — the consequence?

  • AMore accurate detection
  • BThe control loop slows by two orders of magnitude and the beat falls apart
  • CNo impact
Show answer

B. Fast and slow must be separated: perception delivers results asynchronously, and the control loop never waits.

2. What should pass between the real-time layer and the intelligence layer?

  • ARaw images and point clouds
  • BState and commands, with raw data on a bypass
  • CEverything
Show answer

B. Minimal interfaces + a data bypass guarantee the real-time layer can still catch the machine safely when the intelligence layer crashes.

3. The core motivation of the layered hybrid architecture (RTOS + Linux) is?

  • APower savings
  • BPhysically isolating hard real-time from compute-hungry tasks so each gets what it needs
  • CEasier coding
Show answer

B. Both sides matter: the servo loop needs deterministic latency, vision needs massive compute. One machine, two worlds, joined at the interface.

Keep going deeper

Links without a marker stay on this site; the rest point to the Chinese edition until its translation batch lands.

How it fails in the field

  • A beautiful block diagram with no answer for each layer's latency budget or failure modes
  • No degradation path: perception crashes and the whole machine stops; on site the only move left is a reboot

You have learned enough when

You can write a two-page layered design document with per-layer latency and jitter budgets, interface definitions, and degradation strategies.

The Chinese edition carries the full topic page for Robot software architecture, including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/D8/.