Chapter 13
The Drone Challenge
Can you keep the drone at 2 m through everything?
Chapter 13: The Drone Challenge ↗
Mission briefing
June: Okay. Real drone, real delivery. It takes off with a package, rides out a gust, drops the package, and holds 2 m the whole time. Twenty seconds.
Mika: And we're not allowed to touch anything while it flies?
Theo: That's the whole point. The controller has to do it alone. We just pick three numbers. Well, four: the filter too.
The mission, second by second:
- 0 s: take off from the ground carrying a 0.2 kg package (0.7 kg in total).
- 6–9 s: a downward gust pushes with 1.5 N.
- 12 s: the package drops. Suddenly the drone is 0.2 kg lighter.
- 20 s: mission over.
Our drone model gets a little more honest for the finale. Each of these is something real drones have to live with, and each one is an old friend from an earlier chapter:
- Motor lag (τ ≈ 0.05 s): a propeller can't change speed instantly. Its thrust follows the command like Chapter 3's cooling coffee, a first-order lag: 63% of the way after 0.05 s. A late push is Chapter 12's phase lag in disguise.
- **A noisy sensor ( ≈ 2 cm, n for noise; not a pole's σ):** every height reading is off by about 2 cm, randomly, a thousand times a second. Chapter 11 warned us: D turns that jitter into big thrust spikes.
- Limited motors (0 to 20 N): Chapter 10's limit stays on. With the package the drone weighs 6.9 N, so 20 N is only about three times its weight, and the motors can never pull down. While they are pinned, the pile pauses (Chapter 11's anti-windup).
- D is filtered: Chapter 11's fix. D takes the slope of a smoothed sensor reading, a first-order lag with the time constant you choose. Longer means calmer, but later.
Chapter 13: The Drone Challenge ↗
Chapter 12 would draw this. Here is the drone's own loop, the six-star tune once around: controller, motors, drone. Slide the motor lag and watch the phase bend down.
Chapter 13: The Drone Challenge ↗
Theo: Without the lag the phase never gets to −180°, so there's no cliff at all: however far you turned the gain up, the loop could never reach Chapter 10's −1. The motors' tiny lag is what builds the cliff.
Predict first! When the package drops at 12 s, which term does the heavy lifting to get the drone back to exactly 2 m?
Chapter 13: The Drone Challenge ↗
Mika: Wait. So after the drop the drone has to float a little too high for a while? That's the error the pile unlearns from!
Fly the mission
Each change of a slider restarts the mission, and the previous flight stays as a ghost. The small s-plane shows the nominal poles: the motor lag and the filter are in, and only the noise, the package and the limits are left out. So you can see the linear picture while the real, messy flight happens next to it. Earn all six stars for gold.
The limits are what a delivery customer would notice: settled within 3 s, never more than 10% too high, not blown more than a hand's width (20 cm) by the gust, back in 2 s after the drop, never scraping the ground, and motors that don't buzz (under 0.5 N of chatter).
The arrival star means the true height stays within ±5 cm from its arrival until the gust at 6 s; merely crossing 2 m once does not count. The calm-motors star uses the standard deviation of thrust from 3 to 6 s, after the take-off and before the gust: its typical variation around its average, including late settling and sensor chatter. Point at a line of the checklist (or tab to it) to shade the seconds it judges.
Chapter 13: The Drone Challenge ↗
June: I tuned the perfect controller in my head: huge , the tiniest filter so D reacts instantly. It's flawless in calm air! Watch…
June: …why are the motors screaming? The orange line is all fuzz, and now it overshoots too!
Theo: Chapter 11, warning 2. Big times a tiny filter turns every 2 cm of sensor jitter into a thrust spike. And the spikes get clipped at 0 N far more often than at 20 N (the faint orange line shows what the controller asked for: see how often it hits 0 N), so they add a lopsided extra push. That's the overshoot, the same upward drift Chapter 11 caught. It was only flawless because your imaginary calm air came with a perfect sensor.
Chapter 13: The Drone Challenge ↗
Try June's calm-air tune and watch the "motors calm" star fail. Then lengthen the filter to 0.04 s and bring down to about 7. At = 7 it arrives in about 1.9 s instead of June's dream of 1.3 s: that's the price of calm motors. That trade, speed against noise and against robustness, is control engineering.
June: A little slower, and the motors stop screaming. Deal. In my head the air was calm and the sensor was perfect.
Looking back
Mika: I started out thinking "push harder" fixes everything. It's the opposite, isn't it? Most of the trouble came from pushing too hard on old or noisy information. I'm glad I asked all the dumb questions. None of them were dumb.
Theo: I finally believe the Laplace transform. It's not a lookup table: it's a probe that asks a signal "how much of are you?" And because slopes turn into multiplying by , the calculus turns into algebra. The poles are where the answer blows up: the the system is built from.
June: And I learned "more" isn't "better": more gain, more damping, more , more speed. There's always a cliff, and the good designs keep a margin from it. Also: always try it on the drone.
Here's everything we built, from the shower to the finale. Every bubble links back to where it was born.
What we figured out
- Feedback: measure what happened, compare with the goal, act on the error (Ch 0–1).
- P control pushes in proportion to the error, but leaves a droop and wiggles when it's strong (Ch 2).
- Derivatives, exponentials and spinning numbers describe how things change: with grows or shrinks and wiggles (Ch 3–7).
- The Laplace transform turns slopes into multiplication by , so calculus becomes algebra (Ch 9).
- A transfer function’s uncanceled poles mark natural motions visible from its chosen input to output: left-half motions fade, right-half motions grow (Ch 10).
- PID: I kills the droop, D adds damping, and each one moves the poles (Ch 11).
- Delay adds phase lag; margins tell you how far you are from the cliff edge (Ch 12).
- Real hardware adds limits (Ch 10), lag that costs phase margin (Ch 3 + Ch 12) and noise that D amplifies (Ch 11), so good controllers are calm as well as fast (Ch 13).
Explain it to a friend
First, your mission: how many stars did you earn, and which one was hardest? Say why out loud before you read on.
Mika: Mine was the calm star. I kept adding D to calm the motors down, and they only got louder.
The best test of understanding is explaining. Before each answer, try saying your version out loud. Then pick the explanation that best matches it.
One more picture: the state plane
Theo: Every plot in this course showed height over time. But height alone can't tell you what happens next: at 2 m and climbing is not at 2 m and falling.
Two numbers pin down the future: the height measured from the target, , and the speed . Together they are the drone's state. Put them on one plane, height across and speed up, and the whole flight becomes the path of one moving point.
Its rules are Chapter 3's slopes, one for each number: the height changes at the speed, and the speed changes at the acceleration from Chapter 1's equation. With the hover thrust handled and PD control on top, both rules fit in one table:
That table is a matrix: multiply it into the state and out comes the state's velocity. Its top row says the height changes at the speed; its bottom row is Newton's law.
Predict first! With = 20 N/m and no D, the drone starts 1 m low and still. What path does its state trace?
Chapter 13: The Drone Challenge ↗
June: It's Chapter 6's spiral! And when I push past about 5.3, the spiral straightens out and slides in along two dashed lines.
Those straight lines are the modes: start exactly on one and the state slides straight in at that mode's own rate. The rates are the matrix's special numbers, its eigenvalues, found where :
Mika: That's Chapter 7's equation! The eigenvalues are the poles. Same drone, new picture.
And Chapter 10's pole playground was quietly doing state feedback all along: pushes on both numbers of the state, and choosing the two gains placed both poles. Give the state more numbers (tilt, spin, sideways position) and the matrix grows, but the idea stays: the eigenvalues are the poles, and feeding back the whole state can place them all.
One more confession. Every rule in this course is a straight-line rule, but real things curve. A propeller's thrust grows with the square of its spin, . Near hover the curve is almost straight, so we swap it for its tangent at the hover, Chapter 3's ruler:
Chapter 13: The Drone Challenge ↗
Theo: So the straight lines were never a lie. They're a zoomed-in picture: honest near the hover, worse the further you stray. That's why our maths needed the drone near 2 m.
New words
- State
- The numbers that pin down the future: for our drone, height and speed. One point on the state plane.
- Matrix
- A table of numbers that turns the state into its velocity.
- Eigenvalues
- The special rates of a matrix, where . For a drone's they are its poles.
- Linearising
- Replacing a curved rule by its tangent near the point you care about (here, the hover).
Where to go next
You now know more control theory than most people ever meet. Here's where the road goes on, each one a new notebook:
- Root locus: instead of dragging poles, drag the gain and watch the poles trace paths. You'd see at a glance which is too much.
- State-space control: you've had a first taste above. Next come many sensors and motors at once. A real drone must hold tilt, spin and position together, and one-knob-at-a-time tuning stops working.
- Digital control: real controllers run on computers that sample every few milliseconds. Sampling is a small delay too, and the s-plane gets a cousin, the z-plane.
- Kalman filters: blend what a model predicts with what the sensor says, so you can use a noisy sensor without a slow filter.
- Smith predictors and model predictive control: controllers that carry a little simulation inside them to see around delays, the shower's real cure.
- Nonlinear and robust control: what to do when drag isn't linear or the drone flies in 3-D, and how to prove you still have margin.
Theo: Root locus first. I want to watch the poles move while I turn one knob.
Next time a shower makes you dance between scalding and freezing, you'll know exactly what's happening. And you'll know it's not your fault. It's the phase margin.