# A Comparative Study for Control of Quadrotor UAVs
## 2 Materials and Methods
### System Control
#### 2.2.4 Inner Loop--Sliding Mode Control  
The nonlinear attitude dynamical model in equations from (32) to (35) is exploited to design the sliding mode-based attitude stabilizer. The SM control method aims at the convergence of the state vector to another one, called the \"sliding surface\", which corresponds to an exponential achievement of the desired dynamical behavior of the system. The control input is the sum of two terms: a continuous term and a discontinuous one. The former is a continuous function of the state variables and the reference, \(\mathrm{u}_{\mathrm{c}}\), that makes the \"sliding surface\", \(\mathrm{s}\), an invariant set. The discontinuous term, \(\mathrm{u}_{\mathrm{d}}\), is added to achieve convergence to the \"sliding surface\". \(\mathrm{s}\) is intended as a PD \"sliding surface\" with respect to the Euler angles and Euler rates tracking errors. Refer to [28,29] for the theoretical foundations of SM control and further details. \[\mathrm{u}_{\mathrm{i}}=\mathrm{u}_{\mathrm{c}}^{\mathrm{i}}+\mathrm{u}_{ \mathrm{d}}^{\mathrm{i}}\,\ \mathrm{i}=1,2,3 \tag{43}\]  
\[\mathrm{u}_{\mathrm{d}}^{\mathrm{i}}=\mathrm{K}_{\mathrm{d}i}\mathrm{sign}( \mathrm{s}_{\mathrm{i}})=\mathrm{K}_{\mathrm{d}i}\mathrm{sign}(\mathrm{x}_{ \mathrm{i+3 ref}}-\mathrm{x}_{\mathrm{i+3}}+\beta_{\mathrm{i}}(\mathrm{x}_{ \mathrm{ref}}-\mathrm{x}_{\mathrm{i}}))\ \sim\ \mathrm{K}_{\mathrm{d}i}\frac{\mathrm{s}_{\mathrm{i}}}{\sqrt{\mathrm{s}_{ \mathrm{i}}^{2}+\mathrm{a}}}\,\ \mathrm{i}=1,2,3 \tag{44}\]  
\[\mathrm{u}_{\mathrm{c}}^{\mathrm{1}}=\frac{\mathrm{I}_{\mathrm{x}}}{\mathrm{L} }\biggl{[}-\frac{\mathrm{I}_{\mathrm{y}}-\mathrm{I}_{\mathrm{z}}}{\mathrm{I}_ {\mathrm{x}}}\mathrm{x}_{5}\mathrm{x}_{6}+\frac{\mathrm{I}_{\mathrm{R}}}{ \mathrm{I}_{\mathrm{x}}}\mathrm{x}_{5}\mathrm{f}(\mathrm{u})+\frac{1}{\mathrm{ I}_{\mathrm{x}}}\mathrm{K}_{\mathrm{d}}^{\mathrm{R}}\mathrm{x}_{4}+\ \mathrm{x}\cdot 4 \mathrm{ref}+\beta_{1}(\mathrm{x}_{4\mathrm{ref}}-\mathrm{x}_{4})\biggr{]} \tag{45}\]  
\[\mathrm{u}_{\mathrm{c}}^{\mathrm{2}}=\frac{\mathrm{I}_{\mathrm{y}}}{\mathrm{L} }\biggl{[}-\frac{\mathrm{I}_{\mathrm{z}}-\mathrm{I}_{\mathrm{x}}}{\mathrm{I}_ {\mathrm{y}}}\mathrm{x}_{4}\mathrm{x}_{6}+\frac{\mathrm{I}_{\mathrm{R}}}{ \mathrm{I}_{\mathrm{y}}}\mathrm{x}_{4}\mathrm{f}(\mathrm{u})+\frac{1}{\mathrm{ I}_{\mathrm{y}}}\mathrm{K}_{\mathrm{d}}^{\mathrm{R}}\mathrm{x}_{5}+\ \mathrm{x}\cdot 5 \mathrm{ref}+\beta_{2}(\mathrm{x}_{5\mathrm{ref}}-\mathrm{x}_{5})\biggr{]} \tag{46}\]  
\[\mathrm{u}_{\mathrm{c}}^{\mathrm{3}}=\mathrm{I}_{\mathrm{z}}\biggl{[}-\frac{ \mathrm{I}_{\mathrm{x}}-\mathrm{I}_{\mathrm{y}}}{\mathrm{I}_{\mathrm{z}}} \mathrm{x}_{4}\mathrm{x}_{5}+\frac{1}{\mathrm{I}_{\mathrm{z}}}\mathrm{K}_{ \mathrm{d}}^{\mathrm{R}}\mathrm{x}_{6}+\ \mathrm{x}\cdot 6 \mathrm{ref}+\beta_{3}(\mathrm{x}_{6\mathrm{ref}}-\mathrm{x}_{6})\biggr{]} \tag{47}\]  
The sign \((\cdot)\) function in the discontinuous part of the control action is approximated with a smooth function (with a small value of a) to avoid chattering, i.e., oscillations, when the state approaches the \"sliding surface\". The closed-loop attitude dynamics of the system can be adjusted by tuning the control parameters: \(\mathrm{a}\), \(\mathrm{K}_{\mathrm{d}i}\), \(\beta_{\mathrm{i}}\). This follows the closed-loop attitude dynamics of the controlled system.