Fusion of UKF and NMPC for Fixed-Wing UAV Airspeed and Attitude Control

In recent years, fixed-wing unmanned aerial vehicles (UAVs) have gained widespread applications in both military and civilian domains due to their high endurance, large payload capacity, and operational flexibility. The precise control of airspeed and attitude is fundamental to the flight safety and mission effectiveness of a fixed-wing UAV. However, the inherently nonlinear dynamics, coupled with actuator constraints and sensor measurement noise, pose significant challenges to control system design. Particularly, low-cost sensors commonly used in small fixed-wing UAVs, such as MEMS-based inertial measurement units, are susceptible to noise, leading to degraded state estimation and control performance. To address these issues, we propose a novel control framework that integrates a nonlinear model predictive controller (NMPC) with an unscented Kalman filter (UKF) for robust airspeed and attitude regulation under strong measurement noise. This paper presents the complete design methodology, stability analysis, and comparative simulation results that demonstrate the superiority of the UKF-based approach over the extended Kalman filter (EKF) counterpart.

1. Introduction

The fixed-wing UAV is a complex nonlinear system with aerodynamic couplings and multiple control surfaces. Existing attitude control methods, such as fuzzy control, backstepping, and sliding mode control, often struggle to handle actuator saturation and state constraints effectively. Model predictive control (MPC) offers a natural framework for incorporating constraints, yet its real-time implementation for nonlinear systems remains challenging. Recent advances have shown that nonlinear model predictive control (NMPC) with a limited prediction horizon can be executed fast enough for UAV applications. Nevertheless, the performance of any model-based controller is highly dependent on the accuracy of the state feedback. When sensor noise corrupts critical variables like angle of attack, sideslip angle, and body angular rates, the control quality deteriorates significantly.

State estimation techniques, particularly Kalman filters, have been extensively used to mitigate noise effects. The extended Kalman filter (EKF) linearizes the nonlinear model around the current estimate, which introduces linearization errors and can lead to divergence under strong nonlinearities or fast transients. The unscented Kalman filter (UKF) overcomes this limitation by using a deterministic sampling approach to propagate the state distribution through the true nonlinear dynamics, achieving higher accuracy without computing Jacobians. In this work, we propose to combine UKF with NMPC for a fixed-wing UAV, where the UKF estimates the locally sensitive states (angle of attack, sideslip angle, roll rate, pitch rate, and yaw rate) from noisy measurements, and the NMPC uses these filtered estimates to generate optimal control commands that satisfy actuator and flight envelope constraints.

2. Fixed-Wing UAV Dynamic Model

We consider a rigid fixed-wing UAV with symmetrical configuration, assuming a flat Earth and constant mass. The nonlinear dynamics are expressed in the wind frame for translational motion and in the body frame for rotational motion. The state vector is defined as

$$
\mathbf{x} = [V_T,\; \alpha,\; \beta,\; \phi,\; \theta,\; \psi,\; p,\; q,\; r]^{\mathrm{T}}
$$

where \(V_T\) is the true airspeed, \(\alpha\) and \(\beta\) are the angle of attack and sideslip angle, \(\phi,\theta,\psi\) are the roll, pitch, and yaw angles, and \(p,q,r\) are the body angular rates. The control input vector is

$$
\mathbf{u} = [\delta_T,\; \delta_{al},\; \delta_{ar},\; \delta_{el},\; \delta_{er},\; \delta_{r}]^{\mathrm{T}}
$$

where \(\delta_T\) is throttle, and the remaining terms represent the deflections of left aileron, right aileron, left elevator, right elevator, and rudder. The dynamics are given by the following set of differential equations:

$$
\begin{aligned}
\dot{V}_T &= \frac{X_w + F_T\cos\alpha\cos\beta + mg_w^x}{m} \\
\dot{\alpha} &= q – (p\cos\alpha + r\sin\alpha)\tan\beta + \frac{Z_w – F_T\sin\alpha + mg_w^z}{m V_T\cos\beta} \\
\dot{\beta} &= p\sin\alpha – r\cos\alpha + \frac{Y_w – F_T\cos\alpha\sin\beta + mg_w^y}{m V_T} \\
\dot{\phi} &= p + (q\sin\phi + r\cos\phi)\tan\theta \\
\dot{\theta} &= q\cos\phi – r\sin\phi \\
\dot{\psi} &= \frac{q\sin\phi + r\cos\phi}{\cos\theta} \\
\dot{p} &= (c_1 p + c_2 r)q + c_3 L + c_4 N \\
\dot{q} &= c_5 p r – c_6(p^2 – r^2) + c_7 M \\
\dot{r} &= (c_8 p – c_1 r)q + c_4 L + c_9 N
\end{aligned}
$$

In these equations, \(X_w,Y_w,Z_w\) are the aerodynamic force components in the wind frame, \(L,M,N\) are the aerodynamic moments in the body frame, and \(F_T\) is the engine thrust. The coefficients \(c_i\) depend on the inertia tensor. The aerodynamic forces and moments are modeled as polynomial functions of the states and control inputs, capturing the nonlinear behavior of the fixed-wing UAV. The complete parameter set for our test vehicle is taken from the literature. This model serves as the basis for both state estimation and controller design.

3. UKF-Based Local Flight State Estimator

Because the angle of attack, sideslip angle, and body angular rates are most severely affected by sensor noise, we design a UKF estimator specifically for these local states. The local state vector is

$$
\mathbf{x}_s = [\alpha,\; \beta,\; p,\; q,\; r]^{\mathrm{T}}
$$

The discrete-time nonlinear system with additive process noise \(\mathbf{w}(k)\) and measurement noise \(\mathbf{v}(k)\) is:

$$
\begin{aligned}
\mathbf{x}_s(k+1) &= F_s(\mathbf{x}_s(k), \mathbf{u}(k)) + \mathbf{w}(k) \\
\mathbf{y}_s(k+1) &= \mathbf{x}_s(k+1) + \mathbf{v}(k)
\end{aligned}
$$

where the measurement \(\mathbf{y}_s\) directly corresponds to the local states. The UKF algorithm proceeds as follows:

Step 1 – Sigma point generation

At time step \(k\), given the state estimate \(\hat{\mathbf{x}}_{k|k}\) and covariance \(\mathbf{P}_{k|k}\), we generate \(2n+1\) sigma points (\(n=5\)):

$$
\begin{aligned}
\hat{\mathbf{x}}_{k|k}^{(0)} &= \hat{\mathbf{x}}_{k|k} \\
\hat{\mathbf{x}}_{k|k}^{(i)} &= \hat{\mathbf{x}}_{k|k} + \left( \sqrt{\alpha^2 (n+\kappa) \mathbf{P}_{k|k}} \right)_i, \quad i=1,\dots,n \\
\hat{\mathbf{x}}_{k|k}^{(i)} &= \hat{\mathbf{x}}_{k|k} – \left( \sqrt{\alpha^2 (n+\kappa) \mathbf{P}_{k|k}} \right)_{i-n}, \quad i=n+1,\dots,2n
\end{aligned}
$$

We set \(\alpha=0.01\) and \(\kappa=0\) as recommended.

Step 2 – Time update

Each sigma point is propagated through the nonlinear dynamics:

$$
\hat{\mathbf{x}}_{k+1|k}^{(i)} = F_s(\hat{\mathbf{x}}_{k|k}^{(i)}, \mathbf{u}(k))
$$

The predicted mean and covariance are computed using weights \(w_m^{(i)}\) and \(w_c^{(i)}\):

$$
\begin{aligned}
\hat{\mathbf{x}}_{k+1|k} &= \sum_{i=0}^{2n} w_m^{(i)} \hat{\mathbf{x}}_{k+1|k}^{(i)} \\
\mathbf{P}_{k+1|k} &= \sum_{i=0}^{2n} w_c^{(i)} \left( \hat{\mathbf{x}}_{k+1|k}^{(i)} – \hat{\mathbf{x}}_{k+1|k} \right) \left( \hat{\mathbf{x}}_{k+1|k}^{(i)} – \hat{\mathbf{x}}_{k+1|k} \right)^{\mathrm{T}} + \mathbf{Q}_k
\end{aligned}
$$

Step 3 – Measurement update

We recompute sigma points from the predicted state and covariance, then propagate through the measurement function (here identity):

$$
\hat{\mathbf{y}}_{k+1|k}^{(i)} = \hat{\mathbf{x}}_{k+1|k}^{(i)}
$$

The predicted measurement mean, innovation covariance, and cross-covariance are:

$$
\begin{aligned}
\hat{\mathbf{y}}_{k+1} &= \sum_{i=0}^{2n} w_m^{(i)} \hat{\mathbf{y}}_{k+1|k}^{(i)} \\
\mathbf{P}_y &= \sum_{i=0}^{2n} w_c^{(i)} \left( \hat{\mathbf{y}}_{k+1|k}^{(i)} – \hat{\mathbf{y}}_{k+1} \right) \left( \hat{\mathbf{y}}_{k+1|k}^{(i)} – \hat{\mathbf{y}}_{k+1} \right)^{\mathrm{T}} + \mathbf{R}_k \\
\mathbf{P}_{xy} &= \sum_{i=0}^{2n} w_c^{(i)} \left( \hat{\mathbf{x}}_{k+1|k}^{(i)} – \hat{\mathbf{x}}_{k+1|k} \right) \left( \hat{\mathbf{y}}_{k+1|k}^{(i)} – \hat{\mathbf{y}}_{k+1} \right)^{\mathrm{T}}
\end{aligned}
$$

Step 4 – Filter gain and state update

Finally, the Kalman gain and the corrected estimate are:

$$
\begin{aligned}
\mathbf{K}_{k+1} &= \mathbf{P}_{xy} \mathbf{P}_y^{-1} \\
\hat{\mathbf{x}}_{k+1|k+1} &= \hat{\mathbf{x}}_{k+1|k} + \mathbf{K}_{k+1} \left( \mathbf{y}_{k+1} – \hat{\mathbf{y}}_{k+1} \right) \\
\mathbf{P}_{k+1|k+1} &= \mathbf{P}_{k+1|k} – \mathbf{K}_{k+1} \mathbf{P}_y \mathbf{K}_{k+1}^{\mathrm{T}}
\end{aligned}
$$

The weights are defined as:

$$
\begin{aligned}
w_m^{(0)} &= 1 – \frac{n}{\alpha^2 (n+\kappa)} \\
w_c^{(0)} &= (2 – \alpha^2 + \beta) – \frac{n}{\alpha^2 (n+\kappa)} \\
w_m^{(i)} &= w_c^{(i)} = \frac{1}{2\alpha^2 (n+\kappa)}, \quad i=1,\dots,2n
\end{aligned}
$$

with \(\beta=2\). This UKF estimator runs at the same sampling rate as the controller (50 ms) and provides clean estimates of the local states to the NMPC block.

4. Airspeed/Attitude Controller via NMPC

The NMPC controller is designed to track the reference states \(\mathbf{x}_{\text{ref}} = [V_T^{\text{ref}}, \phi^{\text{ref}}, \theta^{\text{ref}}, \beta^{\text{ref}}]\) while respecting actuator constraints and state limits. The continuous-time model is discretized using Euler integration with sampling time \(T_s=0.05\ \mathrm{s}\):

$$
\mathbf{x}(k+1) = \mathbf{x}(k) + T_s \mathbf{f}(\mathbf{x}(k), \mathbf{u}(k))
$$

The optimization problem at each time step \(k\) is formulated as:

Objective Minimize the cost function \(J\) over prediction horizon \(N_p\)
Cost \(J = \sum_{i=0}^{N_p-1} \left( \|\mathbf{x}_e(k+i|k)\|_{\mathbf{Q}}^2 + \|\mathbf{u}(k+i)\|_{\mathbf{R}}^2 \right) + \|\mathbf{x}(k+N_p|k)\|_{\mathbf{P}}^2\)
State error \(\mathbf{x}_e = \mathbf{x} – \mathbf{x}_{\text{ref}}\)
Weights \(\mathbf{Q} = \text{diag}(3,0,0,3,3,3,0,0,0)\), \(\mathbf{R} = 0\cdot I_6\), \(\mathbf{P} = \text{diag}(3,0.01,0.01,3,3,3,0.01,0.01,0.01)\)
Constraints \(\mathbf{u}_{\min} \le \mathbf{u}(k) \le \mathbf{u}_{\max}\), \(\Delta\mathbf{u}_{\min} \le \Delta\mathbf{u}(k) \le \Delta\mathbf{u}_{\max}\), \(\mathbf{x}_{\min} \le \mathbf{x}(k) \le \mathbf{x}_{\max}\)
Terminal constraint \(\mathbf{x}(k+N_p|k) \in \Omega\)

The terminal set \(\Omega\) is defined via a local linearization and a Lyapunov equation, ensuring stability. In particular, we linearize the system at the equilibrium point to obtain matrices \(\mathbf{A}\) and \(\mathbf{B}\). With a terminal controller \(\mathbf{u} = \mathbf{K}\mathbf{x}\) that stabilizes the linearized system, we solve the discrete Lyapunov equation:

$$
\mathbf{A}_K^{\mathrm{T}} \mathbf{P} \mathbf{A}_K – \mathbf{P} + \varepsilon (\mathbf{Q} + \mathbf{K}^{\mathrm{T}} \mathbf{R} \mathbf{K}) = \mathbf{0}
$$

where \(\varepsilon>1\) and \(\mathbf{A}_K = \mathbf{A} + \mathbf{B}\mathbf{K}\). Then the terminal region is \(\Omega = \{ \mathbf{x} \mid \mathbf{x}^{\mathrm{T}} \mathbf{P} \mathbf{x} \le a \}\) for some positive scalar \(a\). Under the assumptions of no disturbances and perfect model, the NMPC with this terminal cost and constraint guarantees recursive feasibility and asymptotic stability. The proof follows the standard quasi-infinite horizon approach, showing that the optimal cost function serves as a Lyapunov function. We solve the nonlinear optimization problem using a direct approach with the control sequence as decision variables.

5. Simulation Results and Discussion

We performed extensive simulations in MATLAB/Simulink to evaluate the performance of the proposed UKF-NMPC framework. The fixed-wing UAV model used corresponds to a conventional configuration with five independent control surfaces. Actuator dynamics are modeled as second-order systems with natural frequency 100 rad/s and damping ratio 0.75. The sensor noise standard deviations are set to \(\sigma_{\alpha,\beta}=2\ ^\circ/\mathrm{s}\) for airflow angles and \(\sigma_{p,q,r}=5\ ^\circ/\mathrm{s}\) for angular rates. The controller sampling time is 50 ms, with prediction horizon \(N_p=2\) and control horizon \(N_c=1\). The process and measurement noise covariance matrices for both UKF and EKF are identical for fair comparison.

The following figure shows a typical fixed-wing UAV similar to the one used in our simulation.

First, we compare the estimation accuracy of UKF and EKF for the local states when both filters are running outside the control loop (i.e., using true states for feedback). The results are summarized in the table below using root mean square error (RMSE) over the entire simulation.

State UKF RMSE EKF RMSE Reduction (%)
\(\alpha\) (deg) 0.5493 2.1785 74.49
\(\beta\) (deg) 0.0335 0.2530 86.86
\(p\) (deg/s) 1.0901 1.9202 43.23
\(q\) (deg/s) 1.4182 3.8164 62.84
\(r\) (deg/s) 0.7311 1.7608 58.49

The UKF consistently outperforms EKF, especially for angle of attack and sideslip angle where the reduction exceeds 70%. During fast transients (e.g., at t=5s and t=10s), EKF exhibits larger spikes due to linearization errors, while UKF maintains smoother and more accurate estimates. This confirms the advantage of the unscented transform for the highly nonlinear fixed-wing UAV dynamics.

Next, we evaluate the closed-loop attitude tracking performance under strong measurement noise. We compare three scenarios: (1) no filter (raw noisy measurements fed to NMPC), (2) NMPC with EKF estimates, and (3) NMPC with UKF estimates. The reference commands include step changes in roll angle, pitch angle, and yaw angle. The maximum absolute tracking errors for each attitude angle are recorded.

Scenario Roll error (deg) Pitch error (deg) Yaw error (deg)
No filter 4.30 0.91 7.72
NMPC+EKF 0.94 0.31 3.01
NMPC+UKF 0.24 0.28 0.60
Improvement UKF vs EKF 74.47% 9.68% 80.07%

Without any filtering, the attitude tracking is extremely noisy, with roll errors exceeding 4° and yaw errors up to 7.72°. Introducing EKF reduces the errors significantly, but visible oscillations remain due to the filter’s sensitivity to rapid state changes. The UKF-based NMPC achieves nearly noise-free tracking: the roll error is only 0.24°, and yaw error is 0.60°, representing improvements of 74.47% and 80.07% over the EKF case, respectively. The pitch angle improvement is modest (9.68%) because the original pitch error was already small. These results demonstrate that the high-fidelity UKF estimates enable the NMPC to operate close to its nominal performance even under severe measurement noise.

We also observed that the control inputs generated by the UKF-equipped controller are smoother and require less aggressive actuator activity, which is beneficial for actuator longevity and overall flight comfort. The proposed fusion of UKF and NMPC provides a robust solution for fixed-wing UAV flight control in challenging sensor environments.

6. Conclusion

In this work, we developed a complete control architecture for fixed-wing UAV airspeed and attitude regulation that synergistically combines unscented Kalman filtering with nonlinear model predictive control. The UKF effectively suppresses sensor noise on critical states such as angle of attack, sideslip angle, and body angular rates, while the NMPC handles system nonlinearities and actuator constraints. Simulation results confirm that the UKF-NMPC framework substantially outperforms an EKF-based counterpart, reducing estimation errors by up to 86.86% and attitude tracking errors by up to 80.07%. The enhanced robustness to measurement noise is especially valuable for small fixed-wing UAVs equipped with low-cost MEMS sensors. Future work may extend this approach to include fault detection and reconfiguration, as well as real-time implementation on onboard hardware.

Scroll to Top