## 2 Mathematical Model of Quadcopter
### Quadcopter Coordinates  
Referring to the dynamic model of a quadcopter presented in Figure 2, the following two reference frames can be used to describe the dynamic behavior movement of a quadcopter [37]:  
* The linear and angular positions of the Earth's inertial frame (\(E\)) can be defined as follows: \[\overrightarrow{\zeta}=\begin{bmatrix}x\\ y\\ z\end{bmatrix},\overrightarrow{\eta}=\begin{bmatrix}\phi\\ \theta\\ \psi\end{bmatrix}\] (1)  
Figure 1: Quadcopter configuration.  
* The linear and angular velocities of the body-fixed frame (\(B\)) can be defined as follows: \[\vec{Y}=\begin{bmatrix}u\\ v\\ w\end{bmatrix}.\vec{\Omega}=\begin{bmatrix}p\\ q\\ r\end{bmatrix}\] (2) The following assumptions were taken into account when developing a dynamic model of a quadcopter:
* The body of the quadcopter is rigid and symmetrical.
* The center of gravity and center of body mass coincide.
* The aerodynamic effects are not significant in the case proposed in this work. Equations (21) and (22) can be used to derive the formulas for \(\dot{\xi}\) and \(\dot{\eta}\) as defined below: \[\dot{\xi}=\mathbf{R}Y\] (3) \[\dot{\eta}=\mathbf{J}\Omega\] (4) The rotation matrices along \(x,y\) and \(z\) axes are defined below:
* Rotation along the \(x\)-axis is as follows: \[\mathbf{R}_{\phi}=\begin{bmatrix}1&0&0\\ 0&C_{\phi}&-S_{\phi}\\ 0&S_{\phi}&C_{\phi}\end{bmatrix}\] where \(C_{\phi}\) and \(S_{\phi}\) indicate \(\cos\phi\) and \(\sin\phi\), respectively.
* Rotation along the \(y\)-axis is as follows: \[\mathbf{R}_{\theta}=\begin{bmatrix}C_{\theta}&0&S_{\theta}\\ 0&1&0\\ -S_{\theta}&0&C_{\phi}\end{bmatrix}\] where \(C_{\theta}\) and \(S_{\theta}\) indicate \(\cos\theta\) and \(\sin\theta\), respectively.
* Rotation along the \(z\)-axis is as follows: \[\mathbf{R}_{\psi}=\begin{bmatrix}C_{\phi}&-S_{\psi}&0\\ S_{\phi}&C_{\phi}&0\\ 0&0&1\end{bmatrix}\] where \(C_{\phi}\) and \(S_{\psi}\) indicate \(\cos\psi\) and \(\sin\psi\), respectively.
* Equation (6) can be used to convert all the angles from the \(B\) frame to \(E\) frame: \[\mathbf{R}=\mathbf{R}_{\phi}\times\mathbf{R}_{\phi}\times\mathbf{R}_{\psi}\] (5) \[\mathbf{R}=\begin{bmatrix}C_{\phi}C_{\theta}&C_{\phi}S_{\theta}S_{\phi}-S_{ \phi}S_{\phi}&C_{\phi}S_{\phi}C_{\phi}+S_{\phi}C_{\phi}\\ S_{\phi}C_{\theta}&S_{\psi}S_{\theta}S_{\phi}+C_{\phi}C_{\phi}&S_{\psi}S_{\phi} C_{\phi}-C_{\phi}S_{\phi}\\ -S_{\theta}&C_{\phi}S_{\phi}&C_{\phi}C_{\phi}\end{bmatrix}\] (6)
* The angular velocity translation matrix (\(\mathbf{J}\)) is defined in Equation (7). \[\mathbf{J}=\begin{bmatrix}1&0&-S_{\theta}\\ 0&C_{\phi}&S_{\phi}C_{\theta}\\ 0&-S_{\phi}&C_{\phi}C_{\theta}\end{bmatrix}\] (7)
Finally, the kinematic model for a quadcopter is given in Equation (8):  
\[\dot{x} = w[S_{\phi}S_{\psi}+C_{\phi}C_{\psi}S_{\theta}]-v[C_{\phi}S_{\psi}-C_ {\phi}S_{\phi}S_{\theta}]+u[C_{\phi}C_{\phi}]\] \[\dot{y} = v[C_{\phi}C_{\psi}+S_{\phi}S_{\psi}S_{\theta}]-w[C_{\phi}S_{\phi}-C _{\phi}S_{\psi}S_{\theta}]+u[C_{\theta}S_{\psi}]\] \[\dot{z} = w[C_{\phi}C_{\theta}]-u[S_{\theta}]+v[C_{\theta}S_{\phi}]\] \[\dot{\phi} = p+r[C_{\theta}T_{\theta}]+q[S_{\phi}T_{\theta}]\] \[\dot{\theta} = q[C_{\phi}]-r[S_{\phi}]\] \[\dot{\psi} = r\times C_{\phi}/C_{\theta}+q\times S_{\phi}/C_{\theta} \tag{8}\]