# Automatic Control Optimization for Large-Load Plant-Protection Quadrotor
## 2 Materials and Methods
### System Model and Identification
Moreover, the tank in this project is an anti-oscillation tank specially designed for plant-protection quadrotor, where water is separated in small blocks, which greatly eliminate the impact of water. As a result, we assume that the water is shaped as a cuboid, as shown in Figure 3.  
In Figure 3, \(cog_{bo}\) is the center of gravity (COG) of the body (including the empty tank), \(cog_{uu}\) is the COG of the water cube, and \(cog_{all}\) is the COG of the total quadrotor. In addition, \(d_{cog}\) denotes the distance between \(cog_{bo}\) and \(cog_{ua}\), \(d_{bo}\) represents the distance between \(cog_{bo}\) and \(cog_{all}\), and \(d_{ua}\) is the distance between \(cog_{uu}\) and \(cog_{all}\). To simplify the calculation, the movement of the COG of the water is ignored, so \(d_{cog}\) is constant. \(V_{ua}\) is the volume of the water cube, and \(l_{ua}\) is the length and width of the water cube, so the height  
Figure 2: System parameter identification. of the water cube can be calculated as \(h_{xu}=V_{wa}/l_{wa}^{2}\). Then, \(d_{bo}\) and \(d_{wa}\) can be calculated as Equation (5) presents:  
\[ \begin{cases}d_{bo}=\frac{V_{wa}\rho_{wa}}{m_{bo}+V_{wa}\rho_{wa}}d_{cog}\\ d_{wa}=\frac{m_{bo}}{m_{bo}+V_{wa}\rho_{wa}}d_{cog},\end{cases}  \tag{5}\]  
where \(\rho_{wa}\) is the density of the water or pesticide. The MOIs of the water can be calculated using Equation (6):  
\[ \begin{cases}J_{xx,wa}=\frac{V_{wa}\rho_{wa}}{12}(l_{wa}^{2}+h_{wa}^{2})\\ Jy_{yy,wa}=\frac{V_{wa}\rho_{wa}}{12}(l_{wa}^{2}+h_{wa}^{2})\\ J_{zz,wa}=\frac{V_{wa}\rho_{wa}}{6}l_{wa}^{2},\end{cases}  \tag{6}\]  
where \(J_{xx,wa}\), \(J_{yy,wa}\), and \(J_{zz,wa}\) are the MOIs of the water cube in the three axes. Then, the MOIs of the total quadrotor can be calculated using rigid-body parallel axis theory, as Equation (7) presents:  
\[ \begin{cases}J_{xx}=J_{xx,bo}+J_{xx,wa}+V_{wa}\rho_{wa}d_{wa}^{2}+m_{bo}d_{bo} ^{2}\\ Jy_{yy}=J_{yy,ba}+V_{yy,wa}+V_{wa}\rho_{wa}d_{cog}^{2}+m_{bo}d_{bo}^{2}\\ J_{zz}=J_{zz,bo}+J_{zz,wa},\end{cases}  \tag{7}\]  
where \(J_{xx,bo}\), \(J_{yy,bo}\), and \(J_{zz,bo}\) are the MOIs of the quadrotor body in the three axes. In this way, we can estimate the MOIs of the total quadrotor with any amount of water carried in it. In this article, we identify the parameters of the motors and rotors with a rotor bench (Figure 2b). The bench can measure the lift force, the torque and the angular velocity of the rotor, so the lift coefficient \(C_{T}\) and torque coefficient \(C_{M}\) can be calculated. The rest of the unknown parameters, such as the dynamic response constant of the rotors \(T_{m}\), can be found in an online quadrotor database: [[https://flyeval.com/](https://flyeval.com/)]([https://flyeval.com/](https://flyeval.com/)) (accessed on 27 March 2021). [22]. In the simulation and training process, the simulation environment updates the states of the quadrotors, including the attitude, the angular velocities of the three axes and the angular velocities of the rotors. The attitude is described in unit quaternions in this article:  
\[ \begin{cases}q_{0}=cos\left(\frac{\Theta}{2}\right)\\ q_{1}=sin\left(\frac{\Theta}{2}\right)\,p_{x}\\ q_{2}=sin\left(\frac{\Theta}{2}\right)\,p_{y}\\ q_{3}=sin\left(\frac{\Theta}{2}\right)\,p_{z},\end{cases}  \tag{8}\]  
Figure 3: Model of the large-load quadrotor with water in the tank. where \(\Theta\) is the combined rotation of the roll angle, the pitch angle and the yaw angle, and \(p_{x},p_{y},p_{z}\) are the projections of \(\Theta\) in the roll, pitch and yaw axes, respectively. The quaternions can be updated with angular velocities in three axes using the Runge-Kutta method:  
\[ \begin{bmatrix}q_{0}\\ \dot{q}_{1}\\ \dot{q}_{2}\\ \dot{q}_{3}\end{bmatrix} =\frac{1}{2} \begin{bmatrix}0&-\omega_{x}&-\omega_{y}&- \omega_{z}\\ \omega_{x}&0&\omega_{z}&-\omega_{y}\\ \omega_{y}&-\omega_{z}&0&\omega_{x}\\ \omega_{z}&\omega_{y}&-\omega_{x}&0\end{bmatrix}\begin{bmatrix}q_{0}\\ q_{1}\\ q_{2}\\ q_{3}.\end{bmatrix}  \tag{9}\]