Robotics core · topic B5 · 45 hours
Classical control (PID / frequency domain / stability)
80% of loops in industry still run PID. It is not sophisticated; it is the fallback layer beneath everything sophisticated.
What to learn
- What each of the three PID terms does, plus the two traps everyone hits: integral windup, and the derivative amplifying noise
- Stability in the frequency domain: gain and phase margin — read them and you know «how far from oscillation»
- Cascaded loops (current → velocity → position) and why tuning must go inside-out
- Feedforward and gravity compensation: why the same PID gains give an order of magnitude less error once feedforward is in
- Anti-windup and bumpless transfer, as actually written in code
The lesson · plain words
PID is the one thing in robotics you can tune without understanding — and never tune well without it. Three knobs, suspiciously simple, holding up 90% of industrial control loops.
This page memorizes no formulas. It does three things: what each knob is actually doing, why adding a filter slows the loop down, and the correct order for tuning.
What the three knobs do
P reads «how far off are we right now» — the further off, the harder it pushes. I reads «how long have we been off» — it kills steady-state error and is prone to overshoot. D reads «is the gap shrinking or growing» — it acts as the brake and is prone to amplifying noise.
Drag the three sliders below: raise P and watch the response start ringing; add D and the ringing is damped but the response goes sluggish; finally a little I and the steady-state error falls to zero. That is the entire feel of tuning.
Interactive figure · drag it and see
The frequency domain: why adding a filter slows the loop
A low-pass filter suppresses noise — and brings phase lag along with it. Accumulate enough lag to reach 180° and negative feedback turns into positive feedback: the loop oscillates on its own.
So «add a filter so it stops jittering» works short-term and plants a mine. The correct sequence: find which band the noise lives in, then choose the filter cutoff relative to the controller bandwidth — deliberately, not by feel.
Interactive figure · drag it and see
Stability: a race between gain and lag
Higher gain corrects harder but leaves less room for lag. Phase margin measures «how much more lag can this loop afford»: below 30° you start sweating, below 15° you wait for the oscillation.
This answers a common confusion: why does adding load (larger inertia) make the system oscillate more easily? Because the same gain is now relatively «harder» against a larger inertia.
The tuning order — do not improvise
Inside-out (current loop → velocity loop → position loop); P before D before I; change one parameter at a time and run a full step response after every change. Slow, but the only way that never gets lost.
One more discipline: get gravity and friction compensation right, and measure the sensor noise, before touching the gains. Treat PID as a cure-all and you will tune until you doubt your sanity.
Three questions — do you really get it?
1. Which term eliminates steady-state error?
- AP
- BI
- CD
Show answer
B. The integral accumulates history: as long as error persists it keeps pushing, until the error reaches zero. The cost is phase lag and overshoot.
2. The main side effect of the D term?
- AAmplifies sensor noise
- BGrows steady-state error
- CSlows the loop to uselessness
Show answer
A. D differentiates the error; noise is high-frequency and gets differentiated just the same. So the D term almost always ships with a low-pass.
3. Why can adding a low-pass filter make a loop oscillate?
- AThe filter changes the gain
- BThe filter lowers the sampling rate
- CThe filter adds phase lag
Show answer
C. Phase lag eats phase margin. At 180° of accumulated lag, negative feedback becomes positive and the loop self-oscillates.
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
- Tuning the position loop before the current loop: oscillates no matter what, then «fixed» by lowering the gains
- An integral that accumulates without bound: every start overshoots, and the blame lands on «mechanical backlash»
You have learned enough when
The Chinese edition carries the full topic page for Classical control (PID / frequency domain / stability), including the complete outline, depth requirements per career track, and further derivations: robotguide.dev/k/B5/.