Genetic Algorithm-Optimized Mamdani Fuzzy Logic Control for Robust Quadrotor Trajectory Tracking
Abstract:
This paper presents a genetic algorithm (GA) tuned Mamdani type fuzzy logic control (FLC) framework for trajectory tracking of a quadrotor unmanned aerial vehicle (UAV) using a nonlinear rigid body model. The proposed architecture adopts a cascaded structure in which an outer loop position controller generates attitude and thrust references $(\phi_{\mathrm{ref}},\theta_{\mathrm{ref}},T_{\mathrm{ref}})$, while an inner loop attitude controller generates body torques $(\tau_\phi,\tau_\theta,\tau_\psi)$. Both loops employ a shared Mamdani fuzzy inference system with normalized inputs (tracking error and error-rate) and a normalized control output. The GA automatically tunes scaling gains $(K_e,K_d,K_u)$ across all axes to minimize a robust objective that averages tracking error, control effort, and constraint violations over multiple scenarios with mass uncertainty and wind disturbances. Simulation results on a three dimensional figure eight trajectory indicate that GA tuning can reduce position and attitude errors while respecting actuator saturation and tilt safety limits, demonstrating a practical route to performance enhancement without requiring a high fidelity aerodynamic model. The methodology leverages the interpretability of fuzzy rules and the global search capabilities of evolutionary optimization within a UAV modeling framework consistent with established quadrotor dynamics literature.
1. Introduction
Quadrotor unmanned aerial vehicles (UAVs) are inherently nonlinear and underactuated systems in which translational motion is strongly coupled with attitude dynamics [1]. This intrinsic coupling, together with aerodynamic effects, actuator limitations, and external disturbances such as wind gusts, renders high performance trajectory tracking a challenging control problem. Over the past two decades, a wide spectrum of control strategies has been proposed to address these challenges, ranging from rigorous model based nonlinear control to adaptive and learning based approaches [2]. For instance, geometric control formulations defined directly on the SE(3) manifold have been shown to provide elegant and globally valid representations of quadrotor dynamics, enabling accurate tracking under precise mathematical modeling assumptions [3]. In parallel, learning based schemes such as neural network output feedback controllers have been introduced to compensate for unmodeled dynamics and aerodynamic uncertainties in an online fashion [4]. Adaptive backstepping and Lyapunov based nonlinear controllers further demonstrate that asymptotic or finite time stability can be guaranteed even in the presence of parameter uncertainties [5], [6].
Despite their strong theoretical guarantees, many of these approaches rely on accurate system models, complex stability analyses, or high computational effort, which may limit their applicability in scenarios involving rapidly changing operating conditions or incomplete system knowledge [2], [7], [8], [9]. In this context, fuzzy logic control (FLC) has attracted sustained interest due to its ability to handle nonlinearities and uncertainties using rule based reasoning that does not require an explicit high fidelity model. Early works have demonstrated that fuzzy controllers can be effectively deployed in UAV applications, including vision based pose control and real time experimental platforms, highlighting their practicality and robustness in real world environments [10]. Subsequent studies have explored the integration of fuzzy logic with other control paradigms, such as sliding mode, backstepping, and adaptive disturbance rejection, to further enhance robustness against external disturbances and modeling errors [11]. Comprehensive surveys confirm that fuzzy based controllers remain competitive with advanced nonlinear methods, particularly when interpretability and implementation simplicity are prioritized [12].
Among fuzzy control paradigms, Mamdani type FLCs are especially attractive for engineering applications because their rule bases directly encode intuitive control actions and can be shaped to resemble proportional derivative (PD) behavior while preserving smooth nonlinear mappings [13], [14]. However, a well known limitation of practical fuzzy controllers lies in the tuning of scaling gains and inference parameters [15], [16]. As the number of controlled axes and control loops increases, manual tuning becomes increasingly difficult, especially when actuator saturation, tilt constraints, and robustness to disturbances must be simultaneously considered. This challenge has motivated the use of evolutionary optimization techniques, such as genetic algorithms (GAs), which offer derivative free global search capabilities well suited to the nonconvex and nonsmooth performance landscapes encountered in closed loop UAV simulations [17], [18]. Recent comparative studies have shown that fuzzy controllers tuned using GAs can outperform manually tuned counterparts and even rival more complex adaptive or hybrid control schemes in outdoor trajectory tracking tasks [19], [20].
Motivated by these developments, this paper proposes a GA optimized Mamdani FLC framework for quadrotor UAV trajectory tracking using a cascaded outer inner loop architecture. In the proposed approach, the outer loop regulates translational motion by mapping position errors to roll, pitch, and thrust references, while the inner loop stabilizes attitude by generating the corresponding body torques. This structure is consistent with widely adopted quadrotor control decompositions and exploits the natural time scale separation between translational and rotational dynamics [21], [22], [23]. Unlike hybrid neuro fuzzy or type 2 fuzzy approaches, the present work retains a fixed and interpretable Mamdani rule base and membership structure, focusing instead on the systematic optimization of scaling gains across all axes via a GA. The contribution of this study lies in demonstrating that significant improvements in tracking accuracy, control smoothness, and robustness can be achieved through gain level optimization alone, without increasing controller complexity. The proposed methodology therefore provides a transparent and computationally efficient pathway for enhancing fuzzy based quadrotor control performance under uncertainty.
2. Methods
This section details the proposed GA optimized Mamdani type FLC framework for nonlinear quadrotor trajectory tracking as illustrated in the control block diagram in Figure 1. The method is constructed around a cascaded inner outer loop architecture that is widely adopted for multirotor vehicles, in which the outer loop governs translational motion by generating attitude and thrust references, and the inner loop stabilizes attitude dynamics by tracking these references through torque control. This separation exploits the natural time-scale hierarchy of quadrotor dynamics and enables systematic handling of constraints (e.g., thrust/torque saturation and tilt limits) while maintaining a modular controller structure.
Within each loop, a shared Mamdani fuzzy inference system maps the instantaneous tracking error and its discrete time rate to a normalized control action using a symmetric linguistic partition and a PD like rule base, followed by centroid defuzzification. The resulting nonlinear control law preserves interpretability through its rule based structure while providing smooth control surfaces suitable for continuous time rigid body dynamics. To eliminate reliance on manual calibration, the GA is employed offline to tune the scaling gains that normalize inputs and scale outputs across all controlled axes, minimizing a robustness oriented fitness function averaged over parameter perturbations and wind disturbance scenarios. This optimization strategy leverages the derivative free global search capability of evolutionary algorithms in closed loop simulation settings, where the objective is typically nonconvex and may include nonsmooth penalty terms due to saturations and safety constraints.

The simulated quadrotor is represented by a 12-state rigid-body model:
where, ($x, y, z$) is position in the inertial frame, ($v_x, v_y, v_z$) is inertial velocity, ($\phi, \theta, \psi$) are roll, pitch, and yaw angles, and ($p, q, r$) are body angular rates. The control input is:
where, $T$ is the total thrust along the body $z$-axis, and $\left(\tau_\phi, \tau_\theta, \tau_\psi\right)$ are body torques.
Let $m$ be the mass and $g$ the gravitational constant. The thrust direction in the inertial frame is obtained via the ZYX rotation matrix $R(\phi, \theta, \psi)$. Translational dynamics follow:
where, $k_{d V}$ is a linear drag coefficient and $F_w$ is an external wind disturbance force. Rotational dynamics are:
where, $\boldsymbol{\eta}=[\phi, \theta, \psi]^{\top}, \boldsymbol{\omega}=[p, q, r]^{\top}, I=\operatorname{diag}\left(I_x, I_y, I_z\right), \boldsymbol{\tau}=\left[\tau_\phi, \tau_\theta, \tau_\psi\right]^{\top}, k_{d W}$ is a rotational damping term, and $E(\phi, \theta)$ maps body rates to Euler angle rates. The simulation uses a fourth-order Runge-Kutta (RK4) integrator, which is widely used for nonlinear UAV simulations due to its numerical stability and accuracy for moderate sampling intervals.
The outer loop regulates position by generating references for roll, pitch, and thrust. Given the position reference $p_{ref}(t)$, define the position error and a discrete-time error-rate approximation:
Three fuzzy mappings are applied:
where, $\mathcal{F}(\cdot)$ is the Mamdani FIS (shared template), $K_e, K_d$ normalize error and error-rate into $[-1,1]$, and $K_u$ scales the normalized fuzzy output to a physical reference magnitude. The tilt saturation ($\phi_{\max }, \theta_{\max }$) enforces a safety envelope.
Given $\eta_{\mathrm{ref}}=\left[\phi_{\mathrm{ref}}, \theta_{\mathrm{ref}}, \psi_{\mathrm{ref}}\right]^{\top}$, the inner loop computes torques:
followed by actuator saturation $\tau_i \leftarrow \operatorname{sat}_{\left[-\tau_{i, \max }, \tau_{i, \max }\right]}\left(\tau_i\right)$. This structure reflects a common and effective separation of timescales: the attitude loop responds faster and stabilizes the thrust direction needed by the position loop.
The shared Mamdani inference system uses two inputs (error $e$ and error-rate $d e$) and one output $u \in[-1,1]$. Seven linguistic terms are employed:
with symmetric triangular membership functions over the normalized universe. The rule base approximates a 108 PD-like behavior by mapping signed linguistic levels of ($e, de$) to an output level resembling $e$ + 0.6 $de$, consistent 109 with early fuzzy control designs that translate operator heuristics into nonlinear feedback mappings.
The inferencemechanismemploysminimumfor implication,maximumfor aggregation, and centroid defuzzification.
The GA tunes 18 decision variables:
subjecting to conservative lower and upper bounds to maintain stable and physically reasonable normalization/scaling.
To promote robustness, fitness is computed as an average over a scenario grid combining mass uncertainty and wind gust magnitudes:
For a single scenario, the objective combines tracking, effort, smoothness, and penalties:
where, $\mathrm{RMSE}_p$ and $\mathrm{RMSE}_\eta$ quantify position and attitude tracking errors, satFrac is the fraction of time any actuator saturates, and tilt $(t)=\sqrt{\phi(t)^2+\theta(t)^2}$. This cost embodies a standard simulation-based multi-objective compromise: prioritize tracking while discouraging excessive control magnitude and aggressive oscillations, and penalize constraint violations. GA is selected because it does not require gradient information and is effective on nonlinear, noisy fitness landscapes typical of closed-loop simulations.
A total of 18 scaling gains are optimized:
The bounds are defined as follows:
Position ($x,y$):
Altitude ($z$):
Attitude $(\phi, \theta)$:
Yaw $(\psi)$:
A two-stage GA is employed:
Stage 1 (Exploration): Population = 24, Generations = 15
Stage 2 (Refinement): Population = 28, Generations = 12, search space reduced by 25%
$\bullet$ Selection: stochastic uniform
$\bullet$ Crossover: arithmetic, fraction $=0.8$
$\bullet$ Mutation: adaptive feasible
$\bullet$ Elitism: top 5%
$\bullet$ Maximum generations reached
$\bullet$ Fitness improvement $<10^{-4}$
The GA optimization evaluates each candidate controller across a spectrum of operational scenarios, including mass variations and external wind gusts. To quantify the performance across these conditions, a robust cost function is utilized. This function weights the tracking RMSE against control chattering and actuator saturation, ensuring that the resulting fuzzy gains generalize well to model uncertainties. The mathematical representation of this fitness landscape is given by:
Fitness is averaged over:
The UAV is tasked with tracking a three-dimensional figure-eight trajectory:
which excites coupled translational dynamics while maintaining altitude and yaw references. The simulation duration is 12 s with sampling time 0.01 s. Robust evaluation uses $\mathcal{M}=\{1.00,0.85,1.15\}$ and $\mathcal{W}=\{0,1.5,2.5\} \mathrm{N}$, consistent with moderate mass variations and bounded gust forcing.
Algorithm 1, 2, and 3 presents the pseud code GA optimized Mamdani FLC for quadrotor UAV:
Algorithm 1: GA Optimized Mamdani FLC for Quadrotor UAV (Cascaded Outer/Inner Loops) | |
1 | Simulation settings ($\Delta t, T$); quadrotor nominal parameters $p=\left\{m, g, I_x, I_y, I_z, k_{d V}, k_{d W}\right\}$; actuator limits $\left(T_{\min }, T_{\max }, \tau_{\max }\right)$; tilt limit $\phi_{\max }$; reference parameters $\left(A, B, \omega, z_0, \psi_d\right)$; robust scenario grids $\mathcal{M}$ (mass scales) and $\mathcal{W}$ (wind levels) Baseline response, GA-optimized response, and performance metrics |
2 | Initialize RNG with seed; |
3 | Build common Mamdani FIS template $\mathcal{F}$ with inputs $(e, d e) \in[-1,1]^2$ and output $u \in[-1,1]$; |
4 | Define 7 linguistic terms $\{\mathrm{NB}, \mathrm{NM}, \mathrm{NS}, \mathrm{Z}, \mathrm{PS}, \mathrm{PM}, \mathrm{PB}\}$ and triangular membership functions on $[-1,1]$; |
5 | Construct PD-like rule base: for each $\left(\ell_e, \ell_{d e}\right) \in\{-3, \ldots, 3\}^2$, set $\ell_u=\operatorname{sat}\left(\ell_e+0.6 \ell_{d e}\right)$ and map to output label index; |
6 | Set baseline gain vector $x_0 \in \mathbb{R}^{18}$ (outer-loop and inner-loop scaling gains); |
7 | if GA enabled then |
8 | Set bounds $x \in[\underline{x}, \bar{x}]$ for $\left(K_e, K_d, K_u\right)$ across all axes; |
9 | Define fitness function $J(x)=\frac{1}{|\mathcal{M}||\mathcal{W}|} \sum_{(\mu, w) \in \mathcal{M} \times \mathcal{W}} \mathcal{J}(x ; \mu, w)$; |
10 | Run GA to solve $x^{\star}=\arg \min _{x \in[\underline{x}, \bar{x}]} J(x)$; |
11 | end |
12 | else |
13 | $x^{\star} \leftarrow x_0$; |
14 | end |
15 | Simulate baseline: out $_0 \leftarrow \operatorname{SimulateUAV}\left(x_0, \mathcal{F}, p, \Delta t, T, \mu=1.0, w=0\right)$; |
16 | Simulate optimized: out $_1 \leftarrow \operatorname{SimulateUAV}\left(x^{\star}, \mathcal{F}, p, \Delta t, T, \mu=1.0, w=0\right)$; |
17 | Compute metrics (RMSE position/attitude, saturation fraction) for out $_0$ and out $_1$; |
18 | Plot reference vs. baseline vs. optimized trajectories and control inputs; |
Algorithm 2: Fitness Evaluation for GA (Robust Scenarios) | |
1 | Chromosome $x$, FIS template $\mathcal{F}$, nominal parameters $p$, simulation step $\Delta t$, simulation time $T$, mass scenario grids $\mathcal{M}$, wind scenario grids $\mathcal{W}$ Fitness value $J$ |
2 | $S \leftarrow \mathcal{M} \times \mathcal{W}$, $J \leftarrow 0$; |
3 | ForAll $(\mu, w) \in S$ do |
4 | out $\leftarrow$ SimulateUAV$(x, \mathcal{F}, p, \Delta t, T, \mu, w)$; |
5 | $\mathbf{e}_p(t) \leftarrow \mathbf{p}(t) - \mathbf{p}_{\text{ref}}(t)$ // position error |
6 | $\mathbf{e}_\eta(t) \leftarrow \text{wrapToPi}\left(\boldsymbol{\eta}(t) - \boldsymbol{\eta}_{\text{ref}}(t)\right)$ // Euler error |
7 | $\operatorname{RMSE}_p \leftarrow \sqrt{\mathbb{E}\left[\left\|\mathbf{e}_p(t)\right\|_2^2\right]}$; |
8 | $\operatorname{RMSE}_\eta \leftarrow \sqrt{\mathbb{E}\left[\left\|\mathbf{e}_\eta(t)\right\|_2^2\right]}$; |
9 | $\mathbf{u}(t) = \left[T, \tau_\phi, \tau_\theta, \tau_\psi\right]^{\top}$, $\quad \Delta \mathbf{u}(t) \leftarrow \frac{\mathbf{u}(t) - \mathbf{u}(t - \Delta t)}{\Delta t}$; |
10 | $J_{\text{track}} \leftarrow 40\,\operatorname{RMSE}_p + 8\,\operatorname{RMSE}_\eta$; |
11 | $J_{\text{ctrl}} \leftarrow 0.02\,\mathbb{E}\left[\|\mathbf{u}(t)\|_2^2\right] + 0.01\,\mathbb{E}\left[\|\Delta \mathbf{u}(t)\|_2^2\right]$; |
12 | $J_{\text{sat}} \leftarrow 50 \cdot \text{satFrac}$ |
13 | $\text{tilt}(t) \leftarrow \sqrt{\phi(t)^2 + \theta(t)^2}$, $\quad J_{\text{tilt}} \leftarrow 200\,\mathbb{E}\left[\max\left(0, \text{tilt}(t) - \phi_{\max}\right)^2\right]$; |
14 | $J \leftarrow J + \left(J_{\text{track}} + J_{\text{ctrl}} + J_{\text{sat}} + J_{\text{tilt}}\right)$; |
15 | end |
16 | Return $J / |S|$; |
Algorithm 3: Simulate UAV: Cascaded Mamdani FLC with RK4 Quadrotor Dynamics | |
1 | Scaling gains $x$, FIS template $\mathcal{F}$, nominal parameters $p$, simulation step $\Delta t$, simulation time $T_{\text{sim}}$, mass scale $\mu$, wind level $w$ Simulation results out |
2 | Parse gains $x \mapsto \left\{\left(K_e, K_d, K_u\right)_{\text{out}, x/y/z}, \left(K_e, K_d, K_u\right)_{\text{in}, \phi/\theta/\psi}\right\}$; |
3 | Set scenario parameters: $m \leftarrow \mu m_0$; wind profile magnitude parameter $\leftarrow w$; |
4 | Initialize time grid $t_k = k \Delta t$, $k = 0, \ldots, N$; |
5 | Initialize state $\mathbf{x}_0 = \left[x, y, z, v_x, v_y, v_z, \phi, \theta, \psi, p, q, r\right]^{\top}$ (near hover); |
6 | Generate reference $\mathbf{p}_{\text{ref}}(t)$ as 3D figure-eight with $z = z_0$ and $\psi = \psi_d$; |
7 | Initialize previous errors $\mathbf{e}_{p,\text{prev}} \leftarrow \mathbf{0}$, $\mathbf{e}_{\eta,\text{prev}} \leftarrow \mathbf{0}$; |
8 | For $k = 0$ To $N-1$ |
9 | Extract $\mathbf{p}, \mathbf{v}, \boldsymbol{\eta}=[\phi, \theta, \psi], \boldsymbol{\omega}=[p, q, r]$ from $\mathbf{x}_k$; |
10 | $\mathbf{F}_w \leftarrow \text{WINDFORCE}(t_k, w)$; // Outer loop (position→ attitude/thrust references): |
11 | $\mathbf{e}_p \leftarrow \mathbf{p}_{\text{ref}}(t_k) - \mathbf{p}$; |
12 | $\dot{\mathbf{e}}_p \leftarrow (\mathbf{e}_p - \mathbf{e}_{p,prev}) / \Delta t$; $\quad \mathbf{e}_{p,prev} \leftarrow \mathbf{e}_p$; |
13 | $\theta_{\text{ref}} \leftarrow \operatorname{sat}_{[-\phi_{\max}, \phi_{\max}]}\left(K_{u,x} \cdot \mathcal{F}\left(\operatorname{sat}_{[-1,1]}(K_{e,x} e_x), \operatorname{sat}_{[-1,1]}(K_{d,x} \dot{e}_x)\right)\right)$; |
14 | $\phi_{\text{ref}} \leftarrow \operatorname{sat}_{[-\phi_{\max}, \phi_{\max}]}\left(K_{u,y} \cdot \mathcal{F}\left(\operatorname{sat}_{[-1,1]}(K_{e,y} e_y), \operatorname{sat}_{[-1,1]}(K_{d,y} \dot{e}_y)\right)\right)$; |
15 | $\Delta T \leftarrow K_{u,z} \cdot \mathcal{F}\left(\operatorname{sat}_{[-1,1]}(K_{e,z} e_z), \operatorname{sat}_{[-1,1]}(K_{d,z} \dot{e}_z)\right)$; |
16 | $T_{\text{ref}} \leftarrow m g + \Delta T$, $\quad \psi_{\text{ref}} \leftarrow \psi_d$; // Inner loop: attitude → body torques |
17 | $\boldsymbol{\eta}_{\text{ref}} \leftarrow [\phi_{\text{ref}}, \theta_{\text{ref}}, \psi_{\text{ref}}]$; |
18 | $\mathbf{e}_\eta \leftarrow \text{wrapToPi}(\boldsymbol{\eta}_{\text{ref}} - \boldsymbol{\eta})$; |
19 | $\dot{\mathbf{e}}_\eta \leftarrow (\mathbf{e}_\eta - \mathbf{e}_{\eta,prev}) / \Delta t$; $\quad \mathbf{e}_{\eta,prev} \leftarrow \mathbf{e}_\eta$; |
20 | $\tau_\phi \leftarrow K_{u,\phi} \cdot \mathcal{F}\left(\operatorname{sat}_{[-1,1]}(K_{e,\phi} e_\phi), \operatorname{sat}_{[-1,1]}(K_{d,\phi} \dot{e}_\phi)\right)$; |
21 | $\tau_\theta \leftarrow K_{u,\theta} \cdot \mathcal{F}\left(\operatorname{sat}_{[-1,1]}(K_{e,\theta} e_\theta), \operatorname{sat}_{[-1,1]}(K_{d,\theta} \dot{e}_\theta)\right)$; |
22 | $\tau_\psi \leftarrow K_{u,\psi} \cdot \mathcal{F}\left(\operatorname{sat}_{[-1,1]}(K_{e,\psi} e_\psi), \operatorname{sat}_{[-1,1]}(K_{d,\psi} \dot{e}_\psi)\right)$; // Actuator saturation and integration |
23 | $T \leftarrow \operatorname{sat}_{[T_{\min}, T_{\max}]}(T_{\text{ref}})$ |
24 | $\tau_i \leftarrow \operatorname{sat}_{[-\tau_{i,\max}, \tau_{i,\max}]}(\tau_i)$ for $i \in \{\phi, \theta, \psi\}$; |
25 | $\mathbf{u}_k \leftarrow [T, \tau_\phi, \tau_\theta, \tau_\psi]^{\top}$; |
26 | $\mathbf{x}_{k+1} \leftarrow \text{RK4Step}(\mathbf{x}_k, \mathbf{u}_k, p, \mathbf{F}_w, \Delta t)$; // Log data |
27 | Log $\mathbf{x}_k$, $\mathbf{u}_k$, and saturation flags; |
28 | end |
29 | return logged trajectories $\{\mathbf{x}(t_k), \mathbf{u}(t_k), \mathbf{p}_{\text{ref}}(t_k), \boldsymbol{\eta}_{\text{ref}}(t_k)\}$; |
30 | end function; |
3. Results
The effectiveness of the proposed GA optimized Mamdani FLC framework was evaluated through high fidelity numerical simulations using the full nonlinear quadrotor model integrated via a fourth order Runge Kutta (RK4) scheme. The controller was assessed on a three dimensional trajectory tracking task consisting of a smooth figure-eight motion in the horizontal plane, combined with constant altitude flight and fixed yaw. The total simulation time was 12 s with a control sampling period of 0.01 s, resulting in a closed-loop update rate of 100 Hz. All results reported in this section correspond to the nominal plant parameters unless otherwise stated, while the GA optimization itself incorporated robustness to mass uncertainty and wind disturbances.
Each individual encoded 18 scaling gains corresponding to the outer loop (position) and inner-loop (attitude) fuzzy controllers. The fitness function, evaluated as an average over multiple mass and wind scenarios, combined trajectory tracking accuracy, control effort, control smoothness, actuator saturation penalties, and tilt safety violations.
Across generations, the best fitness value exhibited a rapid decrease during the early stages of evolution, indicating that the GA was able to quickly identify gain combinations that substantially improved closed loop behavior relative to the hand-tuned baseline. Subsequent generations produced more gradual refinements, reflecting fine tuning of the trade-offs between tracking aggressiveness and constraint handling. The convergence behavior suggests that the chosen search space bounds and fitness formulation were well posed, allowing the GA to consistently converge toward a locally optimal yet robust gain configuration without exhibiting premature stagnation or excessive oscillation in fitness.
Figure 2 illustrates the time domain tracking performance of the quadrotor position along the $x, y$, and $z$ axes for oth the baseline fuzzy controller and the GA-optimized fuzzy controller. For the baseline case, the quadrotor is able o qualitatively follow the figure eight trajectory; however, noticeable transient deviations are observed during periods f high curvature in the reference path, particularly at the turning points of the horizontal motion. These deviations re indicative of suboptimal scaling between the position error, error rate, and the resulting attitude commands.

While both controllers initially follow the sinusoidal reference, the baseline controller suffers a total loss of tracking capability at approximately $t=4 \mathrm{~s}$, failing to follow the subsequent cycles. In contrast, the genetic algorithm-fuzzy logic control (GA-FLC) tracks the reference with high fidelity throughout the 12 -second simulation. The baseline controller exhibits significant drift in the $y$ and $z$ planes, eventually diverging and saturating at $t=4 \mathrm{~s}$ (indicating a simulated crash or total instability). The GA-FLC maintains the desired altitude and lateral position with negligible steady-state error, demonstrating superior robustness.
The baseline controller shows substantial steady state errors, particularly in roll ($\phi$) and yaw ($\psi$). For instance, the baseline roll angle deviates to roughly 0.6 rad, whereas the GA-FLC regulates the angle back to the reference (0 rad) after minor initial transients. The GA-optimized parameters successfully tuned the fuzzy membership functions to provide better damping. While the baseline exhibits erratic behavior before failing, the GA-FLC maintains controlled, low amplitude oscillations, ensuring the quadrotor remains within its flight envelope.
With GA optimization, the attitude tracking performance is substantially enhanced. The optimized inner loop scaling gains increase responsiveness without inducing excessive oscillations or instability. Roll and pitch angles track their respective references more tightly, with reduced phase lag and lower peak errors. Yaw regulation remains stable and well behaved in both cases, as yaw motion is less strongly coupled to translational acceleration in the chosen trajectory; nonetheless, the GA tuned controller achieves a modest reduction in yaw error variance.
The attitude responses for roll $\phi$, pitch $\theta$, and yaw $\psi$ are presented in Figure 3. The improved attitude tracking directly contributes to the observed gains in position tracking performance, confirming the effectiveness of the cascaded control structure when both loops are coherently tuned.

Figure 4 depicts the control inputs, including total thrust $T$ and body torques $\left(\tau_\phi, \tau_\theta, \tau_\psi\right)$. For the baseline controller, the thrust and torque commands display relatively sharp variations during trajectory turns, occasionally approaching the actuator saturation limits. These abrupt changes are symptomatic of overly aggressive or poorly normalized fuzzy outputs.

The baseline controller exhibits severe high-frequency oscillations commonly known as chattering between $t=2 \mathrm{~s}$ and $t=4 \mathrm{~s}$, specifically in the pitch torque ($\tau_\theta$) and yaw torque ($\tau_\psi$). This is often a precursor to mechanical failure or system instability in real world applications. The GA-FLC produces significantly smoother control signals. The thrust ($T$) and torques show purposeful spikes only during initial error correction, settling into a stable regime thereafter. This indicates that the GA optimization has effectively balanced tracking precision with actuator longevity, preventing the “over-correction” seen in the baseline.
The GA optimized controller produces noticeably smoother control signals. While peak thrust and torque magnitudes remain within allowable bounds in both cases, the optimized controller reduces high frequency oscillations and excessive control rate changes. This improvement is quantitatively reflected in the reduced control effort and control smoothness terms within the fitness function. Importantly, smoother actuation not only improves tracking performance but also has practical implications for actuator longevity and energy efficiency.
A key component of the fitness function is the explicit penalization of actuator saturation and excessive vehicle tilt. Under baseline gains, brief saturation events occur during aggressive maneuvers, particularly in roll and pitch torques, increasing the risk of degraded performance or instability under stronger disturbances.
The GA optimized controller significantly reduces the fraction of time during which any actuator reaches its saturation limit. Moreover, the tilt angle $\sqrt{\phi^2+\theta^2}$ remains consistently below the prescribed safety threshold of $35^{\circ}$, even during the most demanding segments of the trajectory. This result highlights the ability of the GA to implicitly encode safety considerations into the tuning process without requiring explicit constraint handling in the controller structure itself.
The quantitative results in Table 1 demonstrate a transformative improvement in the quadrotor's flight performance following the GA optimization. Most notably, the Position and Attitude RMSE were reduced by approximately 81%, signifying a substantial gain in tracking precision and stability over the baseline. While the overall control effort decreased by a modest 5.57%, the qualitative nature of the control signal improved drastically; this is evidenced by a 95.33% reduction in control variation and a near-total elimination of actuator saturation (99.43% improvement). These metrics corroborate the transition from the erratic, high frequency chattering observed in the baseline controller to the smooth, energy efficient response of the GA-optimized Mamdani FLC. Furthermore, the 44.81% reduction in maximum tilt suggests that the optimized controller maintains the vehicle within a safer operational envelope, effectively mitigating the risk of aerodynamic divergence or mechanical failure.
Metric | Baseline | GA-Optimized | Improvement (%) | Unit |
Position RMSE ($\mathrm{RMSE}_p$) | 26.5779 | 5.0957 | 80.83% | m |
Attitude RMSE ($\mathrm{RMSE}_\eta$) | 0.5886 | 0.1096 | 81.38% | rad |
Control Effort ($\mathbb{E}\left[\|\mathbf{u}\|^2\right]$) | 162.3113 | 153.2697 | 5.57% | - |
Control Variation($\mathbb{E}\left[\|\mathbf{u}\|^2\right]$) | 757.3662 | 35.3856 | 95.33% | - |
Saturation Fraction | 14.65% | 0.08% | 99.43% | % |
Maximum Tilt ($\max \sqrt{\phi^2+\theta^2}$) | 0.6068 | 0.3349 | 44.81% | rad |
Although the results presented above focus on nominal system parameters, it is important to emphasize that the GA tuning process explicitly accounted for mass variations and wind disturbances. Controllers optimized under this robust fitness formulation exhibit consistent performance across the tested scenarios, maintaining stable flight and acceptable tracking accuracy despite moderate modeling uncertainties and external forces. This robustness is particularly valuable for real UAV applications, where payload changes and environmental disturbances are unavoidable.
Overall, the simulation results demonstrate that GA based tuning of scaling gains substantially enhances the performance of the Mamdani FLC across multiple dimensions: improved position and attitude tracking accuracy, smoother control inputs, reduced actuator saturation, and enhanced robustness to uncertainty. Crucially, these gains are achieved without altering the underlying fuzzy rule base or membership functions, underscoring the central role of systematic gain calibration in fuzzy control design for nonlinear aerial vehicles.
4. Discussion
This study investigated a cascaded quadrotor control architecture in which an outer loop position controller GA and thrust references, while an inner loop attitude controller produces the torque commands required for rigid body stabilization. The key contribution lies in the systematic calibration of a Mamdani type FLC across all translational and rotational channels using a simulation based genetic algorithm, explicitly accounting for actuator saturation, tilt safety limits, and robustness to mass and wind perturbations. The resulting closed loop behavior supports the premise that rule based nonlinear feedback can be made competitive in multi axis quadrotor tracking when its scaling parameters are optimized with a derivative free global search procedure [1], [12], [21].
Across the nominal figure - eight tracking task, the GA tuned controller consistently improved position tracking fidelity by 80.83% and attitude stability by 81.38% relative to the baseline. These improvements are especially meaningful because they were achieved while simultaneously reducing control variation by 95.33%. Unlike the baseline, which exhibited high frequency chattering, the GA-FLC discovered gain combinations that balance responsiveness with constraint adherence, virtually eliminating actuator saturation (0.08% saturation fraction).
While the proposed GA Mamdani FLC achieves high fidelity tracking, its value is best understood through a direct comparison with established control paradigms. As shown in Table 2, our approach occupies a pragmatic middle ground between the rigid stability of geometric control and the high performance but computationally heavy nature of learning-based schemes.
Feature | Geometric (SE(3)) | Adaptive/NN | Deep Deep Reinforcement Learning | Proposed GA-FLC |
Online compute | Very low | Moderate | High | Very low |
Interpretability | High (Physics) | Low (Black-box) | None | High (Linguistic) |
Model dependence | High | Moderate | Low | Moderate |
Stability proofs | Rigorous | Possible | Experimental | Empirical |
Tuning complexity | Manual/Analytic | High | Very high | Automated (GA) |
The primary practical advantage of this method is implementation simplicity. Unlike geometric controllers that require complex manifold based error dynamics [3], or adaptive controllers requiring online parameter identification [24], the Mamdani FLC relies on a fixed, intuitive rule base. Once the scaling gains are optimized offline via the GA, the controller executes as a series of simple min max operations. This ensures an extremely low online computational burden, making it ideal for low cost micro UAVs with limited onboard processing power. Furthermore, the GA-FLC offers superior interpretability. Each control action can be traced back to a linguistic rule (e.g., If altitude error is large, then increase thrust), providing a transparent causal pathway that is often missing in neural network based or deep reinforcement learning policies. By automating the tuning process, we mitigate the curse of dimensionality typically associated with manually tuning 18 gains across a 6 degrees of freedom (DOF) cascaded system.
Despite the recorded improvements, two main limitations persist. First, the stability of the GA-FLC is validated through simulation and robustness scenarios; it lacks the formal Lyapunov based global stability guarantees found in backstepping or sliding mode control. Second, while the online execution is lightweight, the offline computational cost is high. The two stage GA requires significant time to evaluate thousands of nonlinear simulations to settle on the optimal 18 element gain vector.
5. Conclusion
This study successfully developed and validated a GA optimized Mamdani FLC for robust quadrotor trajectory tracking. Unlike conventional fuzzy tuning methods, the proposed two stage GA systematically explored an 18-dimensional parameter space to minimize a multi objective cost function accounting for tracking precision, control smoothness, and physical constraints. The experimental results yield several critical findings that underscore the efficacy of the optimization process. Most notably, the GA-optimized controller achieved an 80.83% reduction in position RMSE and an 81.38% reduction in attitude RMSE compared to the baseline FLC, demonstrating a significant leap in closed-loop stability and reference adherence.
Beyond error minimization, the optimization process significantly enhanced the qualitative nature of the control response. A 95.33% improvement in control variation was recorded, which effectively eliminated the high-frequency chattering observed in the baseline and reduced the actuator saturation fraction from 14.65% to a negligible 0.08%. These improvements ensure greater mechanical longevity and energy efficiency for the aerial platform. Furthermore, by penalizing excessive tilt within the fitness function, the maximum tilt angle was reduced by 44.81%, ensuring the vehicle remains well within its safe aerodynamic flight envelope even under 2.5 N wind disturbances.
In summary, the GA-FLC provides a powerful alternative to complex model-based controllers by combining the linguistic interpretability and low online computational burden of Mamdani systems with the precision of global optimization. These findings suggest that for resource constrained UAV platforms, the primary barrier to high performance fuzzy control is not the fuzzy logic itself, but the lack of systematic, robustly-oriented tuning. Future work will investigate the real time implementation of this architecture on hardware in the loop systems to validate these gains under actual sensor noise and latency.
Conceptualization, M.M. and M.K.; methodology, M.M. and M.K.; software, M.M. and M.K.; validation, M.M. and M.K.; formal analysis, M.M. and M.K.; investigation, M.M. and M.K.; resources, M.M. and M.K.; writing original draft preparation, M.M. and M.K.; writing review and editing, M.M. and M.K.; visualization, M.M. and M.K.; supervision, M.M. and M.K. All authors have read and agreed to the published version of the manuscript.
The data used to support the research findings are available from the corresponding author upon request.
The authors acknowledge the Sakarya University of Applied Sciences (https://subu.edu.tr/) for the technical support provided to publish the present manuscript.
The authors declare no conflicts of interest.
