Unit 09 · lesson
P, I, and D Without the Magic
PID control is often introduced as three mysterious constants people tune until the robot stops shaking.
The letters have specific jobs.
Proportional: react to current error
A proportional term grows with error.
P output = Kp × error
Large error produces a larger correction. As error shrinks, the correction shrinks.
Too little proportional gain can feel weak. Too much can create overshoot or oscillation.
Integral: react to persistent error
Integral action accumulates error over time.
If a mechanism stays slightly below its target because of gravity or friction, the integral term can continue building until the controller produces enough correction.
That is useful and dangerous.
If the actuator saturates and the error remains, the integral term can grow excessively. This is often called integral windup.
Derivative: react to how error is changing
Derivative action responds to the rate of change of error.
It can provide damping by reacting when the system approaches the target too quickly.
Derivative terms are sensitive to noisy measurements because noise can look like rapid change.
Read the response shape
You do not tune PID from the constants alone. Inspect the behavior over time.
target ─────────────────────────────
weak P: ____/''''''''''
high P: ___/\/\_/\/\____
better: ___/¯¯¯¯¯¯¯¯¯¯¯
The sketch is conceptual, not a data graph.
Saturation changes the story
If the controller calculates 1.4 but the motor output is limited to 1.0, the actuator cannot follow the requested correction.
A controller can be mathematically aggressive and physically powerless.
Explain each term
For a mechanism holding position against gravity, write one sentence for:
- what P responds to;
- what I might correct;
- what D might damp;
- one reason you might intentionally leave a term at zero.
The goal is not to worship PID. It is to understand the control problem well enough to decide whether PID is appropriate.
Walk through one proportional calculation
Suppose the target arm angle is 60° and the measured angle is 52°.
error = target - measured
error = 60 - 52 = 8°
With Kp = 0.05 output/degree:
P output = 0.05 × 8 = 0.40
Later the arm reaches 58°:
error = 2°
P output = 0.05 × 2 = 0.10
The correction naturally shrinks as the error shrinks.
Now imagine gravity requires at least 0.14 output just to hold the arm. Pure proportional control may settle below the target because a small remaining error is needed to generate holding output. That is one situation where feedforward or integral action might be considered.
Do not add terms without a reason
A useful tuning record explains the defect each change is intended to address.
| Observed behavior | Candidate investigation |
|---|---|
| slow response with no overshoot | proportional gain may be low |
| repeated oscillation | proportional gain may be high or damping insufficient |
| stable offset under constant load | feedforward/integral may be relevant |
| noisy, twitchy derivative contribution | derivative may be amplifying sensor noise |
| output pinned at maximum | actuator saturation or unrealistic target |
The table does not diagnose the system automatically. It prevents random gain changes from pretending to be engineering.