## 3 Controller Design
### Design of the USV Controller  
Next, it must be ensured that the convergence of the velocity error satisfies the convergence of the position error. For the sliding mode control, a sliding mode surface is constructed according to the error, and a suitable control law is designed to ensure that the sliding mode surface satisfies the Lyapunov stability condition. Without considering the environmental disturbances, we consider the following NTSM surfaces:  
\[\left\{ \begin{array}{l}S_{1}=\int_{0}^{t}e_{u}dt+\beta_{1}(e_{u}) \frac{p_{1}}{q_{1}}\\ S_{2}=e_{v}+\beta_{2}\big{(}\dot{e}_{v}\big{)}^{\frac{p_{2}}{q_{2}}}\\ \end{array} \right. \tag{17}\]  
where \(\beta_{1}\), \(\beta_{2}>0\), \(p_{i}>q_{i}(i=1,2)\) are positive odd integers. The derivative of the virtual speed can be obtained:  
\[\left[ \begin{array}{c}\dot{u}_{d}\\ \dot{v}_{d}\end{array} \right] = r\left[ \begin{array}{cc}-\sin(\psi)&\cos(\psi)\\ -\cos(\psi)&-\sin(\psi)\end{array} \right]\left[ \begin{array}{c}\dot{x}_{d}+b _{x}{\rm tanh}(-\frac{a_{x}}{b_{x}}x_{e})\\ \dot{y}_{d}+b_{y}{\rm tanh}(-\frac{a_{y}}{b_{y}}y_{e})\end{array} \right]+{ \bf J}^{\rm T}\left[ \begin{array}{c}\ddot{x}_{d}-k_{x}\dot{x}_{e}{\rm sech}^{ 2}(-\frac{a_{x}}{b_{x}}x_{e})\\ \ddot{y}_{d}-k_{y}\dot{y}_{e}{\rm sech}^{2}(-\frac{a_{y}}{b_{y}}y_{e})\end{array} \right] \tag{18}\] \[= r\left[ \begin{array}{c}v_{d}\\ -u_{d}\end{array} \right]+{\bf J}^{\rm T}\left[ \begin{array}{c}\ddot{x}_{d}- G_{1}\\ \dot{y}_{d}-G_{2}\end{array} \right]\]  
where \(G_{1}=k_{x}\dot{x}_{e}{\rm sech}^{2}(-\frac{a_{x}}{b_{x}}x_{e})\), \(G_{2}=k_{y}\dot{y}_{e}{\rm sech}^{2}(-\frac{a_{y}}{b_{y}}y_{e})\). Then, the second derivative of \(v_{d}\) is  
\[\ddot{v}_{d} = -\dot{r}u_{d}-\dot{r}u_{d}-r\cos(\psi)\big{(}\ddot{x}_{d}-G_{1} \big{)}-\sin(\psi)\Big{(}\dddot{x}_{d}-\dot{G}_{1}\Big{)}-r\sin(\psi)\big{(} \ddot{y}_{d}-G_{2}\big{)} \tag{19}\] \[+\cos(\psi)\Big{(}\dddot{y}_{d}-\dot{G}_{2}\Big{)}\] \[= -\dddot{x}_{d}\sin(\psi)+\dddot{y}_{d}\cos(\psi)-\ddot{x}_{d}r \cos(\psi)-\ddot{y}_{d}r\sin(\psi)-\dot{u}_{d}r+G^{\prime}-u_{d}\dot{r}\]  
where \(G^{\prime}=\dot{G}_{1}\sin(\psi)-\dot{G}_{2}\cos(\psi)+G_{1}r\cos(\psi)+G_{2} r\sin(\psi)\). Let \(\Gamma=-\dddot{x}_{d}\sin(\psi)+\dddot{y}_{d}\cos(\psi)-\ddot{x}_{d}r\cos(\psi)- \ddot{y}_{d}r\sin(\psi)-\dot{u}_{d}r+G^{\prime}\), then \(\ddot{v}_{d}\) becomes \(\ddot{v}_{d}=\Gamma-u_{d}\dot{r}\). Then, the time derivative of Equation (18) is:  
\[\dot{S}_{1} = e_{u}+\frac{p_{1}\dot{p}_{1}\dot{v}_{2}}{q_{1}}(e_{u})^{\frac{p_ {1}}{q_{1}}-1} \tag{20}\] \[= e_{u}+\frac{p_{1}p_{1}}{q_{1}}\frac{(m_{2}qr-d_{1}u+\tau_{u})-m _{1}u_{d}}{m_{11}}(e_{u})^{\frac{p_{1}}{q_{1}}-1}\]  
\[\dot{S}_{2} = \dot{e}_{v}+\beta_{2}\big{(}\frac{p_{2}}{q_{2}}\big{)}\ddot{e}_{v }(e_{v})^{\frac{p_{2}}{q_{2}}-1} \tag{21}\] \[= \dot{e}_{v}+\beta_{2}\big{(}\frac{p_{2}}{q_{2}}\big{)}\big{(}\dot{ e}_{v})^{\frac{p_{2}}{q_{2}}-1}\Big{[}\frac{1}{m_{22}}\big{(}-m_{11}\dot{u}r-m_{11} \dot{u}r-d_{22}\dot{v}\big{)}-\Gamma+u_{d}\dot{r}\Big{]}\] \[= \dot{e}_{v}+\beta_{2}\big{(}\frac{p_{2}}{q_{2}}\big{)}\big{(}\dot{ e}_{v})^{\frac{p_{2}}{q_{2}}-1}\Big{\{}\frac{m_{22}u_{d}-m_{11}u}{m_{22}m_{33}}[(m_{11}-m_{22}) uv-d_{33}r+\tau_{r}]\] \[+\frac{1}{m_{22}}\big{(}-m_{11}\dot{u}r-d_{22}\dot{v}\big{)}- \Gamma\Big{\}}\]  
Due to the USV tracking error in Equation (13), the following control inputs can be designed. \[\tau_{u}=d_{11}u-m_{22}vr+m_{11}\bigg{[}\dot{u}_{d}-\frac{q_{1}}{ \beta_{1}p_{1}}(e_{u})^{2-\frac{p_{1}}{q_{1}}}-\frac{\varepsilon_{1}q_{1}}{ \beta_{1}p_{1}}{\rm sign}(S_{1})\bigg{]} \tag{22}\] \[+\cos(\psi)\Big{(}\dddot{y}_{d}-\dot{G}_{2}\Big{)}\]0 (23) \[+\cos(\psi)\Big{(}\dddot{y}_{d}-\dot{G}_{2}\Big{)}\]1  
Stability Analysis of the USV Controller  
Consider the following Lyapunov function for the NTSM:  
\[+\cos(\psi)\Big{(}\dddot{y}_{d}-\dot{G}_{2}\Big{)}\]2By taking the first time derivative of the Lyapunov function \(V_{2}\), along with Equations (19) and (20), one can obtain  
\[