## 2 Improved APF Algorithm
### Resolving Localized Oscillations Caused by U-Shaped Obstacles  
Map preprocessing can only address known obstacles, but when the algorithm is run, the method is not applicable to obstacles that appear suddenly, because map preprocessing requires real-time modeling of the environment, which can lead to inefficiency in path planning if it is used during the planning process, and the appearance of these obstacles is unpredictable and their morphology may change. When a U-shaped obstacle suddenly appears on the trajectory of the APF, a phenomenon of local oscillation occurs, and this phenomenon with its repulsive potential field energy is shown in Figure 6.  
Figure 5: MATLAB simulation plot after optimizing [PERSON]’s algorithm. From the figure, it can be seen that the traditional APF, when faced with the sudden appearance of a U-shaped obstacle, will experience the phenomenon of localized oscillation, i.e., the current point will stall at a certain position and reach a force equilibrium point near the U-shaped obstacle, thus being unable to exit the area. In real vehicle navigation, the vehicle may be trapped by the repulsive force of the obstacle and fall into a localized region of minimum potential field, which makes it difficult to continue driving towards the target, while the U-shaped obstacle causes the computation of the potential field to become more complicated and the computational efficiency of the vehicle controller to increase linearly. Therefore, this paper solves this problem by integrating global and local path planning strategies. The Dijkstra algorithm is used to generate the approximate target path for the APF algorithm, and then the APF algorithm is used to adjust the robot's traveling route in real time to avoid the local optimal trap. However, the global path planned by the optimized [PERSON]'s algorithm can guarantee the distance to the obstacles, but there are more inflection points in the path, which will lead to the APF algorithm showing an increase in the computational complexity as well as a decrease in the algorithm's real-time performance. This paper optimizes the global path, removes redundant path points, and ensures that the distance from the remaining path points to the center point of the obstacle is not less than the distance to the grid, as shown in Equation (5). \[t=\frac{\left(p3-p1\right)\cdot\left(p_{obs}-p1\right)}{\left(p3-p1\right)^{2}} \tag{5}\]  
where \(t\) is the projection scale. \(p1\) is the first point of the selected path. \(p3\) is the third point, and \(p_{obs}\) is the center of the obstacle. The relative position of the center point in this line segment is represented by the projection scale \(t\) while restricting it to the range (0,1), and then the distance _dist_ is calculated by Equation (6). \[dist=\lvert p_{obs}-\left[p1+t\cdot\left(p3-p1\right)\right]\rvert \tag{6}\]  
The steps to implement the method are shown below:  
Figure 6: Plots of localized oscillatory phenomena in APF. They are: (**a**) Plot of localized oscillations due to U-shaped obstacles; and (**b**) Plot of repulsive potential energy versus number of runs of the algorithm. 1. The start point of the path is taken as the first point of the optimization step, called \(p1\), and the subsequent two points, \(p2\) and \(p3\), of this point are selected to connect the path point p1 and the path point \(p3\) and to check whether the connecting line intersects with the obstacle. 2. If they intersect, the intermediate point \(p2\) is retained, and points like \(p2\) are called necessary points; then the next test starts directly from \(p2\), and the three points are selected in turn for the cycle. 3. If they do not intersect, then calculate the shortest distance _dist_ between the center point of the obstacle and \(p1p3\).