PID Control Explained for Robot Builders
PID control is how most robots hold a wheel at a set speed, an arm at a set angle, or a heading on a straight line. The algorithm fits in a dozen lines of…
The Ziegler-Nichols rules, published in 1942, turn one simple experiment into a full set of PID gains. They are still the first tuning method most engineers learn, and still a reasonable starting point. They are also famously aggressive. This guide explains both versions of the method, applies them to the heater in our PID Tuning Simulator, and compares the results with two gentler modern rules.
The simulator's heater behaves like many slow processes: a first-order lag with a time constant of 60 s, a gain of 1.5 °C per percent of heater power, and 8 s of dead time (the delay before a change in power shows up in the measurement). The task is to raise the temperature from 25 °C to 60 °C, with the heater limited to 0 to 100 % power.
| Controller | Kp | Ti | Td |
|---|---|---|---|
| P | 0.5 Ku | ||
| PI | 0.45 Ku | Tu ÷ 1.2 | |
| PID | 0.6 Ku | 0.5 Tu | 0.125 Tu |
The table gives the integral and derivative as times. For the parallel form used in the simulator and most code (u = Kp·e + Ki·∫e + Kd·de/dt), convert with Ki = Kp ÷ Ti and Kd = Kp × Td.
For our heater model, the point of steady oscillation can be calculated exactly: it is where the lag and the dead time together delay the signal by half a cycle. That gives Ku ≈ 8.28 (percent per °C) and Tu ≈ 30.4 s. The Ziegler-Nichols PID gains are then:
If you can't safely make a system oscillate, use its open-loop step response instead. Apply a step in the controller output, record the measurement, and read off three numbers: the process gain K (change in output divided by change in input), the apparent dead time L, and the time constant T. For the heater, K = 1.5, L = 8 s and T = 60 s.
| Controller | Kp | Ti | Td |
|---|---|---|---|
| P | T ÷ (K·L) | ||
| PI | 0.9 T ÷ (K·L) | L ÷ 0.3 | |
| PID | 1.2 T ÷ (K·L) | 2 L | 0.5 L |
For the heater: PID Kp = 1.2 × 60 ÷ (1.5 × 8) = 6.0, Ti = 16 s (Ki = 0.375) and Td = 4 s (Kd = 24).
We ran each set of gains in the simulator, with anti-windup on, derivative on measurement, the heater's real power limit, and then again with a sudden 10 % loss of heater power (a draught) to test disturbance rejection:
| Rule | Kp | Ki | Kd | Overshoot | Settling (2 %) | Worst dip after the draught |
|---|---|---|---|---|---|---|
| ZN closed-loop PID | 4.97 | 0.327 | 18.9 | 9.3 % | 62 s | 2.3 °C |
| ZN closed-loop PI | 3.73 | 0.147 | 0 | 11.9 % | 69 s | 2.8 °C |
| ZN open-loop PID | 6.00 | 0.375 | 24.0 | 10.5 % | 161 s | 2.5 °C |
| ZN open-loop PI | 4.50 | 0.169 | 0 | 14.2 % | 99 s | 2.7 °C |
| Tyreus-Luyben PI | 2.59 | 0.039 | 0 | 1.8 % | 92 s | 3.3 °C |
| SIMC PI (τc = θ) | 2.50 | 0.042 | 0 | 5.1 % | 49 s | 3.3 °C |
Two things stand out. First, the Ziegler-Nichols gains reject disturbances best, which is what they were designed for, but they overshoot and ring more. Second, the actuator limit and anti-windup tame them considerably here. Without anti-windup, the same ZN PID gains overshoot by 73 % and take 146 s to settle, which is closer to the behaviour people usually associate with Ziegler-Nichols.
Treat any tuning rule as a starting point. Apply it, look at the response, and then refine by hand, usually by lowering Kp and Ki a little, following our step-by-step tuning method. You can reproduce every row of the table above in the simulator: select the heater, type in the gains, and toggle the load disturbance and anti-windup.
PID control is how most robots hold a wheel at a set speed, an arm at a set angle, or a heading on a straight line. The algorithm fits in a dozen lines of…
Most PID tuning on robots is done by hand, and most hand tuning is done badly: three gains changed at once, by guesswork, until something looks roughly right.…
The PID equation in a textbook assumes an actuator that can deliver any value, a measurement without noise, and a setpoint that never jumps. Real robots have…
Almost every wheeled robot depends on one small control loop: holding each wheel at the speed the navigation stack asks for, regardless of load, slope and…
If you have any query or problem
feel free to contact us
email: [email protected]
Comments 0