Abstract
This paper intends to address the challenges of insufficient robustness and model uncertainty compensation in unmanned aerial vehicle dynamic systems under complex disturbances. The paper proposes a hybrid control architecture that combines deep fusion model predictive control with adaptive Proportional–Integral–Derivative (PID) based on Transformer attention mechanism. The core innovation of this architecture lies in introducing attention neural networks to dynamically tune PID gains online, and forming a deep collaborative control framework of "prediction-learning-compensation" with Model Predictive Control (MPC) and sliding mode disturbance observer with H∞ (H-infinity) robust optimization. This thereby improvs the adaptability and control accuracy of the system under unstructured disturbances and model mismatches. The control architecture employs a robustly optimized upper-layer MPC controller, which, based on the receding horizon principle, utilizes real-time system state updates to predict future state evolution. An H∞ performance criterion is incorporated into the control sequence optimization to strengthen robustness against model parameter perturbations and external disturbances. The lower-layer controller adopts an adaptive PID structure that responds quickly to the reference signals generated by the MPC. To address the degradation of PID tuning performance under dynamic mismatches and unmodeled disturbances, an attention mechanism neural network based on the Transformer architecture is introduced to adjust the PID gains online and capture nonlinear dynamic variations. Additionally, in order to further enhance system stability under severe disturbances, this control framework integrates sliding mode control technology into the disturbance observer design, and constructs a sliding mode disturbance observer module for explicit estimation of external disturbances and model uncertainties. The estimated values are injected into the lower-level adaptive PID controller through a feedforward compensation mechanism to achieve active disturbance rejection. Simulation experiments conducted in a nonlinear disturbance environment built on the AirSim platform, as well as tests using the EuRoc dataset, demonstrate that the proposed method maintains a steady-state tracking error within 5% during path-following tasks. Compared with the traditional MPC combined with fixed gain PID control, this method improves the steady-state robustness by about 17%, and shortens the system adjustment time from 3.15 s to 2.47 s, significantly improving by 21.6%, demonstrating excellent convergence and anti-interference ability. The results indicate that the MPC-PID hybrid control approach offers significant advantages in enhancing the robustness, adaptability, and control accuracy of UAV systems, making it well-suited for intelligent control demands in complex flight missions.
Supplementary Information
The online version contains supplementary material available at 10.1038/s41598-025-32436-6.
Keywords: PID control, Attention mechanism neural network, Sliding mode control, Robust UAV control
Subject terms: Engineering, Mathematics and computing
Introduction
With the rapid expansion of unmanned aerial vehicle (UAV) applications in areas such as logistics delivery, precision agriculture, infrastructure inspection, disaster response, and military reconnaissance, the operational environments of UAV are becoming increasingly complex and unpredictable. UAV dynamic systems face significant challenges during actual flight operations1,2. On one hand, they are subject to various complex, unstructured disturbances, including wind shear, atmospheric turbulence, gusts, sensor noise, and actuator deviations3. On the other hand, inherent model uncertainties exist within the system, such as deviations in aerodynamic parameter identification, unmodeled high-order dynamic characteristics, variations in mass and inertia, and nonlinearities in actuator dynamics4. These disturbances and uncertainties are often interdependent, substantially reducing the robustness and control accuracy of traditional control methods. Proportional–Integral–Derivative (PID) control is widely applied in industrial settings due to its simple structure and ease of implementation and tuning, while its fixed-gain structure often suffers from severe performance degradation in the presence of dynamic mismatches and strong external disturbances, showing insufficient adaptability and robustness5. In contrast, Model Predictive Control (MPC), based on the principle of receding horizon optimization, explicitly handles system constraints and leverages model-based predictions of future state evolution, offering stronger theoretical potential for robust optimization6. However, MPC imposes a considerable computational burden during online execution and is highly dependent on model accuracy. When faced with rapid, unmodeled disturbances, relying solely on MPC may fail to ensure real-time responsiveness and sufficient system stability7.
Existing studies have attempted to combine MPC and PID in serial or parallel hybrid architectures to integrate their respective strengths. However, these approaches often lack a deeply integrated co-optimization mechanism. In particular, limitations remain in compensating for dynamic uncertainties and enabling adaptive gain adjustment, leaving the fundamental issue of robustness under complex disturbances unresolved8,9. Therefore, there is an urgent need to develop an advanced hybrid control strategy that achieves deep integration and collaborative optimization, aiming to systematically enhance UAV adaptability, disturbance rejection, and control accuracy in harsh and uncertain flight environments.
This study aims to address the aforementioned core challenges by proposing and systematically investigating an innovative and highly robust MPC-PID hybrid control architecture, designed to significantly enhance the overall control performance of UAV dynamic systems under complex disturbances and model uncertainties. The core design objective of this architecture is to achieve deep coordination and complementary advantages across multiple control layers. Specifically, the upper layer incorporates an MPC controller enhanced with an H-infinity (H∞) robust performance criterion. This controller performs predictive optimization within a receding horizon framework using real-time updated system states. By explicitly integrating the H∞ criterion, the design improves robustness against model parameter perturbations and bounded external disturbances, thereby providing globally optimized control decisions and strong disturbance rejection capabilities. The lower layer features a highly adaptive PID structure, with its primary innovation lying in the integration of an attention mechanism neural network based on the Transformer architecture. This network dynamically and online adjusts the PID controller gains by learning and capturing the system’s nonlinear dynamics and disturbance characteristics. This mechanism effectively addresses the performance degradation issues observed in traditional PID control under dynamic mismatches and strong unmodeled disturbances, enabling fast and accurate tracking of the reference signals generated by the upper-layer MPC. Furthermore, to ensure additional stability and precise disturbance rejection under severe or sudden external perturbations, the control framework incorporates a sliding mode control (SMC) module and a Disturbance Observer (DOB). The DOB explicitly estimates compound disturbances, including both external interferences and partial model uncertainties. The SMC utilizes this estimated information to generate an equivalent feedforward control input for compensation, thereby significantly enhancing the system’s stability and robustness under extreme conditions. The ultimate goal is to develop a hierarchically structured, co-optimized, highly adaptive, and robust integrated control solution that ensures UAVs maintain high-precision trajectory tracking and stable flight attitude in complex and uncertain operational environments.
The core innovation of this paper lies in proposing a deep collaborative MPC-PID hybrid control architecture, which introduces an attention mechanism neural network based on Transformer architecture to achieve online dynamic gain adjustment of PID controller. Compared with traditional MPC-PID hybrid or adaptive PID frameworks, its fundamental breakthrough lies in: 1) Applying Transformer attention mechanism to real-time adaptive adjustment of PID gain in MPC-PID framework, enabling it to accurately capture nonlinear dynamic and disturbance features; 2) Forming a closed-loop collaborative mechanism, consisting of upper-layer MPC (H∞ robust prediction optimization), middle-layer attention network (intelligent gain tuning), and lower-layer SMDOB (Sliding Mode Disturbance Observer). This integrated design of "prediction-learning-compensation" provides a systematic new solution for achieving high-precision control of UAV in harsh and uncertain environments.
Literature review
In recent UAV control research, PID control, Linear Quadratic Regulator (LQR) control, and MPC have emerged as some of the most commonly used methods. Okasha et al. (2022) designed three stabilization controllers—PID, LQR, and MPC—for the Parrot Mambo micro UAV, and experimentally compared their performance in attitude control tasks10. In the context of UAV path planning and obstacle avoidance in complex dynamic environments, Feng et al. (2024) proposed a hybrid control method that integrated reinforcement learning strategies to enhance decision-making within the MPC framework11. Fang et al. (2025) introduced an advanced MPC approach for a spherical quadrotor UAV that incorporated both disturbance rejection and input delay compensation. By explicitly modeling disturbance inputs within the predictive model and introducing a delay compensation mechanism, this method significantly improved system stability under pronounced external disturbances and delays12.
In efforts to simplify control dimensionality, Uyar (2024) proposed a gradient-optimized MPC method for single-degree-of-freedom UAV control, focusing on reducing the computational complexity of MPC to meet real-time control requirements13. In terms of PID control and optimization, Alqudsi et al. (2024) proposed a robust hybrid control method and used a meta heuristic algorithm to optimize controller parameters, significantly improving the performance of aerial robots14. This provides a new idea for parameter tuning of PID controllers in complex environments. Basil et al. (2025) designed a hybrid structure of fractional order PID and Tilt-Integral-Derivative controller for unmanned aerial vehicle path planning control problem15, and used a hybrid optimization algorithm for parameter optimization, demonstrating the potential of advanced PID variants in UAV applications. Regarding integrated control strategies, Abbas et al. (2024) conducted a comprehensive review of advanced nonlinear control strategies for UAV, with a focus on the integration of sensor integration and hybrid technology16. This provides a systematic perspective for understanding the collaborative application of multiple control methods in UAV systems. These studies collectively highlight the current trend of improving UAV system performance through hybrid control architecture and intelligent optimization. In practical engineering applications, Bauersfeld et al. (2021) proposed an MPC-based flight control method for tilt-rotor vertical takeoff and landing aircraft. By accounting for tilt dynamics and designing a corresponding MPC structure, the system maintained stability during rapid attitude transitions17.
For high-dynamic trajectory tracking control, Xu et al. (2023) proposed a robust Model Predictive Controller with strong disturbance rejection capabilities to address disturbance issues encountered by quadrotor UAVs during high-speed flight18. Additionally, Sha’aban (2023) analyzed the relative effects of dead-time and damping ratio on the performance of PID control and MPC19. The results indicated that under significant delay or low damping conditions, MPC demonstrated superior control stability and performance retention compared to PID control.
In the framework of robust model predictive control, explicit tubular MPC is an important method for handling bounded disturbances. Soleimani et al. (2025) proposed a cascaded explicit tubular model predictive controller for multi robot systems20, which constrained the evolution range of the system state under disturbance by constructing a robust invariant set, thereby ensuring the robust stability of the system. Their work demonstrates the potential application of explicit methods in complex systems.
To overcome these limitations, this study proposes a multi-layered hybrid control architecture that integrates MPC and PID control. The approach innovatively incorporates an attention mechanism neural network based on the Transformer architecture for online dynamic adjustment of PID controller gains, enhancing the system’s adaptability to nonlinear disturbances. Simultaneously, SMC and a DOB are integrated into the control system to strengthen external disturbance estimation and compensation capabilities, thereby improving the overall robustness and stability of the control system.
Overall control architecture design
The proposed hybrid control architecture adopts a hierarchical collaborative design approach, as illustrated in Fig. 1. It achieves robust optimized control of the UAV dynamic system through deep coordination among the upper-layer MPC, the lower-layer adaptive PID control, and the integrated disturbance compensation modules. In this framework, the upper-layer MPC controller leverages the receding horizon optimization principle and real-time full-state system information to predict future state trajectories and generate globally optimized reference control commands. The lower-layer adaptive PID controller dynamically adjusts its gain parameters to rapidly track the reference signals provided by the MPC. Concurrently, the SMDOB module estimates compound disturbances—including both external interferences and model uncertainties—in real time. This estimated disturbance is injected into the lower-level control law via a feedforward compensation mechanism, forming a closed-loop disturbance rejection structure.
Fig. 1.
Overall control architecture.
The signal flow follows a top-down responsibility allocation: the MPC layer is responsible for macroscopic trajectory optimization and robust decision-making; the PID layer performs fine-grained dynamic tracking; and the SMDOB layer provides explicit disturbance compensation. These three components achieve seamless coupling through state feedback and command transmission.
The core innovation of this architecture lies in the deep integration and collaborative optimization mechanism of multi-level control: the upper MPC controller enhances the robustness against model parameter perturbations and bounded external disturbances by incorporating H∞ performance indicators. The lower-level adaptive PID controller adopts a Transformer-based attention neural network to dynamically adjust the gain parameters in real time, effectively solving the performance degradation problem of traditional PID under dynamic mismatch and strong disturbance. The mid-level disturbance compensation module achieves explicit estimation of composite disturbances through a sliding mode disturbance observer, and injects control laws through a feedforward mechanism to form a closed-loop disturbance rejection structure. The sliding mode disturbance observer module (which incorporates sliding mode control technology to achieve finite time convergence characteristics) estimates composite disturbances in real time, including external disturbances and model uncertainties. The estimated disturbance value is injected into the underlying control law through a feedforward compensation mechanism, forming a closed-loop disturbance rejection structure. It should be noted that sliding mode control technology is mainly applied in observer design here, rather than running in parallel with MPC or PID as an independent controller. This integrated design of "prediction-tuning-compensation" significantly surpasses the functional limitations of existing MPC-PID hybrid or single adaptive PID frameworks.
Upper-layer robust model predictive controller design
The MPC layer in this study employs a receding horizon optimization framework, enhanced by integrating an H∞ robust performance criterion to strengthen disturbance rejection capabilities against model uncertainties and external perturbations. Figure 2 illustrates the rolling optimization mechanism of the MPC.
Fig. 2.
Rolling optimization mechanism of the MPC.
The controller operates based on a discretized system state-space model. At each sampling instant k, the current state vector x(k) is obtained, and an optimization problem is solved over a finite prediction horizon to generate the optimal control sequence21. Defining the prediction horizon as Np and the control horizon as Nc (where Np ≤ Np), the optimization problem is formulated as Eq. (1):
![]() |
1 |
The cost function of Eq. (1) consists of three key terms,
: The state deviation penalty term is used to penalize the deviation of the system state from the equilibrium point in the predicted time domain. A positive definite weight matrix Q is used to weight the errors of different state variables, aiming to optimize trajectory tracking performance and enable the system state to converge quickly and accurately to the desired trajectory.
: The control increment penalty term is used to penalize changes in the control input increment. Introducing this feature can limit the violent fluctuations of the control effect, smooth the control signal, thereby reducing actuator wear and preventing excessive energy consumption. By using a positive definite matrix R, a trade-off is achieved between control performance and energy consumption/smoothness. The robust performance index term of
is based on H∞ theory and is used to enhance the system’s ability to suppress worst-case disturbances. By adjusting the parameter
to control the robustness level, where
represents the controlled output, it can reflect the sensitivity of system performance to disturbances. The combined effect of these three factors enables the designed MPC optimization to balance control smoothness and system robustness while pursuing tracking accuracy.
U(k) = [Δu(k|k)T, Δu(k + 1|k)T,…, Δu(k + Nc − 1|k)T]T is the control increment sequence, Q ≥ 0 and R ≥ 0 are weighting matrices; γ is the H∞ robust tuning parameter; z(k + i|k) denotes the controlled output vector; D represents the bounded disturbance set22.
The prediction model is derived by linearizing the nonlinear UAV dynamic equations around an operating point. A Discrete-Time Linear Parameter-Varying (DTLPV) model is adopted to represent the system dynamics23, as shown in Eqs. (2) and (3):
![]() |
2 |
![]() |
3 |
Here, ρ(k) denotes a time-varying scheduling parameter (such as airspeed or angle of attack); A(ρ(k)) and B(ρ(k)) are parameter-dependent system matrices, and Bd is the disturbance input matrix. State prediction is performed using the iterative model shown in Eq. (4):
![]() |
4 |
In Eq. (4), X(k) = [x(k + 1|k)T, x(k + 2|k)T,…, x(k + Np|k)T]T, D(k) is the disturbance prediction sequence, and Ψ(k), Φ(k), and Γ(k) are the prediction matrices constructed from the DTLPV model.
A combined hard and soft constraint handling strategy is adopted. The control input constraints are defined as:
![]() |
5 |
![]() |
6 |
To avoid infeasibility, state safety constraints are relaxed using a slack variable
, as expressed in Eq. (7):
![]() |
7 |
represents the predicted value of the system state at the future time
based on the current state
and the future control sequence at the current sampling time
. Here,
is the predicted state defined in Eq. (4), used to constrain future states within the allowable range.
A penalty term σ|
|2 (where σ > 0) is added to the objective function to penalize constraint violations. The optimization problem is solved subject to constraints (5)–(7). After generating the optimal control sequence, only the first control increment Δu*(k|k) is applied to the system24. The key parameters of the MPC controller are listed in Table 1.
Table 1.
Key parameter configuration of the MPC controller.
| Parameter | Symbol | Value/Range | Physical Meaning |
|---|---|---|---|
| Prediction horizon | ![]() |
20 | Number of future steps covered by the optimization |
| Control horizon | ![]() |
8 | Degrees of freedom for control action |
| State weighting matrix | ![]() |
![]() |
Penalty weights for position and attitude errors |
| Control weighting matrix | ![]() |
![]() |
Penalty weights for control increment changes |
| H∞ tuning factor | ![]() |
1.5 | Weighting coefficient for robustness performance term |
| Input rate constraint | ![]() |
![]() |
Maximum allowable rate of control change per channel |
| Slack penalty coefficient | ![]() |
![]() |
Penalty intensity for constraint violations |
Adaptive PID controller design
The adaptive PID control layer is implemented using a Transformer neural network architecture to enable real-time dynamic tuning of gain parameters. The core innovation lies in leveraging the attention mechanism to capture system nonlinearities and disturbance patterns, thereby addressing the performance degradation of traditional fixed-gain PID controllers under dynamic mismatch conditions. As illustrated in Fig. 3, the controller receives reference commands uref = [uϕ, uθ, uψ, uT]T from the upper-layer MPC, where each component corresponds to roll, pitch, yaw, and thrust commands, respectively. Additionally, the controller utilizes disturbance estimates d^ from the SMDOB and state feedback x.
Fig. 3.
Structure of the Transformer-based adaptive PID controller.
The control output is generated by the following adaptive PID law, as shown in Eq. (8):
![]() |
8 |
In Eq. (8), e = uref − y represents the tracking error, where y is the system output. Kp, Ki, Kd ∈ R4×4 are the time-varying gain matrices, and Kff is the feedforward disturbance rejection gain matrix25. The gain regulator is constructed based on a multi-layer encoder-decoder Transformer, with the input feature vector defined in Eq. (9):
![]() |
9 |
This feature set comprehensively captures error dynamics, system evolution, and disturbance information. As shown in Fig. 3, the Transformer network first maps the input X into a high-dimensional space via an embedding layer26. It then passes through L encoder layers, each consisting of a Multi-Head Self-Attention (MHSA) module and a Feedforward Neural Network (FFNN). The MHSA operation in the l-th layer is defined by Eqs. (10) and (11):
![]() |
10 |
![]() |
11 |
Here, headh = Attention(E(l)WhQ, E(l)WhK, E(l)WhV), dk is the key vector dimension, and H is the number of attention heads27. The final output of the Transformer network is the representation vector
of the last layer of the encoder. This vector is mapped to a normalized gain adjustment factor
through a fully connected output layer, and its calculation is shown in Eq. (12):
![]() |
12 |
and
are the weights and biases of the output layer. The tanh activation function
ensures that the adjustment factor is limited within the range of
, preventing gain mutations. Then, the adjustment factor
is divided into three parts to adjust the proportional, integral, and differential gain matrices respectively:
![]() |
13 |
![]() |
14 |
![]() |
15 |
Here,
represents the first four elements of vector
, and so on.
is a vector with all elements equal to 1, where ⨀ represents the Hadamard product28,29. This mathematical mapping ensures that the baseline gains
,
,
can be adaptively adjusted smoothly and bounded within the range defined by
,
,
based on the dynamic characteristics of the system.
Regarding network training, the Transformer gain adjuster in this study is trained offline. The training data comes from a high-fidelity simulation platform, which enables the drone to perform various flight tasks and apply different types and intensities of disturbances, thereby collecting system state, error, and corresponding optimal gain data on a large scale. The training process aims to minimize the tracking error of the reference trajectory and the change in control variables, and uses Adam optimizer for supervised learning. Once the network is trained, its parameters are fixed and deployed in the control system for online forward calculation to achieve real-time gain adjustment. This offline training strategy aims to ensure the real-time computational efficiency of the controller, while ensuring its generalization ability through training data covering a wide range of operating conditions.
The weight parameters of the Transformer network in this design (including all projection matrices such as
mentioned in the study and the weights and biases in FFNN) are obtained through offline supervised learning. The training process aims to enable the network to accurately map the optimal gain adjustment factor
based on the input feature vector
. The loss function used for training is defined in the form of mean square error, as shown in Eq. (16):
![]() |
16 |
is an ideal gain adjustment factor that is inversely tuned based on the optimal comprehensive control performance of the system through extensive simulations under various disturbances and flight scenarios, and
is the network prediction output. Use Adam optimizer to update the network weights to minimize the loss function. Once the network is trained, its parameters are fixed and forward propagation is performed during online control to calculate the gain in real-time.
In this study, all weight parameters of the Transformer neural network (including
,
,
,
,
, and weights and biases in the feedforward neural network) are initialized using Xavier uniform distribution. This initialization method automatically adjusts the initialization range based on the number of input and output neurons in each layer of the network, which helps to maintain stable gradient flow in the early stages of training and accelerate model convergence. After offline training, the parameters of the network are fixed and used for online control in all simulation cases.
To ensure fairness and reproducibility of simulation comparisons, all control methods involved in this study have their key parameters independently tuned to achieve their optimal performance. The PID controller with fixed parameters uses the same set of optimized gains in each simulation case. The specific configuration is as follows:
Traditional cascade PID controller: The gain of the outer loop position controller is
,
; The gain of the inner loop attitude controller is
,
,
.
MPC + fixed gain PID controller: Its lower-level PID controller adopts the same attitude controller gain as the cascade PID inner loop, that is
,
,
.
The adaptive PID in the method proposed here: its baseline gains
,
,
are listed in Table 2. In all simulation cases, these baseline gains serve as benchmarks for adjusting the output factors of the Transformer network, and the network dynamically fine tunes the actual gain values based on the real-time system state.
Table 2.
Parameter configuration of the Transformer-PID gain regulator.
| Parameter | Symbol | Value | Description |
|---|---|---|---|
| Input feature dimension | ![]() |
20 | Length of the feature vector |
| Embedding dimension | ![]() |
64 | Dimensionality of the input embedding space |
| Number of encoder layers | ![]() |
3 | Depth of the Transformer stack |
| Number of attention heads | ![]() |
4 | Number of parallel attention mechanisms |
| Key vector dimension | ![]() |
16 | Denominator of the self-attention scaling factor |
| Hidden layer size of FFNN | ![]() |
256 | Number of neurons in the feedforward neural network within the encoder |
| Baseline proportional gain | ![]() |
![]() |
Initial for roll/pitch/yaw/thrust channels |
| Baseline integral gain | ![]() |
![]() |
Initial for each control channel |
| Baseline derivative gain | ![]() |
![]() |
Initial Kd for each control channel |
| Gain adjustment coefficients |
, ,
|
0.6, 0.7, 0.4 | Scaling factors for the gain adjustment range |
The parameter configuration of the Transformer-PID gain regulator is presented in Table 2.
Disturbance compensation module design
The disturbance compensation module in this study comprises a SMDOB and a feedforward compensation unit. Its core function is to estimate and eliminate composite disturbances acting on the UAV system in real time. The feedforward compensation unit maps the disturbance estimates output by the SMDOB into compensation control inputs through a gain matrix and injects them directly into the execution layer of the adaptive PID control30–32. This compensation signal acts in the form of negative feedback within the control law, enabling dynamic disturbance rejection. To optimize disturbance rejection performance and suppress the inherent high-frequency chattering of sliding mode control, the compensation signal is smoothed using a first-order low-pass filter33. The filter’s cutoff frequency is tuned based on the UAV’s dynamic bandwidth and the spectral characteristics of the primary disturbances, ensuring effective noise suppression while preserving essential disturbance information.
The compensation gain matrix is designed in a diagonalized form, allowing for independent gain adjustment across channels to meet the distinct disturbance rejection requirements of roll, pitch, yaw, and thrust34,35. This module operates in coordination with the upper-layer MPC and the lower-layer adaptive PID control: the SMDOB provides feedforward disturbance rejection inputs to the adaptive PID controller, while its disturbance estimates are also fed back to the MPC layer to enhance the accuracy of receding-horizon prediction.
The key parameter configuration of the disturbance compensation module is presented in Table 3.
Table 3.
Key Parameter configuration of the disturbance compensation module.
| Parameter Category | Symbol | Value/Setting | Description |
|---|---|---|---|
| Sliding surface gain matrix | Λ (Lambda) | diag(4.2, 4.2, 5.0, 3.8) | Determines the convergence rate of the sliding variable |
| Reaching law coefficient | Κ (Kappa) | diag(1.5, 1.5, 2.0, 1.2) | Controls the amplitude of sliding motion chattering |
| Boundary layer thickness | Φ (Phi) | 0.05 | Threshold for smoothing function to suppress high-frequency vibration |
| Low-pass filter cutoff frequency | ωc | 15 rad/s | Filters out high-frequency noise from the observer |
| Feedforward compensation gain | Kff | diag(0.9, 0.9, 1.1, 0.7) | Mapping coefficient from disturbance estimates to compensation control inputs |
| Maximum disturbance estimation range | dmax | [3.0, 3.0, 4.0, 2.5]ᵀ | Saturation limits on disturbance amplitudes for each channel |
This study focuses on the controller design and validation of a typical "X" layout quadcopter unmanned aerial vehicle. Its nonlinear dynamic model is based on the Newton–Euler equation and takes into account the gyroscopic effect during low-speed flight. Define the ground inertial coordinate system
and the body coordinate system
. The six degree of freedom full state vector of the system is defined in Eq. (17):
![]() |
17 |
is the position in the inertial frame,
is the linear velocity in the inertial frame,
are the roll, pitch, and yaw angles (represented by Z-Y-X Euler angles), and
is the angular velocity in the body coordinate system.
The definition of positional dynamics is shown in Eq. (18):
![]() |
18 |
is the mass of the UAV,
is the gravitational acceleration,
is the total lift generated by the four rotors,
is the rotation matrix from the body coordinate system to the inertial coordinate system,
, and
is the external disturbance force acting on the position dynamics. The definition of attitude dynamics is shown in Eq. (19):
![]() |
19 |
is the moment of inertia matrix in the body coordinate system,
is the control torque generated by the differential of the four rotors, and
is the external disturbance torque acting on attitude dynamics.
The square of control input
and the four motor speeds
approximately satisfy Eq. (20):
![]() |
20 |
is the rotor lift coefficient,
is the anti-torque coefficient, and
is the arm length (i.e. the distance from the rotor center to the body center).
The key physical parameters of the UAV used in the simulation are set based on the standard Quadrotor model in the AirSim platform, and the specific values are shown in Table 4.
Table 4.
Key physical parameters of UAV model.
| Parameter symbols | Parameter description | Value and unit |
|---|---|---|
![]() |
The mass of UAV | 1.2 kg |
![]() |
Inertia of rotation around the X and Y axes | 0.015 kg·m2 |
![]() |
Inertia of rotation around the Z-axis | 0.028 kg·m2 |
![]() |
Arm length | 0.2 m |
![]() |
Rotor lift coefficient | 5.5e-6 N/(rad/s)2 |
![]() |
Rotor torque coefficient | 1.2e-7 N·m/(rad/s)2 |
![]() |
Gravitational acceleration | 9.81 m/s2 |
![]() |
The maximum speed of motor | 1200 rad/s |
The above models and parameters form the basis for the controller design and high-fidelity simulation verification in the AirSim platform in this study.
System stability analysis
To ensure the theoretical rigor of the proposed hybrid control architecture, this section presents a system stability theorem based on the Lyapunov method.
Theorem 1 (closed-loop system stability): Consider a closed-loop system consisting of a nonlinear dynamics model of the unmanned aerial vehicle, an upper-level MPC controller (Eqs. 1–7), a lower-level adaptive PID controller (Eqs. 8–15), and a sliding mode disturbance observer. Assuming that:
(1) The composite disturbance
experienced by the system is bounded, that is, there exists a normal number
such that
.
(2) The optimization problem of MPC is feasible at every sampling moment.
(3) The PID gain adjustment factor
mapped by the Transformer network is bounded, and the corresponding PID gains
,
,
are always within a tight set that ensures the stability of the nominal system.
(4) The observation error dynamics of the sliding mode disturbance observer are uniformly ultimately bounded within a finite time.
Then the closed-loop system is input to a stable state.
Proof: Consider the candidate Lyapunov function for Eq. (21):
![]() |
21 |
is a Lyapunov matrix related to the MPC cost function, reflecting the energy of the predicted state.
characterizes the energy of tracking error and integration error.
,
is the disturbance estimation error,
.
According to the rolling optimization properties of MPC and its constraint processing, under the assumption 2, it can be proved that there exists a
-class function
and
, and Eq. (22) can be obtained:
![]() |
22 |
For the adaptive PID loop, under the assumption of assumption 3, its error dynamics can be regarded as a nonlinear system with MPC output as the reference input. By combining the PID control law (Eq. 8) and the boundedness of the gain, Eq. (23) can be derived:
![]() |
23 |
For SMDOB, according to sliding mode control theory and assumption 4, its observation error dynamically satisfies Eq. (24):
![]() |
24 |
and
are small constants related to the disturbance boundary. Therefore, Eq. (25) is derived:
![]() |
25 |
Based on the above three parts and utilizing the boundedness of perturbations in assumption 1, it can be proved through algebraic operations that the forward difference of the entire Lyapunov function satisfies Eq. (26):
![]() |
26 |
and
are normal numbers related to the disturbance upper bound
and the observer error bound
. According to the theory of input to state stability, this inequality implies that the closed-loop system is input to state stability for bounded disturbance inputs. So far, the verification is completed.
Implementation and simulation platform configuration
The experimental validation utilizes the European Robotics Challenge Dataset (EuRoc) for cross-platform algorithm testing. The test scenarios from the EuRoc dataset are summarized in Table 5.
Table 5.
Test scenarios from the EuRoc dataset.
| Dataset Sequence | Environmental Characteristics | Dominant Disturbance Type | Dynamic Complexity |
|---|---|---|---|
| MH_01_easy | Indoor factory | Ventilation-induced airflow | Moderate |
| V1_02_medium | Underground warehouse | Vortexes in confined spaces | High |
| V2_03_difficult | Industrial workshop | Mechanical thermal convection | Extremely high |
| V1_01_easy | Indoor laboratory | Man-made wind disturbances | Low |
| V2_02_medium | Large corridor | Drafts from doors and windows | Moderate |
The configuration of the simulation runtime environment is detailed in Table 6.
Table 6.
Simulation runtime environment configuration.
| Component Type | Specifications | Functional Support |
|---|---|---|
| Computing Hardware | Intel Core i9-12900 K, NVIDIA RTX 4090 | Real-time physics engine computation |
| Operating System | Ubuntu 20.04 LTS | Low-level driver support |
| Simulation Framework | AirSim v1.8, Unreal Engine 4.27 | High-fidelity rendering and dynamics simulation |
| Control Algorithm Deployment | Python 3.8 | Hardware-in-the-loop testing for controllers |
Performance validation and analysis of the hybrid control architecture
Control accuracy and dynamic response performance
A comparative analysis of the steady-state tracking error performance is presented in Fig. 4. The proposed method achieves a root mean square error (RMSE) of 3.92 m, accounting for only 4.83% of the total path length. This performance is significantly better than the traditional cascade PID controller’s 12.35% and the MPC combined fixed gain PID’s 8.92%, with an error reduction of 17.2% compared to the latter. This improvement stems from the clear division of labor and collaborative effect between MPC and adaptive PID in the hybrid control architecture. Specifically, the main contribution of MPC controller is reflected in its rolling optimization that incorporates H∞ performance indicators, effectively suppressing state drift caused by model uncertainty. This can be confirmed by comparing the performance differences between MPC + fixed PID and traditional cascade PID. The former reduces RMSE from 8.42 m to 5.87 m, an increase of about 30%. The unique contribution of the adaptive PID controller lies in its ability to dynamically compensate for instantaneous deviations during tracking by adjusting gain parameters online through the Transformer network, thereby achieving a further performance leap on the basis of MPC + fixed PID, reducing RMSE from 5.87 m to 3.92 m and further improving it by about 33%. The MPC layer is responsible for macro level, feedforward trajectory optimization and disturbance rejection, while the adaptive PID layer is responsible for micro level, feedback-based dynamic tracking and compensation. The two work together to form a complete "prediction-tuning" control loop.
Fig. 4.

Comparative analysis of steady-state path tracking errors.
A comparison of dynamic response performance indicators is shown in Fig. 5. This method reduces the adjustment time to 2.47 s, achieving a performance improvement of 21.6% compared to the 3.15 s required by the MPC + fixed gain PID method. This acceleration effect is due to the synergistic effect of the hierarchical control architecture: the upper MPC generates the global optimal reference signal through rolling optimization, effectively avoiding the decision delay of traditional methods. Meanwhile, the adaptive PID controller based on Transformer quickly identifies system dynamics through attention mechanism and adjusts gain parameters adaptively in real time, thereby significantly reducing the delay caused by the accumulation of integral terms. The rise time has also been improved from 1.92 s to 1.42 s, with an increase of 26.0%, further verifying the advantages of the proposed method in dynamic response.
Fig. 5.

Comparative analysis of dynamic response performance metrics.
Verification of disturbance rejection and robustness enhancement mechanisms
The quantitative analysis of robustness performance metrics is presented in Fig. 6. The proposed method achieves a Disturbance Rejection Ratio (DRR) of 0.92, representing a 17.3% improvement in steady-state robustness compared to the baseline method. This enhancement primarily stems from the triple-layer disturbance rejection mechanisms: the H-infinity optimization strengthens the robustness margin against parameter perturbations; the SMDOB enables finite-time estimation of sudden disturbances; and the feedforward compensation module injects disturbance estimates directly into the control law, forming a closed-loop disturbance rejection structure. Together, these mechanisms ensure system stability within a ± 25% parameter perturbation range.
Fig. 6.

Quantitative analysis of robustness performance metrics.
Analysis of key module contributions
The results of the ablation experiments are illustrated in Fig. 7. The ablation study shows that removing the Transformer gain regulator causes the position RMSE to increase by 49%, while disabling the SMDOB module results in a 207% increase in attitude oscillations. These findings confirm the indispensability of each submodule: the Transformer network precisely captures nonlinear dynamic features through its attention weight dynamic allocation mechanism, whereas the SMDOB employs the equivalent control principle to generate high-accuracy disturbance estimates. The absence of either module leads to increased control signal chattering and prolonged recovery time.
Fig. 7.

Analysis of ablation experiment results.
Evaluation of applicability in complex engineering scenarios
The comprehensive performance evaluation in the urban canyon scenario is shown in Fig. 8. In this scenario, the proposed method achieves a task success rate of 98.5%, significantly outperforming alternatives, with disturbance rejection and response speed scores of 9.0 and 8.8, respectively. This advantage derives from the architecture’s adaptability to complex disturbances: the MPC layer avoids state boundary violations caused by buildings through constraint handling; the gain regulator of the adaptive PID controller compensates in real time for dynamic mismatches induced by vortex wind fields; and the SMDOB effectively suppresses airflow sudden changes in confined spaces. Together, these mechanisms ensure control reliability under extreme environmental conditions.
Fig. 8.

Comprehensive performance evaluation in urban canyon scenario.
Conclusion
This study addresses the core issues of insufficient collaborative optimization mechanisms and limited adaptive capabilities of existing MPC-PID hybrid or adaptive PID frameworks in dealing with complex disturbances and model uncertainties. A hybrid control architecture that deeply integrates MPC, Transformer-based adaptive PID, and sliding mode disturbance observer is proposed and systematically verified. Theoretical and experimental results indicate that this architecture effectively addresses the robustness shortcomings of traditional methods. Compared with the method of MPC combined with fixed gain PID, the proposed scheme significantly reduces the RMSE of steady-state path tracking from 5.87 m to 3.92 m, with an accuracy improvement of about 33%. Moreover, the system adjustment time is shortened from 3.15 s to 2.47 s, and the dynamic response speed is accelerated by about 21.6%. In terms of robustness, the disturbance suppression ratio reaches 0.92, an improvement of 17.3% compared to the benchmark method, and can tolerate up to 25% of system parameter perturbations. These quantified performance improvements confirm that the introduction of attention mechanism to achieve online dynamic tuning of PID gain, and deep collaboration with MPC with H∞ robust optimization and disturbance observer with feedforward compensation, can systematically solve the control problem under the coexistence of model mismatch and external disturbances. The core contribution of this study lies in the construction of a multi-level collaborative control mechanism with a "prediction-learning-compensation" closed-loop. This mechanism provides a systematic new solution for achieving high-precision control of unmanned aerial vehicles in highly uncertain environments, and its design framework can also be extended to robust control of other unmanned dynamic systems.
However, this study has several limitations. First, the real-time performance of the hybrid controller depends on high-performance computing platforms, requiring further optimization for deployment on embedded devices. Second, the Transformer network training data covers limited scenarios, and its generalization capability for extreme, untrained disturbance patterns needs enhancement. Third, the current validation is focused on simulation environments and dataset testing, necessitating real-flight experiments to verify engineering robustness. Future work will focus on three aspects: (1) developing lightweight neural network architectures to reduce computational complexity and better suit onboard hardware; (2) integrating reinforcement learning to enable online self-evolution of the controller under unknown disturbances; and (3) constructing multi-UAV collaborative testing platforms to validate disturbance rejection strategies in swarm flight. The results of this study provide key technical support for autonomous control of intelligent unmanned systems in complex tasks such as logistics, inspection, and disaster response, and the design framework can also be extended to robust control of dynamic systems such as unmanned ground vehicles and robots.
Supplementary Information
Author contributions
W.Z. drafted the initial manuscript text and designed the study framework. L.Z. conducted data collection and preliminary analysis. T.Y. supervised the research process and provided critical revisions on the methodology section. R.C. prepared Figs. 1–8 and compiled supplementary data tables. D.L. reviewed the final manuscript for scientific accuracy and contributed to the discussion section. All authors approved the final version of the manuscript.
Funding
This work was sponsored in part by National Natural Science Foundation of China: Research on the Stability and Bifurcation Behavior of Helicopter System Aerolastic Response (No.11702240) and National Natural Science Foundation of China: Research on the Physical Mechanism and Method of Dynamic Instability of Helicopter Rotor/Fuselage Coupling (No.11547215).
Data availability
The data that support the findings are available from corresponding author upon reasonable request.
Declarations
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
References
- 1.Yavari, M., Gupta, K. & Mehrandezh, M. Interleaved predictive control and planning for an unmanned aerial manipulator with on-the-fly rapid re-planning in unknown environments. IEEE Trans. Autom. Sci. Eng.20(3), 1690–1705 (2022). [Google Scholar]
- 2.Meda-Campaña, J. A. et al. Energy-Efficient hybrid PID Control with exponential trajectories for smooth setpoint transitions: Applications in robotics and aeronautics. Appl. Sci.15(13), 7223 (2025). [Google Scholar]
- 3.Hu, Y. et al. D-tracking: Digital twin enabled trajectory tracking system of autonomous vehicles. IEEE Trans. Veh. Technol.73(11), 16457–16469 (2024). [Google Scholar]
- 4.Kurnaz, M. K., Olmez, Y. & Koca, G. O. Altitude control of quadrotor based on metaheuristic methods. Int. J. Innov. Eng. Appl.9(1), 37–46 (2025). [Google Scholar]
- 5.Li, X. et al. Converter inlet temperature control in flue gas acid-making process based on equivalent input disturbance and model prediction. Optim. Control Appl. Methods44(4), 2093–2111 (2023). [Google Scholar]
- 6.Lops, G. et al. A deep deterministic policy gradient control algorithm for automatic insulin delivery. IFAC-PapersOnLine59(2), 13–18 (2025). [Google Scholar]
- 7.Song, D. et al. An air supply system regulation method for PEMFCs based on disturbance observation and MPC control. Proc. Inst. Mech. Eng., Part D: J. Auto. Eng.238(9), 2672–2684 (2024). [Google Scholar]
- 8.Uralde, J. et al. Ultraprecise controller for piezoelectric actuators based on deep learning and model predictive control. Sensors23(3), 1690 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Luo, Q. et al. Model-free predictive trajectory tracking control and obstacle avoidance for unmanned surface vehicle with uncertainty and unknown disturbances via model-free extended state observer. Int. J. Control Autom. Syst.22(6), 1985–1997 (2024). [Google Scholar]
- 10.Okasha, M., Kralev, J. & Islam, M. Design and experimental comparison of pid, lqr and mpc stabilizing controllers for parrot mambo mini-drone. Aerospace9(6), 298 (2022). [Google Scholar]
- 11.Feng, Z. et al. Learning hybrid policies for MPC with application to drone flight in unknown dynamic environments. Unmanned Syst.12(02), 429–441 (2024). [Google Scholar]
- 12.Fang, Y. et al. Advanced MPC controller with disturbance suppression and input delay compensation for spherical quadrotor UAV. Eng. Lett.33(4), p1115 (2025). [Google Scholar]
- 13.Uyar, O. & Gradient-Based, M. P. C. Controller for one DOF copter control. Int. J. Appl. Methods Electron. Comput.12(4), 97–103 (2024). [Google Scholar]
- 14.Alqudsi, Y. S. et al. Enhancing aerial robots performance through robust hybrid control and metaheuristic optimization of controller parameters. Neural Comput. Appl.36(1), 413–424 (2024). [Google Scholar]
- 15.Basil, N. et al. Performance analysis of hybrid optimization approach for UAV path planning control using FOPID-TID controller and HAOAROA algorithm. Sci. Rep.15(1), 4840 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 16.Abbas, N. et al. Survey of advanced nonlinear control strategies for UAVs: Integration of sensors and hybrid techniques. Sensors24(11), 3286 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Bauersfeld, L. et al. MPC flight control for a tilt-rotor VTOL aircraft. IEEE Trans. Aerosp. Electron. Syst.57(4), 2395–2409 (2021). [Google Scholar]
- 18.Xu, Z. et al. A robust disturbance-rejection controller using model predictive control for quadrotor UAV in tracking aggressive trajectory. Drones7(9), 557 (2023). [Google Scholar]
- 19.Sha’aban, Y. A. The effect of dead-time and damping ratio on the relative performance of MPC and PID on second order systems. Appl. Sci.13(2), 1138 (2023). [Google Scholar]
- 20.Soleimani, E., Nikoofard, A. & Nejabat, E. Cascade explicit tube model predictive controller: Application for a multi-robot system. Control Theory Technol.23(2), 237–252 (2025). [Google Scholar]
- 21.Zhang, Q. et al. Wave heave compensation based on an optimized backstepping control method. China Ocean Eng.36(6), 959–968 (2022). [Google Scholar]
- 22.Martínez-Vera, E., Bañuelos-Sánchez, P. & Etcheverry, G. Comparative examination of control strategies in dc-dc power converters: A traditional and artificial intelligence perspective. J. Intell Syst. Control2(2), 82–98 (2023). [Google Scholar]
- 23.Mei, Y. et al. High precision height control for wing-in-ground crafts. Int. J. Aerosp. Eng.2022(1), 3839100 (2022). [Google Scholar]
- 24.Wan, X. Zone model predictive control with ellipsoid softing target in chemical processes. Processes12(8), 1611 (2024). [Google Scholar]
- 25.Huang, Y. S. et al. Evaluation of a combined MHE-NMPC approach to handle plant-model mismatch in a rotary tablet press. Processes9(9), 1612 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.Alawad, N. A., Humaidi, A. J. & Alaraji, A. S. Observer sliding mode control design for lower exoskeleton system: Rehabilitation case. J. Robot. Control (JRC)3(4), 476–482 (2022). [Google Scholar]
- 27.Xu, H. et al. A survey on digital twin for industrial internet of things: Applications, technologies and tools. IEEE Commun. Surv. Tutor.25(4), 2569–2598 (2023). [Google Scholar]
- 28.Liu, Z. et al. Assembly-oriented finite-time coordinated control of underactuated dual rotary cranes for payload position and attitude regulation. IEEE Trans. Autom. Sci. Eng.21(3), 3678–3690 (2023). [Google Scholar]
- 29.Jiang, Y. et al. Leveraging modular architecture for bug characterization and analysis in automated driving software. ACM Trans. Softw. Eng. Methodol.34(4), 1–31 (2025). [Google Scholar]
- 30.Okulski, M. & Ławryńczuk, M. How much energy do we need to fly with greater agility? Energy consumption and performance of an attitude stabilization controller in a quadcopter drone: A modified MPC vs. PID. Energies15(4), 1380 (2022). [Google Scholar]
- 31.Martínez-León, A. S., Jatsun, S. & Emelyanova, O. Investigation of wind effects on UAV adaptive PID based MPC control system. Enfoque UTE15(2), 36–47 (2024). [Google Scholar]
- 32.Noordin, A., Mohd Basri, M. A. & Mohamed, Z. Real-time implementation of an adaptive PID controller for the quadrotor MAV embedded flight control system. Aerospace10(1), 59 (2023). [Google Scholar]
- 33.Noordin, A., Mohd Basri, M. A. & Mohamed, Z. Adaptive pid control via sliding mode for position tracking of quadrotor mav: Simulation and real-time experiment evaluation. Aerospace10(6), 512 (2023). [Google Scholar]
- 34.Borbolla-Burillo, P. et al. Design and real-time implementation of a cascaded model predictive control architecture for unmanned aerial vehicles. Mathematics12(5), 739 (2024). [Google Scholar]
- 35.Sadi, M. A., Jamali, A. & Abang Kamaruddin, A. M. N. Optimizing UAV performance in turbulent environments using cascaded model predictive control algorithm and Pixhawk hardware. J. Braz. Soc. Mech. Sci. Eng.47(8), 396 (2025). [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
The data that support the findings are available from corresponding author upon reasonable request.

































































