Research on Optimization of Static Path Planning Algorithm for UAV Autonomous Flight

The combination of artificial potential field method (APF) and A* path planning algorithm can optimize the path planning problem in the UAV static map. The artificial potential field method also has shortcomings, especially in avoiding obstacles. The simple A* algorithm takes too long to retrieve. The fusion of the two can improve the effect of obstacle avoidance. This article attempts to improve this fusion method. In this article, we introduce the application of artificial potential field method, A* algorithm and improved A* algorithm in static path planning. Finally, we will compare the artificial potential field method combining A* algorithm and improved A* algorithm.


Introduction
We suppose the combination of the information of all the main obstacles and threat area in the static map is known in the path planning algorithm. The path planning algorithm in the static map refers to using this known information as the premise input of the algorithm to make a path planning. When the UAV is flying at high altitude, some obstacles in the environment can neither change with time, nor can it change with the movement of the UAV. We only need to execute the drone route planning algorithm once to obtain a reasonable and feasible route. Then UAV can complete the flight task based on the UAV's flight control system autonomously. The purpose of this article is to try to improve the effort of the combination of two common UAV autonomous flight static path planning algorithms, the artificial potential field method (APF) and A* path planning algorithm. We use the artificial potential field method to make the Global flight path planning. The A* algorithm is used to make the UAV local flight path planning. With the combination the two method, the shortcomings of the artificial potential field method in avoiding obstacles can be effectively made up. The problem of the long search time of simple A * algorithm can be solved.

Artificial Potential Field Method
We take the gravitational field of a planar UAV map in a two-dimensional map as an example. The X (x, y) coordinate is set to the drone. X t ( x t , y t ) coordinates are set as the target point. X i (x i , y i ) coordinates are set as obstacles. We use k to represent coefficient of the velocity and gravity of the UAV at the obstacle location. Therefore, the expression of U(X) gravitational field is: ρ in the formula represents the dangerous distance between the UAV and the position of a given point obstacle. In the formula, when the value of the distance between the UAV and the position of a given point obstacle is larger than ρ, the UAV moves to the target position under the static gravitational field of the artificial potential field method, otherwise the drone avoids. The movement of the UAV is not affected by the gravitational field of the dangerous position. Figure 1 shows the simulation result of the static path planning using the artificial potential field method. The simulation result gives the movement of a UAV moving from a starting point to a given target in a given point-shaped obstacle environment.

A* Algorithm
We set the coordinates of the node where the distance between the drone and the dangerous node of the obstacle be less than or equal to the dangerous distance be X a (x a , y a ). Next, rasterize the map nodes. Each small square around the obstacle represents a dangerous node. The length of the dangerous node is 1. Figure 2 shows the model of an obstacle.
The starting node is set to node X a on the map. We calculate the Euclidean spatial distance between nodes on the outer layer of the obstacle and the end point of the map, and set the point X e (x e , y e ) with the shortest distance to the end point as the obstacle's terminate node. In A* algorithm, the process of the UAV moving from the starting node to the next node via the current node (the current node's coordinate is x(x, y)) is substituted into the obstacle avoidance function:  Figure 2. The model of an obstacle g(x) represents the estimated cost of moving from the starting node to the current node. h(x) represents the estimated cost of moving from the current node to the terminate node.
During each round of scanning on the map in the two-dimensional node scanning environment, the coordinates of the four nodes ( X 1 (x p +1,y p ), X 2 (x p -1,y p ), X 3 (x p ,y p +1) ), X 4 (x p , y p -1) ) in the center of the current node scan are substituted into the valuation function of the UAV. We can take the coordinates X 1 (x p +1, y p ) of the center node of the UAV as an example. If the cost of passing each node is 10, there are: Therefore, the value of the obstacle avoidance function f(X 1 ) of the UAV is equal to the addition of h(X 1 ) and g(X 1 ). Comparing the values of obstacle avoidance function of the four open nodes, the node with the smallest obstacle avoidance function value among the four nodes is stored in an open node list. The flight route from the starting node to the ending node is obtained in this way.

Improved A* Algorithm
As mentioned before, the A* algorithm may have the problem of large search range and long time. Therefore, the idea of improving the A* algorithm is to use the node pruning and hop search rules to remove part of the grid nodes when searching the path in a given environment. As a result, the amount of calculation of the grid nodes can be reduced and the search speed can be improved. As shown in Figure 3, the environmental space is represented by a 3×3×3 cube. The space grid has a first layer, a second layer and a third layer. Each layer has 9 grids representing nodes. When nodes 4 to 5 are found by the algorithm in the second layer, reaching node 5 from node 4 is its first step, and then to nodes 1, 2, 3, 7, 8, and 9 in the second layer. All nodes are the first and third layers. The distance is obviously longer than or equal to the distance to node 4 without passing through node 5. Therefore, in this search, we can select nodes 1, 2, 3, 7, 8, and 9 of the nodes of layer 2, and delete all nodes of layers 1 and 3. Other diagonal and plane nodes can also be deleted and optimized in the same way.

Program Design and Verification
We carry out simulation experiments on the above improved algorithm with the help of MATLAB R2019a, so as to verify effect of the static path planning of UAV autonomous flight.
The flow chart of artificial potential field method combined with A* algorithm for static path planning is shown in Figure 4.   Figure 6. Simulation diagram of static path planning using improved algorithm It can be calculated that the path length obtained by combining the APF and A* algorithm is 33.21m, and the path length after improvement by removing unnecessary search nodes is 31.80m. Some results have been achieved in static path planning.

Conclusion
This paper analyzes the principles of the APF algorithm, A* algorithm, and improved A* algorithm, and performs simulation to verify the performance of the algorithm before and after improvement. After the improvement, the static path planning problem is optimized to a certain extent.