# Adaptive Backstepping Control of Quadrotor UAVs with Output Constraints and Input Saturation
## 3 Adaptive Backstepping Controller Design
### Controller Design  
The position controller and attitude controller are designed separately, and the design process is similar. The control inputs of position-attitude control systems need to be designed with anti-saturation strategies. Define the system tracking errors as  
\[ \begin{cases}e_{i1}=&x_{i1}-\lambda_{i1}-x_{i1d}\\ e_{i2}=&x_{i2}-\lambda_{i2}-s_{i}\end{cases}  \tag{12}\]  
where \(x_{i1d}\) is the desired trajectory of the system state \(x_{i1}\). \(s_{i}\) is the introduced first-order filter virtual function. The first-order filter structure is  
\[\tau_{i}\dot{s}_{i}+s_{i}=\alpha_{i} \tag{13}\] \[s_{i}(0)=\alpha_{i}(0)\]  
where \(\tau_{i}\) is the time constant of the filter. \(\alpha_{i}\) is the virtual control. Define the first-order filter function error as \(T_{i}=s_{i}-\alpha_{i}\), and its derivative is  
\[\dot{T}_{i}=\dot{s}_{i}-\dot{\alpha}_{i}=\frac{\alpha_{i}-s_{i}}{\tau_{i}}- \dot{\alpha}_{i}=-\frac{T_{i}}{\tau_{i}}+\varrho(x_{i1},x_{i1d},\dot{x}_{i1d},\dot{x}_{i1d},\lambda_{i1},\lambda_{i2}) \tag{14}\]  
where \(\varrho(x_{i1},x_{i1d},\dot{x}_{i1d},\dot{x}_{i1d},\lambda_{i1},\lambda_{i2})\) is a continuous function and assume that there is an unknown boundary \(\varrho^{*}\) such that \(\varrho\leq|\varrho^{*}|\). Derivation of the tracking error \(e_{i1}\) yields  
\[ \begin{split}\dot{e}_{i1}&=\dot{x}_{i1}-\dot{ \lambda}_{i1}-\dot{x}_{i1d}=x_{i2}-\dot{\lambda}_{i1}-\dot{x}_{i1d}\\ &=\lambda_{i2}+s_{i}+e_{i2}-\lambda_{i2}+p_{i1}\lambda_{i1}- \dot{x}_{i1d}\\ &=e_{i2}+s_{i}+p_{i1}\lambda_{i1}-\dot{x}_{i1d}\end{split}  \tag{15}\]  
The states \((x,y,z)\) do not need to be constrained in the position controller, while the states \((\phi,\theta,\psi)\) need to be constrained. The Lyapunov function is designed as  
\[V_{i1}= \begin{cases}\dfrac{1}{2}e_{i1}^{2}+\dfrac{1}{2}T_{i}^{2},&i=x,y,z\\ \dfrac{1}{2}ln\dfrac{e_{i1}^{2}}{k_{ai}^{2}-e_{i1}^{2}}+\dfrac{1}{2}T_{i}^{2},&i=\phi,\theta,\psi\end{cases}  \tag{16}\]  
where \(k_{ai}\) is the upper bound of the attitude tracking error, which satisfies \(|e_{i1}|<k_{ai}\). To facilitate the derivation of subsequent formulas, a function \(a_{i}\) is defined for the state constrained. \[a_{i}= \begin{cases}1,&i=x,y,z\\ \dfrac{1}{k_{ai}^{2}-e_{i1}^{2}},&i=\phi,\theta,\psi\end{cases}  \tag{17}\]  
Taking the time derivative of (16). According to \(s_{i}=T_{i}+\alpha_{i}\), we obtain  
\[\dot{V}_{i1}=a_{i}e_{i1}\dot{e}_{i1}+T_{i}\dot{T}_{i}=a_{i}e_{i1}(e_{i2}+T_{i} +\alpha_{i}+p_{i1}\lambda_{i1}-\dot{x}_{i1d})+T_{i}\bigg{(}-\dfrac{T_{i}}{ \tau_{i}}+\varrho_{i}\bigg{)} \tag{18}\]  
According to the fundamental theorem of [PERSON]'s inequality, suppose there exists an arbitrary positive constant \(\sigma_{i}\) that satisfies the following inequality:  
\[|e_{i1}T_{i}|\leq e_{i1}^{2}+\dfrac{1}{4}T_{i}^{2} \tag{19}\]  
\[|T_{i}\varrho_{i}|\leq\dfrac{1}{2\sigma_{i}}T_{i}^{2}\varrho_{i}^{2}+\dfrac{ \sigma_{i}}{2}\leq\dfrac{1}{2\sigma_{i}}T_{i}^{2}\varrho_{i}^{*2}+\dfrac{ \sigma_{i}}{2} \tag{20}\]Substituting (19) and (20) into (18) yields  
\[ \begin{split}\dot{V}_{i1}&\leq a_{i}e_{i1}(e_{i2}+\alpha _{i}+p_{i1}\lambda_{i1}-\dot{x}_{i1d})+a_{i}\bigg{(}e_{i1}^{2}+\frac{1}{4}T_{i}^ {2}\bigg{)}-\frac{T_{i}^{2}}{\tau_{i}}+\frac{1}{2\sigma_{i}}T_{i}^{2}\varrho_{i }^{*2}+\frac{\sigma_{i}}{2}\\ &\leq a_{i}e_{i1}(e_{i2}+\alpha_{i}+p_{i1}\lambda_{i1}-\dot{x}_{i1 d})-T_{i}^{2}\bigg{(}\frac{1}{\tau_{i}}-\frac{1}{4}-\frac{1}{2\sigma_{i}}\varrho_{i }^{*2}\bigg{)}+\frac{\sigma_{i}}{2}+a_{i}e_{i1}^{2}\end{split}  \tag{21}\]  
According to Equation (21), the virtual control is designed as follows:  
\[\alpha_{i}=-k_{i1}e_{i1}+\dot{x}_{i1d}-p_{i1}\lambda_{i1} \tag{22}\]  
where \(k_{i1}\) is the parameter to be designed and satisfies \(k_{i1}>0\)  
Substituting (22) into (21) results in  
\[\dot{V}_{i1}\leq-a_{i}(k_{i1}-1)e_{i1}^{2}+a_{i}e_{i1}e_{i2}-T_{i}^{2}\bigg{(} \frac{1}{\tau_{i}}-\frac{a_{i}}{4}-\frac{1}{2\sigma_{i}}\varrho_{i}^{*2} \bigg{)}+\frac{\sigma_{i}}{2} \tag{23}\]  
Taking the time derivative of \(e_{i2}\) yields  
\[