## 2 Preliminaries
### Controller Design
#### 2.2.1 Inner Loop Controller  
To devise a controller for attitude states, considering attitude dynamics from Equation (10) and by writing moment equation for each corresponding state, we have  
\[\begin{bmatrix}\tau_{\phi}\\ \tau_{\phi}\\ \tau_{\psi}\end{bmatrix}=\begin{bmatrix}IL_{2}\\ IU_{3}\\ U_{4}\end{bmatrix}=\begin{bmatrix}I_{x}\ddot{\phi}\\ I_{y}\ddot{\theta}\\ I_{z}\ddot{\psi}\end{bmatrix}+\begin{bmatrix}\dot{\theta}I_{z}\dot{\psi}-\dot{ \psi}I_{y}\dot{\theta}\\ \dot{\psi}I_{x}\dot{\phi}-\dot{\phi}I_{z}\dot{\psi}\\ \dot{\phi}I_{y}\dot{\theta}-\dot{\theta}I_{x}\dot{\phi}\end{bmatrix}+ \begin{bmatrix}\dot{\theta}I_{r}\Omega_{r}-0\\ 0-\dot{\phi}I_{r}\Omega_{r}\\ 0\end{bmatrix} \tag{11}\]  
\[\begin{bmatrix}\tau_{\phi}\\ \tau_{\phi}\\ \tau_{\psi}\end{bmatrix}=\begin{bmatrix}I_{x}&0&0\\ 0&I_{y}&0\\ 0&0&I_{z}\end{bmatrix}\begin{bmatrix}\ddot{\phi}\\ \dot{\theta}\\ \dot{\psi}\dot{\psi}\\ \dot{\psi}\end{bmatrix}+\begin{bmatrix}I_{z}-I_{y}&0&0\\ 0&I_{x}-I_{z}&0\\ 0&0&I_{y}-I_{x}\end{bmatrix}\begin{bmatrix}\dot{\theta}\dot{\psi}\\ \dot{\phi}\dot{\psi}\\ \dot{\phi}\dot{\phi}\dot{\theta}\end{bmatrix}+\begin{bmatrix}\dot{\theta}I_{ r}\Omega_{r}\\ -\dot{\phi}I_{r}\Omega_{r}\\ 0\end{bmatrix} \tag{12}\]  
\[\tau=I_{1}\ddot{\Theta}+I_{2}\Lambda\Big{(}\dot{\phi},\dot{\theta},\dot{\psi} \Big{)}+G\Big{(}\dot{\phi},\dot{\theta},\dot{\psi},I_{r}\Omega_{r}\Big{)} \tag{13}\]  
\[\text{where }\tau=\begin{bmatrix}\tau_{\phi}\\ \tau_{\phi}\\ \tau_{\phi}\end{bmatrix},\ I_{1}=\begin{bmatrix}I_{x}&0&0\\ 0&I_{y}&0\\ 0&0&I_{z}\end{bmatrix},\ \ddot{\Theta}=\begin{bmatrix}\ddot{\phi}\\ \ddot{\theta}\\ \ddot{\psi}\end{bmatrix},\ I_{2}=\begin{bmatrix}I_{2}-I_{y}&0&0\\ 0&I_{x}-I_{z}&0\\ 0&0&I_{y}-I_{x}\end{bmatrix},\]  
\[\Lambda\Big{(}\dot{\phi},\dot{\theta},\dot{\psi}\Big{)}=\begin{bmatrix}\dot{ \phi}\dot{\psi}\\ \dot{\phi}\dot{\psi}\\ \dot{\phi}\dot{\theta}\\ \dot{\phi}\dot{\theta}\end{bmatrix},\text{and }G\Big{(}\dot{\phi},\dot{\theta},\dot{\psi},I_{r}\Omega_{r}\Big{)}= \begin{bmatrix}\dot{\theta}I_{r}\Omega_{r}\\ -\dot{\phi}I_{r}\Omega_{r}\\ 0\end{bmatrix}.\]The model-based part of the partitioning control scheme generates the following input command, which, in fact, is a computed torque term:  
\[\tau=\alpha\tau^{\prime}+\beta \tag{14}\]  
where \(\alpha=I_{1}\) and \(\beta=I_{2}\Lambda\left(\dot{\phi},\dot{\theta},\dot{\psi}\right)+G\left(\dot{ \phi},\dot{\theta},\dot{\psi},I_{r}\Omega_{r}\right)\).  
Equations (10) and (11) lead to following:  
\[\ddot{\Theta}=\tau^{\prime} \tag{15}\]  
By defining error as \(e=\Theta_{d}-\Theta\), where \(\Theta_{d}=\begin{bmatrix}\phi_{d}\\ \theta_{d}\\ \psi_{d}\end{bmatrix}\) and \(\Theta=\begin{bmatrix}\phi\\ \psi\end{bmatrix}\), we can formulate the servo part of the adopted control scheme as:  
\[\tau^{\prime}=\tilde{\Theta}_{d}+K_{d}\dot{e}+K_{p}e \tag{16}\]  
\[\tilde{\Theta}=\tilde{\Theta}_{d}+K_{d}\dot{e}+K_{p}e \tag{17}\]  
The following equation is derived from (17):  
\[\ddot{e}+K_{d}\dot{e}+K_{p}e=0 \tag{18}\]  
Equation (18) is a second-ordered differential equation in the error space and holds two coefficients (gains). The careful tuning of these gains allows to obtain the desired response.