# Research and Verification of Trajectory Tracking Control of a Quadrotor Carrying a Load
## 3 Controller Design
### Attitude Controller Design
The error integration term is introduced to reduce the steady-state error of the system and improves the steady-state performance of the system, and a neural network adaptive algorithm with strong adaptive and learning capabilities is incorporated to estimate online and compensate for the errors caused by model uncertainty and external disturbances. Taking the roll angle channel of the quadrotor as an example, the roll angle part is extracted, the roll angle controller is designed and the roll angle dynamic model is organized as in Equation (22):  
\[\ddot{\phi}=U_{2}\frac{l}{I_{x}}+\frac{I_{y}-I_{z}}{I_{x}}\phi\dot{\psi}+d_{ \phi} \tag{22}\]  
Step 1: Based on the backstepping method, define the roll angle tracking error as \(e_{1}\):  
\[e_{1}=\phi_{d}-\phi \tag{23}\]  
where \(\phi_{d}\) is the expected rolling angle. The derivative of the rolling angle tracking error can be obtained by taking the derivative of Equation (23) as \(\dot{e}_{1}\):  
\[\dot{e}_{1}=\dot{\phi}_{d}-\dot{\phi}=\dot{\phi}_{d}-p \tag{24}\]  
\(p=\phi\) is the actual roll angular acceleration of the quadrotor. To stabilize \(e_{1}\), the Lyapunov function of \(e_{1}\) is chosen to be \(V_{1}\):  
\[V_{1}=\frac{1}{2}{e_{1}}^{2}\geq 0 \tag{25}\]  
The derivative of [PERSON]'s formula for Equation (25) yields Equation (26):  
\[\dot{V}_{1}=e_{1}\dot{e}_{1}=e_{1}(\dot{\phi}_{d}-p) \tag{26}\]  
The actual roll angular velocity \(p\) is defined as the virtual control input, while the desired virtual control is defined as \(p_{d1}\). To make \(\dot{V}_{1}\leq 0\), let \[p_{d1}=k_{1}e_{1}+\dot{\phi}_{d} \tag{27}\]  
Step 2: Considering the need to eliminate the effect of model uncertainty, enhance robustness and reduce steady-state errors, an integration term \(\mu_{1}\gamma_{1}\) is added to the virtual control variable:  
\[p_{d1}=k_{1}e_{1}+\dot{\phi}_{d}+\mu_{1}\gamma_{1} \tag{28}\]  
where \(\gamma_{1}=\int_{0}^{t}e_{1}(\tau)d\tau\). \(k_{1}\) and \(\mu_{1}\) are constants and are greater than 0. Step 3: Define the error of the virtual control input as \(e_{2}\):  
\[e_{2}=p_{d1}-p=k_{1}e_{1}+\dot{\phi}_{d}+\mu_{1}\gamma_{1}-p=k_{1}e_{1}+\mu_{1} \gamma_{1}+\dot{e}_{1} \tag{29}\]  
Substituting Equation (29) into Equation (24), obtain:  
\[\dot{V}_{1}=e_{1}\dot{e}_{1}=e_{1}(-k_{1}e_{1}-\mu_{1}\gamma_{1}+e_{2})=-k_{1}{ e_{1}}^{2}-e_{1}\mu_{1}\gamma_{1}+e_{1}e_{2} \tag{30}\]  
Choose a new Lyapunov function to simultaneously stabilize \(e_{1}\), \(e_{2}\) and define Lyapunov \(V_{2}\) as:  
\[V_{2}=V_{1}+\frac{1}{2}e_{2}^{2}+\frac{1}{2}\mu_{1}\gamma_{1}^{2}\geq 0 \tag{31}\]  
The derivative of Equation (31) yields:  
\[e_{1}=\phi_{d}-\phi \tag{23}\]0  
\[e_{1}=\phi_{d}-\phi \tag{23}\]1  
Step 4: Since there are uncertain parameters and external wind disturbances \(d_{\phi}\) in Equation (32) and the upper limit of disturbance \(d_{\phi}\) is unknown, the approximation of the neural network control is designed to estimate and compensate for the uncertain parameters and external disturbances. The algorithm of the neural network is as follows:  
\[e_{1}=\phi_{d}-\phi \tag{23}\]2  
\[e_{1}=\phi_{d}-\phi \tag{23}\]3  
where \(x\) is the input to the neural network, \(c_{j}\) is the center of the training data points, \(j\) is the number of nodes in the hidden layer and \(b_{j}\) is a parameter representing the arrival rate or the rate at which the function drops to zero. The smaller the arrival rate, the narrower the image. \(h=\big{[}h_{j}\big{]}^{T}\) is the output of the Gaussian function of the neural network, \(W\) is the upper layer weight of the neural network and \(\zeta\) is the approximation error of the neural network. After designing the adaptive law of network weights, the RBF network input is \(e_{2}\) and \(e_{2}\) is the roll angular velocity tracking error. Then, the output of the network is:  
\[e_{1}=\phi_{d}-\phi \tag{23}\]4  
\[e_{1}=\phi_{d}-\phi \tag{23}\]5  
where \(\hat{W}=\hat{W}-W^{\ast}\). Therefore, the rolling angle controller \(U_{2}\) is designed as follows:  
\[e_{1}=\phi_{d}-\phi \tag{23}\]6