## 2 Materials and Methods
### Automatic Deviation Correction Control Strategy
#### 2.2.1 Prediction Method of the Driving Cycle EndPoint  
The starting point and endpoint of motion control must be determined before the roadheader body is automatically calibrated. The starting point is the center coordinate of the roadheader body at the initial position of the cycle, which can be measured by the pose detection system. However, the selection of the endpoint needs to consider the requirements of the roadheader motion stability during the deviation correction process, and avoid large changes in the angle speed of the roadheader. In this paper, we propose a path endpoint prediction method based on the initial state. The basic principle of this method is to predict the end position according to the position and angle of the roadheader at the starting point, and to predict the end position without control input. If the position deviation of the prediction point is less than the initial deviation, the prediction point is set as the endpoint of the cycle. If the deviation of the predicted point is larger than the deviation of the starting point, the endpoint of the cycle is set on the roadway centerline. If the starting point deviation is too large, the roadheader deviation can be corrected in stages within multiple driving cycles. The predicted deviation is less than the initial deviation (\(\left\lfloor e_{1}\right\rceil\leq\left\lfloor e_{0}\right\rceil\)). (1) The predicted deviation is less than the initial deviation (\(\left\lfloor e_{1}\right\rceil\leq\left\lfloor e_{0}\right\rceil\))  
As shown in Figure 3, O\({}_{0}\) is the starting point of the roadheader in the ideal state, O\({}_{1}\) is the endpoint of the roadheader in the ideal state, located on the Y axis, and its y coordinate is the distance of the driving footage of each cycle. P\({}_{0}\) is the actual starting point, that is, the current position of the roadheader; \(\alpha_{0}\) is the yaw angle of the roadheader at the starting point and e\({}_{0}\) is the deviation of the body position of the roadheader at the starting point. Furthermore, P\({}_{1}\) is the endpoint predicted according to the pose of the roadheader at the starting point; \(e_{1}\) is the deviation of the prediction point and \(L_{\rm c}\) is the driving cycle footage. Figure 3: The starting point and endpoint when \(\left\lfloor e_{1}\right\rceil\leq\left\lfloor e_{0}\right\rfloor\). The position deviation of the roadheader is indicated to tend to decrease by \(\mid e_{1}\mid\;\leq\;\mid e_{0}\mid\). In order to stabilize the movement of the roadheader, the control input should be reduced as much as possible. The initial speed and direction of the roadheader remain unchanged and the forward travel distance \(L_{\rm c}\) reaches the point \(P_{1}\). If this point is set as the endpoint, the coordinates of the endpoint are (\(e_{0}\)-\(L_{\rm c}\)tan \(\alpha_{0}\), \(L_{\rm c}\)). 2. The predicted deviation is greater than the initial deviation, and the initial deviation is less than the maximum deviation correction amount (\(\mid e_{1}\mid\;>\;\mid e_{0}\mid\) and \(\mid e_{0}\mid\;\leq\;\mid\)). When the lateral (X-axis) deviation at the starting point is large, if you try to eliminate the lateral deviation within a driving cycle, it may affect the flatness of the roadway. Defining [\(e\)] as the maximum adjustment amount allowed for a single drive cycle, signifies [\(e\)] as the X-axis difference between the start and end of the cycle. Since \(\mid e_{0}\mid\;\leq\;\mid\)[\(e\)] indicates that the starting point deviation of the roadheader at the starting point is small, the roadheader position deviation can be adjusted to zero within one cycle. In fact, \(\mid e_{1}\mid\;>\;\mid e_{0}\mid\) indicates that the position deviation of the roadheader continues to increase. At this time, the target point \(P_{1}\) is set on the Y-axis with coordinates (0, \(L_{\rm c}\)), as shown in Figure 4.
3.