# Quadcopter Adaptive Trajectory Tracking Control:
## 3 Trajectory Tracking Control: Adaptive Backstepping Design and Stability Analysis
### Altitude Controller  
The quadcopter's vertical movement should be able to track the reference signal \(z_{d}(t)\) which should satisfy Assumption 2. To ensure safe operation, the system altitude should always be smooth with a limited tracking error. This is achieved through the barrier Lyapunov function. The second quadcopter subsystem along the \(z-axis\) is described in (45) with the boundary conditions of the altitude tracking shown in (46):  
\[\ddot{z}=\frac{1}{m}\left(\cos(\phi)\cos(\theta)\right)U_{1}-g \tag{45}\] \[|e_{z}|=|z-z_{d}|\leq\epsilon,\quad\epsilon\geq 0 \tag{46}\]  
**Lemma 1**. : _[_45_]_ _For any given positive constants \(\epsilon\), let \(\mathcal{Z}\triangleq\left\{e_{z}\in\mathbb{R}|\left|e_{z}\right|<\epsilon \right\}\subset\mathbb{R}\) and \(\mathcal{X}\triangleq\mathbb{R}^{4}\times\mathcal{Z}\subset\mathbb{R}^{5}\) be open sets._  
_Considering the general system_  
\[\xi=f\left(\varsigma,u\right) \tag{47}\]  
_where \(\varsigma\triangleq\left[x,y,\phi,\theta,z\right]^{T}\in\mathcal{X}\) and \(f(\varsigma,u):\mathcal{X}\rightarrow\mathbb{R}^{5}\). There exist functions \(V_{4}\): \(\mathbb{R}^{4}\rightarrow\mathbb{R}_{+}\) and \(V_{5}\): \(\mathcal{Z}\rightarrow\mathbb{R}_{+}\), continuously differentiable and positive definite in their respective domains, such that_  
\[V_{4}\left(x,y,\phi,\theta\right)>0 \tag{48}\] \[\dot{V}_{4}<0\] (49) \[V_{5}(e_{z})\rightarrow\infty\quad\text{as}\quad|e_{z}|\rightarrow\epsilon \tag{50}\]  
_Let \(V\left(\varsigma\right)=V_{4}\left(x,y,\phi,\theta\right)+V_{5}(e_{z})\), and \(e_{z}(0)\) belongs to the set \(e_{z}\in\left(-\epsilon,\epsilon\right)\). If the time-derivative along the state trajectory can be achieved as:_  
\[\mathcal{L}_{f}V=\frac{\partial V}{\partial\varsigma}f<0 \tag{51}\]  
_then \(e_{z}(t)\) remains in the open set \(\left(-\epsilon,\epsilon\right)\), \(\forall t\in\left[0,\infty\right)\)_The fifth Lyapunov candidate function (52) and its time-derivative along the solution of model (45):  
\[V_{5} =\frac{1}{2}\text{ln}\left|\frac{e^{2}}{e^{2}-e_{z}^{2}}\right|+ \frac{1}{2}\left(\dot{z}-r_{4}\right)^{2} \tag{52}\] \[r_{4} =\dot{z}_{d}-k_{5}e_{z}\left(e^{2}-e_{z}^{2}\right) \tag{53}\]  
Time-derivative of (52):  
\[\dot{V}_{5}= \frac{e_{z}\left(\dot{z}-\dot{z}_{d}+r_{4}-r_{4}\right)}{\epsilon ^{2}-e_{z}^{2}}+\left(\dot{z}-r_{4}\right)\left(\ddot{z}-\dot{r}_{4}\right) \tag{54}\] \[|e_{z}|=|z-z_{d}|\leq\epsilon,\quad\epsilon\geq 0 \tag{46}\]0  
Under Assumption 1, \(\cos(\phi)\) and \(\cos(\theta)\) are always strictly positive. Therefore, the proposed vertical control law can be shown as:  
\[|e_{z}|=|z-z_{d}|\leq\epsilon,\quad\epsilon\geq 0 \tag{46}\]1  
There exist the positive scalars \(k_{5}\) and \(k_{6}\) appropriately such that the controller (56) forces vertical flight to achieve the bounded tracking asymptotic stability of system (45) at the origin. Therefore, the time-derivative of \(V_{5}\) (55) is negative definite:  
\[|e_{z}|=|z-z_{d}|\leq\epsilon,\quad\epsilon\geq 0 \tag{46}\]2  
According to Lemma 1, the tracking error is always bounded \(|e_{z}(t)|<\epsilon\) as long as the assumption \(|e_{z}(0)|<\epsilon\) holds. It is clear that if the desired signal \(z_{d}\) is created to satisfy Assumption 2 and the altitude error is always bounded, the safety of the system is guaranteed. Additionally, because the error will never reach its boundary \(|e_{z}(t)|=\epsilon\), the control input (56) will also never become unbounded. The control diagram of the proposed control and adaptive law is shown in Figure 2 to certainly show our contributions in three red boxes. In the box [1], the virtual control \(r_{2}\) and a new variable \(\theta\) are presented to clearly describe the relationship between two loops of the horizontal subsystem. Additionally, there is a new adaptive law to estimate several unknown parameters such as inertial moment, arm length, and drag moment coefficients in the box [2].