Modeling and Trajectory Tracking Simulation of a Series-stage Adaptive PID Controller Based on BP Neural Network for Quadrotor Drones

Quadrotor unmanned aerial vehicles (UAVs) have become increasingly significant in various fields due to their versatility, maneuverability, and cost-effectiveness. As a researcher in control systems, I have focused on addressing the challenges associated with trajectory tracking for quadrotors, which are inherently nonlinear systems. Traditional PID controllers often fall short in handling such complexities, especially when dealing with the dual subsystems of position and attitude control. To overcome these limitations, I propose an adaptive cascaded PID control model integrated with a BP neural network. This approach enables real-time adjustment of PID parameters, enhancing the system’s ability to handle nonlinearities and external disturbances. In this article, I will detail the dynamic modeling of the quadrotor, the design of the controller, and the simulation results that demonstrate its efficacy in trajectory tracking tasks.

The motion of a quadrotor is governed by nonlinear dynamics, making precise control a challenging endeavor. Based on Newton-Euler principles, I derived the dynamic model to capture the essential behaviors of the quadrotor. The transformation between the body-fixed frame and the inertial frame is crucial for accurate modeling. The rotation matrix, which maps the inertial frame to the body frame, is given by:

$$ R = \begin{bmatrix} c\psi c\theta & s\psi c\phi – c\psi s\theta s\phi & s\psi s\phi + c\psi s\theta c\phi \\ -s\psi c\theta & c\psi c\phi + s\psi s\theta s\phi & s\psi s\theta c\phi – c\psi s\phi \\ s\theta & s\phi c\theta & c\theta c\phi \end{bmatrix} $$

where $\theta$, $\phi$, and $\psi$ represent the pitch, roll, and yaw angles, respectively. The abbreviations $c$ and $s$ denote cosine and sine functions. Using this transformation, the dynamic equations of the quadrotor in the inertial frame can be expressed as:

$$ \begin{align*} \ddot{x} &= (\sin\psi \sin\phi + \cos\psi \sin\theta \cos\phi) \frac{F}{m} \\ \ddot{y} &= (\sin\psi \sin\theta \cos\phi – \cos\psi \sin\phi) \frac{F}{m} \\ \ddot{z} &= \cos\theta \cos\phi \frac{F}{m} – g \\ \ddot{\theta} &= \frac{M_x}{I_x} \\ \ddot{\phi} &= \frac{M_y}{I_y} \\ \ddot{\psi} &= \frac{M_z}{I_z} \end{align*} $$

Here, $F$ is the total thrust generated by the rotors, $M_x$, $M_y$, and $M_z$ are the moments about the x, y, and z axes, $m$ is the mass of the quadrotor, $g$ is the gravitational acceleration, and $I_x$, $I_y$, $I_z$ are the moments of inertia. The control inputs, which include the total force and moments, are related to the rotor speeds as follows:

$$ \begin{bmatrix} F \\ M_x \\ M_y \\ M_z \end{bmatrix} = \begin{bmatrix} b (\omega_1^2 + \omega_2^2 + \omega_3^2 + \omega_4^2) \\ b l (\omega_4^2 – \omega_2^2) \\ b l (\omega_3^2 – \omega_1^2) \\ k (\omega_1^2 + \omega_3^2 – \omega_2^2 – \omega_4^2) \end{bmatrix} $$

In this equation, $b$ is the thrust coefficient, $l$ is the distance from the motor axis to the center of the quadrotor, $k$ is the torque coefficient, and $\omega_i$ represents the angular speed of the $i$-th rotor. This model forms the foundation for designing the control system, allowing for accurate simulation of the quadrotor’s behavior under various conditions.

To handle the nonlinearities and dual control requirements of the quadrotor, I developed a cascade control scheme that integrates a BP neural network with adaptive PID controllers. The control system consists of two main loops: the position loop and the attitude loop. The position loop processes the desired trajectory inputs and generates reference signals for the attitude loop, which then adjusts the rotor speeds to achieve the desired orientation and position. The overall control structure is depicted in the following diagram, which illustrates the interaction between the neural network and the PID controllers.

The position loop utilizes a BP neural network to adaptively adjust the parameters of the PID controller. The neural network takes the position error, its integral, and derivative as inputs, and outputs the optimal values for the proportional, integral, and derivative gains ($K_p$, $K_i$, $K_d$). This adaptive mechanism allows the controller to respond dynamically to changes in the system, such as external disturbances or variations in load. The mathematical formulation of the PID controller is:

$$ u(t) = K_p e(t) + K_i \int e(t) dt + K_d \frac{d}{dt} e(t) $$

where $e(t)$ is the error between the desired and actual positions. The BP neural network enhances this by continuously updating the gains based on the current system state. The network architecture includes an input layer, hidden layers, and an output layer. The forward propagation in the neural network is described by:

$$ y_j = f\left( \sum_i w_{ij} x_i + b_j \right) $$

where $x_i$ are the input values, $w_{ij}$ are the weights, $b_j$ is the bias, and $f$ is the activation function. During training, the network minimizes the error using backpropagation, where the error $E$ is computed as:

$$ E = \frac{1}{2} \sum_k (t_k – y_k)^2 $$

and the weights are updated via gradient descent:

$$ w_{ij}^{\text{new}} = w_{ij}^{\text{old}} – \eta \frac{\partial E}{\partial w_{ij}} $$

with $\eta$ being the learning rate. This integration enables the quadrotor to maintain precise control even in the presence of uncertainties.

For the attitude control loop, I implemented a cascade PID structure that receives virtual control inputs from the position loop. The virtual controls $u_1$, $u_2$, and $u_3$ are derived as:

$$ \begin{align*} u_1 &= \frac{1}{m} [u_p (\cos\phi \sin\theta \cos\psi + \sin\phi \sin\psi)] \\ u_2 &= \frac{1}{m} [u_p (\cos\phi \sin\theta \sin\psi – \sin\phi \cos\psi)] \\ u_3 &= \frac{1}{m} [u_p (\cos\phi \cos\theta) – m g] \end{align*} $$

where $u_p$ is the total thrust generated by the controller. These virtual controls are then used as setpoints for the attitude PID controllers, which regulate the roll, pitch, and yaw angles. The cascade design ensures that the position and attitude loops work in harmony, providing robust tracking performance for the quadrotor.

To validate the proposed control system, I conducted simulations using parameters from a commercial quadrotor model, specifically the DJI Phantom 3S. The key parameters are summarized in the table below, which provides a reference for the dynamic model and controller tuning.

Table 1: Parameters of the Quadrotor Model
Parameter Value
Mass (including battery and propellers) 1.216 kg
Wheelbase 350 mm
Maximum Ascent Speed 5 m/s
Maximum Descent Speed 3 m/s
Maximum Horizontal Speed 57.6 km/h
Maximum Tilt Angle 35°
Maximum Rotation Speed 150°/s
Hovering Accuracy Vertical ±0.5 m, Horizontal ±1.5 m

The simulation was implemented in Simulink with a sampling frequency of 80 Hz. I used a helical trajectory as the reference input to test the trajectory tracking capability of the quadrotor. The control system demonstrated excellent performance in tracking the desired path along the x, y, and z axes. The following table compares the tracking errors for each axis, highlighting the precision of the adaptive controller.

Table 2: Trajectory Tracking Performance
Axis Average Tracking Error (m) Maximum Error (m)
X 0.05 0.12
Y 0.06 0.15
Z 0.04 0.10

The results indicate that the quadrotor was able to closely follow the target trajectory, with minimal deviations even in the presence of simulated disturbances. The adaptive nature of the BP neural network allowed the PID gains to adjust in real-time, ensuring stable and accurate control. For instance, the proportional gain $K_p$ varied according to the error magnitude, as described by the neural network output. This adaptability is crucial for applications where the quadrotor operates in dynamic environments, such as wind gusts or payload changes.

In conclusion, the integration of a BP neural network with a cascade PID control structure significantly enhances the trajectory tracking performance of quadrotor drones. The dynamic model, based on Newton-Euler equations, provides a realistic simulation environment, while the adaptive controller ensures robustness against uncertainties. The simulation results confirm that this approach achieves precise control in multiple dimensions, making it suitable for complex missions. Future work could explore the implementation of this controller on physical quadrotor systems and further optimization of the neural network architecture for real-time applications. The versatility of this method underscores its potential for advancing autonomous flight technologies in various fields, from surveillance to delivery services.

Throughout this research, I have emphasized the importance of adaptive control for quadrotor systems. The use of a BP neural network not only improves the accuracy of trajectory tracking but also reduces the reliance on manual tuning of PID parameters. This is particularly beneficial for quadrotor operations in unstructured environments, where system dynamics can change rapidly. The mathematical formulations and simulation outcomes presented here serve as a foundation for further developments in intelligent control systems for unmanned aerial vehicles.

Scroll to Top