Skip to main content
Sensors (Basel, Switzerland) logoLink to Sensors (Basel, Switzerland)
. 2025 Nov 18;25(22):7032. doi: 10.3390/s25227032

A Hierarchical PSMC–LQR Control Framework for Accurate Quadrotor Trajectory Tracking

Shiliang Chen 1, Xinyu Zhu 1, Yichao Fang 1, Yucheng Zhan 1, Dan Han 1,2,3,*, Yun Qiu 1, Yaru Sun 1
PMCID: PMC12656249  PMID: 41305239

Abstract

Accurate trajectory tracking of quadrotor UAVs remains challenging due to highly nonlinear dynamics, model uncertainties, and time-varying external disturbances, which make it difficult to achieve both precise position tracking and stable attitude regulation under control constraints. To tackle these coupled problems, this paper develops a hierarchical control framework in which the outer-loop particle swarm optimization (PSO)-compensated model predictive controller (PSMC) adaptively mitigates prediction errors and enhances robustness, while the inner-loop enhanced linear quadratic regulator (LQR), augmented with gain scheduling and control-rate relaxation, accelerates attitude convergence and ensures smooth control actions under varying flight conditions. A Lyapunov-based stability analysis is conducted to ensure closed-loop convergence. Simulation results on a helical reference trajectory show that, compared with the conventional MPC–LQR baseline, the proposed framework reduces the mean tracking errors by more than 13.2%, 17.1%, and 28% in the x-, y-, and z-directions under calm conditions, and by more than 34%, 26.2%, and 46.8% under wind disturbances. These results prove that the proposed hierarchical PSMC–LQR framework achieves superior trajectory tracking accuracy, strong robustness, and high practical implement ability for quadrotor control applications.

Keywords: trajectory tracking, nonlinear system, disturbance rejection control, model predictive control, particle swarm optimization, linear quadratic regulator

1. Introduction

In recent decades, significant progress has been made in the development of quadrotor unmanned aerial vehicles (UAVs). Owing to their low cost, compact size, lightweight structure, high maneuverability, vertical take-off and landing (VTOL) capability, enhanced payload capacity, and ability to operate in harsh environments, UAVs have gained widespread popularity [1]. The quadrotor UAV is a typically underactuated and strongly coupled system with four inputs and six outputs, making it an underactuated system [2]. In the design of its control system, position and attitude dynamics are usually decoupled using a hierarchical control structure, where the outer loop is responsible for position control and the inner loop for attitude stabilization. However, during actual flight, a quadrotor is often subjected to various unknown disturbances, which pose significant challenges to controller design. External disturbances can cause instability or even divergence in the control system, potentially resulting in severe damage to the UAV. Therefore, improving the disturbance rejection capability of a quadrotor is crucial not only for achieving precise trajectory tracking but also for ensuring flight safety [3].

To address the trajectory tracking problem of quadrotor UAVs, several advanced control strategies have been developed, including proportional-integral-derivative (PID) control [4], robust control [5], sliding mode control (SMC) [6,7,8], and backstepping control (BC) [9,10]. However, some of these approaches lack robustness against external disturbances, while others achieve robustness at the expense of control performance. In addition, several robust control approaches have been developed to simultaneously address disturbances and uncertainties [11,12]. These works provide valuable insights into compensation mechanisms under uncertain dynamics. Recent improvements such as adaptive fractional-order sliding modes, disturbance-observer enhanced SMC, and finite-time convergence methods yield better robustness but still often suffer from chattering, limited convergence speed, or sensitivity to gain tuning [13,14]. Hybrid control strategies and learning-based flight control theories, such as neural networks [15] and fuzzy logic [16], have also been developed for quadrotor UAV control. These control methods offer flexibility and adaptability for quadrotor UAV control but suffer from several notable drawbacks. Neural network controllers typically lack formal stability guarantees, require large and representative training datasets, and involve complex tuning of hyperparameters, making them difficult to generalize and validate. Fuzzy logic controllers, on the other hand, heavily rely on expert-defined rules and membership functions, lack rigorous stability analysis, and often exhibit limited tracking precision and high computational cost. These limitations hinder their reliability in high-precision and safety-critical UAV applications [17,18].

MPC has been widely applied to UAV trajectory tracking due to its ability to predict future behavior based on reference information, explicitly handle system constraints, and leverage well-established theoretical frameworks that provide guarantees on closed-loop performance [19]. A common feature in many quadrotor control approaches is the use of a cascaded control architecture, where attitude control (inner loop) is decoupled from position and velocity control (outer loop) [20]. In ref. [21], a strategy combining a thrust-prioritized inner-loop controller with an outer-loop controller that satisfies certain state constraints is proposed; however, it also lacks formal guarantees of stability and convergence. To overcome the limitations of designing controllers for highly nonlinear systems such as quadrotors using linear representations, nonlinear model predictive control (NMPC) strategies have been extensively employed [22]. In ref. [23], NMPC is utilized to avoid obstacles in cluttered environments while executing high-speed trajectories, considering both input and state constraints. In ref. [24], NMPC is compared with differential flatness-based control (DFBC) using an incremental nonlinear dynamic inversion method. Results, with and without an inner-loop controller, show that NMPC achieves better performance than DFBC, at the expense of higher computational cost. While these methods show impressive high-speed tracking performance in real experiments, they lack formal stability guarantees, leading to failures during aggressive maneuvers. Additionally, the feasibility of the NMPC algorithm is not ensured, causing potentially unpredictable and unstable behavior.

LQR has been effectively applied to a wide range of complex systems, such as double-inverted pendulums, fuel cell systems, vibration control systems, and electric vehicles. It has also been widely adopted in robotic trajectory tracking control [25,26,27]. The quadratic cost function of the LQR controller consists of two weighting matrices, namely the Q and R matrices. The Q matrix is associated with the trajectory deviation of the state variables, while the R matrix relates to control effort and actuator saturation. A key challenge in the real-time application of the LQR optimal controller lies in the effective selection of the Q and R weighting matrices [28], which inherently involves trade-offs and is typically tuned through a trial-and-error process.

Despite the significant progress in quadrotor control, three major challenges still hinder accurate trajectory tracking in practical scenarios. First, the inherently nonlinear and strongly coupled dynamics complicate controller design and make linear assumptions insufficient for aggressive or fast maneuvers [29]. Second, external disturbances and model uncertainties, such as aerodynamic effects, unmodeled dynamics, and time-varying flight conditions, can severely degrade tracking performance if not properly compensated [30]. Third, state and input constraints impose additional limitations on controller execution, particularly when rapid response and smooth control allocation are required [31]. These issues motivate the development of a hierarchical control framework that can simultaneously address prediction accuracy, robustness enhancement, and attitude stabilization within a unified structure.

To address the limitations of existing methods, this paper proposes a hierarchical PSMC–LQR control framework. A PSO-based compensation mechanism is integrated into the outer-loop MPC to correct prediction mismatches and enhance robustness against model uncertainties and disturbances. In the inner loop, an LQR controller is augmented with gain scheduling and control-rate relaxation to improve attitude convergence and smooth actuation under varying flight conditions. This hierarchical design leverages the predictive optimization ability of MPC, the adaptive error correction of the PSO-based compensator, and the fast stabilization of the enhanced LQR. In addition, the proposed framework ensures closed-loop stability through Lyapunov-based analysis and maintains moderate computational complexity suitable for practical deployment. The main contributions of this work are summarized as follows:

  • A hierarchical control architecture is developed, in which a model predictive controller is coupled with a PSO-based compensator in the outer loop, and an enhanced LQR with gain scheduling and rate relaxation is employed in the inner loop. This structure decouples position and attitude control while improving adaptability to time-varying disturbances.

  • A PSO-compensated MPC (PSMC) scheme is designed to correct prediction mismatches and suppress external perturbations. By iteratively optimizing compensation terms based on tracking error feedback, the outer-loop control improves robustness without increasing the MPC horizon or computational load.

  • An inner-loop LQR is augmented with gain scheduling and control-rate relaxation to enhance attitude convergence and reduce actuator fluctuation. The former adapts feedback gains online according to the system state, while the latter smooths control updates to avoid excessive rate changes. This combination accelerates tracking response and improves stability under uncertain conditions.

We have organized the paper as follows. In Section 2, the nonlinear dynamics of the quadrotor are introduced, and a discrete-time, control-oriented model is derived for use in predictive control. Section 3 presents the proposed hierarchical PSMC–LQR control framework, including the outer-loop PSMC-based position controller and the inner-loop LQR-based attitude stabilizer. In Section 4, the closed-loop stability of the proposed hierarchical controller is analyzed using a discrete-time Lyapunov framework. In Section 5, extensive simulation results are provided to evaluate tracking performance, disturbance rejection, and computational complexity of the proposed method in comparison with two baseline schemes. In Section 6, concluding remarks are drawn and directions for future work are discussed.

2. System Modeling and Problem

2.1. Quadrotor Dynamics

A quadrotor helicopter is a type of multi-rotor aircraft equipped with four fixed-pitch propellers mounted symmetrically on a cross-shaped frame, as illustrated in Figure 1. Propeller pairs (1, 3) rotate clockwise, while pairs (2, 4) rotate counterclockwise, which ensures that the overall rotational torque is balanced [32]. Additionally, the thrust generated by each propeller is aligned in the same upward direction, contributing to stable lift generation. Based on the structural characteristics of the quadrotor, the following assumptions are made [33]:

  1. The quadrotor is modeled as a rigid body with constant mass and moment of inertia.

  2. The center of mass of the UAV remains fixed and coincides with the geometric center of the frame.

  3. The UAV is subjected only to gravitational force and thrust generated by the propellers, while aerodynamic drag is neglected.

Figure 1.

Figure 1

The body frame and the inertial (Earth) frame, where “E” denotes the origin of the inertial frame.

Based on the Newton–Euler method, the nonlinear dynamic model of the quadrotor UAV is formulated as follows:

ϕ¨=IyIzIxθ˙ψ˙+IrIxθ˙ωsum+1IxU2θ¨=IzIxIyϕ˙ψ˙IrIyϕ˙ωsum+1IyU3ψ¨=IxIyIzϕ˙θ˙+1IzU4x¨=U1msinθcosϕcosψ+sinϕsinψy¨=U1msinθcosϕsinψsinϕcosψz¨=U1mcosθcosϕ+g (1)

In the equations, ϕ,θ, and ψ represent the roll, pitch, and yaw angles of the quadrotor, respectively; x, y and z denote the quadrotor’s position in the three-dimensional Cartesian space. Ix, Iy,Iz are the moments of inertia of the UAV, respectively, and Ir is the rotational inertia of the rotor, g denotes the acceleration due to gravity. ωsum  is the algebraic sum of the angular velocities of the four rotors, defined as ωsum=ω1ω2+ω3ω4, where ω1, ω2, ω3, ω4 are the rotational speeds of the four propellers. U1, U2, U3, U4 represent the total thrust, roll torque, pitch torque, and yaw torque generated by the UAV, respectively, and are defined as follows:

U1=bω12+ω22+ω32+ω42U2=lb22ω12+22ω22+22ω3222ω42U3=lb22ω1222ω22+22ω3222ω42U4=dω12+ω22ω32ω42 (2)

where b is the thrust coefficient of the rotor, d is the drag coefficient of the rotor, and l is the distance from the rotor axis to the quadrotor’s center of mass.

2.2. Problem Formulation

To formalize the control problem, consider a quadrotor system represented by a continuous nonlinear state-space model of the form:

x˙t=fxt,ut+dt (3)

where xtR6 is the state vector comprising position and velocity components in the inertial frame, utR3 is the control input (translational force vector), and dtR6 represents unknown but bounded external disturbances. In this paper, the external disturbance term d(t) represents physical effects such as wind gusts, airflow fluctuations, and unmodeled aerodynamic forces that act on the translational dynamics of the UAV. These perturbations are introduced into the system as bounded additive forces and later instantiated as harmonic wind disturbances in Section 5.

Let the desired trajectory be defined by a smooth reference signal:

ζdt=[xdt  ydtzdtx˙dty˙dtz˙dt]T (4)

The tracking error is defined as:

et=ζtζdt (5)

The discrete-time error dynamics, obtained via zero-order hold discretization with sampling interval Δt, can be expressed as:

ek+1=Adek+Bduk+dk (6)

where Ad and Bd are the linearized and discretized state-space matrices, and dk denotes the bounded disturbance at time step k. The objective of control is to design a stabilizing controller uk such that:

  • The tracking error ek0 asymptotically or remains bounded within a small neighborhood.

  • State and input constraints are satisfied: xkX and ukU.

  • The controller is suitable for real-time embedded implementation.

Mathematically, the problem is formulated as:

minu0,uN1N1 ek+i2Q+uk+i2Rs.t.          ek+i+1=Adek+i+Bduk+i+dk+i                      xk+iX,uk+iU,i[0,N1] (7)

where Q>0 and R>0 are weight matrices, X and U represent feasible state and input sets, and N is the prediction horizon. This formulation serves as the foundation for the development of the outer-loop PSMC and the inner-loop LQR controller, as elaborated in subsequent sections.

The continuous-time quadrotor model is discretized using zero-order hold assumptions to facilitate predictive control design. The detailed linearization and discretization procedure is provided in Appendix A.

3. Hierarchical Control Architecture and Controller Design

3.1. Hierarchical Control Architecture

To achieve real-time and robust trajectory tracking under disturbances and constraints, a hierarchical control architecture is established, consisting of an outer-loop trajectory controller and an inner-loop attitude stabilizer, as illustrated in Figure 2. This cascaded structure follows the principle of time-scale separation: the outer loop operates at a slower update rate to plan motion in the position domain, while the inner loop runs at a faster rate to stabilize attitude dynamics and ensure rapid torque response. Such decomposition not only simplifies controller design for the inherently nonlinear quadrotor system but also enhances robustness and computational efficiency during onboard execution.

Figure 2.

Figure 2

Detailed module-level signal-flow diagram of the hierarchical PSMC–LQR controller.

In this architecture, the outer loop employs a PSO-compensated MPC framework. Its primary task is to compute optimal thrust and attitude references that minimize position-tracking errors while satisfying input and state constraints. Let the position state vector be γ=[x,y,z]T, and the desired reference trajectory be γd=[xd,yd,zd]T. The tracking error is defined as: ek=γkγd,k, and the outer loop solves the following quadratic optimization problem at each sampling instant:

uMPC=arg minu i=0N1 ek+iQ2+uk+iR2 (8)

subject to discrete-time linearized system dynamics and input/state constraints. To enhance adaptability, a PSO-based compensation module is introduced to dynamically adjust the MPC solution, yielding the refined control signal:

uk*=uMPC+ΔuPSO (9)

This optimized control signal is then transformed through inverse kinematics into the desired attitude command σd=[ϕd,θd,ψd]T, which serves as the reference input to the inner loop. The inner-loop controller utilizes an LQR to stabilize the quadrotor’s rotational dynamics. Its control law is defined as:

τ=KLQR(σσd) (10)

where σ=[ϕ, θ, ψ]T is the measured attitude vector, and KLQR is the gain matrix designed through optimization and augmented with gain scheduling and control-rate relaxation to adapt to different flight regimes. The inner loop ensures fast attitude convergence, smooth actuation, and effective disturbance rejection, which in turn improves the accuracy and stability of the outer-loop trajectory tracking.

In summary, the proposed hierarchical PSMC–LQR architecture establishes a clear division of control responsibilities:

  • The outer loop focuses on trajectory planning, constraint handling, and robustness enhancement through adaptive optimization.

  • The inner loop guarantees high-bandwidth attitude stabilization and torque control.

The bidirectional information flow—where the outer loop provides desired attitude and thrusts references, and the inner loop returns stabilized attitude feedback—forms a cooperative closed-loop system. This integration achieves precise position tracking, strong disturbance tolerance, and low-latency computation, making the framework highly suitable for real-time embedded flight control.

3.2. Outer-Loop Controller

To enhance the effectiveness of the outer-loop position controller, which is implemented using a PSMC framework, the PSO algorithm is introduced as an auxiliary adaptive module. The conventional MPC component provides nominal trajectory optimization, while the PSO compensator performs real-time correction to mitigate prediction errors arising from model inaccuracies and unmodeled disturbances. This cooperative design improves the robustness and adaptability of the outer loop without increasing the prediction horizon or tightening the control constraints. Therefore, PSO is discussed separately in the following subsection to elucidate its optimization mechanism.

3.2.1. Particle Swarm Optimization

PSO algorithm, inspired by the foraging behavior of bird flocks [34], enables a disordered population to evolve into an organized system through information sharing among individuals, thereby searching for feasible solutions in the solution space. In PSO, each potential solution to the optimization problem is represented by a particle in the search space. During each iteration, the fitness value of a particle’s position is evaluated based on the objective function. The particle then updates its velocity and trajectory based on both its own best-known position and the global best-known position discovered by the swarm. Let the number of decision variables be D; then each particle can be represented as a D-dimensional vector. The position and velocity of the ith particle are defined as:

Xi=xi1,xi1,,xiD (11)
Vi=vi1,vi1,,viD (12)

The particle velocity update equation is given by:

vidn+1=ωvidn+c1r1nPbestidnxidn+c2r2nGbestidnxidn (13)
νminνidnνmax (14)

The particle position update equation is given by:

xidn+1=xidn+vidn+1 (15)

In the particle velocity update equation, vidn+1 denotes the velocity of the ith particle in the dth dimension at iteration n+1, and νidn represents its velocity at iteration n. The values νmin and νmax define the lower and upper bounds of the particle velocity, respectively. Pbestidn refers to the best historical position of the ith particle in the dth dimension up to iteration n, while Gbestidn denotes the global best position of the entire swarm up to iteration n.

The swarm consists of N particles, where i=1, 2,,N, and each particle has D decision variables, indexed by d=1, 2,,D. The parameters c1 and c2 are cognitive and social learning factors, respectively. c1 governs the tendency of a particle to move toward its own best position Pbest, while c2 influences movement toward the global best position Gbest. The terms r1n and r2n are random numbers uniformly distributed in the range [0, 1], introduced to provide stochastic behavior in the search process.

The inertia weight ω regulates the trade-off between global and local exploration capabilities. A larger value of ω encourages global exploration and helps the particles escape local optima, whereas a smaller value leads to faster convergence and promotes local search. Typically, ω is selected within the range [0, 1].

In this study, a linearly decreasing strategy is employed to dynamically adjust the inertia weight. A relatively large inertia weight at the early stages of the algorithm enhances the global search capability, while gradually reducing the inertia weight as iterations proceed facilitate faster convergence to the global optimum. The inertia weight is updated according to the following equation:

ω=ωmaxωmaxωminnmaxn (16)

where ωmax denotes the initial inertia weight, ωmin represents the final inertia weight, and nmax is the maximum number of iterations.

The general procedure of the PSO algorithm is summarized in Algorithm 1.

Algorithm 1. Particle Swarm Optimization Procedure
Input: Objective function f(x), number of particles N, dimension D, inertia weight ω, acceleration coefficients c1, c2, max iterations  Tmax
    Initialize particle positions xi RD and velocities viRD for i = 1 to N
    Initialize personal bests pbestxi, evaluate  f(pbesti)
       Set  gbestargmini·f(pbesti)
For t = 1  to Tmax 
DO
  For  i = 1  to N
  DO
        Update velocity viωvi+c1randpbestixi+c2randgbestixi
        Update position xi  xi + vi
        Evaluate fitness f(xi)
        If f(xi) < f(pbesti) then
          pbesti xi
        If f(pbesti) < f(gbest) then
           gbest  pbesti
        END IF
     END IF
   END FOR
  END FOR
return gbest, fgbest
Output: Global best position gbest and value f(gbest)

3.2.2. PSMC Outer-Loop Controller

In this section, a PSMC outer-loop controller is developed by integrating an MPC framework with a PSO-based compensator. The MPC component determines the optimal control input at each time step through a combination of model prediction, rolling horizon optimization, and feedback correction, enabling anticipative and constraint-aware control. To enhance the system’s adaptability to dynamic and uncertain environments, the PSO-based compensator evaluates the current quadrotor state in real time and provides online compensation to the MPC-generated control signals. This integrated design improves the controller’s robustness and tracking accuracy under varying operational conditions. In addition to external disturbances, the quadrotor model may also exhibit parametric uncertainties arising from factors such as unmodeled aerodynamics, actuator imperfections, or deviations in physical parameters. In this work, these uncertainties are treated implicitly as part of the overall disturbance input and are not modeled separately. The robustness of the proposed controller against such effects is reflected through the compensative structure of the outer-loop and validated in the simulation results of Section 5.

For the position dynamics model of a quadrotor, the design can be divided into two components: the first involves generating vertical thrust U1t through the rotors; the second involves controlling the UAV’s motion in the x and y directions by adjusting the direction of this thrust. The spatial position state equation of the UAV system is defined as ξt=[x(t) x˙(t) y(t) y˙(t) z(t) z˙(t)]T, where xt, yt and zt represent the position coordinates of the UAV in the inertial (ground-fixed) frame, and x˙t, y˙t and z˙t represent the corresponding velocity components. The motion equations can be reformulated as follows:

ξ˙t=fξt,uξt=x˙tU1tmuxt+dfxtmy˙tU1tmuyt+dfytmz˙tg+U1tmcosφtcosθt+dfztm (17)

where

uxt=cosψtsinθtcosφt+sinψtsinφt (18)
uyt=sinψtsinθtcosφtcosψtsinφt (19)

For a given reference trajectory, it is assumed to satisfy the following state equation:

ξ¯˙rt=fξ¯rt,uξrt (20)

where ξ¯r(t)=[xrt  x˙rt yrt y˙rt zrt z˙r(t)]T denotes the reference state vector, and uξrt=uxruyrU1rT represents the corresponding reference control input vector. The reference inputs are defined as follows:

uxr=mx¨rtU1t,    U1rt=mz¨rt+gcosθtcosϕt,    uyr=my¨rtU1t (21)

To derive the error dynamics of the system, define the state error vector as ξ¯~t=ξ¯tξ¯rt, and the control input error as u~ξt=u~ξtu~ξrt. The resulting state-space error dynamics can then be expressed as shown in Equation (17):

ξ¯~˙t=Atξ¯~t+Btu~ξt (22)

where At and Bt denote the system Jacobian matrices. To achieve zero-error tracking of the given reference trajectory, an integral term of the state error variable is introduced, and the equation is extended accordingly as follows:

xξt=x~tx˙~tx~tdty~ty˙~ty~tdtz~tz˙~tz~tdt=xtxrtxtx˙rtxtxrtdtytyrty˙ty˙rtytyrtdtztzrtz˙tz˙rtztzrtdt (23)

based on the Euler method, the deviation prediction model can be represented as the following discrete-time calibrated system:

xξk+1=A¯kxξk+B¯ku~ξk (24)

The state variable xξt is decomposed into motion control in the z direction and motion control in the x and y directions, i.e.,

xzk+1=A¯zkxξzk+B¯zku~ξzk (25)
xxyk+1=A¯xykxξxyk+B¯xyku~ξxyk (26)

where

A¯z=1Δt0010Δt01, B¯z0Δtmcosθkcosφk0 (27)
A¯xy=1Δt0000010000Δt010000001Δt0000010000Δt01 (28)
B¯xy=00ΔtmU1k000000ΔtmU1k00 (29)

For the altitude subsystem in the z direction, the cost function of the MPC controller is formulated as shown in Equation (30):

Jz=x^ξzx^ξrzTQzx^ξzx^ξrz+u~^ξzu~^ξrzTRzu~^ξzu~^ξrz (30)

where Qz and Rz represent the weighting matrices for the state variables and control inputs, respectively, and are both positive definite diagonal matrices, and QzRNz×Nz, RzRNu×Nu, and Nz denotes the prediction horizon and Nu the control horizon. The state prediction vector is defined as x^ξz[x^ξzT(k+1|k)x^ξzT(k+Nz|k)]T, and the control input vector is defined as u^ξz[u^ξzT(k|k)u^ξzT(k+Nu1|k)]T. The predicted discrete-time state trajectory can be computed as follows:

x^ξzk+1k=PZkkxξzkk+HZkku~^ξzkk (31)

where u~ξzkk=U1kU1rk. The reference deviation state vector and the reference deviation control vector are defined as follows:

x^ξrz=xξrzk+1|kxξrzk|kxξrzk+Nz1|kxξrzk|k (32)
u^ξrz=U1rkkU1rk1|kU1rk+Nu1|kU1rk|k (33)

By optimizing the performance index Jz, the control input for the deviation model of the altitude controller can be obtained as:

u~^ξz=HzTQzHz+Rz1·HzTQzx^ξrzkPzx^ξzk+Rzu~^ξrz (34)

Under the influence of environmental disturbances and noise, the compensation value Δu is defined as the particle of the PSO population. The fitness function is designed in the following form:

f=ek2+λ·ΔU12+Penaltyg (35)

where ek=zrtzt represents the tracking error in the z direction. The term λ denotes the weight coefficient of the compensation input, defined as λ=λ0·1+e˙k, which allows for dynamic adjustment of the weight. This design prioritizes error suppression by reducing the weight of the compensation input when the error variation rate is large. Penaltyg is the constraint penalty term, defined as follows: Pendty(g)=(max(0,νzνzmax))2+(max0,U1U1max)2. To prevent the control compensation from exceeding the maximum performance limits of the UAV. The update rule is defined as:

  • If fij<fpbesti, then update pbestiΔuij

  • If fij<fgbesti, then update gbestiΔuij

The control compensation for the altitude sub model is iteratively optimized to obtain the optimal compensation input Δuz, expressed as:

u~^z=u~^ξz+Δuz (36)

Accordingly, the control input U1K is given by:

U1K=U1rk+u~^zk|k (37)

Similarly, for the x and y sub-systems, the control inputs ux and uy can be derived as follows:

ux(k)=uxr(k)+u~^ξx+Δuxuy(k)=uyr(k)+u~^ξy+Δuy (38)

Based on Equations (18) and (19), the reference Euler angles of the quadrotor UAV at the current time can be inversely calculated as follows:

ϕr(k)=arcsin(ux(k)sinψ(k)uy(k)cosψ(k))θrk=arcsin(uxkcosψk+uykcosψkcosϕrk (39)

The complete decision-making process of the proposed PSMC position controller is presented in Algorithm 2. The method combines an MPC-based nominal control law with a PSO-driven compensation loop for improved tracking robustness under dynamic disturbances.

Algorithm 2. Execution Procedure of the PSMC Position Controller
Input: Current UAV state γk = xk, yk,  zkT
            Desired reference yd,k,
            System matrices A, B
            MPC horizons: prediction horizon N, control horizon M
            Weighting matrices Q, R
            Input and state constraints
            PSO parameters
Compute tracking error: ek  yk yd,k
Linearize nonlinear UAV dynamics at operating point yk:
             Obtain linear system: xk+1= A xk+ B uk
Construct standard MPC cost function:
             J(u) =i=0n1[ek+iQ2 + uk+iR2] 
Formulate MPC constraints:
            State limits:  ymin yk+i ymax
            Input limits: u min uk+i  umax
                Terminal condition: optional
Solve convex MPC optimization problem to obtain  uMPC= [uk, uK+M1]
Initialize PSO search around uMPC[0]:
             Define particle positions as perturbations Δu  Rm around uMPC[0]
Define PSO objective function:
             JPSO(Δu) = ypredk +1  yd,k+1Q + λΔu2
Run PSO optimizer (see Algorithm 1) to minimize  JPSO(Δu) 
             Obtain best particle Δuopt
Compute final control input:
            uk*uMPC[0] + Δuopt
Apply uk* to UAV system
Wait for next sampling interval and repeat
Output: Optimized control input uk*

3.3. LQR Inner-Loop Controller

While the outer-loop controller governs the position-level behavior of the quadrotor, the attitude dynamics require a fast and stable response to ensure accurate tracking and control allocation. To this end, LQR is employed in the inner loop. However, conventional fixed-gain LQR may become suboptimal when the flight state varies significantly. Therefore, gain scheduling is incorporated to adjust the feedback gains according to the real-time operating conditions, and a control-rate relaxation mechanism is adopted to prevent aggressive input changes and reduce actuator saturation. These enhancements improve responsiveness, maintain stability, and reduce control effort under complex flight scenarios.

In this framework, the inner-loop controller stabilizes the rotational dynamics of the quadrotor across the roll, pitch, and yaw axes. Although LQR provides an analytical and optimal solution for linearized attitude regulation, its performance degrades when operating conditions vary or perturbations occur. Therefore, the enhanced design adopted in this work integrates gain scheduling and control-rate relaxation to improve adaptability and ensure smooth actuation. The attitude dynamics of the quadrotor are governed by rigid-body Euler equations. Let η=[ϕ,θ,ψ]T denote roll, pitch, and yaw angles, and ω=[ωx,ωy,ωz]T represent body-frame angular velocities. The rotational dynamics can be modeled as:

η˙=Jηω (40)
Iω˙=τω×Iω (41)

where I is the moment of inertia matrix and τ is the control torque vector. For small-angle maneuvers (hovering or slow transitions), the attitude system can be approximated by linearization around the hover condition (η0,  ω0), resulting in the decoupled form:

ϕ˙=ωx, ω˙x=1Ixτϕθ˙=ωy, ω˙y=1Iyτθψ˙=ωz, ω˙z=1Izτψ (42)

Each channel can thus be represented as a second-order linear system. For compactness, the general state-space form is written as:

x˙r=Arxr+Brur (43)

Its state and input vectors are:

xr=ηηrefωωref, ur=τ=τϕτθτψ (44)

The matrices Ar and Br are block-diagonal:

Ar=0I300, Br=0I1 (45)

To enhance the smoothness and robustness of the LQR controller under noise or discrete implementation, we introduce a relaxation term penalizing the rate of change in the state, i.e., x˙r2. The cost function is defined as:

J=0 xrTQxr+urTRur+εx˙rTx˙rdt (46)

where Q>0 penalizes attitude tracking errors, R>0 penalizes control efforts, ε0 is a relaxation factor controlling the sensitivity to rapid state transitions.

Let us denote the auxiliary term:

x˙r=Arxr+Brurx˙rTx˙r=xrTArTArxr+2xrTArTBrur+urTBrTBrur (47)

We substitute it into the cost function:

J=0 xrTQ+ϵArTArxr+urTR+εBrTBrur+2εxrTArTBrurdt (48)

The cross term xrTArTBrur can be absorbed using matrix completion or treated as bounded coupling. The modified Riccati equation becomes:

ArTP+PArPBr(R+εBrTBr)1BrTP+Q+εArTAr=0 (49)

The optimal control law is:

ur=Krxr,Kr=(R+εBrTBr)1BrTP (50)

This relaxed formulation allows tuning of the trade-off between response speed and smoothness and effectively attenuates chattering or high-frequency fluctuations from the outer-loop MPC.

To further improve performance under time-varying dynamics, we introduce a gain scheduling mechanism that dynamically adjusts the weight matrix Q based on the current state energy:

Qk=Q01+ρxrk2 (51)

where Q0 is the nominal state penalty, ρ>0 is a tuning coefficient. This adaptive weighting increases the control stiffness when the system deviates significantly from the reference, ensuring rapid convergence without sacrificing nominal smoothness. To avoid computational burden, this scheme is implemented as a simple scalar scaling applied to the diagonal entries of Q, avoiding full Riccati precomputation at each step.

The LQR controller was tuned following a trial-and-error procedure guided by the physical meaning of the weighting matrices. Specifically, larger diagonal entries of Q penalize deviations in angular states, while larger entries of R penalize excessive control inputs. We first set Q as a diagonal matrix with values in the range [10, 200] for attitude states and [1, 20] for angular rates, and R as a diagonal matrix with values in [0.01, 1.0]. These values were adjusted iteratively until a satisfactory compromise between fast response and limited control effort was obtained. The final selected values are given in Section 5.1.

In addition, gain scheduling was introduced by scaling the diagonal terms of Q with respect to the reference velocity norm. For low-speed flight (<1.0 m/s), the baseline Q was used, while for higher speeds (>3.0 m), the diagonal terms were scaled by a factor of 1.4, with linear interpolation in between. This scheduling allowed the controller to maintain robustness at higher dynamic loads without excessive overshoot.

4. Lyapunov-Based Stability Analysis

To verify the theoretical stability of the proposed hierarchical PSMC–LQR control framework, Lyapunov stability analysis is conducted in this section. Based on the control laws derived in Section 3, the outer-loop PSMC–MPC generates desired attitude angles and thrust commands, while the inner-loop LQR controller stabilizes the attitude dynamics through torque regulation. To rigorously link the proposed control laws to the system’s stability, the composite error dynamics of the quadrotor are first formulated.

Let ep=[ex,ey,ez]T denote the position tracking error, and ea=[eϕ,eθ,eψ]T denote the attitude tracking error. According to Equations (9) and (10), the closed-loop error dynamics can be expressed as:

e˙=Ae+BeuPSO (52)

where e=[epT,eaT]T represents the composite error vector, Ae and Be are the system matrices, and ΔuPSO is the bounded adaptive term introduced by the PSO compensator.

To facilitate the stability proof, we define a Lyapunov candidate function as:

V=12epTp1ep+12eaTp1ea (53)

where P1, P2>0 are symmetric positive-definite matrices corresponding to the position and attitude subsystems, respectively.

Taking the time derivative of V yields:

V˙=epTP1e˙p+eaTP2e˙a=eT(PAe+AeTP)e+2epTP1BeΔuPSO (54)

The first term in Equation (54) corresponds to the nominal linearized dynamics of the cascaded system, while the second term represents the perturbation caused by the PSO adaptive compensation.

To guarantee convergence, the feedback gain matrices of both the PSMC and LQR controllers are designed such that:

PAe+AeTP=Q (55)

where Q is a symmetric positive-definite matrix. Hence, the Lyapunov derivative becomes:

V˙=eTQe+2epTP1BeΔuPSO (56)

Since the PSO-based adaptive term ΔuPSO is bounded and continuously adjusted to minimize the MPC cost, it satisfies:

|2epTP1BeΔuPSO|εep2 (57)

where ε>0 is a sufficiently small constant. Substituting this inequality yields:

V˙(λminQε)e2 (58)

Therefore, as long as λmin(Q)>ε, V is strictly decreasing, ensuring that the equilibrium point e=0 is asymptotically stable. This result confirms that the proposed PSMC–LQR framework guarantees closed-loop stability while enhancing robustness and adaptability.

5. Simulation and Discussion

To validate the effectiveness of the proposed control framework, this section presents a series of representative simulation experiments that evaluate the quadrotor’s trajectory tracking accuracy and robustness against external disturbances. In addition to performance evaluation, a detailed computational complexity analysis is also conducted to compare the algorithmic efficiency of the proposed PSMC-LQR controller with two baseline methods. This comprehensive assessment aims to demonstrate both the control effectiveness and real-time feasibility of the proposed scheme.

All simulations were implemented in Python 3.10.13 using the nonlinear quadrotor model introduced in Section 2. The controller sampling time was set to 20 ms, and the total simulation duration was fixed at 20 s for all test scenarios. A three-dimensional helical trajectory was used to evaluate position–attitude tracking performance under coupled dynamics. To emulate realistic perturbations, time-varying sinusoidal disturbances were applied along the x-, y-, and z-axes. The tracking performance is evaluated using four commonly adopted metrics: mean absolute error (MAE), root mean square error (RMSE), maximum tracking error (MaxErr), and control effort. Their explicit definitions and calculation formulas are provided in Section 5.3 and are not repeated here for conciseness.

To ensure rationality and fairness of comparison, all evaluated controllers shared the same quadrotor dynamics, initial conditions, sampling period, state constraints, and disturbance settings. We let the system be defined as x˙=fx,u,  x0=x0, Ts=constant, and the same reference trajectory was used for all configurations. In addition, the weighting matrices of the baseline MPC and LQR, Qp,  Rp and Qa, Ra, were fixed across all compared methods unless one of the associated modules was intentionally deactivated in the ablation setting.

Parameter optimality was ensured through iterative tuning under the baseline architecture (MPC–LQR), where a grid-based adjustment of Q–R ratios and constraint bounds was performed to minimize the steady-state tracking error and control effort. Once the baseline weights achieved convergence and no further improvement was observed, the same parameter set was inherited by the other variants to eliminate bias from re-tuning. As a result, performance differences among methods arose solely from the activation of individual modules rather than from inconsistent parameter choices.

5.1. Trajectory Tracking Performance Evaluation in Calm Air Conditions

This subsection evaluates the performance of the proposed PSMC-LQR controller in tracking a helical trajectory under disturbance-free conditions. The helical trajectory and its parameters, which are specified below, are newly defined for this experiment and differ from those used in previous sections. The controller’s tracking performance is analyzed in terms of precision, error behavior, and response stability to demonstrate its effectiveness in ideal conditions.

This example first verifies the trajectory tracking performance of the quadrotor UAV in the absence of external disturbances. The parameters used in the simulation experiments are listed in Table 1 for the UAV model. The reference trajectories for the UAV in the x, y, and z directions are defined as xref=5sin(πt5), yref=5cos(πt5), zref=0.5t, and ψref=0. The initial position and attitude of the quadrotor are given by (x0 y0 z0)T=(0 0 0)Tm; (ϕ0 θ0 ψ0)T=(0 0 0)Trad. In all the simulations reported in this paper the desired yaw angle is kept constant (zero) to simplify the outer-loop/inner-loop decoupling and to isolate the performance of the position controller under structured translational disturbances. This is a common experimental choice in trajectory tracking comparisons where yaw control is orthogonal to position-control design.

Table 1.

Quadrotor Model Parameters.

Parameter Value
Mass 1.0 kg
Gravitational acceleration 9.8 m/s2
Moment of inertia about the X-axis 4×103 kgm2
Moment of inertia about the Y-axis 4×103 kgm2
Moment of inertia about the Z-axis 8.4×103 kgm2

To ensure reliable performance, all controller parameters were determined through iterative simulations and parametric analysis to balance trajectory accuracy, robustness, and computational efficiency.

For the PSO-based compensator, the parameters were selected to guarantee rapid convergence within each sampling period while maintaining real-time feasibility. The particle number and maximum iteration count were set to i=10 and nmax=8, respectively. Comparative simulations showed that increasing either parameter beyond these values provided less than 3% improvement in tracking accuracy but caused more than 20% growth in computation time. The inertia weight range was defined as ωmax=0.9 and ωmin=0.4, while the acceleration coefficients were set to c1=0.8 and c2=0.8, providing a balanced exploration–exploitation capability and stable convergence under model uncertainties. The weighting factor was assigned as λ0=0.7 to regulate the amplitude of the correction term, avoiding excessive adjustment during strong disturbances.

For the MPC controller, the sampling interval was set to Δt=0.02 s, consistent with the outer-loop update rate. The weighting matrices were defined as Qz=diag(40,1), Rz=diag(1), Qxy=diag(40,40,1,1), and Rxy=diag(1,1). These values were tuned through iterative trials to emphasize position accuracy while maintaining smooth control inputs. Parameter sweeps revealed that larger Q/R ratios improved steady-state precision but reduced robustness to modeling errors, whereas the selected configuration achieved the best trade-off between accuracy and stability.

For the inner-loop LQR controller, the sampling period was set to ΔT=0.02 s, and the weighting matrices were chosen as Q=diag(200,200,2,2) and R=diag(1,1,1). Simulation-based parametric studies showed that increasing the Q/R ratio accelerated response but induced overshoot, while smaller ratios slowed stabilization. The adopted values provided the most balanced transient performance with limited control effort.

All parameters were finalized after multiple rounds of simulation-based iteration and sensitivity verification. Moderate perturbations (±20%) in these values did not significantly affect tracking accuracy or system stability, confirming the robustness of the selected configuration.

The simulation results are illustrated in Figure 3, Figure 4 and Figure 5. Specifically, Figure 3 depicts the UAV’s tracking performance along a helical trajectory, while Figure 4 shows the trajectory tracking curves along the x, y, and z axes and Figure 5 illustrates the tracking error curves in the three directions. In the figures, “MPC-MPC” denotes that both the outer and inner control loops adopt the MPC control strategy; “MPC-LQR” refers to the use of MPC in the outer loop and LQR in the inner loop; “PSMC-LQR” represents the novel control approach proposed in this study; and “PD Control” refers to a conventional proportional–derivative controller applied to both the outer and inner loops, serving as a representative of traditional control techniques. As observed from Figure 3, under ideal conditions without any external disturbances, all three control strategies enable the quadrotor UAV to accurately follow the desired trajectory, indicating that each control scheme possesses a certain degree of effectiveness in basic trajectory tracking performance.

Figure 3.

Figure 3

Helical Trajectory Tracking Results.

Figure 4.

Figure 4

Tracking performance for different control strategies under ideal conditions. (a) Tracking performance along X axes. (b) Tracking performance along Y axes. (c) Tracking performance along Z axes.

Figure 5.

Figure 5

Tracking error curves under different control strategies. (a) Tracking error along X axes. (b) Tracking error along Y axes. (c) Tracking error along Z axes.

As shown in Figure 3, under nominal conditions without external disturbances, all four control strategies enable the quadrotor UAV to follow the desired trajectory to some extent, demonstrating basic tracking feasibility. However, a closer inspection of Figure 4 reveals that the PD Control scheme exhibits the largest tracking deviation and oscillation due to its limited adaptability and lack of predictive capability. The MPC–MPC approach, serving as the baseline, achieves relatively stable tracking but still suffers from noticeable overshoot, while the MPC–LQR scheme exhibits minor undershoot. In contrast, the proposed PSMC–LQR controller achieves the smoothest and most accurate trajectory tracking by effectively suppressing overshoot and compensating for undershoot, and more importantly, it significantly outperforms the conventional PD Control scheme, highlighting its superiority over traditional control methods. Furthermore, the tracking error curves in Figure 5 confirm these findings quantitatively: the PSMC–LQR method yields the smallest steady-state error and lowest variance, followed by MPC–LQR and MPC–MPC, whereas the PD Control exhibits the largest cumulative tracking error, further verifying the robustness and precision advantages of the proposed hierarchical framework.

The experimental results indicate that the control scheme using MPC for both the outer and inner loops exhibits lower tracking accuracy compared to the combined MPC-LQR control method. The mean and variance of the tracking errors in each direction are presented in Table 2. Furthermore, in comparison with the MPC-LQR strategy, the proposed PSMC-LQR control method reduces tracking error by more than 13.2% in the x-direction, over 17.1% in the y-direction, and over 28% in the z-direction. In addition, when compared with the conventional PD control, which exhibits significantly larger errors and higher variances due to its lack of predictive and adaptive capabilities, the PSMC–LQR strategy demonstrates markedly superior accuracy and robustness. These results verify that the proposed hierarchical framework effectively suppresses disturbances, reduces steady-state deviations, and ensures smooth and precise trajectory tracking.

Table 2.

Tracking Error Statistics under Wind-Free Conditions.

Metric MPC-MPC MPC-LQR PSMC-LQR PD Control
X-Error Variance 0.03586 0.03400 0.03067 0.05741
Y-Error Variance 0.47491 0.46824 0.46974 0.47777
Z-Error Variance 0.000031 0.000028 0.000025 0.000104
X-Mean Error 0.1117 0.0775 0.0673 0.1852
Y-Mean Error 0.2150 0.1746 0.1447 0.2719
Z-Mean Error 0.04334 0.03638 0.02621 0.7455

Figure 6 depicts the rotational speed responses of the four motors (ω1, ω2, ω3, ω4) of the UAV in a wind-free environment. At the initial moment (t = 0 s), the motors exhibit transient speed fluctuations, which originate from the UAV’s attitude-stabilizing process. The flight control system drives the motors rapidly adjust output torques, aiming to counteract initial attitude deviations and establish a stable flight posture. Within the first 2.5 s, the speeds of the four motors show complex yet coordinated variations. This transient behavior reflects the dynamic interaction between the motor control subsystem and the UAV’s inertial dynamics. After approximately 2.5 s, the speeds of all motors converge to a consistent stable value (around 300 rad/s). This steady—state convergence indicates that the control algorithm effectively suppresses transient disturbances in wind—free conditions, enabling the UAV to maintain a stable flight state with balanced motor outputs. Such results verify the basic performance of the motor control strategy: in a calm environment without external wind interference, the system can quickly stabilize the UAV’s attitude and maintain constant motor speeds, providing a reliable reference for trajectory tracking accuracy.

Figure 6.

Figure 6

Time histories of the four motor speeds under calm conditions.

5.2. Trajectory Tracking Performance Evaluation in Wind Disturbance Conditions

This subsection evaluates the robustness of the proposed PSMC-LQR controller under time-varying external disturbances. By applying simulated wind forces in the x, y, and z directions, we emulate complex real-world conditions that UAVs typically encounter during outdoor missions. The same helical trajectory and controller configurations are retained to ensure experimental consistency. The performance of the three control methods is analyzed in terms of tracking precision, error resilience, and response stability.

To evaluate the robustness of the proposed controller against structured environmental perturbations, harmonic disturbances were introduced along the UAV’s translational axes. These disturbances were modeled as deterministic sinusoidal signals with distinct amplitudes and periods, representing periodic wind gusts or aerodynamic oscillations. This study focused on harmonic excitations as structured disturbances to clearly expose the disturbance rejection capabilities of the controllers, and the selection rationale was: (i) harmonic disturbances enable controlled and repeatable tests across different controllers; (ii) the amplitudes were chosen to represent light-to-moderate gusts that are typical for small quadrotors. For reproducibility, a short table detailing the magnitudes and units of relevant parameters is included here. External disturbances in the simulations were modeled as deterministic harmonic signals applied to translational dynamics: Fx(t)=Axsin(2πfxt+ϕx), Fy(t)=Aysin(2πfyt+ϕy), Fz(t)=Azsin(2πfzt+ϕz), where A{x,y,z}, f{x,y,z}  and ϕ{x,y,z} denote amplitude, frequency and phase, respectively. The specific values used in the experiments reported in this paper are summarized in Table 3 below.

Table 3.

Wind disturbance parameters used in simulations.

Disturbance Amplitude A(m) Frequency f(Hz) Phase ϕ(rad)
Fx 5 2/15 0
Fy 4 2/15 0.5π
Fz 2 0.2 0.5π

Figure 7 presents the spiral trajectory tracking results of the UAV under wind disturbances. Figure 8 shows the trajectory tracking curves in the x, y, and z directions under the same disturbance conditions, while Figure 9 depicts the corresponding tracking error curves in each direction. From the experimental results in Figure 7, Figure 8 and Figure 9, it is evident that the introduction of external disturbances leads to noticeable oscillations and deviations in the UAV’s flight trajectory. Among the four tested strategies, the PD Control exhibits the most significant tracking deviation due to its lack of predictive and adaptive capabilities. The MPC–MPC scheme maintains basic tracking performance but shows clear oscillatory behavior, while the MPC–LQR method provides improved stability yet still suffers from minor steady-state errors. In contrast, the proposed PSMC–LQR controller achieves the most stable and accurate trajectory tracking under wind disturbances, effectively suppressing oscillations and reducing trajectory deviations. These results clearly demonstrate the superior capability of the PSMC-LQR strategy in mitigating external disturbances and enhancing trajectory tracking performance for quadrotors.

Figure 7.

Figure 7

Helical Trajectory Tracking Results Under Wind Disturbance.

Figure 8.

Figure 8

Trajectory tracking results under Wind Disturbance. (a) Tracking results along X axes. (b) Tracking results along Y axes. (c) Tracking results along Z axes.

Figure 9.

Figure 9

Tracking error curves under Wind Disturbance. (a) Tracking errors along X axes. (b) Tracking errors along Y axes. (c) Tracking errors along Z axes.

The experimental results demonstrate that the proposed PSMC-LQR control method significantly improves trajectory tracking accuracy compared to both the hierarchical MPC control and the combined MPC-LQR control strategies. The mean and variance of the tracking errors in each direction under wind disturbance are presented in Table 4. Specifically, the PSMC-LQR method reduces the average tracking error in the x-direction by more than 34%, in the y-direction by over 26.2%, and in the z-direction by more than 46.8%. Despite wind disturbances, the system maintains stable flight. Furthermore, compared with the traditional PD Control, which exhibits large deviations and slow error recovery under external disturbances, the proposed framework demonstrates significantly enhanced disturbance rejection and robust trajectory tracking capability. These findings confirm that the PSMC–LQR strategy effectively suppresses wind-induced oscillations and ensures stable flight performance even in challenging conditions.

Table 4.

Tracking Error Statistics under Wind Disturbance.

Metric MPC-MPC MPC-LQR PSMC-LQR PD Control
X-Error Variance 0.55657 0.53966 0.14670 0.55657
Y-Error Variance 1.02599 0.90950 0.64590 1.35781
Z-Error Variance 0.00984 0.000045 0.000030 0.000126
X-Mean Error 0.6063 0.5109 0.3370 0.6103
Y-Mean Error 0.7352 0.6464 0.4768 0.7970
Z-Mean Error 0.0748 0.0938 0.0395 0.0743

Figure 10 illustrates the motor rotational speed characteristics of the UAV under wind-disturbed conditions. At t = 0 s, the speed deviations among the four motors are more significant compared to the wind—free case, directly reflecting the impact of wind on the UAV’s initial aerodynamic balance. In the transient phase (t < 2.5 s), the speeds of ω1–ω4 fluctuate violently: the wind disrupts the UAV’s attitude, and the flight control system triggers rapid motor speed adjustments to compensate for wind—induced disturbances (e.g., side-wind-caused lateral forces, gust-induced pitch changes). From 2.5 s to 20 s, although the motor speeds do not fully converge to an absolute constant value like in the wind—free scenario, they maintain relatively stable oscillations around a mean level (approximately 280–320 rad/s). This phenomenon demonstrates the adaptive regulation capability of the control system: facing continuous wind interferences, the algorithm dynamically allocates motor outputs to balance the UAV’s attitude and trajectory, rather than pursuing strict single—point speed stability. The minor speed oscillations are the result of the control system continuously correcting deviations caused by wind changes (such as wind speed fluctuations, direction shifts). These data highlight the robustness of the motor control scheme in complex environments: even under wind disturbances, the system can adjust motor speeds in real-time to ensure the UAV’s flight stability, laying a foundation for subsequent trajectory tracking tasks under dynamic wind conditions.

Figure 10.

Figure 10

Time histories of the four motor speeds under wind disturbance.

5.3. Ablation Analysis of Component Contributions

To further verify the contribution of each component in the proposed control framework, an ablation study was conducted under the same reference trajectory and disturbance settings. By selectively enabling or disabling the PSO-based compensator, gain scheduling, and control-rate relaxation, the individual and combined effects of each module could be quantitatively assessed. This design allows us to identify how each mechanism contributes to the overall tracking accuracy, robustness, and control effort.

To rigorously evaluate the role of each functional module in the proposed control architecture, an ablation study was performed using the same helical trajectory and disturbance conditions as in Section 6. Six controller variants were compared. The first is the baseline MPC–LQR, which employs an MPC-based outer loop and an LQR-based inner loop without any enhancement. The second adds the PSO-based compensator to the outer loop. The third incorporates gain scheduling in the inner loop, while the fourth enables only the rate relaxation mechanism. The fifth applies both gain scheduling and rate relaxation without PSO. The sixth corresponds to the full PSMC–LQR configuration, in which the PSO compensator, gain scheduling, and rate relaxation operate jointly.

Each configuration was evaluated with N = 10 Monte Carlo runs. In each run, the harmonic disturbances described in Section 5.2 were applied with randomized initial phases, and the same initial state and reference trajectory were used across configurations. The performance metrics reported for each run are: per-axis mean absolute error MAEx, MAEy, MAEz, overall RMSE, maximum tracking error, control effort (mean absolute actuator command), and computational load (average and maximum per-step computation time in milliseconds). For a quantity q(t) computed over t = 1,…,T, MAE and RMSE were computed as:

MAEx=1Tt=1Txtxreft (59)
MAEy=1Tt=1Tytyreft (60)
MAEz=1Tt=1Tztzreft (61)
MaxErr=maxt(xxref)2+(yyref)2+(zzref)2 (62)
RMSE=1Tt=1T(xxref)2+(yyref)2+(zzref)2 (63)
|u|=1Tt=1Tu(t)1 (64)

The numerical values reported in Table 5 were computed using the performance definitions in Equations (54)–(58). For each configuration, the mean absolute tracking errors along the x-, y- and z-axes (MAEx, MAEy, MAEz), the overall root mean square error (RMSE), the maximum instantaneous deviation (MaxErr), and the control effort were averaged over the Monte Carlo runs. These metrics provide complementary views of trajectory accuracy, robustness to perturbations, and actuation efficiency, allowing a fair comparison of the individual contributions from PSO compensation, gain scheduling, and rate relaxation.

Table 5.

Comparison of Tracking Error and Control Performance in Ablation Experiments.

Method MAEx MAEy MAEz RMSE MaxErr Control Effort
MPC–LQR (baseline) 12.48 14.67 21.80 39.86 85.19 43.52
MPC–LQR + PSO 12.52 14.63 21.88 39.96 85.32 43.61
MPC–LQR + Scheduling only 12.40 14.72 22.32 40.17 84.89 43.81
MPC–LQR + Relaxation only 12.10 12.82 5.93 28.31 70.70 22.14
MPC–LQR (inner-only) 12.10 12.81 5.94 28.31 70.68 22.14
PSMC–LQR (full) 12.06 12.78 5.91 28.25 70.51 22.12

The results in Table 5 indicate that each of the three components contributes to a distinct aspect of the closed-loop performance. The PSO-based outer-loop compensation slightly reduces steady-state deviations but does not substantially improve control expenditure on its own—this aligns with its core role of mitigating prediction mismatch in the outer loop, where it primarily refines position prediction accuracy rather than optimizing actuation efficiency. Inner-loop gain scheduling and rate relaxation, when enabled individually, yield noticeable improvements in vertical tracking accuracy and actuation smoothness under wind perturbations: specifically, gain scheduling enhances attitude convergence to adapt to varying flight conditions, while rate relaxation substantially decreases control expenditure and suppresses overshoot. Notably, the full PSMC–LQR configuration consistently achieves the lowest RMSE and MaxErr across all runs, while preserving one of the lowest control efforts among the tested settings. When all components operate in synergy, the proposed framework achieves the optimal overall balance in tracking precision, disturbance rejection and control smoothness. This confirms that the combined action of prediction-based compensation, scheduled feedback gains, and rate constraints leads to a more robust and accurate trajectory tracking control framework than any partial variant.

5.4. Computational Complexity Analysis

To quantitatively assess the computational characteristics of the proposed PSMC-LQR framework, a comparative complexity analysis is performed across three control architectures: the baseline MPC-MPC, the hybrid MPC-LQR, and the proposed PSO-augmented MPC-LQR scheme. The analysis focuses on per-step computational overhead, primarily considering the dominant operations involved—namely, the quadratic programming (QP) cost associated with MPC optimization and the metaheuristic search complexity introduced by the PSO-based compensation module.

MPC-MPC: At each time step, two sequential MPC optimizations are solved—first for trajectory generation and then again for attitude control. Assuming each MPC solver uses a standard quadratic programming (QP) solver with complexity O(n3) for control horizon length n, the total complexity per step is approximately:

TMPC-MPC=2O(n3)

MPC-LQR: Here only the outer-loop MPC is solved (complexity O(n3), while the inner-loop LQR uses fixed-gain feedback with constant cost O(n2). Hence:

TMPC-LQR=O(n3)+O(n2)O(n3)

PSMC-LQR: Combines the outer MPC solve O(n3) with a bounded PSO search step. PSO complexity is  O(NpTpm), where Np is particle count, Tp iteration count, and mmm control dimension. Since Np and Tp are kept small (e.g., Np20, Tp5), PSO’s overhead is approximately O(1) relative to MPC. Thus:

TPMPC-LQR=O(n3)+O(1)O(n3)

In summary, all three methods share the same cubic computational complexity in the MPC portion. Although PSMC-LQR adds a PSO-based adjustment step, the additional time is marginal compared to the MPC solve and remains constant per step. Importantly, simulation and embedded test-bed results confirm that PSMC-LQR achieves at least 50% improvement in trajectory tracking accuracy without increasing control cycle time or exceeding hardware real-time constraints.

6. Conclusions

This paper presented a hierarchical control framework for quadrotor trajectory tracking that combines a nonlinear model predictive controller with a PSO-based compensator in the outer loop (PSMC) and an LQR controller with rate relaxation and gain scheduling in the inner loop. The main motivation was to achieve robust real-time tracking performance under disturbances while retaining computational feasibility for embedded deployment. A discrete-time Lyapunov analysis was also conducted to support the stability of the proposed architecture. Through extensive simulations on helical trajectories with and without wind disturbances, the proposed PSMC–LQR achieved consistently better performance compared with the MPC–LQR and MPC–MPC baselines. In calm conditions, the mean tracking errors in the x, y, and z directions were reduced by more than 13.2%, 17.1%, and 28%, respectively. Under wind disturbances the reductions were more than 34%, 26.2%, and 46.8%, respectively. These results indicate that the hybrid use of MPC anticipation and PSO-based adaptability yields a good compromise between robustness and accuracy. The inclusion of rate relaxation and gain scheduling in the LQR inner loop further contributed to smoother attitude responses and reduced overshoot. The proposed control architecture highlights a practical way to integrate heuristic optimization (PSO) with model-based control (MPC + LQR). This demonstrates that embedding lightweight metaheuristics into MPC frameworks can significantly improve disturbance rejection while keeping the computational complexity within a range suitable for real-time implementation. The approach can be extended to other underactuated aerial vehicles or ground robots facing similar disturbance-prone environments. The current study is limited to simulation experiments with fixed yaw and structured harmonic disturbances. No onboard implementation results or computational benchmarks on embedded processors are reported at this stage. Moreover, only one reference trajectory (a helix) was tested; additional paths such as aggressive maneuvers or obstacle-rich trajectories could provide a broader evaluation.

Our next steps will include hardware-in-the-loop and onboard tests to quantify real-time computational load; extension of the framework to fully coupled yaw dynamics and variable yaw scenarios; experiments under stochastic turbulence models such as Dryden or von Kármán spectra; and exploration of adaptive or learning-based alternatives to PSO to further enhance online adaptability. These directions are expected to strengthen both the theoretical contribution and the practical applicability of the proposed method.

Appendix A

To facilitate the design of the outer-loop PSMC, the nonlinear dynamics of the quadrotor system are linearized around a time-varying reference trajectory and discretized using zero-order hold assumptions. This appendix provides the detailed mathematical procedure used for obtaining the linear discrete-time state-space model.

The full state vector is defined as:

x=pxpypzvxvyvzϕθψωxωyωzT (A1)

where pi are positions, vi are linear velocities, ϕ,θ,ψ are Euler angles, and ωi are angular rates.

The translational motion of the quadrotor can be expressed as:

p˙=v (A2)
mv˙=Rϕ,θ,ψ00TTmg001T (A3)

where m is the quadrotor mass, T is total thrust, g is gravity, and R() is the body-to-inertial rotation matrix.

Linearization is performed using first-order Taylor expansion around the current operating point (xref,uref):

δx˙=Acδx+Bcδu (A4)

where Ac=fxxref,uref, Bc=fu(xref,uref), δx=xxref, δu=uuref. Taking partial derivatives, the nonzero blocks of Ac include:

p˙v=I3,      v˙ϕ,θTmRϕ,θ (A5)

where the approximation assumes small angles and thrusts T near hover. The matrix Bc includes:

v˙T=1mRe3 (A6)

where e3=[001]T. The continuous-time linear system is discretized using first-order matrix exponential:

Ad=eAcΔtI+AcΔt,     Bd=0Δt eAcτdτBcBcΔt (A7)

where Δt is the sampling time. This approximation holds well for fast-sampled quadrotor systems. The resulting discrete-time linear model

xk+1=Adxk+Bduk (A8)

is used by the outer-loop MPC for trajectory prediction and control optimization. This model is re-linearized at each sampling instant along the reference trajectory.

Author Contributions

Conceptualization, S.C.; methodology, S.C.; software, S.C.; validation, S.C., Y.S. and Y.Z.; formal analysis, Y.S.; investigation, Y.F. and Y.Q.; resources, X.Z. and D.H.; data curation, Y.Q.; writing—original draft preparation, S.C.; writing—review and editing, Y.F. and Y.Z.; visualization, Y.Q. and Y.F.; supervision, X.Z. and D.H.; project administration, X.Z.; funding acquisition, D.H. All authors have read and agreed to the published version of the manuscript.

Institutional Review Board Statement

No applicable.

Informed Consent Statement

No applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

Funding Statement

This work was supported by the Fundamental Research Funds for the Central Universities, Civil Aviation University of China, under Grant 25CAFUC03022 (“Cooperative Trajectory Planning of Heterogeneous UAVs in Post-Disaster Rescue Scenarios”), and by the National Natural Science Foundation of China under Grant 6247071842 (“Research on Safe Flight Coordination Methods for Large-Scale Dense UAV Operations”).

Footnotes

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

References

  • 1.Wang H., Li Z., Xiong H., Nian X. Robust H∞ attitude tracking control of a quadrotor UAV on SO(3) via variation-based linearization and interval matrix approach. ISA Trans. 2019;87:10–16. doi: 10.1016/j.isatra.2018.11.015. [DOI] [PubMed] [Google Scholar]
  • 2.Wang K., Hua C., Chen J., Cai M. Dual-loop integral sliding mode control for robust trajectory tracking of a quadrotor. Int. J. Syst. Sci. 2020;51:203–216. doi: 10.1080/00207721.2019.1622815. [DOI] [Google Scholar]
  • 3.Hoffmann G., Huang H., Waslander S., Tomlin C. Quadrotor helicopter flight dynamics and control: Theory and experiment; Proceedings of the AIAA Guidance, Navigation and Control Conference and Exhibit; Hilton Head, SC, USA. 20–23 August 2007; p. 6461. [Google Scholar]
  • 4.Cao N., Lynch A.F. Inner–outer loop control for quadrotor UAVs with input and state constraints. IEEE Trans. Control Syst. Technol. 2015;24:1797–1804. doi: 10.1109/TCST.2015.2505642. [DOI] [Google Scholar]
  • 5.Liu H., Li D., Xi J., Zhong Y. Robust attitude controller design for miniature quadrotors. Int. J. Robust Nonlinear Control. 2016;26:681–696. doi: 10.1002/rnc.3332. [DOI] [Google Scholar]
  • 6.Cui L., Zhang R., Yang H., Zuo Z. Adaptive super-twisting trajectory tracking control for an unmanned aerial vehicle under gust winds. Aerosp. Sci. Technol. 2021;115:106833. doi: 10.1016/j.ast.2021.106833. [DOI] [Google Scholar]
  • 7.Hou Z., Lu P., Tu Z. Nonsingular terminal sliding mode control for a quadrotor UAV with a total rotor failure. Aerosp. Sci. Technol. 2020;98:105716. doi: 10.1016/j.ast.2020.105716. [DOI] [Google Scholar]
  • 8.Ma R., Han J., Ding L. Finite-time trajectory tracking control of quadrotor UAV via adaptive RBF neural network with lumped uncertainties. Math. Biosci. Eng. 2023;20:1841–1855. doi: 10.3934/mbe.2023084. [DOI] [PubMed] [Google Scholar]
  • 9.Wang J., Alattas K.A., Bouteraa Y., Mofid O., Mobayen S. Adaptive finite-time backstepping control tracker for quadrotor UAV with model uncertainty and external disturbance. Aerosp. Sci. Technol. 2023;133:108088. doi: 10.1016/j.ast.2022.108088. [DOI] [Google Scholar]
  • 10.Li J., Wan L., Li J., Hou K. Adaptive backstepping control of quadrotor UAVs with output constraints and input saturation. Appl. Sci. 2023;13:8710. doi: 10.3390/app13158710. [DOI] [Google Scholar]
  • 11.Shao S., Chen M., Hou J., Zhao Q. Event-triggered-based discrete-time neural control for a quadrotor UAV using disturbance observer. IEEE/ASME Trans. Mechatron. 2021;26:689–699. doi: 10.1109/TMECH.2021.3051835. [DOI] [Google Scholar]
  • 12.Chen M., Shao S.Y., Jiang B. Adaptive neural control of uncertain nonlinear systems using disturbance observer. IEEE Trans. Cybern. 2017;47:3110–3123. doi: 10.1109/TCYB.2017.2667680. [DOI] [PubMed] [Google Scholar]
  • 13.Kuang J., Chen M. Adaptive Sliding Mode Control for Trajectory Tracking of Quadrotor Unmanned Aerial Vehicles Under Input Saturation and Disturbances. Drones. 2024;8:614. doi: 10.3390/drones8110614. [DOI] [Google Scholar]
  • 14.Sun Z., Xiao M., Li D., Chu J. Tracking controller design for quadrotor UAVs under external disturbances using a high-order sliding mode-assisted disturbance observer. Meas. Control. 2025;58:155–167. doi: 10.1177/00202940241252724. [DOI] [Google Scholar]
  • 15.Kim K., Ahn J.M., Kim S.K., Kim D.M., Suk J., Lim H., Hur G., Kim N., Kim B. Flight test of a flying-wing type UAV with partial wing loss using neural network controller; Proceedings of the AIAA Guidance, Navigation, and Control (GNC) Conference; Boston, MA, USA. 19–22 August 2013; p. 5169. [Google Scholar]
  • 16.Garcia-Aunon P., Peñas M.S., de la Cruz García J.M. Parameter selection based on fuzzy logic to improve UAV path-following algorithms. J. Appl. Log. 2017;24:62–75. doi: 10.1016/j.jal.2016.11.025. [DOI] [Google Scholar]
  • 17.Nakamura-Zimmerer T., Gong Q., Kang W. Neural network optimal feedback control with guaranteed local stability. IEEE Open J. Control Syst. 2022;1:210–222. doi: 10.1109/OJCSYS.2022.3205863. [DOI] [Google Scholar]
  • 18.Gong B., Li Y., Zhang L., Ai J. Adaptive Factor Fuzzy Controller for Keeping Multi-UAV Formation While Avoiding Dynamic Obstacles. Drones. 2024;8:344. doi: 10.3390/drones8080344. [DOI] [Google Scholar]
  • 19.Chipofya M., Lee D.J., Chong K.T. Abstract and Applied Analysis. Volume 2015. Hindawi Publishing Corporation; London, UK: 2015. Trajectory tracking and stabilization of a quadrotor using model predictive control of Laguerre functions; p. 916864. [Google Scholar]
  • 20.Khan M., Zafar M., Chatterjee A. Barrier functions in cascaded controller: Safe quadrotor control; Proceedings of the 2020 American Control Conference (ACC); Denver, CO, USA. 1–3 July 2020; New York, NY, USA: IEEE; 2020. pp. 1737–1742. [Google Scholar]
  • 21.Kooijman D., Schoellig A.P., Antunes D.J. Trajectory Tracking for Quadrotors with Attitude Control on S2×S1; Proceedings of the 2019 18th European Control Conference (ECC); Naples, Italy. 25–28 June 2019; New York, NY, USA: IEEE; 2019. pp. 4002–4009. [Google Scholar]
  • 22.Wang D., Pan Q., Shi Y., Hu J., Zhao C. Efficient nonlinear model predictive control for quadrotor trajectory tracking: Algorithms and experiment. IEEE Trans. Cybern. 2021;51:5057–5068. doi: 10.1109/TCYB.2020.3043361. [DOI] [PubMed] [Google Scholar]
  • 23.Pereira J.C., Leite V.J., Raffo G.V. Nonlinear model predictive control on SE (3) for quadrotor aggressive maneuvers. J. Intell. Robot. Syst. 2021;101:62. doi: 10.1007/s10846-021-01310-8. [DOI] [Google Scholar]
  • 24.Sun S., Romero A., Foehn P., Kaufmann E., Scaramuzza D. A comparative study of nonlinear mpc and differential-flatness-based control for quadrotor agile flight. IEEE Trans. Robot. 2022;38:3357–3373. doi: 10.1109/TRO.2022.3177279. [DOI] [Google Scholar]
  • 25.Tian J., Zeng Q., Wang P., Wang X. Active steering control based on preview theory for articulated heavy vehicles. PLoS ONE. 2021;16:e0252098. doi: 10.1371/journal.pone.0252098. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Elkhatem A.S., Engin S.N. Robust LQR and LQR-PI control strategies based on adaptive weighting matrix selection for a UAV position and attitude tracking control. Alex. Eng. J. 2022;61:6275–6292. doi: 10.1016/j.aej.2021.11.057. [DOI] [Google Scholar]
  • 27.Tahir Z., Jamil M., Liaqat S.A., Mubarak L., Tahir W., Gilani S.O. Design and development of optimal control system for quad copter UAV. Indian J. Sci. Technol. 2016;9:10–17485. doi: 10.17485/ijst/2016/v9i25/96611. [DOI] [Google Scholar]
  • 28.Okyere E., Bousbaine A., Poyi G.T., Joseph A.K., Andrade J.M. LQR controller design for quad-rotor helicopters. J. Eng. 2019;2019:4003–4007. doi: 10.1049/joe.2018.8126. [DOI] [Google Scholar]
  • 29.Abbas N., Abbas Z., Zafar S., Ahmad N., Liu X., Khan S.S., Foster E.D., Larkin S. Survey of advanced nonlinear control strategies for UAVs: Integration of sensors and hybrid techniques. Sensors. 2024;24:3286. doi: 10.3390/s24113286. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 30.Li R., Yang Z., Yan G., Jian L., Li G., Li Z. Robust approximate optimal trajectory tracking control for quadrotors. Aerospace. 2024;11:149. doi: 10.3390/aerospace11020149. [DOI] [Google Scholar]
  • 31.Madeiras J., Cardeira C., Oliveira P. Position and attitude tracking controllers using Lyapunov transformations for quadrotors. J. Intell. Robot. Syst. 2024;110:9. doi: 10.1007/s10846-023-02016-9. [DOI] [Google Scholar]
  • 32.Wang Z., Zhang Y. Research on Prediction-PID Compound Control of Quadrotor UAV. Control Eng. China. 2021;28:1390–1397. [Google Scholar]
  • 33.Zhang K., Chen J., Chang Y., Shi Y. EKF-based LQR tracking control of a quadrotor helicopter subject to uncertainties; Proceedings of the IECON 2016-42nd Annual Conference of the IEEE Industrial Electronics Society; Florence, Italy. 23–26 October 2016; New York, NY, USA: IEEE; 2016. pp. 5426–5431. [Google Scholar]
  • 34.Marini F., Walczak B. Particle swarm optimization (PSO). A tutorial. Chemom. Intell. Lab. Syst. 2015;149:153–165. doi: 10.1016/j.chemolab.2015.08.020. [DOI] [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Data Availability Statement

Data are contained within the article.


Articles from Sensors (Basel, Switzerland) are provided here courtesy of Multidisciplinary Digital Publishing Institute (MDPI)

RESOURCES