# Nonsingular Terminal Sliding Mode Based Finite-Time Dynamic Surface Control for a Quadrotor UAV
## 3 Finite-Time ESO and DSC-Based Control Algorithm Design
### NTSMC and DSC-Based Finite-Time Position Controller Design  
In this section, a NTSMC and a DSC-based control scheme are used to design the finite-time position tracking controller. At the same time, this scheme is applied to the attitude subsystem. In order to decrease the negative impacts of the ESO error on the stability of the position subsystem, we introduce an adaptive law to compensate for the observation error. **Step1:** Define the dynamic errors \(e_{z1}=x_{1}-x_{1d}\) and \(e_{z2}=x_{2}-\beta_{f}\), where \(x_{1d}\) denotes the desired altitude and \(\beta_{f}\) is the output of finite-time filter. Construct the following virtual control law  
\[\beta=\dot{x}_{1d}-l_{1}|e_{z1}|^{c_{1}}\text{sign}(e_{z1}) \tag{31}\]  
with \(l_{1}>0\), \(0<c_{1}<1\). To address the problem of \"explosion of complexity\" in the traditional backstepping design, the finite-time filter is introduced as  
\[ \begin{cases}\dot{\beta}_{f}=\varphi_{1}-\lambda_{1}|\beta_{f}-\beta|^{p_{1}} \text{sign}(\beta_{f}-\beta)\\ \dot{\varphi}_{1}=-\lambda_{2}|\beta_{f}-\beta|^{p_{2}}\text{sign}(\beta_{f}- \beta)\end{cases}  \tag{32}\]  
with \(0<p_{1}<1\), \(p_{2}=2p_{1}-1\). \(\lambda_{1}\) and \(\lambda_{2}\) are positive constants. From [44], it is known that \(\beta_{f}\) converges to \(\beta\) after finite time, namely \(|\beta_{f}-\beta|=0\) after finite time. Considering a Lyapunov function \(V_{2}=0.5e_{z1}^{2}\), taking the time derivative of \(V_{2}\) yields  
\[\dot{V}_{2}= e_{z1}\dot{e}_{z1} \tag{33}\] \[= e_{z1}(e_{z2}+\beta_{f}-\dot{x}_{1d})\]  
When \(\beta_{f}\) converges to \(\beta\), by substituting (31) into (33), one can obtain  
\[\dot{V}_{2}\leq-l_{1}|e_{z1}|^{c_{1}+1}+e_{z1}e_{z2} \tag{34}\]  
**Step2:** Design the following nonsingular terminal sliding mode variable  
\[s_{1}=e_{z2}+2\zeta\sqrt{\rho+|\text{arctan}(e_{z1})|}(1+e_{z1}^{2})\text{ sign}(e_{z1}) \tag{35}\]The proposed position control law is  
\[u_{F}= -\frac{1}{f_{1}}[-g-\frac{k_{3}}{m}x_{2}+\hat{Z}_{2}-\hat{\beta}_{f}+f_{2 }^{{}^{\prime}}+\varepsilon|s_{1}|^{c_{1}}\text{sign}(s_{1})+\varepsilon_{z1}+ \hat{a}_{1}\text{sign}(s_{1})] \tag{36}\]  
where \(\varepsilon\) is a positive constant, \(\hat{a}_{1}\) is the estimation of \(a_{1}\), and \(a_{1}\) is the upper bound of the observation error \(\hat{Z}_{2}\). \(\hat{a}_{1}\) is defined as  
\[\hat{a}_{1}=m_{1}|s_{1}|-n_{1}\hat{a}_{1} \tag{37}\]  
with \(\hat{a}_{1}(0)\geq 0\), \(m_{1}>0\) and \(n_{1}>0\). According to Lemma 2 in [45], one can get \(0<\hat{a}_{1}<\hat{a}_{1}\), where \(\hat{a}_{1}\) is positive scalar. The function \(f_{2}^{{}^{\prime}}\) is given by  
\[f_{2}^{{}^{\prime}}= \begin{cases}\frac{\zeta\dot{\varepsilon}_{z1}(1+4 \varepsilon_{z1}(\arctan(\varepsilon_{z1})-\rho))}{\sqrt{\rho}-\arctan( \varepsilon_{z1})},&\text{if }\varepsilon_{z1}<0\\ 0,&\text{if }\varepsilon_{z1}=0\\ \frac{\zeta\dot{\varepsilon}_{z1}(1+4\varepsilon_{z1}(\arctan(\varepsilon_{ z1})+\rho))}{\sqrt{\rho}+\arctan(\varepsilon_{z1})},&\text{if }\varepsilon_{z1}>0\end{cases}  \tag{38}\]  
**Theorem 2**. : _Consider the position subsystem presented in \((\ref{eq:14})\) and finite-time ESO in \((\ref{eq:12})\). If the NTSMC-based finite-time dynamic surface controller is designed as \((\ref{eq:15})\), then the states of system can be practically finite-time stabilized._  
Proof. : Consider a Lyapunov function \(V_{3}=V_{2}+0.5s_{1}^{2}+(\hat{a}_{1}-a_{1})^{2}/2m_{1}\). By differentiating \(V_{3}\), one can obtain  
\[\dot{V}_{3}= \dot{V}_{2}+s_{1}\dot{s}_{1}  
(1) When \(0<|\hat{a}_{1}-a_{1}|<1\), one can get  
\[0\leqslant|\hat{a}_{1}-a_{1}|^{c_{1}+1}-|\hat{a}_{1}-a_{1}|^{2}\leqslant\varsigma \tag{43}\]  
with \(\varsigma=b^{\frac{b}{1-b}}-b^{\frac{1}{1-b}}\), \(b=\frac{c_{1}+1}{2}\). (2) When \(|a_{1}-a_{1}|>1\), the inequality  
\[|\hat{a}_{1}-a_{1}|^{c_{1}+1}-|\hat{a}_{1}-a_{1}|^{2}<0 \tag{44}\]  
holds. Hence, it is apparent that the inequality \(|\hat{a}_{1}-a_{1}|^{c_{1}+1}-|\hat{a}_{1}-a_{1}|^{2}\leqslant\varsigma\) is guaranteed in any case.