A rocket with one gimballed engine, dropped from height and off to one side, and shoved mid-air by a gust it never sees coming. Every tenth of a second the controller solves a short optimal control problem from where it is on the model, flies the first piece, and solves again. That is the whole trick, and it lands. You choose how far ahead each plan looks, how often it is remade, and how much computing each one gets.
The rocket is a slender body with its engine at the base: thrust up to about twice its weight, a gimbal of twenty degrees. Each plan is an optimal control problem over the horizon on the model, solved by iterative LQR: a running cost on fuel, on tilt, on sideways speed, on being off the pad, and on straying from a descent profile that the engine could still arrest, a terminal cost on being at the pad and still, and a wall at the ground. The solver gets the sweeps you allow, warm-started from the last plan shifted in time, and a cold start beside it in case the shove made the old plan a bad guess. Cost is fuel in hover-seconds, plus six per metre of miss, twenty per radian of tilt and a little per excess speed at touchdown; a slam, a tumble or a run-off is a hundred. Hidden today: where the gust hits and how hard, and a rocket a few percent heavier or lighter than the model.
One plan flown blind dies at the shove, because a plan is only as good as its start and the shove moves the start. A linear regulator to the pad does not know the engine has limits or the ground is there, and on a hard day it discovers both. Model predictive control does neither: it plans, which is how it respects the limits and the ground, and it re-plans from the measured state, which is how it is feedback. The horizon is the interesting knob. Too short and the plan cannot see the landing coming, so it dives now and pays later; too long and the far end of the plan is fantasy the shove will rewrite, at the price of computing that a short one would have spent looking again. And the sweeps: a plan solved from the last plan needs almost none, because last plan was nearly right, which is the observation behind the real-time iteration that lets this run at ten hertz in a browser, and would let it run at a kilohertz on a chip.
An optimal control problem over the whole flight is one plan, and a plan is open loop. Cut the problem to a horizon, solve it from the state you have now, keep only the beginning, and next period do it again: the repetition closes the loop, and the horizon keeps the problem small enough to solve in time. Constraints are not an afterthought but part of the problem, which is why the field grew up in chemical plants, where valves have ends and vessels have walls, and why it flies rockets now.
The theory's central worry is the horizon's edge: a plan that ends in a place from which no good continuation exists. The terminal cost Vf and a terminal set are what the stability proofs put there, a guarantee that the truncated problem does not lie about the future; here the descent profile plays that role. Get it wrong and a short horizon dives, which you can watch.
Solving a nonlinear optimal control problem to convergence takes many sweeps; doing that every period is what kept MPC slow for thirty years. The observation that broke it is that consecutive problems are nearly the same problem, so the previous solution, shifted by one period, is an excellent initial guess, and one sweep from it is usually enough. The controller then never converges and never needs to: it tracks the moving optimum with a lag of one sweep, and the lag is smaller than the plant's own motion.
The failure mode is a jump, when the state moves far from where the last plan began, as the shove does here. Then the warm start is wrong and one sweep is a step in the wrong basin; this page solves a cold start beside the warm one and keeps the better, which is a small price for a fall a plan cannot see. Iterative LQR is the sweep used here: linearise along the plan, a Riccati pass backwards, a rollout forwards, with a line search so that a bad step is rejected.