## 4 Problem Statement  
For the existing LOS method solving the path following problem, there are two limitations. Firstly, the look-ahead distance considered is usually time-invariant, which is poorly adapted to changes in external conditions, especially changes in path form. Secondly, the drift angle of AUV during navigation will cause the heading of AUV to be inconsistent with the course of AUV, that is, the direction of forward speed is inconsistent with the direction of combined velocity, which leads to deviations from the desired path. In this paper, an improved ALOS is designed. Three main factors are considered to make look-ahead distance more adaptive. The look-ahead is adjusted according to the cross-track error and path curvature, and the change speed of look-ahead is determined according to the speed of AUV. The adaptive look-ahead allows AUV to converge quickly if it deviates from the path, and accurately guides AUV to sail along the path, whether the path is a straight line or a curve. Due to the presence of the time-varying drift angle, the deviations problem should be solved. However, the drift angle generated from the sway speed, such as ocean currents or AUV itself, can not be eliminated. In this paper, a modified guidance law with an extra proportional term according to drift angle is employed, so that the direction of combined velocity of AUV is consistent with the desired path. The essence is to reduce the effect of drift angle, rather than eliminate drift angle itself. Some preliminaries are explained here. In order to study any curve tracking between path points, the path point coordinate system and Serret-Frenet (\(SF\)) coordinate system are introduced, as shown in Figure 2, which makes the guidance method have the versatility for path following of straight lines or curves. There are two path points: \(A(X1,Y1)\) and \(B(X2,Y2)\). Firstly, taking \(A\) as the origin and \(AB\) as the \(x\)-axis to establish the path point coordinate system \((x^{\prime}o^{\prime}y^{\prime})\), any point on the given curve \(f\left(\ast\right)\) can be conveniently represented. Let point \(P(x,y)\) express the current position of AUV in earth-fixed coordinates. Transformation matrix \(\kappa(\alpha)\) is employed to know \(P\) in path point coordinates by Equation (9), i.e., the target point \(P\left(x^{\prime},y^{\prime}\right)\) on the desired path can be calculated:  
\[\left[ \begin{array}{c}x^{\prime}\\ y^{\prime}\end{array} \right]=\left[ \begin{array}{cc}\cos\alpha&\sin\alpha\\ -\sin\alpha&\cos\alpha\end{array} \right]\left[ \begin{array}{c}x-X1\\ y-Y1\end{array} \right]=\kappa(\alpha)\left[ \begin{array}{c}x-X1\\ y-Y1\end{array} \right], \tag{9}\]  
where \(\alpha=\tan^{-1}((Y2-Y1)/(X2-X1))\) is the rotation angle of transformation matrix, which is defined as the angle between the \(x\)-axis \((o^{\prime}x^{\prime})\) of the path point coordinate system and the \(x\)-axis \((ox)\) of the world coordinate system. Then, the desired position \(T\left(x_{T}^{\prime},y_{T}^{\prime}\right)\) in the path point coordinate system can be obtained by the converted coordinates because of \(x_{T}^{\prime}=x^{\prime}\) and \(y_{T}^{\prime}=f\left(x_{T}\right)\). Finally, \(T\) can be converted to the world coordinate system by Equation (10):  
\[\left[ \begin{array}{c}x_{T}\\ y_{T}\end{array} \right]=\kappa^{-1}\left(\alpha\right)\left[ \begin{array}{c}x _{T}^{\prime}\\ y_{T}^{\prime}\end{array} \right]+\left[ \begin{array}{c}X1\\ Y1\end{array} \right]. \tag{10}\]  
The \(SF\) coordinate system \((x_{SF}o_{SF}y_{SF})\) is established at point \(T\). \(\gamma_{T}\) is the rotation angle between the \(x\)-axis \((o_{SF}x_{SF})\) of the \(SF\) coordinate system and the \(x\)-axis \((o^{\prime}x^{\prime})\) of the path point coordinate system. Consequently, the along-track error \(x_{e}\) and the cross-track error \(y_{e}\) for a given position \((x,y)\) are calculated by Equation (11):  
\[\left[ \begin{array}{c}x_{e}\\ y_{e}\end{array} \right]=\kappa^{-1}\left(\gamma_{T}\right)\left[