Landing a 6-DOF rocket with robust & nonlinear MPC
TL;DR
- Problem
- Land a simulated 6-DOF rocket (12 states) precisely within actuator and tilt limits, despite model mismatch, unknown mass and disturbances.
- What we built
- A dual-layer flight control system (PID and MPC) for highly accurate speed and trajectory tracking, an offset-free observer, a robust tube MPC for a safety-first landing, and a custom nonlinear MPC in CasADi.
- Result
- The nonlinear MPC recovers from a 30° roll and lands on target in under 4 s; the tube MPC keeps the rocket above ground under worst-case disturbance.
- Stack
- Python, CasADi + IPOPT, CVXPY + PIQP, mpt4py, python-control
How do you land precisely when your model is wrong and the world pushes back?
- 30° ROLL → LANDED < 4 S
- MPC
- Nonlinear MPC
- Tube MPC
- CasADi

The approach
- Decouple. Linearize around hover and split the rocket into x, y, z and roll subsystems. Each gets an MPC with an LQR terminal cost and a maximal invariant terminal set, which keeps the controller feasible over time.
- Dual layer. An outer PID position loop sends velocity setpoints to the MPCs. Soft constraints keep the problem feasible on the full nonlinear simulator.
- Offset-free tracking. A disturbance-augmented model and a Luenberger observer remove the steady-state error when the rocket is 1.5× heavier than modeled, and while it burns fuel.
- Safety-first landing. A robust tube MPC on altitude, built from a minimal robust invariant set and tightened constraints, guarantees the rocket never goes below the ground for any disturbance within its bounds.
- Custom nonlinear MPC. One controller for the full nonlinear dynamics in CasADi: RK4 discretization, 3.5 s horizon, LQR terminal cost and warm-started IPOPT solves.
What it achieved
- 30° roll → landed in under 4 s. The custom nonlinear MPC corrects complex aerodynamic drag and prevents orientation errors during landing, starting 10 m up with a 30° roll.
- Guaranteed stability under unpredictable wind disturbances. Even with a constant worst-case disturbance, the tube MPC keeps the rocket above ground and the throttle within limits.
- Fast linear MPCs. The per-axis controllers stabilize from 5 m/s in under 7 s and track a 35° roll setpoint in about 3 s.
- Offset-free at 1.5× mass. The disturbance observer cancels the steady-state velocity error of a rocket 50% heavier than its model.
Figures




Notes
The rocket model, simulator and 3D visualizer were provided by the course. We closed the project with a comparison of nonlinear MPC and robust linear MPC on safety guarantees, computational cost and axis coupling.