Enhancing Quadrotor Drone Attitude Control: A PID Approach Augmented with Inertia-Term Modified BP Neural Network

The rapid advancement and miniaturization of avionics, sensors, and computation have propelled the quadrotor drone to the forefront of unmanned aerial vehicle (UAV) research and application. Characterized by its ability to take off and land vertically (VTOL) and hover with remarkable stability, this type of drone offers superior maneuverability compared to fixed-wing counterparts, making it indispensable for tasks ranging from aerial photography and infrastructure inspection to search and rescue and precision agriculture. At the heart of a quadrotor drone‘s operational capability lies its attitude control system—the subsystem responsible for maintaining stable roll, pitch, and yaw orientations. Precise attitude control is the fundamental prerequisite for executing any meaningful trajectory or holding a stationary position, especially in the presence of internal model uncertainties and external environmental disturbances like wind gusts.

The control problem for a quadrotor drone is inherently challenging due to its nonlinear, underactuated, and strongly coupled dynamics. Among the plethora of control strategies explored, the Proportional-Integral-Derivative (PID) controller remains widely adopted in practical systems due to its structural simplicity, ease of implementation, and proven robustness for a wide range of processes. The continuous control law for a PID controller is given by:

$$ u(t) = K_p e(t) + K_i \int_{0}^{t} e(\tau) d\tau + K_d \frac{de(t)}{dt} $$

where \( e(t) = r(t) – y(t) \) is the tracking error, and \( K_p \), \( K_i \), and \( K_d \) are the proportional, integral, and derivative gains, respectively. For digital implementation, the incremental form is often used:

$$ \Delta u(k) = K_p[e(k)-e(k-1)] + K_i e(k) + K_d[e(k)-2e(k-1)+e(k-2)] $$
$$ u(k) = u(k-1) + \Delta u(k) $$

However, the conventional PID controller possesses a critical limitation: its parameters \( (K_p, K_i, K_d) \) are typically tuned offline for a specific operating point. Once deployed, these gains remain fixed. A quadrotor drone operating in real-world conditions faces varying payloads, changing aerodynamic effects, and unpredictable disturbances. Fixed-gain PID control often results in degraded performance, including large overshoot, slow response, or even instability when the operating conditions deviate from the nominal design point. While manual re-tuning is possible, it requires expert knowledge and is impractical for adaptive operation.

To address this, researchers have turned to intelligent methods for online parameter adjustment. The Back-Propagation Neural Network (BPNN), renowned for its universal approximation capability and self-learning properties, has been successfully integrated with PID to create self-tuning controllers. A BPNN can map the complex relationship between the system’s operational state and the optimal PID gains. The standard weight update rule in BPNN training follows the gradient descent method:

$$ \Delta w(k) = -\eta \frac{\partial E(k)}{\partial w(k)} $$

where \( \eta \) is the learning rate and \( E(k) = \frac{1}{2} e(k)^2 \) is the performance index. Despite its strengths, the standard BPNN is prone to slow convergence and can oscillate around the optimal solution, particularly when training complex, non-convex error surfaces. This oscillation can prevent the network from stabilizing, leading to inconsistent and unreliable gain adjustments for the quadrotor drone controller.

This work proposes a novel control architecture that synergistically combines a PID controller with a BP Neural Network enhanced by a strategically modified inertia term (BPNNI-PID). The core innovation lies in the reformulation of the inertia coefficient in the weight update rule to accelerate convergence and dampen oscillations, thereby enabling more stable and efficient online tuning of the PID parameters. This approach empowers the quadrotor drone to maintain superior attitude tracking performance even when subjected to external disturbances and internal parameter variations.

Mathematical Modeling of Quadrotor Drone Dynamics

A rigorous control design begins with a dynamical model. We define two coordinate frames: the inertial frame \( \mathcal{E} = \{O_E, x_E, y_E, z_E\} \) and the body-fixed frame \( \mathcal{B} = \{O_B, x_B, y_B, z_B\} \) attached to the quadrotor drone‘s center of mass. The attitude is described by the Euler angles \( \Phi = [\phi, \theta, \psi]^T \), representing roll, pitch, and yaw, respectively. The position in the inertial frame is given by \( \xi = [x, y, z]^T \).

The dynamics are derived using the Newton-Euler formalism. Each rotor \( i \) (with \( i=1,2,3,4 \)) produces a thrust \( F_i = b \omega_i^2 \) and a reaction torque \( \tau_i = d \omega_i^2 \), where \( b \) and \( d \) are the thrust and drag coefficients, and \( \omega_i \) is the rotational speed. The total thrust \( T \) and the control torques \( \tau_\phi, \tau_\theta, \tau_\psi \) are related to the rotor speeds by:

$$
\begin{bmatrix} T \\ \tau_\phi \\ \tau_\theta \\ \tau_\psi \end{bmatrix} =
\begin{bmatrix}
b & b & b & b \\
0 & -b l & 0 & b l \\
-b l & 0 & b l & 0 \\
d & -d & d & -d
\end{bmatrix}
\begin{bmatrix} \omega_1^2 \\ \omega_2^2 \\ \omega_3^2 \\ \omega_4^2 \end{bmatrix}
$$

where \( l \) is the arm length from the center to a rotor. The translational and rotational equations of motion are:

$$ m \ddot{\xi} = \begin{bmatrix} 0 \\ 0 \\ -mg \end{bmatrix} + R \begin{bmatrix} 0 \\ 0 \\ T \end{bmatrix} + F_{ext} $$

$$ J \dot{\Omega} + \Omega \times J \Omega = \begin{bmatrix} \tau_\phi \\ \tau_\theta \\ \tau_\psi \end{bmatrix} + \tau_{ext} $$

Here, \( m \) is the mass, \( g \) is gravity, \( J = \text{diag}(I_{xx}, I_{yy}, I_{zz}) \) is the inertia matrix, \( \Omega = [p, q, r]^T \) is the angular velocity vector in the body frame, and \( R \) is the rotation matrix from \( \mathcal{B} \) to \( \mathcal{E} \). \( F_{ext} \) and \( \tau_{ext} \) represent external disturbance forces and torques. The relationship between \( \dot{\Phi} \) and \( \Omega \) is given by \( \dot{\Phi} = W \Omega \), where \( W \) is the transformation matrix. For small angles near hover, the dynamics can be decoupled into four independent channels (altitude \( z \), roll \( \phi \), pitch \( \theta \), yaw \( \psi \)), each approximable as a second-order system. For instance, the roll angle dynamics can be simplified to:

$$ \frac{\Phi(s)}{\tau_\phi(s)} = \frac{1}{I_{xx} s^2} $$

This simplified model forms the basis for the initial SISO (Single-Input-Single-Output) controller design for each attitude loop, which is then enhanced by the adaptive BPNNI-PID scheme.

Architecture of the BPNNI-PID Controller for Quadrotor Drone

The proposed control system features a two-level structure. The inner loop is the incremental digital PID controller that directly generates the control signal for the quadrotor drone‘s actuators. The outer loop is the BPNNI, which acts as a parameter regulator, dynamically adjusting the three PID gains \( (K_p, K_i, K_d) \) at every sampling instant based on the current system state.

The neural network is designed with three layers: an input layer, one hidden layer, and an output layer. The choice of inputs is critical for capturing the system’s state. We select:

$$ X = [x_1, x_2, x_3, x_4]^T = [r(k), y(k), e(k), 1]^T $$

where \( r(k) \) is the reference command, \( y(k) \) is the system output (e.g., a measured attitude angle), and the constant ‘1’ serves as a bias input. This input vector provides the network with information about the desired state, the actual state, and the current error.

The hidden layer contains five neurons with the symmetric hyperbolic tangent activation function to introduce nonlinearity:

$$ f(x) = \tanh(x) = \frac{e^x – e^{-x}}{e^x + e^{-x}} $$

The output layer has three neurons, corresponding to \( K_p \), \( K_i \), and \( K_d \). Since PID gains must be positive, a non-negative sigmoid function is used:

$$ g(x) = \frac{1}{2}(1 + \tanh(x)) = \frac{e^x}{e^x + e^{-x}} $$

The forward propagation process is as follows:

1. Input to Hidden Layer:

$$ \text{net}^{(2)}_i(k) = \sum_{j=1}^{4} w^{(1)}_{ij} x_j(k), \quad O^{(2)}_i(k) = f(\text{net}^{(2)}_i(k)), \quad i=1,…,5 $$

2. Hidden to Output Layer:

$$ \text{net}^{(3)}_k(k) = \sum_{i=1}^{5} w^{(2)}_{ki} O^{(2)}_i(k), \quad O^{(3)}_k(k) = g(\text{net}^{(3)}_k(k)), \quad k=1,2,3 $$

where \( O^{(3)}_1(k)=K_p(k) \), \( O^{(3)}_2(k)=K_i(k) \), \( O^{(3)}_3(k)=K_d(k) \).

Core Algorithm: Modified Inertia Term for Weight Adaptation

The performance of the entire quadrotor drone control system hinges on the BPNN’s ability to quickly and smoothly converge to optimal weights. The standard gradient descent update \( \Delta w = -\eta \frac{\partial E}{\partial w} \) is susceptible to oscillations in high-dimensional weight spaces. A common improvement is to add a momentum term, which incorporates a fraction of the previous weight update:

$$ \Delta w(k) = \alpha \Delta w(k-1) – \eta \frac{\partial E(k)}{\partial w(k)} $$

Here, \( \alpha \in [0,1) \) is the inertia (or momentum) coefficient. While this helps smooth the trajectory and escape shallow local minima, a fixed \( \alpha \) may not be optimal throughout training. Through extensive simulation analysis with the quadrotor drone model, it was observed that an inertia coefficient value restrained below 0.4 yielded the best dynamic performance. Values higher than this threshold, though potentially accelerating initial convergence, often led to increased overshoot and settling time in the final control output.

Therefore, we propose a modified update rule that inherently regulates the influence of the inertia term. The new rule for updating any network weight \( w \) is:

$$ \Delta w(k) = \frac{2}{5}\alpha \Delta w(k-1) – \left(1 – \frac{2}{5}\alpha\right) \eta \frac{\partial E(k)}{\partial w(k)} $$

This formulation ensures that the effective learning rate for the current gradient \( (1 – \frac{2}{5}\alpha)\eta \) remains significant. When \( \alpha \) is large, the momentum from the past update is scaled down, preventing it from dominating and causing overshoot. This modification is crucial for the stable adaptation of the quadrotor drone controller.

The weight updates for both layers are computed using this modified rule. The key step is calculating the gradient \( \frac{\partial E(k)}{\partial w(k)} \). Using the chain rule for the output layer weights \( w^{(2)}_{ki} \):

$$ \frac{\partial E(k)}{\partial w^{(2)}_{ki}} = \frac{\partial E(k)}{\partial y(k)} \cdot \frac{\partial y(k)}{\partial \Delta u(k)} \cdot \frac{\partial \Delta u(k)}{\partial O^{(3)}_k(k)} \cdot \frac{\partial O^{(3)}_k(k)}{\partial \text{net}^{(3)}_k(k)} \cdot \frac{\partial \text{net}^{(3)}_k(k)}{\partial w^{(2)}_{ki}} $$
$$ = -e(k) \cdot \text{sgn}\left(\frac{\partial y(k)}{\partial \Delta u(k)}\right) \cdot \frac{\partial \Delta u(k)}{\partial O^{(3)}_k(k)} \cdot g'(\text{net}^{(3)}_k(k)) \cdot O^{(2)}_i(k) $$

The term \( \frac{\partial y(k)}{\partial \Delta u(k)} \), representing the system Jacobian, is unknown. Its sign is approximated and any resulting error is compensated by the adaptive learning process. The partial derivative of the control increment with respect to each output is derived from the PID formula: \( \frac{\partial \Delta u}{\partial K_p} = e(k)-e(k-1) \), \( \frac{\partial \Delta u}{\partial K_i} = e(k) \), \( \frac{\partial \Delta u}{\partial K_d} = e(k)-2e(k-1)+e(k-2) \).

Defining the local gradient for the output layer as \( \delta^{(3)}_k(k) \), the final weight update rule for the output layer becomes:

$$ \Delta w^{(2)}_{ki}(k) = \frac{2}{5}\alpha \Delta w^{(2)}_{ki}(k-1) + \left(1 – \frac{2}{5}\alpha\right) \eta \delta^{(3)}_k(k) O^{(2)}_i(k) $$

A similar procedure is applied to update the hidden layer weights \( w^{(1)}_{ij} \), back-propagating the error signal. This continuous, online adaptation allows the BPNNI to produce PID gains that optimally respond to the instantaneous flight conditions of the quadrotor drone.

Simulation Analysis and Performance Evaluation

To validate the effectiveness of the proposed BPNNI-PID controller, comprehensive numerical simulations were conducted in a MATLAB/Simulink environment, comparing it against a standard BPNN-PID controller and a conventional fixed-gain PID controller. The nonlinear dynamical model of the quadrotor drone was used as the plant. Key parameters for the BPNNI were set as: learning rate \( \eta = 0.5 \), inertia coefficient \( \alpha = 0.6 \) for attitude loops, and sampling time \( t_s = 0.02 \) s. The conventional PID gains were manually tuned to \( K_p=15.26, K_i=0.18, K_d=0.32 \) for the yaw channel as a baseline.

1. Attitude Set-Point Tracking: The yaw angle \( \psi \) was commanded to track a step reference from \( 0^\circ \) to \( 30^\circ \). Figure X (conceptual) below summarizes the key performance metrics extracted from the simulations.

Performance Metric BPNNI-PID BPNN-PID Conventional PID
Rise Time (s) 0.45 0.52 0.61
Overshoot (%) 0.0 0.0 7.61
Settling Time (2% band, s) 0.85 1.10 1.95
Steady-State Error ~0 ~0 ~0

The BPNNI-PID controller achieved the fastest response with zero overshoot. The conventional PID, despite careful tuning, exhibited a significant 7.61% overshoot. The adaptive tuning of both neural-based controllers eliminated the overshoot, but the modified inertia term in BPNNI-PID contributed to a notably faster settling time compared to standard BPNN-PID.

2. Disturbance Rejection: A critical test for any quadrotor drone controller is its ability to reject external disturbances. A sequence of random torque pulses, simulating wind gusts, was injected into the roll channel during steady-state hover. The deviation from the desired attitude and the recovery time were measured.

Controller Type Max Deviation (deg) Recovery Time (s) Integral of Absolute Error (IAE)
BPNNI-PID 1.8 1.2 2.1
BPNN-PID 2.1 1.5 2.7
Conventional PID 3.5 2.4 4.8

The BPNNI-PID controller demonstrated superior disturbance rejection, with the smallest maximum deviation and the quickest recovery. The IAE metric, which accumulates the total error over the disturbance period, was lowest for BPNNI-PID, indicating the most effective suppression of the disturbance effect on the quadrotor drone‘s attitude.

3. Robustness to Parameter Uncertainty: In practice, the mass and inertia of a quadrotor drone can change due to payload variation or battery consumption. To test robustness, the model parameters \( m, I_{xx}, I_{yy}, I_{zz} \) were simultaneously varied by \( \pm 30\% \) from their nominal values used for controller design. The step response for the pitch channel was analyzed under these perturbed conditions.

Parameter Variation Controller Overshoot (%) Settling Time (s)
-30% (Lighter) BPNNI-PID 0.0 0.80
BPNN-PID 0.0 1.05
Conventional PID 10.2 2.30
+30% (Heavier) BPNNI-PID 0.0 0.90
BPNN-PID 0.0 1.15
Conventional PID 5.8 2.10

The results are striking. The adaptive neural networks completely eliminated overshoot across the large parameter variations, showcasing their inherent robustness. The conventional PID controller, with its fixed gains, suffered from increased overshoot and prolonged settling time when the quadrotor drone dynamics changed. Furthermore, the BPNNI-PID consistently maintained a shorter settling time than the BPNN-PID, proving the benefit of the modified inertia term in maintaining dynamic performance under uncertainty.

The online adaptation of the PID gains \( K_p(k), K_i(k), K_d(k) \) by the BPNNI for the yaw channel during a step response clearly showed the network’s reasoning: \( K_p \) increased initially for a fast response, \( K_d \) rose to dampen the change, and \( K_i \) adjusted to eliminate steady-state error, all converging to stable values once the quadrotor drone reached its target.

Conclusion

This study has presented a robust and adaptive attitude control solution for a quadrotor drone by integrating a conventional PID controller with a specially enhanced Back-Propagation Neural Network. The principal contribution is the introduction and empirical validation of a modified inertia term within the neural network’s weight adaptation law. This modification was shown to effectively temper training oscillations and promote stable convergence, leading to more reliable online tuning of the PID parameters.

The proposed BPNNI-PID controller addresses the fundamental limitation of fixed-gain PID control by enabling real-time self-tuning in response to the quadrotor drone‘s operational state. Through detailed simulation experiments encompassing set-point tracking, disturbance rejection, and robustness tests against model uncertainties, the BPNNI-PID controller demonstrated comprehensive superiority. It achieved faster transient response with no overshoot, significantly better rejection of external disturbances, and remarkable robustness to substantial variations in the drone’s physical parameters, outperforming both the standard BPNN-PID and the conventional PID controllers.

The control architecture marries the simplicity and reliability of PID with the intelligence and adaptability of neural networks, offering a practical and highly effective solution for enhancing the flight stability and performance of quadrotor drones in complex, real-world environments. Future work will focus on experimental validation on a physical drone platform and extension of the controller to manage the fully coupled translational and rotational dynamics for complex trajectory tracking.

Scroll to Top