Lab 2 / 15 · A/B experiment
The Jitter Bill of a 1kHz Control Loop
The same control loop on stock Linux vs PREEMPT_RT — how many microseconds apart, made visible.
Runtime environment
Readouts
Data is modeled on field experience (non-real-time 100–800µs, PREEMPT_RT 10–50µs, isolated cores + governor off 5–20µs) with random variation per run. Measure it yourself on real hardware with cyclictest.
What problem this lab solves
«Robots need real-time» gets said in every interview, but few can state concrete numbers: what period, what jitter, what eats the jitter. This experiment plots period error as a histogram — switch the configuration and see the difference.
How to read the figure
Left: the distribution of period error (ideal 1000µs). Right: how the error drifts over time. Three metrics: max jitter, the 99.9th percentile, and timeout count (times beyond 1.5× the period). Jitter is not an average problem, it is a tail problem — averages look lovely, but one 800µs spike is enough to make an arm shudder.
Hands-on
Start on «unoptimized» and note the jitter tail; switch to «PREEMPT_RT», then to «+isolated cores». Then ask: if jitter drops from 300µs to 40µs, how many times higher can you push your position-loop Kp? That is the real impact of real-time on performance.
Done playing — where next
Related topics
Next labs (in play-learn order)
RTOS Scheduling and Priority Inversion
Three tasks fight over one CPU; flip on priority inheritance and see whether the high-priority task still gets stuck.
9 min
PID Tuning Lab
Drag three gains and watch one control curve go from sluggish to oscillating and back to stable.
8 min
QoS and Callback Backlog
Drag publish rate, callback time, and queue depth, and watch latency climb from 3 ms to hundreds of milliseconds.
8 min