# Inverse Optimal Design for Position Control of a Quadrotor
## 2 Dynamic Model of a Quadrotor  
A quadrotor has a cross configuration with four motors, each of which is attached to each end of a cross-shaped body. The four motors are equipped with propellers whose axes of rotation are all parallel to each other. The behavior of a quadrotor can be controlled by adjusting the rotational velocities of these four propellers. The equations describing the position and attitude motions of a quadrotor are those of a rotating rigid body with six degrees-of-freedom (DoFs).  
To derive the equation for the movement of a quadrotor, we should to consider the coordinates of a quadrotor system. The generalized coordinates of a quadrotor system is shown in Figure 1, where \(B\) and \(E\) denote the body-fixed and earth inertial frames, respectively.  
Let us assume that the generalized velocity vectors with respect to the earth inertial and body-fixed frames are in the form of \(\dot{\xi}=\left[\dot{I}^{iE}\quad\dot{\Theta}^{E}\right]^{T}\) and \(\
u=\left[V^{B}\quad\omega^{B}\right]^{T}\), respectively. Here, \(\varGamma^{E}=(X,\ Y,\ Z)\) represents the position of the center of mass of a quadrotor and \(\Theta^{E}=\left(\phi,\ \theta,\ \psi\right)\) are the Euler angles representing the orientation of a quadrotor, namely roll-pitch-yaw, with respect to the earth inertial frame. Similarly, \(V^{B}=(u,\ v,\ w)\) and \(\omega^{B}=(p,\ q,\ r)\) represents the linear and angular velocity of the quadrotor with respect to the body-fixed frame, respectively.  
Now, we describe the kinematics of a generic six-DoF rigid-body as follows:  
\[\dot{\xi}=\begin{bmatrix}R&0_{3\times 3}\\ 0_{3\times 3}&T\end{bmatrix}\
u, \tag{1}\]  
where, \(0_{3\times 3}\) is a 3 by 3 submatrix filled with all zeros, \(R\) is the coordinate transformation matrix from the body-fixed frame to the earth inertial frame, and \(T\) is the angle-rates transformation matrix from the body-fixed frame to the earth-inertial frame. Here, matrices \(R\) and \(T\) are defined, respectively, as follows:  
\[R=\begin{bmatrix}c_{\psi}c_{\phi}&-s_{\psi}c_{\phi}+c_{\psi}s_{\theta}s_{\phi} &s_{\psi}s_{\phi}+c_{\psi}s_{\theta}c_{\phi}\\ s_{\psi}c_{\theta}&c_{\psi}c_{\phi}+s_{\psi}s_{\theta}s_{\phi}&-c_{\psi}s_{\phi} +s_{\psi}s_{\theta}c_{\phi}\\ -s_{\theta}&s_{\phi}c_{\theta}&c_{\phi}c_{\theta}\end{bmatrix}, \tag{2}\]  
\[T=\begin{bmatrix}1&s_{\phi}t_{\theta}&c_{\phi}t_{\theta}\\ 0&c_{\phi}&-s_{\phi}\\ 0&s_{\phi}/c_{\theta}&c_{\phi}/c_{\phi}\end{bmatrix}, \tag{3}\]  
where \(c_{k}=cos(k)\), \(s_{k}=sin(k)\), and \(t_{k}=tan(k)\).  
To describe the dynamic model of the position of a quadrotor, we use the Newton-Euler formalism. The dynamics of a generic six-DoF rigid-body takes into account the mass of the body. The dynamics of the position is described by  
\[m\cdot\dot{V}^{B}+\omega^{B}\times\left(mV^{B}\right)=F^{B}, \tag{4}\]  
where \(m\) is the mass of a quadrotor, \(I_{3\times 3}\) refers to a 3 by 3 identity matrix, \(V^{B}\) is the linear velocity vector, \(\dot{V}^{B}\) is the linear acceleration vector of the body-fixed frame, \(\omega^{B}\) is the angular velocity vector of  
Figure 1: The coordinates and thrusts of a quadrotor.  
the body-fixed frame, and \(F^{B}\) is the force vector of the body-fixed frame. However, it may be useful to express the dynamics of the position using the earth-inertial frame.  
The nonlinear dynamics of a quadrotor can be described by  
\[\begin{array}{l}\ddot{X}=\left(cos(\phi)sin(\theta)cos(\psi)+sin(\phi)sin(\psi )\right)\frac{u_{1}}{m},\\ \ddot{Y}=\left(cos(\phi)sin(\theta)sin(\psi)-sin(\phi)cos(\psi)\right)\frac{u_{ 1}}{m},\\ \dot{Z}=\left(cos(\theta)cos(\phi)\right)\frac{u_{1}}{m}-g.\end{array} \tag{5}\]  
where \(g\) is the gravitational acceleration, and \(u_{1}\) is the attitude control input represented by  
\[u_{1}=b({\Omega_{1}}^{2}+{\Omega_{2}}^{2}+{\Omega_{3}}^{2}+{\Omega_{4}}^{2}). \tag{6}\]  
Here, \(\Omega_{i}(i=1,2,3,4)\) is the propeller speed of the \(i\)-th rotor and \(b\) is the thrust factor of a quadrotor.