AeroCoder

Controls Lab

CLASSICAL CONTROL

Design a controller and see it from every angle: time response, Bode, root locus and Nyquist, with saturation, delay, noise and a digital controller

Plant G(s)

A double integrator (inertia only) behind a first-order motor lag: the reason drone rate loops need D-term filtering and fast motors.

Roll inertia Ix

0.0082 kg·m²

Arm length l

0.17 m

Motor time constant

0.03 s

0.17

0.000246s³ + 0.0082s²

in: differential thrust ΔT (N) · out: roll angle φ (rad)

Controller C(s)

Kp (proportional)

3

Ki (integral)

1

Kd (derivative)

0.7

D filter N (rad/s)

100

Ziegler–Nichols (ultimate gain) : n/a (phase never reaches −180°)

Real-world effects

Reference step

0.35

Actuator limit ±4

motors, valves and control surfaces have a maximum

Limit

4

Anti-windup (clamping)

stop integrating while the actuator is saturated

Derivative on measurement

avoids the 'derivative kick' on a setpoint step

Digital controller period Ts

0 s

Sensor noise (σ, × step)

0

Load disturbance (× limit)

0

Simulation time

3 s

The time simulation integrates the plant with RK4 and models delay exactly. Bode and Nyquist use the exact delay; the root locus and pole checks use a 2nd-order Padé approximation of it.

Closed loop

stable

Rise 10–90 %

0.327 s

Overshoot

2.8 %

Settling 2 %

1.67 s

Steady-state err

-0.0117

Phase margin

42.5°

at 14.3 rad/s

Gain margin

-31.6 dB

at 1.28 rad/s

Peak |u|

1.05

Step response

t 0 s

00.511.522.5300.10.20.30.4t (s)

reference r

output y

00.511.522.5300.51limitt (s)

control effort u

The physical system

roll 0.0°

Press play or click on the response plots to scrub through time. Green dashed = where the controller is trying to go; orange = what the actuator is doing.

POLES

open loop: 0, 0, -33.3

closed loop: -0.364, -10.7+14.8j, -106, -10.7−14.8j, -5.39

Bode plot of L(jω) = C·G

10⁻³10⁻²10⁻¹10⁰10¹10²10³10⁴-1000100200ωc

|L| dB

10⁻³10⁻²10⁻¹10⁰10¹10²10³10⁴-250-200-150−180°ω180ω (rad/s)

∠L deg

Root locus (k · C·G)

click to rescale the gains

-200-150-100-50050100-50050Re s

× open-loop poles

○ zeros

● closed-loop poles now

Nyquist plot

must not encircle −1 (for an open-loop stable plant)

-15-10-5051015-8-6-4-202468Re L

ω > 0

ω < 0

Reading the plots

Step response: how the closed loop follows a step in the reference. Overshoot comes from low damping; a steady-state error means the loop has no integrator for this kind of input.

Bode: the open loop L = C·G. Where |L| crosses 0 dB (ωc) sets the bandwidth; the phase there minus −180° is the phase margin. Aim for 45–60° for a well-damped response.

Root locus: where the closed-loop poles go as the overall gain k goes from 0 to ∞. Poles in the right half-plane mean instability; poles far left are fast; poles near the imaginary axis ring.

Nyquist: L(jω) in the complex plane. The distance to −1 is the robustness: the gain margin along the real axis and the phase margin on the unit circle.

Try: the inverted pendulum with a small torque limit, the FOPDT process with a long dead time, or a digital controller with a large Ts on the quadrotor.