# Quadrotor Stabilization and Tracking Using Nonlinear Surface Sliding Mode Control and Observer
## 3 Sliding Mode Observer-Based Augmented Dynamics  
The purpose of an SMO is to estimate the states of a quadrotor system. Sliding mode observer works using a switching function to minimize the error between the real quadrotor's state and the observer output [32; 33; 34]. In this section, we estimate the quadrotor rotational angle and angular velocity and design the augmented quadrotor dynamics by SMO. The super-twisting higher order sliding mode method is adopted as a state observer design for model uncertainties [34]. Using the super-twisting observer, we estimate the state values in finite time under the presence of disturbances. For the stabilization and tracking control of the quadrotor, the sliding mode controller is used in the observer design.  
\[\begin{array}{l}\dot{\hat{x}}_{i}=f_{i}(\dot{\mathbf{x}},\mathbf{u})+Lv,\\ v=\varsigma\text{sgn}(\hat{o}_{i}-o_{i}),\end{array} \tag{6}\]  
where \(\varsigma>0\), \(L>0\) and \(\text{sgn}(\cdot)\) means a signum function. The outputs of \(o_{i}\) (\(i\) = 1, 3, 5) mean the measurements of attitude for roll, pitch, and yaw angles, respectively. \(\hat{x}_{i}\) is an estimated state of \(x_{i}\) and \(\hat{o}_{i}\) is an estimated output of \(o_{i}\). \(L\) is an observer gain that is large enough to guarantee the sliding mode. The correction variables are used in the adaptive SMO to estimate the system state in the presence of unknown external disturbances. To design the augmented model, we define the integral value \((\omega_{i})\) of the correction variables \((z_{i})\). These variables can be represented as follows:  
\[\begin{array}{l}z_{1}=k_{1}|E_{1}|^{\frac{2}{3}}sat(E_{1}),z_{2}=k_{2}|E_{1} |^{\frac{1}{3}}sat(E_{1}),\ z_{3}=k_{3}sat(E_{1}),\\ z_{4}=k_{4}|E_{3}|^{\frac{2}{3}}sat(E_{3}),z_{5}=k_{5}|E_{3}|^{\frac{1}{3}}sat (E_{3}),\ z_{6}=k_{6}sat(E_{3}),\\ z_{7}=k_{7}|E_{5}|^{\frac{2}{3}}sat(E_{5}),z_{8}=k_{8}|E_{5}|^{\frac{1}{3}}sat (E_{5}),\ z_{9}=k_{9}sat(E_{5}).\end{array} \tag{7}\]  
In Equation (7), \(E_{i}\) is the error between the measured and estimated values, expressed as \(E_{i}=x_{i}-\hat{x}_{i}\), (\(i\) = 1, 3, 5). We define a new state variable by applying SMO with the integral value and correction variables added to the quadrotor angles, \(\mathbf{s}=[\hat{x}_{1}\,\hat{x}_{2}\,\omega_{1}\,\hat{x}_{3}\,\hat{x}_{4}\, \omega_{2}\,\hat{x}_{5}\,\hat{x}_{6}\,\omega_{3}\,x_{7}\,x_{8}\,x_{9}\,x_{10}\, x_{11}\,x_{12}]^{T}\).  
We propose an observer based on differentiation of the state variables \(x_{1}\) through \(x_{12}\) of the quadrotor attitude dynamics as Equation (8).  
\[\dot{\mathbf{s}}=\mathbf{g}(\mathbf{s},\mathbf{z},\mathbf{u})=\left[\begin{array}[] {c}\dot{x}_{2}+z_{1}\\ c_{1}\dot{x}_{4}\dot{x}_{6}+c_{2}\dot{x}_{4}\Omega+c_{6}u_{1}+\omega_{1}+z_{2} \\ z_{3}\\ \dot{x}_{4}+z_{4}\\ c_{3}\dot{x}_{2}\dot{x}_{6}+c_{4}\dot{x}_{2}\Omega+c_{7}u_{2}+\omega_{2}+z_{5} \\ z_{6}\\ \dot{x}_{6}+z_{7}\\ c_{5}\dot{x}_{2}\dot{x}_{4}+c_{8}u_{3}+\omega_{3}+z_{8}\\ z_{9}\\ x_{8}\\ -g+\frac{1}{m}(\cos\hat{x}_{1}\cos\hat{x}_{3})u_{4}\\ x_{10}\\ \frac{1}{m}u_{x}u_{4}\\ x_{12}\\ \frac{1}{m}u_{y}u_{4}\end{array}\right] \tag{8}\]  
The integral value and correction variables are applied to the roll, pitch, and yaw angles for quadrotor stabilization. Based on SMO with an augmented quadrotor model, the control procedure of the quadrotor is shown in Figure 2.