## 3 Controller Design
### Attitude Controller Design Based on Quaternion
#### 3.2.2. Design of Fast and Robust Feedforward PD Controller Based on the Learning Rate  
According to the analysis in the previous section, the effect of controlling the quaternion and Euler angle in the attitude system can be converted equally. Generally speaking, the response speed of the inner loop of the cascade control system is faster than that of the outer loop, so the PD control frame with a simple structure and fast response is used to design the attitude quaternion controller. The PD control algorithm is a very classical linear control algorithm; the function of the proportion (P) term is to promote the control error to converge quickly to zero; the function of the differentiation (D) term is similar to the \"brake\", for which the hysteresis error overshoot fluctuation is around 0. A basic feedforward PD control law is designed as follows [16;33]:  
\[\tau_{v\Theta}=-k_{p}\widetilde{q}_{v}-k_{d}\widetilde{\omega}-f_{\Theta} \tag{49}\]  
In the previous discussion, we discussed that a coaxial HAUV suffers from more complex perturbations and parameter perturbations than traditional UUVs and UAVs. The use of observer observation to compensate for external perturbations is not enough to completely offset the effect of complex perturbations. Therefore, adaptive technology is adopted to further compensate for the remaining residual terms \(\overline{\hat{d}}_{p}\), and \(\left(\left|\overline{\hat{d}}_{i}\right|-\hat{D}_{i}\right)\) is redefined as \(\widetilde{D}_{i}\). By substituting the adaptive law (44) into Equation (54),  
\[ \begin{array}{ll}\dot{V}_{p}&\leq-k_{3}\|s_{p}\|^{2}-\delta_{p}\|s_{p}\|+ \sum\limits_{i=1}^{3}|s_{i}|\tilde{D}_{i}-\frac{\gamma_{1}}{\gamma_{1}}\sum \limits_{i=1}^{3}\widetilde{D}_{i}\big{(}|s_{i}|-\gamma_{2}\tilde{D}_{i}\big{)} \\ &\leq-k_{3}\|s_{p}\|^{2}-\delta_{p}\|s_{p}\|+\gamma_{2}\sum\limits_{i=1}^{3} \widetilde{D}_{i}\tilde{D}_{i}\end{array}  \tag{55}\]  
According to [PERSON]'s inequality, the term \(\widetilde{D}_{i}\tilde{D}_{i}\) satisfies the following relation:  
\[ \begin{array}{ll}\widetilde{D}_{i}\tilde{D}_{i}&=\widetilde{D}_{i}\Big{(}D_{ i}-\widetilde{D}_{i}\Big{)}\\ &=-\widetilde{D}_{i}^{2}+\widetilde{D}_{i}D_{i}\\ &\leq-\widetilde{D}_{i}^{2}+\left(\widetilde{D}_{i}^{2}/2+D_{i}^{2}/2\right) \\ &\leq-\widetilde{D}_{i}^{2}/2+D_{i}^{2}/2\end{array}  \tag{56}\]  
A further simplified representation can be obtained:  
\[ \begin{array}{ll}\dot{V}_{p}&\leq-k_{3}\|s_{p}\|^{2}-\frac{\gamma_{2}}{2} \sum\limits_{i=1}^{3}\left(\widetilde{D}_{i}^{2}-D_{i}^{2}\right)\\ &\leq-k_{3}s_{p}^{\mathrm{T}}s_{p}-\frac{\gamma_{2}}{2}\widetilde{D}_{p}^{ \mathrm{T}}\widetilde{D}_{p}+\frac{\gamma_{2}}{2}\sum\limits_{i=1}^{3}D_{i}^{ 2}\\ &\leq-\lambda_{p}V_{p}+\Delta_{p}\end{array}  \tag{57}\]  
where \(\lambda_{p}=\min\{2k_{3},\gamma_{1}\gamma_{2}\}\), \(\Delta_{p}=\frac{\gamma_{2}}{2}\sum\limits_{i=1}^{3}D_{i}^{2}\). According to the Lyapunov stability criterion and Lemma 2, the above proof process only verifies the asymptotic stability of the system in a strict sense; then, \(s_{p}\) and \(\widetilde{D}_{p}\) are uniformly and terminally bounded. The actual finite time stability of the closed-loop system will be proved next. In order to prove the finite time convergence of error variables more precisely, the new Lyapunov function is chosen as  
\[V_{p1}=\frac{1}{2}s_{p}^{\mathrm{T}}s_{p} \tag{58}\]  
Taking the derivative of the Lyapunov function, we obtain  
\[ \begin{array}{ll}\dot{V}_{p1}&=s_{p}^{\mathrm{T}}\big{(}\dot{e}_{p}+H\big{(} e_{p},\dot{e}_{p}\big{)}\big{)}\\ &=s_{p}^{\mathrm{T}}\Big{(}\Big{(}\tau_{p}+f_{p}+\overline{\hat{d}}_{p}- \widetilde{\eta}_{1d}\Big{)}+H\big{(}e_{p},\dot{e}_{p}\big{)}\Big{)}\end{array}  \tag{59}\]  
By substituting the derivative of the sliding mode variable and the controller into the above equation, we can obtain  
\[