# Simulation of a Quadrotor under Linear Active Disturbance Rejection
## 2 Mathematical Model  
The power of the \"\(\times\)\" quadrotor comes from four rotors, and the rotation directions of the two adjacent rotors are opposite to overcome the anti\(-\)torque torque generated by the rotation of the rotors. The quadrotor has a total of 6 degrees of freedom, each channel has strong coupling and the robustness of the flight system is weak. So as to achieve its full attitude takeoff, the quadrotor is regarded as a rigid body, \(O_{g}\) is the Earth\(-\)fixed inertial frame and \(O_{c}\) is the body\(-\)fixed frame [22] when building mathematical models. The coordinate reference system of the quadrotor is shown in Figure 1.  
\( \begin{bmatrix}X_{c}&Y_{c}&Z_{c}\end{bmatrix} \) represent the coordinate transformation in the earth coordinate system, \( \begin{bmatrix}\theta&\varphi&\psi\end{bmatrix} \) represent three attitude angles, respectively. The position and attitude control of the quadrotor are confirmed in the structure \(O_{g}\), \(O_{c}\), respectively, introducing \(M_{\text{g}}^{\text{c}}\) to represent the transformation matrix, as follows:  
\[M_{\text{g}}^{\text{c}}= \begin{bmatrix}M_{1}&M_{2}&M_{3}\end{bmatrix}  \tag{1}\]  
where,  
\[M_{1} =\left[ \begin{array}{c}\cos\theta\cos\psi\\ \cos\theta\sin\psi\\ -\sin\theta\end{array} \right] \tag{2}\] \[M_{2} =\left[ \begin{array}{c}\sin\theta\sin\varphi\cos\psi-\sin \varphi\sin\varphi\\ \sin\theta\sin\varphi\sin\psi+\cos\psi\cos\varphi\\ \sin\varphi\cos\theta\end{array} \right]\] \[M_{3} =\left[ \begin{array}{c}\sin\theta\cos\varphi\cos\psi+\sin\psi \sin\varphi\\ \sin\theta\sin\psi\cos\varphi-\cos\varphi\cos\psi\\ \cos\varphi\cos\theta\end{array} \right]\]  
In the body - fixed frame \(O_{c}\), the lift of the four rotors is represented by \(V_{1}\), \(V_{2}\), \(V_{3}\), \(V_{4}\), respectively, the lift of a quadrotor is expressed as:  
\[V_{c}= \begin{bmatrix}V_{Xc}&V_{Yc}&V_{Zc}\end{bmatrix} ^{T}= \begin{bmatrix}0&0&V_ {1}+V_{2}+V_{3}+V_{4}\end{bmatrix} ^{T} \tag{3}\]  
From Equations (1) and (3), one has:  
\[V_{F}= \begin{bmatrix}V_{x}&V_{y}&V_{z}\end{bmatrix} ^{T}=M_{g}^{c}\cdot V_{c} \tag{4}\]  
Figure 1: The coordinate reference frames of quadrotors. In the Earth\(-\)fixed inertial frame \(O_{g}\), the position of the quadrotor is represented by \(x\), \(y\) and \(z\), and the dynamic equation of space motion is expressed as:  
\[\left\{ \begin{array}{l}\ddot{x}=\left(V_{x}-r_{s}\dot{x}\right)/m\\ \dot{y}=\left(V_{y}-r_{s}\dot{y}\right)/m\\ \ddot{z}=\left(V_{z}-mg-r_{s}\dot{z}\right)/m\end{array} \right. \tag{5}\]  
The rotation of the quadrotor is represented by \(\theta\), \(\varphi\), \(\psi\), and its attitude motion equation is expressed as:  
\[\left\{ \begin{array}{l}\ddot{\theta}=j\big{(}-V_{1}+V_{2}+V_{3}-V_{4}-r_{s} \dot{\theta}\big{)}/p_{2}+(p_{3}-p_{1})\dot{\phi}\dot{\psi}/p_{2}\\ \ddot{\varphi}=j\big{(}-V_{1}+V_{2}+V_{3}-V_{4}-r_{s}\dot{\varphi}\big{)}/p_{2 }+(p_{2}-p_{3})\dot{\theta}\dot{\varphi}/p_{1}\\ \ddot{\psi}=\left[\mathrm{r}_{o}\big{(}-V_{1}+V_{2}-V_{3}+V_{4}-r_{s}\dot{ \psi}\big{)}/p_{3}\right]+(p_{1}-p_{2})\dot{\theta}\dot{\varphi}/p_{3}\end{array} \right. \tag{6}\]  
The quadrotor UAV dynamics model can be obtained by combining Equations (5) and (6), where the model parameters are shown in Table 1 and the constants of the mathematical model are designed with reference to the literature [23]. To simplify the quadrotor model, we introduce the virtual control force \(H_{1}\), \(H_{2}\), \(H_{3}\), \(H_{4}\) to replace the lift force \(V_{1}\), \(V_{2}\), \(V_{3}\), \(V_{4}\) of the four rotor. The virtual control variable \(H_{x}\), \(H_{y}\), \(H_{z}\) is introduced to simplify the motion equation. \[ \begin{bmatrix}H_{1}\\ H_{2}\\ H_{3}\\ H_{4}\end{bmatrix} = \begin{bmatrix}1/m&1/m&1/m&1/m\\ -j/p_{2}&j/p_{2}&j/p_{2}&-j/p_{2}\\ -j/p_{1}&j/p_{1}&j/p_{1}&-j/p_{1}\\ -r_{o}/p_{3}&r_{o}/p_{3}&-r_{o}/p_{3}&r_{o}/p_{3}\end{bmatrix}\begin{bmatrix}V _{1}\\ V_{2}\\ V_{3}\\ V_{4}\end{bmatrix}  \tag{7}\]  
where,  
\[ \begin{bmatrix}H_{x}\\ H_{y}\\ H_{z}\end{bmatrix}