# MRAS Using Lyapunov Theory with Sliding Modes for a Fixed-Wing MAV
## 3 Adaptive Controller Design and Stability Proof  
This section describes the adjustment mechanisms of the adaptive proportional gain and the derivative gain designed for a PD controller. These are represented by \(\hat{k}_{pax_{x}}\) and \(\hat{k}_{dax_{y}}\), respectively, with \(\kappa:=\theta,\psi,\phi\) and the sub-index \(x=1,2,3,4\in a_{x}\). Thus, \(a_{1}\) means are used to adjust the adaptive gains via Lyapunov theory, \(a_{2}\) corresponds, which the Lyapunov  
Figure 3: Roll angle. Figure 2: Yaw angle. theory with sliding mode (L-SM) to adjust the adaptive gains, \(a_{3}\) corresponds to Lyapunov theory with second-order sliding mode (L-2 SM), and \(a_{4}\) corresponds the Lyapunov theory with high order sliding mode (L-HOSM) to adjust the adaptive gains in the control law. To design the adjustment mechanism, the continuous-time model reference adaptive system (MRAS) using Lyapunov theory with different sliding-modes techniques is used to obtain a robust mechanism to achieve the control objective; that is, the fixed-wing MAV must stay at a desired altitude and in the desired yaw and roll angles despite the unknown perturbations such perturbations are due to the wind gusts. The MRAS block diagram is presented in Figure 4.  
Considering the equations that describe the longitudinal dynamic and directional-lateral dynamic, the adaptive controller is given by:  
\[ \begin{pmatrix}\delta_{e}\\ \delta_{r}\\ \delta_{a}\end{pmatrix} = \begin{pmatrix}\hat{k}_{p\theta a_{x}}&0&0\\ 0&\hat{k}_{p\psi a_{x}}&0\\ 0&0&\hat{k}_{p\phi a_{x}}\end{pmatrix}\begin{pmatrix}e_{\theta}\\ e_{\psi}\\ e_{\phi}\end{pmatrix} + \begin{pmatrix}\hat{k}_{d\theta a_{x}}&0&0\\ 0&\hat{k}_{d\psi a_{x}}&0\\ 0&0&\hat{k}_{d\phi a_{x}}\end{pmatrix}\begin{pmatrix}q\\ r\\ p\end{pmatrix}  \tag{12}\]  
where \(\hat{k}_{p\kappa a_{x}}\) and \(\hat{k}_{d\kappa a_{x}}\) are the position and velocity adaptive gains. The error is given by \(\mathbf{e_{\kappa}}=\mathbf{\eta}_{d}-\mathbf{\eta}\), defining \(\mathbf{\eta}_{d}=(\theta_{d},\psi_{d},\phi_{d})^{T}\), where \(\theta_{d}\), \(\psi_{d}\), and \(\phi_{d}\) represent the desired pitch angle to achieve the desired altitude, desired yaw angle, and desired roll angle, respectively. Let us define \(\mathbf{\eta}=(\theta,\psi,\phi)^{T}\) and the error equation for the model reference output and the plant output, which are defined by \(\mathbf{e_{\kappa m}}=\mathbf{\eta}_{m}-\mathbf{\eta}\), and \(\mathbf{\eta}_{m}=(\theta_{m},\psi_{m},\phi_{m})^{T}\), representing the model reference outputs for the altitude, the yaw angle, and roll angle, respectively. The aerodynamic model Equations (5), (6), (8)-(11) and the control law can be represented for a closed-loop system in transfer function to follow the methodology presented in [29] and to obtain the adjustment mechanism based on MRAS using Lyapunov theory with sliding modes theory. Then, the closed-loop transfer function with the adaptive controller is defined in a matrix form:  
\[\underline{\mathbf{\dot{\eta}}}=A_{\kappa}\underline{\mathbf{\eta}}+B_{\kappa}\kappa_ {d} \tag{13}\]  
where the vectors, matrix, and scalar are defined by:  
\[\underline{\mathbf{\dot{\eta}}}= \begin{pmatrix}\dot{\eta}\\ \dot{\eta}\end{pmatrix} ,\quad A_{\kappa}= \begin{pmatrix}0&1\\ -C_{2}\hat{k}_{p\kappa a_{x}}&-(C_{2}\hat{k}_{d\kappa a_{x}}-C_{1})\end{pmatrix} \]  
\[\underline{\mathbf{\eta}}= \begin{pmatrix}\dot{\eta}\\ \dot{\eta}\end{pmatrix} ,\quad B_{\kappa}= \begin{pmatrix}0\\ C_{2}\hat{k}_{p\kappa a_{x}}\end{pmatrix} ,\quad\kappa_{d}:=\theta_{d},\psi_{d },\phi_{d}\]  
where \(C_{1}:=C_{m_{\theta}},C_{n_{r}},C_{lp}\) and \(C_{2}:=C_{m_{\phi_{x}}},C_{n_{\phi}},C_{l_{\phi}}\), see Table 1. The model reference in matrix form is given by:  
\[\underline{\mathbf{\dot{\eta}}}_{m}=A_{\kappa n}\underline{\mathbf{\dot{\eta}}}_{m}+B _{\kappa n}\kappa_{d} \tag{14}\]  
Figure 4: Block diagram. with  
\[\dot{\underline{\eta}}_{m}= \begin{pmatrix}\dot{\eta}_{m}\\ \dot{\eta}_{m}\end{pmatrix} ,\quad A_{\kappa_{m}}= \begin{pmatrix}0&1\\ -\omega_{n}^{2}&-2\zeta\omega_{n}\end{pmatrix}