## 2 Improved APF Algorithm
### [PERSON]'s Algorithm Optimization and Map Preprocessing  
In this paper, the APF algorithm is applied to raster maps, but the traditional raster maps and [PERSON]'s algorithm have the following defects: firstly, although the child node generated by the algorithm is not in the range of the obstacle, the connecting line of the child node and the parent node is easy to be close to the obstacle, and secondly, in the actual path planning, there are some concave obstacles as well as some extremely narrow roads, which cause the algorithm to waste unnecessary resource area to explore these unnecessary grids, as shown in Figure 3.  
From Figure 3, we can see that in the raster map without preprocessing, due to the characteristics of [PERSON]'s algorithm, the global path will be close to or even diagonally through the obstacles when planning. This is because the single optimization of the cost function only takes the \"shortest distance\" as the optimization goal; even if there is no collision, the path will be too close to the obstacle and ignore the safety of the path. Moreover, due to the limitation of the search method, each node in the path must be adjacent to the previous node and is not allowed to enter the obstacle grid. As a result, the path can only be selected from the passable grids around the obstacle, resulting in the effect of \"near but not through.\" In this paper, the following two methods are used to improve this, and the improved effect is shown in Figure 4.  
Figure 4: Example of a planned path after optimizing [PERSON]’s algorithm.  
Figure 3: Hazardous path diagrams.  
1. Change the searching method of [PERSON]'s algorithm by removing the nodes in the search direction to the left and right of the neighborhood if there are obstacles near the searching neighborhood.
2. Directly expand the obstacles to increase their effective range and avoid the global path being too close to the obstacles.  
As can be seen in Figure 4, when the pre-processed obstacles appear near the search neighborhood, the optimized [PERSON]'s algorithm filters out the 1 and 7 search neighborhoods to prevent the phenomenon of diagonal penetration of obstacles and selects Neighborhood 2 for planning. At the same time, preprocessing the obstacles can ensure the safety of the path.  
In this paper, the obstacle grid is inflated with a width of 1 m. This inflation threshold is for the safety margin provided by the global planning algorithm (Dijkstra). At the same time, if a larger distance expansion is chosen, it will result in a situation where the passable area is too small, which is additionally burdensome. In practice, the expansion threshold is not necessarily fixed and can be adjusted according to the situation.  
In this paper, the proposed two measures are simulated and verified. Among them, the green grid, red grid, and black grid represent the starting point, arrival point, and obstacles, respectively; the gray grid is the extended grid; and the blue line is the path planned after the Dijkstra algorithm optimizes the search direction, as shown in Figure 5.  
From Figure 5, it can be observed that the optimized raster map and the distance between the path planned by [PERSON]'s algorithm and the obstacles are enlarged by at least one raster width, which improves the quality of the path and provides a good basis for the subsequent APF algorithm.