Appearance
Nonlinear Model Predictive Control (NMPC)
Problem Statement
NMPC optimizes constrained control over a finite horizon using the full nonlinear UAV model. It handles state and input constraints explicitly while tracking aggressive trajectories.
Model and Formulation
At each control step solve:
$$ \min_{u_{0:N-1}} \sum_{k=0}^{N-1}\left(|x_k-x_k^{ref}|_Q^2 + |u_k-u_k^{ref}|_R^2\right) + |x_N-x_N^{ref}|_P^2 $$
subject to:
$$ x_{k+1}=f(x_k,u_k),\quad u_{min}\le u_k \le u_{max} $$
Algorithm Procedure
- Warm-start control sequence from previous solution.
- Integrate dynamics (single-shooting/multiple-shooting).
- Solve nonlinear program under constraints.
- Apply first control action, then shift horizon.
Tuning Guidance
- Increase terminal weight
Pto improve horizon-end stability. - Use shorter horizons for strict realtime budgets.
- Start with soft constraints before switching to hard constraints.
Failure Modes and Diagnostics
- Solver infeasibility appears under inconsistent references or tight bounds.
- Poor warm starts increase optimization latency.
- Inaccurate models produce biased constraint activity.
Implementation and Execution
bash
python -m uav_sim.simulations.trajectory_tracking.nmpcEvidence
![]()
References
- Diehl et al., Real-Time Optimization and NMPC (2002)
- Rawlings, Mayne, Diehl, Model Predictive Control: Theory, Computation, and Design