# Discrete Integral Optimal Controller for Quadrotor Attitude Stabilization: Experimental Results
## 2 Control Strategy
### Integral Control  
Consider the nonlinear system:\[\dot{\overline{x}}=f(\overline{x},\overline{u})\]  
\[\overline{y}=h(\overline{x}),\]  
where the state \(\overline{x}\in\mathbb{R}^{n}\), and the vector control \(\overline{u}\in\mathbb{R}^{p}\). The variables \(f\) and \(h\) are continuously differentiable functions in a domain \(D_{\overline{x}}\times D_{\overline{u}}\subset\mathbb{R}^{n}\times\mathbb{R}^ {p}\), and \(\overline{y}\in\mathbb{R}^{p}\) is the controlled output. Let \(\overline{y}_{R}\in\mathbb{R}^{p}\) be a constant reference; the integral control is a feedback state such that  
\[\overline{y}(t)\rightarrow\overline{y}_{R},\hskip 14.226378 ptt\rightarrow\infty\]  
Assume that the controlled output \(\overline{y}\) can be measured. Note that for our case \(\overline{y}=\overline{x}\) because when using the Optitrack vision system, the complete state is measurable and therefore available. The regulation task will be achieved by stabilizing the system at an equilibrium point where \(\overline{y}=\overline{y}_{R}\). In order to maintain it in that equilibrium condition, there exists a pair \((\overline{x}_{ss},\overline{u}_{ss})\in D_{\overline{x}}\times D_{\overline{u}}\) such that:  
\[0=f(\overline{x}_{ss},\overline{u}_{ss}),\]  
\[0=h(\overline{x}_{ss})-\overline{y}_{R}.\]  
Assume that these equations have a unique solution \((\overline{x}_{ss},\overline{u}_{ss})\). Now, the integral action is included as follows: consider the tracking error \(\overline{e}=\overline{y}-\overline{y}_{R}\). Then, the following equivalence is defined  
\[\dot{\sigma}=\overline{e}=\overline{y}-\overline{y}_{R},\]  
So control will be obtained as a feedback function of \(\overline{x}\) and \(\overline{\sigma}\) such that in the closed loop there is an equilibrium point \((\overline{x},\overline{\sigma})\) with \(\overline{x}=x_{ss}\). Assuming that the system is linearizable around \(x_{ss},\overline{\sigma},u_{ss}\), it follows that:  
\[\overline{\dot{\xi}}=\left[ \begin{array}{cc}A&0\\ C&0\end{array} \right]\overline{\dot{\overline{\xi}}}+\left[ \begin{array}{ cc}B\\ 0\end{array} \right]v\triangleq\mathcal{A}\overline{\dot{\overline{\xi}}}+ \mathcal{B}v, \tag{1}\]  
with  
\[\overline{\dot{\xi}}=\left[ \begin{array}{cc}\overline{x}-x_{ss}\\ \overline{\sigma}-\overline{\sigma}\end{array} \right]\]  
\(v=\overline{u}-u_{ss}\) where:  
\[A=\left.\frac{\partial f}{\partial\overline{x}}\right|_{(\overline{x}, \overline{u})=(x_{ss},u_{ss})},B=\left.\frac{\partial f}{\partial\overline{u} }\right|_{(\overline{x},\overline{u})=(x_{ss},u_{ss})},\]  
\[C=\left.\frac{\partial h}{\partial\overline{x}}\right|_{\overline{y}=x_{ss}}\]  
Assume that the pair \((A,B)\) is controllable and  
\[rank\left[ \begin{array}{cc}A&B\\ C&0\end{array} \right]=n+p.\]  
Then \((\mathcal{A},\mathcal{B})\) is controllable [4]. Then, design a matrix \(\mathcal{K}\) such that \(\mathcal{A}+\mathcal{B}\mathcal{K}\) is Hurwitz [4]. Consider the partition for the matrix \(\mathcal{K}\) as \([\mathcal{K}_{1}\ \mathcal{K}_{2}]\). The control signal is then defined by:  
\[\overline{u}=\mathcal{K}_{1}(\overline{x}-x_{s}s)+\mathcal{K}_{2}(\overline{ \sigma}-\overline{\sigma})+u_{ss}.\]  
It is not difficult to verify that the closed-loop nonlinear system has a unique equilibrium point \((x_{ss},\overline{\sigma}_{ss})\)[4]. As is demonstrated in [4], the equilibrium point \((x_{ss},\overline{\sigma}_{ss})\) is exponentially stable, and all solutions starting close enough to this equilibrium point approach it as \(t\) tends to infinity. Then \(\overline{y}(t)-\overline{y}_{R}\to 0\) as \(t\to\infty\). Following these ideas, in this contribution, the matrix \(\mathcal{K}\) is designed using the optimal control approach. For altitude, we take advantage of the fact that in the mathematical model for the altitude of the quadrotor, it can be stabilized by exact linearization, and then, it is not necessary to linearize the nonlinear dynamics. The integral action is used to minimize the effects of external disturbances on vehicle performance.