In the realm of unmanned aerial vehicles, the quadrotor drone has emerged as a pivotal platform due to its versatility and maneuverability. As an enthusiast and researcher in autonomous systems, I have dedicated significant effort to enhancing the flight performance of these drones, particularly in attitude control. The ability to maintain stable and rapid adjustment of orientation is crucial for applications ranging from aerial photography to surveillance. However, the quadrotor drone is inherently a nonlinear, underactuated, and highly coupled system, making traditional control methods less effective under disturbances. This article delves into the design and implementation of a fuzzy PID controller to improve the dynamic response of flight attitude, specifically focusing on the yaw angle adjustment. Through extensive simulation and analysis, we demonstrate that integrating fuzzy logic with conventional PID control significantly enhances the quadrotor drone’s adaptability and precision.
The quadrotor drone operates with four rotors arranged symmetrically, each generating lift and torque. Its motion is defined by six degrees of freedom: translational movements along the X, Y, and Z axes, and rotational movements around these axes, denoted as roll ($\phi$), pitch ($\theta$), and yaw ($\psi$). The dynamic model is derived from Newton-Euler equations, considering forces and moments. The lift force $F$ produced by each propeller is given by:
$$ F = \left( \frac{1}{2\pi} \right)^2 C_T \rho \omega^2 (2r_p)^4 $$
where $C_T$ is the thrust coefficient, $\rho$ is air density, $\omega$ is the angular velocity of the propeller, and $r_p$ is the propeller radius. Similarly, the torque $M_p$ is expressed as:
$$ M_p = \left( \frac{1}{2\pi} \right)^2 C_M \rho \omega^2 (2r_p)^5 $$
with $C_M$ as the torque coefficient. Air density $\rho$ varies with altitude and temperature, approximated by:
$$ \rho = \frac{273 P_a}{101325(273 + T_t)} \rho_0 $$
where $P_a$ is atmospheric pressure, $T_t$ is temperature, and $\rho_0$ is standard air density (1.293 kg/m³). For low-altitude flights, these parameters are often treated as constants to simplify the model.

The transformation between the body frame and the inertial frame is crucial for modeling the quadrotor drone. The rotation matrix $R$ is:
$$ R = \begin{bmatrix} \cos\theta \cos\psi & \sin\phi \sin\theta \cos\psi – \cos\phi \sin\psi & \cos\phi \sin\theta \cos\psi + \sin\phi \sin\psi \\ \cos\theta \sin\psi & \sin\phi \sin\theta \sin\psi + \cos\phi \cos\psi & \cos\phi \sin\theta \sin\psi – \sin\phi \cos\psi \\ -\sin\theta & \sin\phi \cos\theta & \cos\phi \cos\theta \end{bmatrix} $$
Using this, the nonlinear dynamic equations are derived based on force and moment balances. The control inputs are defined from the motor speeds $\omega_i$ (for $i=1,2,3,4$):
$$ \begin{aligned} U_1 &= C_T (\omega_1^2 + \omega_2^2 + \omega_3^2 + \omega_4^2) \\ U_2 &= C_T (\omega_4^2 – \omega_2^2) \\ U_3 &= C_T (\omega_3^2 – \omega_1^2) \\ U_4 &= C_M (\omega_4^2 – \omega_3^2 + \omega_2^2 – \omega_1^2) \end{aligned} $$
Here, $U_1$ controls altitude, $U_2$ roll, $U_3$ pitch, and $U_4$ yaw. The equations of motion for the quadrotor drone are:
$$ \begin{aligned} \ddot{x} &= (\cos\psi \sin\theta \cos\phi + \sin\psi \sin\phi) \frac{U_1}{m} \\ \ddot{y} &= (\sin\psi \sin\theta \cos\phi – \cos\psi \sin\phi) \frac{U_1}{m} \\ \ddot{z} &= (\cos\theta \cos\phi) \frac{U_1}{m} – g \\ \ddot{\phi} &= \left[ l U_2 + \dot{\theta} \dot{\psi} (I_y – I_z) \right] / I_x \\ \ddot{\theta} &= \left[ l U_3 + \dot{\phi} \dot{\psi} (I_z – I_x) \right] / I_y \\ \ddot{\psi} &= \left[ l U_4 + \dot{\phi} \dot{\theta} (I_x – I_y) \right] / I_z \end{aligned} $$
where $m$ is mass, $g$ is gravity, $l$ is the arm length, and $I_x$, $I_y$, $I_z$ are moments of inertia. The parameters for a typical small quadrotor drone are summarized in the table below.
| Parameter | Symbol | Value |
|---|---|---|
| Gravity acceleration | $g$ | 9.81 m/s² |
| Arm length | $l$ | 0.2223 m |
| Mass | $m$ | 1.023 kg |
| Thrust coefficient | $C_T$ | 1.4865 × 10⁻⁷ N·min²/r² |
| Torque coefficient | $C_M$ | 2.925 × 10⁻⁹ N·m·min²/r² |
| X-axis moment of inertia | $I_x$ | 0.0095 kg·m² |
| Y-axis moment of inertia | $I_y$ | 0.0095 kg·m² |
| Z-axis moment of inertia | $I_z$ | 0.0186 kg·m² |
To design controllers, we linearize the model around hover conditions and derive transfer functions for each channel. For instance, the yaw channel transfer function is obtained by applying Laplace transforms to the linearized equations. The transfer functions for the quadrotor drone are listed in the following table, which serves as the basis for controller design.
| Channel | Transfer Function |
|---|---|
| Pitch | $G_1(s) = \frac{\theta(s)}{U_1(s)} = \frac{84.55s + 9719}{s^3 + 138.5s^2 + 1747s + 3034}$ |
| Roll | $G_2(s) = \frac{\phi(s)}{U_2(s)} = \frac{84.55s + 9719}{s^3 + 138.5s^2 + 1747s + 3034}$ |
| Yaw | $G_3(s) = \frac{\psi(s)}{U_3(s)} = \frac{114.5}{s^2 + 468.7s}$ |
| Altitude | $G_4(s) = \frac{z(s)}{U_4(s)} = \frac{2.916}{s^2 + 15.81s}$ |
The conventional PID controller has been widely used for the quadrotor drone due to its simplicity. The control law is given by:
$$ u(t) = k_p e(t) + k_i \int e(t) dt + k_d \frac{de(t)}{dt} $$
where $e(t)$ is the error between desired and actual states, and $k_p$, $k_i$, $k_d$ are proportional, integral, and derivative gains, respectively. In Laplace domain, the transfer function is:
$$ G_c(s) = k_p + \frac{k_i}{s} + k_d s $$
However, the quadrotor drone’s nonlinearities and external disturbances often degrade PID performance, leading to slow adjustments and overshoot. To address this, we incorporate fuzzy logic to dynamically tune the PID parameters. The fuzzy PID controller adjusts $k_p$, $k_i$, $k_d$ in real-time based on error $E$ and error change rate $EC$, enhancing robustness.
The design of the fuzzy PID controller involves four steps: fuzzification, rule base establishment, fuzzy inference, and defuzzification. For the quadrotor drone, we define input variables $E$ and $EC$ for the yaw angle error and its derivative. The error $E$ is computed from the current and target positions. For instance, in navigation, the yaw error can be derived from geographic coordinates:
$$ E = \arctan\left( \frac{(B_j – A_j) \times \cos(B_w)}{B_w – A_w} \right) $$
where $(A_j, A_w)$ and $(B_j, B_w)$ are target and current latitude-longitude pairs. Alternatively, for attitude control, $E = \theta_e – \theta_r$, with $\theta_e$ as desired yaw and $\theta_r$ as actual yaw. The error change rate is $EC = dE/dt$. These inputs are mapped to fuzzy sets with membership functions, typically triangular, over domains like $[-1, 1]$ for $E$ and $[-400, 400]$ for $EC$.
The fuzzy rule base uses “if-then” statements to relate $E$ and $EC$ to output adjustments $\Delta k_p$, $\Delta k_i$, $\Delta k_d$. A sample rule table is provided below, where linguistic variables such as NB (Negative Big), NM (Negative Medium), NS (Negative Small), ZO (Zero), PS (Positive Small), PM (Positive Medium), and PB (Positive Big) are employed.
| $E$ | $EC$ | ||||||
|---|---|---|---|---|---|---|---|
| NB | NM | NS | ZO | PS | PM | PB | |
| NB | PB/NB/PS | PB/NB/PS | PM/NB/ZO | PM/NM/ZO | PS/NM/ZO | PS/ZO/PB | ZO/ZO/PB |
| NM | PB/NB/NS | PB/NB/NS | PM/NM/NS | PM/NM/NS | PS/NS/ZO | ZO/ZO/PM | ZO/ZO/PM |
| NS | PM/NM/NB | PM/NM/NB | PM/NS/NM | PS/NS/NS | ZO/ZO/ZO | NS/PS/PM | NM/PS/PM |
| ZO | PM/NM/NB | PS/NS/NM | PS/NS/NM | ZO/ZO/NS | NS/PS/ZO | NM/PS/PM | NM/PM/PM |
| PS | PS/NS/NB | PS/NS/NM | ZO/ZO/NS | NS/PS/NS | NS/PS/ZO | NM/PM/PS | NM/PM/PS |
| PM | ZO/ZO/NM | ZO/ZO/NS | NS/PM/NS | NM/PM/NS | NM/PM/ZO | NM/PB/PS | NB/PB/PS |
| PB | ZO/ZO/PS | NS/PS/ZO | NS/PM/ZO | NM/PM/ZO | NM/PB/ZO | NB/PB/PB | NB/PB/PB |
Each entry in the table represents the output for $\Delta k_p / \Delta k_i / \Delta k_d$. For inference, we use Mamdani method, which computes the Cartesian product of fuzzy sets and applies min-max operations. Defuzzification converts fuzzy outputs to crisp values via the centroid method, yielding $\Delta k_p$, $\Delta k_i$, $\Delta k_d$. The final PID parameters for the quadrotor drone are:
$$ \begin{aligned} k_{p\text{-Fuzzy}} &= k_p + \Delta k_p \\ k_{i\text{-Fuzzy}} &= k_i + \Delta k_i \\ k_{d\text{-Fuzzy}} &= k_d + \Delta k_d \end{aligned} $$
This adaptive mechanism allows the controller to respond swiftly to disturbances, such as wind gusts or sudden maneuvers, ensuring stable flight for the quadrotor drone.
To validate the fuzzy PID controller, we conduct simulations in Simulink. The quadrotor drone model is implemented using the nonlinear equations, and both traditional PID and fuzzy PID controllers are tested for yaw angle regulation. A step input is applied to simulate a sudden change in desired yaw, mimicking real-world scenarios like course correction. The performance metrics include peak time $t_p$, overshoot $\sigma_p$, settling time $t_s$, and steady-state error $e_{ss}$. These are defined as:
$$ \sigma_p = \frac{y(t_p) – y(\infty)}{y(\infty)} \times 100\% $$
$$ e_{ss} = \lim_{t \to \infty} [r(t) – y(t)] $$
where $y(t)$ is the system response and $r(t)$ is the reference signal. For the quadrotor drone, settling time is critical as it reflects how quickly the drone can reorient itself during missions.
The simulation results show a marked improvement with fuzzy PID. For instance, the yaw channel response to a step input indicates that the fuzzy PID controller reduces settling time by approximately 33% compared to traditional PID. The detailed performance comparison is tabulated below.
| Control Method | Peak Time $t_p$ (s) | Overshoot $\sigma_p$ (%) | Settling Time $t_s$ (s) | Steady-State Error $e_{ss}$ (‰) |
|---|---|---|---|---|
| Traditional PID | 0.030 | 13.40 | 0.1020 | 8.40 |
| Fuzzy PID | 0.024 | 8.71 | 0.0684 | 5.68 |
These results highlight that the fuzzy PID controller shortens the adjustment time to 67.1% of the traditional PID’s settling time and reduces overshoot to 65% of the original value. This enhancement is attributed to the dynamic tuning of gains, which allows the quadrotor drone to dampen oscillations and converge faster. The steady-state error is also minimized, ensuring precise attitude holding. In practical terms, this means the quadrotor drone can execute rapid turns or stabilize quicker after disturbances, improving mission efficiency.
Beyond yaw control, we extended the fuzzy PID approach to other channels of the quadrotor drone. For roll and pitch, similar fuzzy rules were applied, but with tailored input domains based on angular rate limits. The altitude channel, however, presented unique challenges due to gravitational effects and coupling with attitude. We addressed this by decoupling the control loops and implementing separate fuzzy PID controllers for each axis. The overall control architecture for the quadrotor drone involves a cascade structure: an outer loop for position control and an inner loop for attitude control. The fuzzy PID operates in the inner loop, adjusting Euler angles to achieve desired orientations. This hierarchical design enhances the quadrotor drone’s robustness in complex flight environments.
To further analyze the fuzzy PID controller, we conducted frequency response tests. The Bode plots indicate that the fuzzy PID increases phase margin and bandwidth compared to traditional PID, which translates to better disturbance rejection for the quadrotor drone. Additionally, we simulated wind disturbances by adding random forces to the dynamic model. The fuzzy PID controller maintained stable flight with smaller deviations, whereas the traditional PID exhibited noticeable oscillations. This robustness is crucial for outdoor operations where the quadrotor drone faces unpredictable environmental factors.
The implementation of fuzzy logic requires careful selection of membership functions and rule bases. For the quadrotor drone, we experimented with different shapes, such as Gaussian and trapezoidal, but found triangular functions sufficient for real-time processing. The rule base was refined through iterative simulation, focusing on minimizing overshoot and settling time. We also considered computational efficiency, as the quadrotor drone’s onboard processor has limited resources. By optimizing the fuzzy inference engine, we ensured that the controller could run at high frequencies without lag, which is essential for the quadrotor drone’s agile maneuvers.
In comparison to other advanced control methods, such as backstepping or sliding mode control, the fuzzy PID offers a balance between performance and complexity. While neural network-based controllers can learn online, they demand extensive training data and computational power. The fuzzy PID, in contrast, relies on expert knowledge encoded in rules, making it more accessible for practical deployments of the quadrotor drone. Moreover, the fuzzy PID parameters are intuitive to tune, as they relate directly to error and its rate of change. This simplicity facilitates integration with existing flight control systems for the quadrotor drone.
Looking ahead, there are several avenues for improving the fuzzy PID controller for the quadrotor drone. One direction is to incorporate adaptive mechanisms that update the rule base online based on flight data, enabling the quadrotor drone to learn from experience. Another is to fuse fuzzy logic with predictive control to anticipate disturbances. Additionally, hardware-in-the-loop testing could validate the controller on physical quadrotor drone platforms, assessing its performance under real-world conditions. These efforts would further solidify the fuzzy PID as a reliable solution for autonomous flight.
In conclusion, the integration of fuzzy logic with PID control significantly enhances the flight attitude control of a quadrotor drone. By dynamically adjusting gains, the fuzzy PID controller reduces settling time, overshoot, and steady-state error, leading to quicker and more stable orientation adjustments. This improvement is vital for applications requiring precision and agility, such as surveillance or delivery. Through simulations, we demonstrated the superiority of fuzzy PID over traditional methods, underscoring its potential for widespread adoption in quadrotor drone systems. As technology advances, such intelligent control strategies will continue to push the boundaries of what quadrotor drones can achieve.
