3.5.38Guidance, Navigation & Control (GNC)

PID control — proportional, integral, derivative terms

2,034 words9 min readdifficulty · medium4 backlinks

1. Setting up the problem from scratch

HOW do we build ff? We ask: what information does e(t)e(t) carry?

  1. Its value now → how big is the mistake right now?
  2. Its accumulated history → have we been consistently off in one direction?
  3. Its rate of change → is the mistake growing or shrinking?

These are exactly value, integral, derivative — the three things calculus lets you extract from a function.


2. The Proportional term (present)

uP(t)=Kpe(t)u_P(t) = K_p\, e(t)

  • KpK_p = proportional gain (bigger = more aggressive).

3. The Integral term (past)

uI(t)=Ki0te(τ)dτu_I(t) = K_i \int_0^t e(\tau)\, d\tau

HOW it removes steady-state error (derivation): In steady state ee is constant =ess=e_{ss} and uu is constant. But duIdt=Kie\frac{du_I}{dt} = K_i\, e. For uIu_I to be constant we need duIdt=0Kiess=0ess=0\frac{du_I}{dt}=0 \Rightarrow K_i\, e_{ss} = 0 \Rightarrow e_{ss}=0. So as long as any error remains, the integrator keeps changing the output, and the only resting state is zero error.


4. The Derivative term (future)

uD(t)=Kdde(t)dtu_D(t) = K_d\, \frac{de(t)}{dt}

HOW it damps: if yy is rushing toward rr, then ee is dropping, e˙<0\dot e<0, so uD<0u_D<0 pulls back the command, softening the approach and reducing overshoot/oscillation.


5. The full PID law

Figure — PID control — proportional, integral, derivative terms

6. Worked examples


7. Feynman & memory

Recall Explain it to a 12-year-old (click to reveal)

Imagine steering a toy boat to a dot in a pond.

  • P: the farther the boat is from the dot, the harder you turn the wheel.
  • I: if the wind keeps nudging it off and P keeps leaving it just short, you get annoyed and add extra turn for how long it's been wrong — until it finally sits on the dot.
  • D: when the boat is zooming toward the dot, you start un-turning early so it doesn't shoot past. Present, past, future — three helpers steering one boat.

8. Flashcards

What is the error signal in a control loop?
e(t)=r(t)y(t)e(t)=r(t)-y(t), setpoint minus measured process variable.
Write the continuous PID control law.
u=Kpe+Ki0tedτ+Kde˙u=K_p e + K_i\int_0^t e\,d\tau + K_d\,\dot e.
Why does a pure-P controller leave steady-state error under a constant disturbance?
At equilibrium u=Kpessu=K_p e_{ss} must equal the disturbance dd, so ess=d/Kp0e_{ss}=d/K_p\neq0; zero error would give zero output and nothing cancels dd.
Which term eliminates steady-state error, and why?
The integral: steady state needs u˙I=Kie=0e=0\dot u_I=K_i e=0\Rightarrow e=0, so the loop can only rest at zero error.
Which term adds damping / reduces overshoot?
The derivative — it responds to e˙\dot e, resisting fast change.
What practical problem does a large KdK_d cause?
It amplifies high-frequency sensor noise, causing control chatter (fix: filter the derivative).
What is integrator windup and its fix?
Integral keeps accumulating while the actuator is saturated, causing large overshoot; fix with anti-windup clamping.
Give the discrete PID update equation.
uk=Kpek+KijejΔt+Kdekek1Δtu_k=K_p e_k + K_i\sum_j e_j\Delta t + K_d\frac{e_k-e_{k-1}}{\Delta t}.
Map symptom → term: system never settles / oscillates.
Increase KdK_d (damping).
Map symptom → term: system settles but with constant offset.
Increase KiK_i.

9. Connections

  • Feedback control loops — PID is one choice of the controller block.
  • Steady-state error and system type — why I raises the "type number."
  • Stability & the Routh–Hurwitz criterion — how gains affect stability.
  • Laplace transforms & transfer functionsC(s)=Kp+Ki/s+KdsC(s)=K_p+K_i/s+K_d s.
  • Ziegler–Nichols tuning — systematic gain selection.
  • Reaction wheels & attitude control — GNC actuators PID commands.
  • Sensor noise & filtering — why derivative needs a low-pass filter.

Concept Map

minus PV

minus

drives

commands

changes

value now

accumulated past

rate of change

leaves

causes

eliminates

sum

sum

sum

Setpoint r

Error e

Process variable y

PID controller u

Actuator

Proportional term Kp e

Integral term Ki integral e

Derivative term Kd de/dt

Steady-state error

Constant disturbance d

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Socho tumhe ek satellite ko sahi angle par point karna hai. Jahan tum le jaana chahte ho (setpoint) aur jahan wo abhi hai (measured value) — dono ka difference hai error e=rye = r - y. Controller ka kaam hai is error ko dekh kar command banana jo actuator (thruster ya reaction wheel) ko bhejein. PID bas isi error ka teen tareeke se istemaal karta hai: present, past, aur future.

P (Proportional): jitna zyada error, utna zyada push — KpeK_p e. Problem yeh hai ki agar koi constant disturbance ho (jaise gravity ya solar torque), to sirf P se ek chhota sa error hamesha bacha reh jaata hai, kyunki output tabhi banega jab thoda error hoga. Isse bolte hain steady-state error.

I (Integral): yeh error ko time ke saath jodta rehta hai — KiedtK_i\int e\,dt. Agar chhota error bhi lambe time tak rahe, integral badhta jaata hai aur push tab tak barhta hai jab tak error bilkul zero na ho jaaye. Yani I offset ko khatam karta hai. Lekin zyada KiK_i se windup aur overshoot hota hai.

D (Derivative): yeh error ki speed dekhta hai — Kde˙K_d\,\dot e. Agar tum bahut tezi se target ki taraf ja rahe ho, D pehle se brake lagata hai taaki overshoot na ho — shock absorber jaisa damping. Lekin zyada KdK_d sensor noise ko badha deta hai. Toh yaad rakho: P = speed, I = accuracy, D = stability. Teeno milke ek smooth aur accurate control dete hain — isiliye PID har jagah, drones se lekar spacecraft tak, use hota hai.

Go deeper — visual, from zero

Test yourself — Guidance, Navigation & Control (GNC)

Connections