## 2 Materials and Methods
### Automatic Deviation Correction Control Strategy
#### 2.2.3 Research on the Trajectory Tracking Algorithm  
Trajectory tracking control methods include the PID tracking model, the pure tracking model and the neural network. The PID tracking control algorithm is relatively mature, but the optimal control parameters are complex, and it is difficult to obtain the optimal parameters under complex conditions. The neural network control algorithm needs to collect a large number of samples for training and verification, which is difficult to realize [29]. The pure tracking algorithm adopts the preview following principle, and the tracking process is very smooth, which meets the requirements of the windlass deviation correction for stability. To sum up, this paper uses  
It must be established that the coordinate system XBOBYB is attached to the roadheader, and the YB axis is consistent with the movement direction. The instantaneous center is always located on the XB axis in the roadheader coordinate system. According to the pure tracking control strategy, the curvature of the roadheader at the current position is equal to the radius of the fitting arc from the current point to the target point, and the distance from the target point to the current point becomes the preview distance [31]. The arc is a tangent to the YB axis, so the coordinates of the target point in the roadheader body coordinate system can be calculated by the following formula:  
\[\left\{\begin{array}{l}x_{g}=\dfrac{\cos\varphi-1}{\rho_{sp}}\\ y_{g}=\dfrac{\sin\varphi}{\rho_{sp}}\end{array}\right. \tag{10}\]  
where \(\varphi\) is the angle that the roadheader body turns from the current point to the target point along the arc and \(\rho_{\text{sp}}\) is the curvature of the current point.  
The preview distance can be calculated by the following formula:  
\[L_{fc}^{2}=x_{g}^{2}+y_{g}^{2}=\dfrac{2-2\cos\varphi}{\rho_{sp}^{2}}=-\dfrac{2 x_{g}}{\rho_{sp}} \tag{11}\]  
In accordance with (11) and (12), the roadheader body angle, is:  
\[\varphi=-\arcsin\dfrac{2x_{g}y_{g}}{L_{fc}^{2}} \tag{12}\]  
Figure 10: The pure-pursuit algorithm.  
It should be noted that \(x_{\rm g}\) and \(y_{\rm g}\) are local coordinates under the roadheader body coordinate system, and the target point sequence is the global coordinates under the roadway coordinate system. Therefore, it is necessary to convert the global coordinates into local coordinates, that is  
\[\left[\begin{array}{c}x_{g}\\ y_{g}\end{array}\right]=\left[\begin{array}{cc}\cos\alpha&\sin\alpha\\ -\sin\alpha&\cos\alpha\end{array}\right]\left[\begin{array}{c}x^{\prime}_{g}- x\\ y^{\prime}_{g}-y\end{array}\right] \tag{13}\]  
where \(\alpha\) is the yaw angle and (\(x\),\(y\)) is the current position coordinate of the windlass body.  
The state update equation of motion is:  
\[\left\{\begin{array}{l}x_{k+1}=x_{k}+v_{k}\cos\alpha_{k}t_{d}\\ y_{k+1}=y_{k}+v_{k}\sin\alpha_{k}t_{d}\\ \alpha_{k+1}=\alpha_{k}+\varphi\\ v_{k+1}=v_{k}+a_{k}t_{d}\end{array}\right. \tag{14}\]  
where \(a_{k}\) is the acceleration, which can be calculated by the following formula  
\[a_{k}=K(v_{g}-v_{k-1}) \tag{15}\]  
where \(v_{g}\) is the target speed, \(v_{k-1}\) is the current speed and \(K\) is the speed gain.