Robotics

PID Controller

Almost every engineered object around is regulated by a PID: home thermostat, car cruise control, quadrotor stabiliser, industrial arm joint. Three terms invented in the 1940s have not aged. Each term addresses a different dimension of the control problem: error right now, error accumulated over time, error projected into the near future.

  • **Quadrotors:** a separate PID per axis (x, y, z, roll, pitch, yaw), running at 400-1000 Hz
  • **Industrial robots:** PID at each joint, update rates of 1-10 kHz
  • **Temperature control:** 3D printers, server cooling, chemical reactors
  • **Cruise control:** hundreds of millions of vehicles worldwide

P controller: the proportional term

A quadrotor must hold an altitude of 10 metres. Currently at 8 metres, the error is e = 10 - 8 = 2 m. The simplest regulator: apply thrust proportional to the error. Larger deviation, stronger correction. This is the **P controller**: u(t) = Kp * e(t).

**Steady-state error:** to hold a quadrotor at 10 m against gravity, a constant thrust u0 is needed. But at e=0, u=0. The actual equilibrium is at e = u0/Kp > 0. This residual error is exactly what the I term eliminates.

A P controller with Kp=10 and error e=0.5 outputs u =

I term and integral windup

The P controller leaves a steady-state error because it has no memory. If the altitude is consistently below the setpoint, the accumulated deficit is large and persistent. The **integral term** captures exactly this: the sum of all past errors over time.

u_I(t) = Ki * integral(e) dt. The accumulated error grows as long as e != 0, pushing the control signal until the setpoint is reached exactly. At e=0 the integrator stops growing - equilibrium is achieved with zero steady-state error.

**Integral windup** is a classic trap: if the actuator is saturated for a long time (motor at maximum), the integrator accumulates an enormous value. When saturation lifts, the controller emits a large impulse and the system swings into heavy oscillation. Anti-windup is mandatory in real-world systems.

Integral windup occurs when:

D term and noise amplification

P reacts to the current error, I to its accumulated history. Neither knows the **rate of change** of the error. If the error is 2 m and falling rapidly, heavy correction is not needed. If it is 2 m and growing fast, aggressive action is required. The **D term** provides this predictive capability.

u_D(t) = Kd * de/dt. A rapidly decreasing error produces negative de/dt, which adds a 'braking' force and reduces overshoot. The central problem: differentiation **amplifies high-frequency noise** in measurements.

**Derivative on measurement vs derivative on error:** a sudden setpoint step causes the error to jump instantaneously, producing a large spike in de/dt. Computing -d(measurement)/dt instead avoids this spike entirely - the measurement changes smoothly regardless of setpoint jumps. This is the more common industrial practice.

A low-pass filter is applied to the D term of a PID controller in order to:

PID tuning: Ziegler-Nichols method

Choosing Kp, Ki, Kd from scratch is difficult. The **Ziegler-Nichols** method (1942) is a systematic approach: find the critical gain experimentally, then compute the coefficients from a lookup table.

  1. Set Ki=0, Kd=0. Pure P controller.
  2. Gradually increase Kp until the system oscillates with constant amplitude. This is the critical gain **Ku**.
  3. Measure the oscillation period **Tu** (time of one complete cycle).
  4. Compute Kp, Ki, Kd from the Ziegler-Nichols table.
TypeKpKiKdCharacteristic
P0.5 Ku00Fast, but steady-state error remains
PI0.45 Ku0.54 Ku/Tu0Eliminates error, slightly slower
PID0.6 Ku1.2 Ku/Tu0.075 Ku*TuFast + zero error, noisier

In the Ziegler-Nichols method, Ku is the ultimate gain. What happens when Kp > Ku?

PID Controller

  • P: u = Kp*e - reacts to current error, leaves steady-state error under constant disturbance
  • I: u += Ki*integral(e)dt - eliminates steady-state error, dangerous windup at saturation
  • D: u += Kd*de/dt - predicts future error, amplifies noise - filtering required
  • Anti-windup: clamp the integrator when the actuator saturates
  • Derivative on measurement: -d(y)/dt avoids spikes at setpoint steps
  • Ziegler-Nichols: find Ku and Tu experimentally, then apply the tuning table

Related topics

PID is the classical control baseline. Modern methods extend it for nonlinear and multivariable systems.

  • Robot kinematics and dynamics — The plant that PID controls
  • Modern Control Theory: LQR and MPC — Optimal methods that outperform PID on complex multi-axis systems
  • Sensors and sensor fusion — Source of the measurement signal fed to PID

Вопросы для размышления

  • Why is integral windup especially dangerous in safety-critical systems such as aviation?
  • How does the D term help when controlling high-inertia systems like ships or flywheels?
  • In what situations does PID fail and more sophisticated control methods become necessary?

Связанные уроки

  • sci-05
PID Controller

0

1

Sign In