# Inverse Optimal Design for Position Control of a Quadrotor
## 3 Design of Inverse Optimal Position Controller
### Altitude Control of a Quadrotor  
In this paper, we propose an altitude control input based on the inverse optimal position control method. To do this, the altitude dynamics in (5) can be rewritten in state-space form using the following states:  
\[x_{5}=Z,\ x_{6}=\dot{Z}.\]  
We have the altitude state-space equation of a quadrotor as follows:  
\[\left\{ \begin{array}{l}\dot{x_{5}}=x_{6}\\ \dot{x_{6}}=\frac{\cos\phi\cos\theta}{m}\left(u_{1}-g\frac{m}{\cos\phi\cos \theta}\right)=T_{1}(\phi(t),\theta(t))\cdot v_{1}\end{array} \right. \tag{11}\]  
where \(v_{1}\) is the pseudo altitude control input defined by  
\[v_{1}:=\left(u_{1}-g\frac{m}{\cos\phi\cos\theta}\right), \tag{12}\]  
and \(T_{1}(\phi(t),\theta(t))\) is the first transformation variable given by  
\[T_{1}(\phi(t),\theta(t))=\frac{\cos\phi\cos\theta}{m}. \tag{13}\]  
The states \(x_{5}\) and \(x_{6}\) related to the altitude of a quadrotor can be rewritten by the state \(\chi_{z}\), as follows:  
\[\chi_{z}= \begin{bmatrix}x_{5}-z_{d}\\ x_{6}-\dot{z}_{d}\end{bmatrix} , \tag{14}\]  
where \(z_{d}\) is the reference value of the altitude. Differentiating \(\chi_{z}\) with respect to time, we obtain  
\[\dot{\chi}_{z}=A_{z}\,\chi_{z}+B_{z}(\phi(t),\theta(t))\;v_{1}, \tag{15}\]  
where \(A_{z}\) and \(B_{z}(\phi(t),\theta(t))\) are defined as \(A_{z}:= \begin{bmatrix}0&1\\ 0&0\end{bmatrix} \) and \(B_{z}(\phi(t),\theta(t)):= \begin{bmatrix}0\\ T_{1}(\phi(t),\theta(t))\end{bmatrix} \), respectively. For the invertibility of \(T_{1}(\phi(t),\theta(t))\), throughout the paper, we use the following assumption. **Assumption 2**. : _The attitude angles \(\phi,\theta,\) and \(\psi\) satisfy the following conditions:_  
\[\|\phi,\theta,\psi\| <\frac{\pi}{2} (\forall\phi,\theta\in\mathbb{R})\]  
The parameters, \(\phi(t)\) and \(\theta(t)\) are function of time, so we can express (15) as (16):  
\[\dot{\chi_{z}}=A_{z}\,\chi_{z}+B_{z}(t)\;v_{1}. \tag{16}\]  
where we denote \(B_{z}(t):=B_{z}(\phi(t),\theta(t))\) with a slight abuse of notation. For the system (16), we propose the following inverse optimal pseudo altitude control input \(v_{1}\) of a quadrotor:  
\[v_{1}=-k_{z}(\phi,\theta)\cdot\chi_{z}, \tag{17}\]  
where \(k_{z}(\phi,\theta)\) is given by  
\[k_{z}(\phi,\theta)=\gamma_{alt}^{-1}(\phi,\theta)\cdot B_{z}^{T}(t)\cdot P_{z}. \tag{18}\]  
where we denote \(\gamma_{alt}(t):=\gamma_{alt}(\phi(t),\theta(t))\) with a slight abuse of notation. Here, the \(\gamma_{alt}(t)\) is given by  
\[\gamma_{alt}(t)=T_{1}^{2}(\phi(t),\theta(t))\cdot\gamma_{z}, \tag{19}\]  
and \(P_{z}= \begin{bmatrix}P_{11z}&P_{12z}\\ P_{12z}&P_{22z}\end{bmatrix} \) is the solution of the ARE  
\[A_{z}^{T}P_{z}+P_{z}A_{z}-\frac{1}{\gamma_{z}}P_{z}B_{z,0}B_{z,0}^{T}P_{z}+Q_ {z}=0_{2\times 2}, \tag{20}\]  
where \(A_{z}:= \begin{bmatrix}0&1\\ 0&0\end{bmatrix} \), \(B_{z,0}:= \begin{bmatrix}0\\ 1\end{bmatrix} \), and a positive definite matrix \(Q_{z}:= \begin{bmatrix}q_{z,1}&0\\ 0&q_{z,2}\end{bmatrix} \), \(q_{z,1}\), \(q_{z,2}>0\), respectively. Therefore, based on the definition of \(v_{1}\) in (17) and (11), we can derive the actual altitude control input as follows:  
\[u_{1}=v_{1}+g\frac{m}{\cos\phi\cos\theta}. \tag{21}\]  
**Theorem 1**. : _Consider the transformation variable \(T_{1}(\phi(t),\theta(t))\), as shown in (13), and the altitude system (16) of a quadrotor using the pseudo altitude control input (17). Then,_(i) Stability: _The pseudo altitude control input (17) asymptotically stabilizes the altitude system (16) of a quadrotor.