This project explores how Model Predictive Control (MPC) can provide high-level guidance to a damaged aircraft using only a 3D kinematic model.
Developed as the final project for UC Berkeley MECENG 231A – Model Predictive Control.
📄 Project Report (PDF): describes the two-layer guidance stack (long-horizon geometric planner + short-horizon MPC) and simulation results.
Read the report
The controller outputs guidance commands (desired longitudinal acceleration, turn-rate, and climb-angle rate), which are assumed to be tracked by an ideal lower-level autopilot.
The core idea is a two-layer guidance stack:
-
Long-horizon geometric planner (convex QP)
Generates a smooth, runway-aligned 3D waypoint reference to the runway threshold. -
Short-horizon guidance MPC (convex QP, LTV)
Tracks a local segment of the reference while enforcing constraints and handling degraded authority.
Unlike “replan every step” architectures, the planner only replans when the MPC declares the current plan infeasible.
State:
| State | Meaning | Units |
|---|---|---|
x | North position in world frame | meters |
y | East position in world frame | meters |
h | Altitude | meters |
V | Airspeed magnitude | m/s |
χ | Heading angle (0° = North, 90° = East) | radians |
γ | Climb angle | radians |
Kinematics:
Inputs (tracked by ideal autopilot):
-
$u_{accel}$ : longitudinal acceleration command ($\mathrm{m/s^2}$ ) -
$u_{\dot{\chi}}$ : heading-rate command (rad/s) -
$u_{\dot{\gamma}}$ : climb-angle-rate command (rad/s)
At each control iteration, the nonlinear kinematics are linearized about the current operating point and discretized (e.g., forward Euler) to form an LTV prediction model:
The planner solves a convex QP over the stacked waypoint decision vector:
Define
Smoothness (second finite differences):
Glide-slope shaping (altitude tracking to a glide reference):
Runway centerline shaping (cross-track penalty):
Terminal runway heading alignment (penalize heading misalignment near runway):
Let
In implementation, the waypoint weights
Replanning policy: the planner is called only when the short-horizon MPC flags the current plan as infeasible.
Tracks a short window of the planned reference while enforcing:
- state bounds
- input bounds
- input rate bounds
The MPC solves a convex quadratic program over a finite horizon to track the planner reference while minimizing control effort:
where
Reference construction: the planner provides position/altitude waypoints directly, and the MPC primarily penalizes tracking error in
Damage is modeled by tightening input bounds (and potentially tightening the allowable (\gamma) envelope mid-flight) while keeping the same kinematic model. This can render the original runway plan infeasible.
During flight, the MPC monitors feasibility using:
- a cross-track error accumulation counter, and
- a progress-stall detector based on insufficient along-path progress.
If triggers persist for several consecutive steps, the current plan is declared infeasible and the planner replans.
If (after damage) runway landing is declared infeasible, the system switches to a secondary reference + MPC structure:
-
Online reachability check
Compare remaining horizontal distance along the planned approach polyline vs. maximum achievable horizontal range computed from altitude and shallowest allowable descent. -
Crash touchdown selection with no-land zones (ellipses)
The long-horizon planner selects a feasible touchdown point within remaining range while avoiding no-land ellipses by scanning bearings about current heading and rejecting candidates that intersect restricted regions. If the aircraft starts inside a no-land ellipse, an intermediate “escape waypoint” is generated just outside the ellipse boundary. -
Crash landing MPC
Tracks the crash polyline using the same convex QP structure, with an added terminal/near-ground penalty encouraging reduced vertical impact severity.

Damaged-mode response: after damage, the controller enforces a constrained flight-path angle
(climb angle) of −30° ≤ γ ≤ −10° and replans to a feasible touchdown.
flight_control_mpc/path_planner.py— long-horizon planner + crash plannerflight_control_mpc/guidance_mpc.py— short-horizon MPC + feasibility logicflight_control_mpc/aircraft_model.py— nonlinear kinematic model + linearizationflight_control_mpc/test.py— runnable scenarios / demosflight_control_mpc/plot.py,flight_control_mpc/animation.py— visualization

