# Research and Verification of Trajectory Tracking Control of a Quadrotor Carrying a Load
## 3 Controller Design  
### Attitude Controller Design  
After modeling the eight-degree-of-freedom model and defining each quantity, it is shown in Figure 2.  
In the figure, \(Z_{d}\), \(Y_{d}\), \(X_{d}\) are the expected height, \(Y\)position and \(X\) position of the quadrotor, respectively. \(u_{ttrottle}\) is the height control quantity output by the height controller to the motor, \(u_{x}\) and \(u_{y}\) are the output of the horizontal position controller, and combined with the output \(u_{\alpha}\), \(u_{\beta}\) of the hanging swing angle controller, the final horizontal direction control quantity \(U_{x}\), \(U_{y}\) can be obtained. Considering the coupling effect of the yaw angle and the expected roll angle, pitch angles \(\phi_{d}\) and \(\theta_{d}\) are obtained after attitude calculation. Combined with the given expected yaw angle \(\varphi_{d}\) as the control variable of the attitude angle controller, the output to the motor's horizontal and the control variables of the roll angle, pitch angle and yaw angle are \(u_{roll}\), \(u_{pitch}\), \(u_{yaw}\), respectively. \(u_{1}\), \(u_{2}\), \(u_{3}\), \(u_{4}\) are obtained by allocating the four control variables of the motor, which is the PWM value of the motor, which defines the virtual control value \(U_{1}\), \(U_{2}\), \(U_{3}\), \(U_{4}\). The output of eight channels can be obtained from the system model \(X/\dot{X}\), \(Y/\dot{Y}\), \(Z/\dot{Z}\), \(\phi/\dot{\phi}\), \(\theta/\dot{\theta}\), \(\psi/\dot{\psi}\), \(\alpha/\dot{\alpha}\), \(\beta/\dot{\beta}\). The relationship between the control variables of the four PWM motors and the control variables of the designed virtual channels is defined by the following Equation (18):  
\[\left\{ \begin{array}{l}u_{1}=u_{ttrottle}+u_{yaw}+u_{pitch}\\ u_{2}=u_{throttle}+u_{yaw}-u_{pitch}\\ u_{3}=u_{throttle}-u_{yaw}+u_{roll}\\ u_{4}=u_{throttle}-u_{yaw}-u_{roll}\\ \end{array} \right. \tag{18}\]  
As shown in Figure 2, \(u_{1}\), \(u_{2}\), \(u_{3}\) and \(u_{4}\) are the PWM value of the four rotor motors. \(u_{throttle}\) represents the input signal of the throttle channel, and \(u_{roll}\), \(u_{pitch}\) and \(u_{yaw}\) represent the control input values of the roll channel, pitch channel and yaw channel, respectively. The motors drive the rotor rotation of the quadrotor, and the generated lift and reaction moments are shown in Equation (19), as follows:  
Figure 2: Control structure of a quadrotor carrying a load system. \[\left\{ \begin{array}{l}L_{i}=M_{t}\frac{\omega}{s+\omega}u_{i},i=1,2,3,4\\ Q_{i}=M_{y}\frac{\omega}{s+\omega}u_{i},i=1,2,3,4\end{array} \right. \tag{19}\]  
\(L_{i}\) is the upward vertical lift generated by the rotor, \(Q_{i}\) is the horizontal counter-torque, \(M_{t}\) and \(M_{y}\) are the lift and counter-torque coefficients, respectively, \(\omega\) is the motor bandwidth and \(u_{i}\) is the PWM control input signal to the motor. In calculating the relationship between the motor PWM signal and the force and the torque generated by the motor propeller, it is assumed that the motor is an ideal case with a sufficiently fast response, so the model can be simplified to the next relationship, see Equation (20):  
\[ \begin{cases}L_{i}=M_{t}u_{i},i=1,2,3,4\\ Q_{i}=M_{y}u_{i},i=1,2,3,4\end{cases}  \tag{20}\]  
The relationship between the virtual control quantity and the input signal is given by Equation (21):  
\[\left\{ \begin{array}{l}U_{1}=M_{t}(u_{1}+u_{2}+u_{3}+u_{4})=M_{t}\sum_{i=1} ^{4}u_{i}\\ U_{2}=M_{t}(u_{3}-u_{4})\\ U_{3}=M_{t}(u_{1}-u_{2})\\ U_{4}=M_{y}(u_{1}+u_{2}-u_{3}-u_{4})\end{array} \right. \tag{21}\]  
Assuming that a quadrotor carrying a load is in the environment of time-varying wind field disturbance, the attitude controller and swing angle controller are designed by the neural network adaptive method based on integral backstepping.