Plant models and fourteen small products
Fourteen product-shaped demos, all passing in double and float: a CNC axis down to 1.48 µm, an ABS stop of 27.5 m, MPPT at 99.97 %. All in simulation.

The control library only does maths, so it needs
something to push against. When a demo writes its own plant it writes the flattering one: a clean first-order
lag with no saturation, no friction, no delay, where any controller looks good. So the plants got their own
library, act: DC and stepper motors, valves, heaters, converters, a cart-pole, a two-link arm, a vehicle, a
piezo stack, a PV panel, a battery cell. Header-only, SI units, RK4 where the dynamics need it. The parts that
break controllers on real hardware are explicit switches: actuator limits, gearbox backlash, stiction, encoder
quantisation, a sample of ADC delay, thermal derating.
On top of the two libraries I wrote fourteen demos, each shaped like a product instead of a plot: a CNC axis, a 3D-printer hotend, cruise control, ABS, a battery charger, MPPT, a grid-tie inverter, a piezo nanopositioner, a drone rate loop, a robot arm, a two-tank rig, a cart-pole swing-up, and two identification demos. Each one asserts its own headline numbers and exits non-zero if the physics changed, so the folder doubles as a regression test.
$ cmake -S demos/actuator-controller -B build/products && cmake --build build/products -j
$ cmake -S demos/actuator-controller -B build/products_f -DCMAKE_CXX_FLAGS=-DCTL_REAL_FLOAT
On 2026-11-22 all fourteen printed all expectations met in both builds. The tank rig and the two
identification demos are written up on the control library hub; the rest that I found worth a story are below.
The stories
| # | Story | Result | Status |
|---|---|---|---|
| 1 | Cart-pole swing-up: energy pump, then a hand-over to LQR Why one controller isn't enough, and the catch condition people forget (the rate, not the angle) |
Upright 1.98 s after release, settled to 0.000 rad / 0.000 m, peak force 4.63 N of 12 N, zero rail hits; LQR alone never gets closer than 2.77 rad | Done |
| 2 | CNC axis: 264 mm to 1.5 µm with the same gains A ballscrew axis with a 220 Hz resonance: profile, prewarped notch, feedforward, and a gain margin that was negative all along |
Peak following error 264 mm -> 248 µm -> 26.5 µm -> 1.48 µm; gain margin -18.1 dB without the notch, +6.3 dB with it | Done |
| 3 | Cruise control on a hill, and an ABS that can't be a PID Where the speed loss on a 4 % grade actually goes, and a brake plant whose gain flips sign at the friction peak |
Speed loss on a 4 % grade 11.99 -> 0.18 km/h; stopping from 90 km/h 41.3 m locked vs 27.5 m with slip control, +35 % wet, +18 % snow | Done |
| 4 | 3D printer hotend: one step test, SIMC gains, and the thermistor that falls out Fit gain, time constant and dead time from one step, compute a PI from them, and catch thermal runaway by watching response, not temperature |
PI from one step test: 5.1 % overshoot, 0.10 K steady error, 2.1 K dip when the fan starts; runaway caught in 20.0 s at 231 °C | Done |
| 5 | Piezo stage: learning control vs an inverse model, and the answer I didn't expect 13 % hysteresis on a sub-nanometre actuator; iterative learning with no model against a closed-form Prandtl-Ishlinskii inverse |
RMS error per scan line 567 nm open loop, 168 nm with learning, 118 nm with the inverse model; opening the Q-filter makes learning diverge to 38.8 µm | Done |
| 6 | Power loops: a charger with no state machine, MPPT, and a sine an integrator can't follow CC-CV as the minimum of two loops, perturb-and-observe on a panel that heats up, and resonant vs repetitive control on a grid-tie inverter |
Charger 99.5 % full vs 90.0 % with a state machine; MPPT 92.7 % -> 99.97 % of available energy; inverter RMS error 0.225 -> 0.067 A, THD 0.085 % | Done |
Still open
All simulation. The models are as honest as I could make them, but a model’s resonance or friction is still a number I typed in. The drone rate loop and the two-link arm ran fine and have numbers (37 ms rise with no integrator; an unknown 1 kg payload still adds 26 mrad of sag under computed torque, 38.5 under plain PD), but I haven’t written them up.