Periodic trajectory tracking for a fixed-wing aircraft#
This example uses nonlinear MPC to make a fixed-wing aircraft track a periodic reference, a tilted circular orbit, in unknown and time-varying wind. An extended Kalman filter (EKF) estimates the state and the wind. The control scheme follows a very similar approach to Gros et al. (2012). In Harzer et al. (2026), the same approach is applied to a tethered aircraft, combined with a more complex wind field estimation.
The example can be found in examples/acados_python/fixed_wing_aircraft.
Model#
The aircraft is modeled as a rigid body, the aerodynamic forces and moments come from a polynomial regression model. Its 22-dimensional state consists of position (3 dimensions), velocity (3), orientation as a rotation matrix (9), rotation rates (3), left and right thrust (2), and elevator and aileron deflection (2). The four controls are the rates of the left thrust, the right thrust, the elevator deflection and the aileron deflection. While the two thrusts act independently, the ailerons deflect anti-symmetrically, so one deflection describes both. Wind enters as a 3-dimensional parameter, provided by the EKF, and is assumed constant over the prediction horizon.
Optimal control problem#
where \(x_k^\mathrm{ref}\) and \(u_k^\mathrm{ref}\) are a precalculated reference trajectories, \(\hat x\) the estimated current state and \(\hat p\) the estimated wind. \(h\) are nonlinear constraints consisting of the airspeed, the angle of attack and the sideslip angle. They are optionally softened by slacks.
State and wind estimation#
The EKF estimates the full state and, in addition, the 3-dimensional wind parameter.
The prediction step integrates the dynamics with an AcadosSimSolver.
Its forward sensitivities with respect to the state and the parameter yield the required Jacobian.