## 3 Controller Design
### Position Controller Design  
#### 3.1.1 The Basic Sliding Mode Controller Frame Design  
Define the desired location as \(\eta_{1d}=\left[x_{d}\quad y_{d}\quad z_{d}\right]^{\mathrm{T}}\); then, the tracking error of the position can be expressed as \(e_{p}=\eta_{1}-\eta_{1d}=\left[e_{x}\quad e_{y}\quad e_{z}\right]^{\mathrm{T}}\).  
First, the finite-time terminal sliding surface based on the learning rate is designed as follows [49]:  
\[s_{p}=\left[s_{x}\quad s_{y}\quad s_{z}\right]^{\mathrm{T}}=\dot{e}_{p}+k_{1}e_ {p}+k_{2}\mathrm{tanh}\left(e_{p}\right) \tag{33}\]  
where \(k_{1}\), \(k_{2}\) is the parameter matrix of the sliding mode manifold. \(k_{1}\) is the designed parameter based on the learning rate.  
\[k_{1}=k_{10}+\alpha\big{|}\dot{e}_{p}\big{|} \tag{34}\]  
where \(k_{10}\) is a positive number and \(\alpha\) is the learning rate, and its expression is \(\alpha=b^{|e_{p}|}-1\), satisfying \(b>0\), \(b\
eq 1\).  
Remark 5 ([50]): _A variable coefficient \(k_{1}\) is introduced to adjust the speed at which the tracking error converges to zero. The tracking error \(e_{p}\) in the initial stage is large, and the change rate of the tracking error \(\dot{e}_{p}\) caused by the controller is also large. The learning rate changes with the error at an exponential rate, which makes the coefficient \(k_{1}\) rise rapidly so that the tracking error converges at a faster rate. However, when the error reaches the sliding mode surface at high speed and the tracking error repeatedly crosses the sliding mode surface, this leads to the system chattering problem.  
Figure 3: Control logic block diagram of coaxial HAUV.  
_The learning rate will change with the decrease in the tracking error rate so that the coefficient \(k_{1}\) adaptively becomes a small number. The tracking error approaches the surface of the sliding mode at a low speed and effectively inhibits the chattering of the system._  
The derivative of the sliding mode variable is calculated as  
\[\begin{array}{ll}\dot{s}_{p}&=\ddot{e}_{p}+\Big{(}k_{1}+k_{2}\Big{(}1-\tanh^{ \mathsf{T}}(e_{p})\tanh(e_{p})\Big{)}\Big{)}\dot{e}_{p}\\ &=\Big{(}\tau_{p}+f_{p}+\vec{d}_{p}-\ddot{\eta}_{1d}\Big{)}+H\big{(}e_{p},\dot{ e}_{p}\big{)}\end{array} \tag{35}\]  
where \(H\big{(}e_{p},\dot{e}_{p}\big{)}=\Big{(}k_{1}+k_{2}\Big{(}1-\tanh^{\mathsf{T}} (e_{p})\tanh(e_{p})\Big{)}\Big{)}\dot{e}_{p}\).  
By setting the derivative of the sliding mode variable to 0, the basic finite-time sliding mode controller can be obtained, expressed as follows:  
\[\tau_{p}=-f_{p}+\ddot{\eta}_{1d}-H\big{(}e_{p},\dot{e}_{p}\big{)}-k_{3}s_{p}- D_{p}\text{sign}\big{(}s_{p}\big{)} \tag{36}\]  
where \(k_{3}\) is a positive constant, and \(D_{p}\) is a sufficiently large constant.  
According to the design principle of the sliding mode controller, the main source of its robustness is the switching term \(D_{p}\text{sign}(s_{p})\) with a sign function. If \(D_{p}\) is too large, it will lead to serious chattering of the control signal. In order to ensure the robustness of the controller, a composite robust controller design combining adaptive technology and disturbance observer technology is adopted here.  
**Remark 6**.: _The hyperbolic tangent function \(\tanh(s_{i}/\xi_{i}),\xi_{i}\in(0,1)\) is used to substitute sign function \(\text{sign}(s_{i})\) to weak chattering. It is worth noting that the smaller the value of \(\xi_{i}\) is, the closer the properties of the hyperbolic tangent function are to the sign function._