## 2 Literature Review
### Mathematical Modeling of Quadcopter Motion
\begin{aligned} i=2\\ i=4\\ \tau_{\phi}=\sum rx\\ =l\left(-\mathrm{k_{t}}\omega_{2}^{2}+\mathrm{k_{t}}\omega_{2}^{2} \right)\\ =l\mathrm{k_{t}}\left(-\omega_{2}^{2}+\mathrm{\omega_{2}^{2}}\right)\\ \end{aligned} \right. \tag{12}\]  
\[\tau_{\phi}=\sum rxT=1\left(-\mathrm{k_{t}}\omega_{1}^{2}+\mathrm{k_{t}} \omega_{3}^{2}\right)=l\mathrm{k_{t}}\left(-\omega_{1}^{2}+\mathrm{\omega_{3} ^{2}}\right) \tag{13}\]  
\[\tau_{\phi}=\left(-1\right)^{1+i}\mathrm{k_{b}}\omega_{i}^{2}+I_{m}\dot{\omega _{i}} \tag{14}\]  
where \((-1)^{1+i}\) 1 is positive for the \(i\)th propeller if the propeller is spinning clockwise and negative if it is spinning counterclockwise, at steady state \(\dot{\omega_{i}}\approx 0\), \(\tau_{\phi=\mathrm{k_{b}}(-\omega_{1}^{2}+\omega_{2}^{2}-\omega_{3}^{2}+\omega_ {2}^{2})}\), where \(kt\) is the thrust coefficient, \(kb\) is the drag coefficient, and \(l\) is the distance between the rotor and the center of mass of the quadcopter,  
\[T_{B}= \begin{bmatrix}\tau_{\phi}\\ \tau_{\phi}\\ \tau_{\phi}\end{bmatrix} = \begin{bmatrix}l\mathrm{k_{t}}\left(-\omega_{2}^{2}+ \mathrm{\omega_{2}^{2}}\right)\\ l\mathrm{k_{t}}\left(-\omega_{1}^{2}+\mathrm{\omega_{2}^{2}}\right)\\ \mathrm{k_{b}}\left(-\omega_{1}^{2}+\mathrm{\omega_{2}^{2}}-\mathrm{\omega_{3} ^{2}}+\mathrm{\omega_{4}^{2}}\right)\end{bmatrix}  \tag{15}\]  
Using Newtonian equation to model the linear dynamics, the extraneous forces acting on the quadcopter are:  
\[m\dot{V}_{I}= \begin{bmatrix}0\\ 0\\ -m_{S}\end{bmatrix} +RT_{B}+F_{D} \tag{16}\]  
where \(F_{D}\) is the drag force acting on the system as a result of fluid friction (air resistance). A simplified equation can be used where \(F_{D}\) is friction. Drag force is assumed to be proportional to the linear velocity in all directions, \(F_{D}=-k_{d}V_{I}\). The angular velocity of the \(i\)th rotor creates a force Fi in the direction of the rotor axis (z-direction). The combined forces create thrust T in the direction of the body's z-axis:  
\[T=\sum_{i=1}^{4}F_{i}=k_{t}\sum_{i=1}^{4}\omega_{i}^{2} \tag{17}\]  
Since it acts in the z-axis,  
\[T_{B}= \begin{bmatrix}0\\ 0\\ T\end{bmatrix} =k_{t} \begin{bmatrix}0\\ 0\\ \sum i=l\omega_{i}^{2}\end{bmatrix}  \tag{18}\]and  
\[\dot{\omega_{B}}=I^{-1}\left( \begin{bmatrix}p\\ q\\ r\end{bmatrix} x \begin{bmatrix}I_{xx}p\\ I_{yy}q\\ I_{zz}r\end{bmatrix} -J_{r} \begin{bmatrix}p\\ q\\ r\end{bmatrix} \omega_{r}+\tau_{B}\right) \tag{19}\]  
\[ \begin{bmatrix}\dot{p}\\ \dot{q}\\ \dot{r}\end{bmatrix} = \begin{bmatrix}\frac{\left(I_{yy}-I_{xz}\right)}{I_{yy}} qr\\ \frac{\left(I_{zz}-I_{xx}\right)}{I_{zz}}qr\end{bmatrix} -J_{r} \begin{bmatrix}\frac{q}{I_{xz} }\\ \frac{q}{I_{yy}}\\ 0\end{bmatrix} \omega_{r}+ \begin{bmatrix}\frac{\tau_{B}}{I_{xx}}\\ \frac{q}{I_{yy}}\\ \frac{q}{I_{zz}}\end{bmatrix}  \tag{20}\]  
From the linear dynamics,  
\[\left[\tilde{X}\;\tilde{Y}\;\tilde{Z}\right]=\begin{pmatrix}-g \begin{bmatrix}0 \\ 0\\ 1\end{bmatrix} +\frac{T}{m} \begin{bmatrix}c(\psi)s(\theta)c(\phi)+s(\psi)s(\phi) \\ s(\psi)s(\phi)c(\phi)+c(\psi)s(\phi)\\ c(\phi)c(\phi)\end{bmatrix} \\ c(\phi)c(\phi)\\ \begin{bmatrix}k_{dx}&0&0\\ -\frac{1}{m}\begin{bmatrix}k_{dy}&0\\ 0&k_{dy}&0\\ 0&0&k_{dz}\end{bmatrix}\begin{bmatrix}\tilde{x}\\ \dot{y}\\ \dot{z}\end{bmatrix}\end{bmatrix}  \tag{21}\]  
Once we had developed this mathematical model, the next step was to construct a suitable controller. The challenge for the controller was to read a sensor, process variables in quadcopter control systems, and generate a control signal to dynamically reduce the difference between the output and the desired setpoint of the quadcopter system. The controller model we developed achieves this by computing the PID responses and summing these three components to compute the desired actuator output.