A new method for unmanned aerial vehicle path planning in complex environments

Abstract: In response to challenges in unmanned aerial vehicle (UAV) path planning, such as low search efficiency, non-smooth paths, and the inability to adapt to unknown environments, this paper proposes a novel UAV path planning method integrating a dual-layer optimization of A* and the dynamic window approach(DWA). Firstly, neighbor node pruning rules are defined to optimize the node expansion process of the A* algorithm. The heuristic function of the A* algorithm is dynamically adjusted based on obstacle coverage, and key path nodes are extracted using the Bresenham algorithm. Secondly, a deviation sub-function is introduced to enhance local path planning coherence, and an adaptive weighting method for the evaluation function is designed. Lastly, the optimized key nodes are utilized as sub-goals for local path planning, integrating the dynamic window approach to enhance real-time obstacle avoidance and adaptability in unknown environments. Simulation results demonstrate that the proposed method significantly improves the efficiency, smoothness, and obstacle avoidance performance of mobile robot path planning, meeting the requirements of complex planning tasks more effectively.


Introduction
With the development of society, quadcopter drones are widely used in agriculture, power inspection, aerial imaging, national defense, and other fields [1][2][3].This imposes higher requirements on the intelligent operational capabilities of drones.Depending on the different application scenarios of drones, path-planning algorithms for drones can be divided into static global algorithms and dynamic local algorithms.Common global algorithms include graph-based search algorithms such as Dijkstra's algorithm [4] and A* algorithm [5][6]; sampling-based algorithms such as Rapidly-exploring Random Trees (RRT) [7] and Probabilistic Roadmaps (PRM) [8]; intelligent algorithms such as reinforcement learning [9], deep reinforcement learning [10], etc. Static global path planning involves finding an optimal path for a drone in a known environment, with the A* algorithm widely applied due to its advantages in speed and optimal path generation [11].However, it has issues like high memory consumption and poor path quality.Chen [12] proposed an approximately optimal bidirectional A* search algorithm, which rapidly completes path planning by selecting optimal node pairs.Daniel [13] introduced the Theta* and Angle-Propagation Theta* algorithms, both capable of planning smoother paths at arbitrary angles on grid maps.Hu Shiqiang [14] combined vector cross-product with a scale balancing factor to optimize the A* heuristic function.They employed a jump-point search strategy, achieving variable step-size search.Wang Bin [15] combined an improved A* algorithm with dynamically adjustable heuristic function weights and a dynamic window approach based on an environment-adaptive improvement strategy.This not only solves issues in traditional A* and Dynamic Window Approach like redundancy, low efficiency, and path redundancy but also enhances path safety and real-time performance, aligning better with the motion characteristics of mobile robots.Zhao Xiao [16] improved A* with a jump point search algorithm, reducing unnecessary memory consumption.However, most A* and its improved algorithms lack obstacle avoidance capabilities, leading to planning failures when the environment changes.Wang Hongbin [17] designed the Optimal Target-First Search method, which sorts multiple targets based on cost, and sequentially plans paths for each target point.Subsequently, the A* algorithm is employed for secondary optimization.Zhang Zhen [18] incorporates environmental and parent node information into the A* evaluation function and designs a safe extension strategy to dynamically change the extension direction, thereby improving pathfinding efficiency and obstacle avoidance capability.Local path planning algorithms include the dynamic window approach [19][20], artificial potential field method [21], etc. Local algorithms calculate progressively using the latest sensor information during motion and can effectively avoid both known and unknown obstacles.Li Xinying [22] used an improved multi-objective particle swarm algorithm to dynamically adjust the weight coefficients of the Dynamic Window Approach.The adaptive weighting problem is transformed into a multi-objective optimization problem, and an improved particle swarm algorithm is employed for optimization, enabling the adapted DWA algorithm to dynamically adjust parameters based on the environment.Wang Yongxiong [23] proposed a parameter-adaptive DWA algorithm that adjusts the weights in the objective function based on the distance between the robot and obstacles and the density of obstacles, resulting in more reasonable paths.Chou et al. [24] improved the DWA algorithm by incorporating region analysis techniques.They filter incorrect commands through lookahead verification to guide the path toward optimal results.Chang [25] defined state and action spaces, and through dynamically adaptive adjustments using reinforcement learning to the sub-evaluation functions of DWA, they improved the environmental adaptability and dynamic obstacle avoidance performance of the DWA algorithm.The algorithms mentioned above have been improved in various aspects for A* and the Dynamic Window Approach, enhancing operational efficiency and environmental adaptability to some extent.However, issues such as path redundancy and high memory consumption still persist.Therefore, this paper proposes a dual-layer optimization algorithm.Firstly, neighbor node pruning rules are defined, and obstacle coverage is dynamically adjusted to regulate the weight of the heuristic function, allowing it to adaptively adjust based on environmental changes, thereby improving planning efficiency.Secondly, the Bresenham algorithm is employed to extract key path nodes, and a deviation function is designed to enhance the followability of the DWA algorithm in local path planning, with simultaneous dynamic adjustments of evaluation function weights based on the environment.Finally, the extracted key path nodes are utilized as temporary sub-goals, endowing the A* algorithm with the ability to navigate around unknown obstacles.The effectiveness of the improved algorithm is verified through simulation and experimentation.

Principle of Algorithm A* Algorithm
A* algorithm is built upon Dijkstra's algorithm by incorporating a heuristic function to guide the search.It is capable of finding the shortest path from the starting point to the destination, possessing completeness and optimality [26].By maintaining two sets, Open and Closed, the A* algorithm iteratively expands nodes with the minimum cost.The path planning concludes when the destination is added to the Closed set or the Open queue becomes empty.The calculation of the node cost is done by Where, represents the total cost from the starting point through the node to the target point; represents the actual cost from the starting point to the node; represents the heuristic estimated cost from the node to the target point.The primarily has two calculation methods: Euclidean Distance and Manhattan Distance [27] , specified as follows: Where, ( , ) x y mm is the current node coordinate, ( , )   xy nn is the target node coordinates,Due to the relatively complex and computationally intensive nature of calculating Euclidean Distance, this paper adopts the Manhattan Distance formula.
Although the A* algorithm can find the shortest path required to complete a task in a known environment, it has a broad search scope, low planning efficiency, and is unable to navigate around unknown obstacles.

Dynamic Window Approach
The DWA algorithm possesses the advantages of efficiency, real-time capability, strong obstacle avoidance, and ease of implementation.It primarily performs discrete sampling within the allowed velocity space based on the current motion state of the drone and simulates the motion trajectories of these velocity combinations within the forward prediction time.Subsequently, the trajectory scores are determined by the evaluation function, leading to the identification of the optimal trajectory [28].Subject to the constraints of motor performance and the environment, the velocity of the unmanned aerial vehicle at time t+1, denoted as,must satisfy the following constraints: (1) Due to the constraints imposed by the hardware performance of the unmanned aerial vehicle, the velocity constraints for the drone are expressed as:   Where， max v and min v represent the maximum and minimum linear velocity constraints; max to the maximum and minimum angular velocity constraints.
(2) Subject to the constraints of the unmanned aerial vehicle's motor performance, the drone should ensure velocity vector space sampling within the range that the motor torque can withstand, namely the unmanned aerial vehicle motor acceleration constraints [29] : [max( , ), min( , )] [max( , ), min( , )] Here, min max , x x aa represents the maximum deceleration and acceleration in the UAV's x-axis direction.The original evaluation function of the DWA algorithm is given by: Where,

( , )
heading v  is the heading sub-function, used to evaluate the extent to which the trajectory aligns with the target.

( , )
dist v  is the distance sub-function, predicting that the farther the trajectory is from obstacles, the higher the score for this term.
( , ) vel v  is the velocity sub-function, characterizing the swiftness of the flight.  、 、 is the weight coefficient for the respective terms,  represents the normalization process.

Adjacency Node Clipping Rule
Based on the expansion direction between the parent node and the current node, the neighbor node pruning rules are defined, as shown in Figure 1.Here, gray grids represent free nodes that are unoccupied by obstacles and do not need to be considered.White grids represent neighboring nodes that the current node needs to consider, and black grids represent obstacles.The specific neighbor node pruning rules are as follows: In the absence of obstacles, if the current node is expanded from the parent node in the horizontal or vertical direction, then the current node's neighbors only need to consider one node in the same expansion direction, as shown in Figure 1(a).Other neighboring nodes can be reached from the parent node without passing through the current node at a lower cost, eliminating the need for expansion.In the case of diagonal expansion, as depicted in Figure 1(b), the situation is similar to straight-line expansion, with the only difference being that paths not passing through the current node must strictly dominate, facilitating subsequent recursive searches.When there are obstacles around the current node, and the parent node does not have a better path to reach certain nodes without passing through the current node, such neighboring nodes also need to be considered, as illustrated in Figures 1(c) and 1(d).

Adaptive A* Heuristic Function
The A* algorithm balances accuracy and speed using a heuristic function.However, the heuristic function often underestimates the distance from the current node to the goal, resulting in low search efficiency.To address this, this paper introduces obstacle coverage rate to abstract environmental information.It constructs a function similar to a sigmoid function to dynamically adjust the weight of the heuristic function, aiming to enhance the efficiency of path planning.The main idea is as follows: when there are many obstacles in the environment, increase the heuristic function value of nodes appropriately to reduce the error between the estimated distance and the actual distance, thereby improving search speed.Conversely, when there are fewer obstacles, the estimated cost between nodes and the goal will be closer to the actual value.In this case, appropriately decrease the magnitude of weight adjustment to better balance search accuracy and speed.The new cost function and obstacle coverage rate are defined as follows: 1, ( , ) ( , ) 0, ( , ) Here, obs C and free C respectively represent obstacle space and free space; ( , ) value i j is the value function for coordinates ( , ) ij， indicating whether the corresponding grid is occupied by an obstacle.

Bresenham Algorithm Extracts Key Nodes
When using the A* algorithm for path planning, the planned path often contains redundant and turning points, increasing memory overhead, and the path is not smooth.Further optimization is required.In this paper, a strategy for extracting key path nodes is proposed based on the direction of node expansion and the Bresenham algorithm.The Bresenham algorithm is a linear scan conversion method [30] that can determine the grid area through which the line connecting two nodes passes quickly by using the slope and intercept of the line.This facilitates the collision detection process.As shown in Figure 2, the grid area through which the line connecting nodes A and B passes has obstacles, indicating a collision in that path segment, making it impassable.

Figure 2. Bresenham algorithm for collision detection
The steps for extracting critical path nodes are as follows: (1) Differentiating Redundant Nodes and Turning Points Based on Node Expansion Direction: Define ( ) as the expansion direction between two adjacent nodes and .If is considered a redundant node; otherwise, it is classified as a turning point.
(   In complex and dynamic environments, the Dynamic Window Approach with fixed weight values may encounter planning failures or result in unreasonable paths [31] .This paper proposes a method with adaptive weightings, selecting weight combinations based on the distance between the robot's current position and obstacles.This allows the robot to generate more reasonable scores in diverse environments.The specific steps are as follows: a) Define the detection distance between the current position and obstacles as

UAV Performance Analysis
UAV path planning involves the pre-flight formulation of an optimal reference trajectory that satisfies co nstraints based on environmental information and mission requirements.During flight, in the presence of unk nown or dynamic threat information, local trajectory optimization is performed dynamically.The global plann ing objective is to avoid convergence to local optima and minimize computational complexity, while local op timization focuses on reducing planning time for real-time responsiveness.In certain tasks, UAVs may neglec t changes in altitude by projecting three-dimensional objects onto a two-dimensional plane to simplify proble m complexity and enhance trajectory planning efficiency.Two-dimensional path planning finds extensive appli cations across various domains including agricultural crop protection, search and rescue operations, and aerial photography, among others.When engaging in path planning for UAVs, it is crucial to comprehensively account for the constraints arising from the UAV's inherent performance limitations, thereby ensuring the seamless execution of tasks.T he constraints integral to UAV path planning encompass factors such as the maximum turning angle and the maximum trajectory length, both of which must be adhered to for effective planning.
Maximum Turning Angle: During UAV flight, the turning angle is limited by the aircraft's performance, and it must adhere to a specific range in order to determine the agility of the UAV.If  represents the maximum allowable turning angle for optimal UAV performance, sati sfying: max i   (11) Maximum track length: The UAV needs to avoid obstacles during flight, and it is difficult to maintain a straight line.The maximum flight path of the UAV is affected by its own battery energy consumption, so the maximum flight path of the UAV will be constrained.If the track path is composed of several sections i l ( 1, 2, , )   in = and the maximum track length of the UAV is max

Fusion Algorithm
The advantage of the A* algorithm lies in its ability to plan the shortest path in an environment with static obstacles.However, the planned path often contains many turning points and redundant nodes.Moreover, in dynamic environments, the path generated by A* in a static environment may not effectively avoid obstacles.Due to the lack of guidance from a global path, the traditional Dynamic Window Approach algorithm often struggles to obtain an ideal optimal path, especially in complex obstacle environments, leading to a tendency to get stuck in local optima and be unable to reach the target point.Therefore, this paper integrates the global path planning information from the improved A* algorithm to guide the DWA algorithm.This ensures local dynamic obstacle avoidance while achieving global path optimality.In the end, the workflow of the integrated algorithm is depicted in Figure 3.

Fusion Algorithm Simulation Analysis
To validate the effectiveness and superiority of the improved A* algorithm, a simulation-based comparative analysis was conducted among the A* algorithm, Theta* algorithm, and the improved algorithm proposed in this paper using different environmental maps.The computer configuration includes a Windows 10 64-bit operating system, an Intel (R) Core (TM) i5-10210U CPU with a base frequency of 1.60GHz (turbo boost up to 2.11GHz), and 16GB of RAM.MATLAB R2017b was used as the simulation software, and the parameter values used in the simulation are detailed in Table 2.
To validate the superiority of the algorithm proposed in this paper, simulations were conducted on grid maps with unknown obstacles of sizes 20×20 and 30×30.Traditional A*, traditional DWA algorithm, the algorithm proposed in [18], and the fused algorithm proposed in this paper were compared.The experimental data is recorded in Table 3, and the experimental results are illustrated in Figures 4 and 5.In these figures, magenta grids represent the starting points, green grids represent the target points, black grids represent known obstacles, green broken lines indicate global paths, blue curves indicate local paths, and nodes along the paths are marked with asterisks (*).From the above simulation results, it is evident that in Figure 4(a), the traditional A* algorithm fails to navigate around unknown obstacles, resulting in path planning failure.In Figure 4(b), the traditional DWA algorithm easily gets trapped in local optima, especially when faced with "U"-shaped obstacles, making it unable to reach the target point.Figure 4(c) shows that the algorithm proposed in [18] successfully reaches the target point through dual-layer path planning; however, it exhibits large turning angles and poor local path following, still suffering from the issue of lengthy paths.In contrast, in Figure 4(d), the fused algorithm proposed in this paper successfully avoids unknown obstacles, resulting in smoother paths and stronger environmental adaptability.As indicated in Table 3, the runtime of the fused algorithm proposed in this paper is reduced by 58.6% and 61.1% compared to the algorithm in the literature and the DWA algorithm, respectively.Furthermore, the path length is reduced by 29.1% and 51.7%, with smaller turning angles, making it more suitable for UAV flight conditions.
To further validate the superiority of the fused algorithm proposed in this paper, comparative experiments were conducted with the algorithm in the literature on a 30×30 random obstacle map, as shown in Figure 5.
(a) Algorithm in reference [18] (b) This text fusion algorithm , it can be observed that both the algorithm proposed in [18] and the fused algorithm proposed in this paper successfully find a path from the starting point to the destination in an environment containing unknown and random obstacles.However, as indicated in Table 3, compared to the algorithm in the literature, the fused algorithm proposed in this paper reduces the number of expanded grids by 15.1%, decreases the runtime by 39.1%, and shortens the path length by 10.8%.The proposed algorithm exhibits significantly improved operational speed and planning efficiency, with better local path following characteristics.Its curvature is continuous, and turning angles are smaller.Figure 6 provides a comparison of linear velocity and angular velocity between the two algorithms during the planning process, with average data recorded from multiple measurements as shown in Table 4.The simulation results reveal that the proposed algorithm exhibits small and gradual changes in linear and angular velocities when avoiding unknown obstacles.Compared to the literature algorithm, the proposed algorithm shows an average increase of 67.3% in linear velocity and a 33.3% improvement in average angular velocity, indicating a significant enhancement in algorithm speed.

Experimental Research
To further validate the effectiveness of the improved A* algorithm in practical applications, real-world experiments were conducted using the P200 unmanned aerial vehicle equipped with a SICK A2 LiDAR and Jetson TX2 onboard computer.The experimental UAV platform is illustrated in Figure 5, and the experimental parameters are provided in Table 1.The onboard computer runs on Ubuntu 18.04, and the robot operating system is Melodic.Prior to the experiment, the gmapping algorithm was utilized for mapping, and the experimental results were visualized using the Rviz tool, as shown in Figure 7.The experimental results demonstrate that the proposed improved A* algorithm exhibits strong adaptability in real-world applications, effectively avoiding unknown obstacles on the path and successfully completing path planning in a safe and efficient manner.

Conclusion
To effectively address issues in UAV path planning, such as low search efficiency, non-smooth paths, and the inability to adapt to unknown environments, this paper proposes a UAV path planning method based on the improved A* algorithm.Firstly, by defining neighbor node pruning rules, the A* algorithm's node expansion is optimized.Simultaneously, a dynamic adjustment of the heuristic function based on obstacle coverage is designed to enhance search efficiency.Secondly, the Bresenham algorithm is employed to extract key path nodes, improving path smoothness.Next, a deviation sub-function is designed to enhance local path-following capabilities, along with a proposed adaptive weighting method for the evaluation function.Finally, the optimized key nodes are used as sub-goals for local path planning, integrating with the dynamic window approach to enhance real-time obstacle avoidance and adaptability to unknown environments.Simulation and experimental results demonstrate that the proposed algorithm significantly improves UAV path planning efficiency, smoothness, and environmental adaptability in complex scenarios, validating the effectiveness and superiority of the proposed algorithm.
deceleration and acceleration in the UAV's y-axis direction.min max , aa  represents the maximum deceleration and acceleration in the UAV's angular velocity.

Figure 1 .
Figure 1.Adjacency node clipping rule ) Using the Bresenham algorithm to identify key path nodes: Starting from the initial point ,connect to the next turning point j P and subsequent nodes jk P + .Conduct collision detection sequentially.If the first collision occurs on the line connecting node to jk P + ,then node 1 jk P +− is considered a key path point.

( 3 )
Starting from the new key path node, repeat step (2) until the target point is extracted.
By utilizing the key path nodes extracted through the A* algorithm as intermediate target points for the Dynamic Window Approach, coupled with the real-time obstacle avoidance capability of the Dynamic Window Approach, the improved A* algorithm can promptly respond to and navigate around unknown obstacles in the planning environment.This enhances the environmental adaptability and success rate of A* algorithm path planning.Considering the tracking performance of local path planning after obstacle avoidance, this paper introduces a global path deviation sub-function to improve local path following effects, achieving global optimality.The evaluation function and distance sub-function calculation method for improving the Dynamic Window Approach algorithm are as follows: Dist v w is the distance evaluation function, ( , ) obs dist v w is the obstacle avoidance function, representing the distance between the current trajectory endpoint and obstacles, and ( , ) dev dist v w is the deviation function, indicating the distance between the global optimal path and the current trajectory.
the robot is close to the obstacle, and a response to enter the safe zone is required.At this point, it is necessary to increase  which is the weight value of the obstacle avoidance function ( , ) obs dist v w and decrease  which is the weight value of the deviation function ( the current distance is within the danger distance, the primary task is to leave this area.Therefore, it is necessary to continue increasing the obstacle avoidance weight.d) When min now dist dist  ,indicating that the robot is in a safe zone, in order to improve local path-following performance, it is necessary to increase the weight value of the deviation function ( , ) dev dist v w and decrease the weight value of the obstacle avoidance function ( , ) obs dist v w .The weight combination is as follows: of the UAV in segment i , and i   denotes the required turning angle for transitioning to the next segment, max Algorithm in reference[18] (d) This text fusion algorithm

Figure 4 .
Figure 4. 20×20 ladder obstacle mapFrom the above simulation results, it is evident that in Figure4(a), the traditional A* algorithm fails to navigate around unknown obstacles, resulting in path planning failure.In Figure4(b), the traditional DWA algorithm easily gets trapped in local optima, especially when faced with "U"-shaped obstacles, making it unable to reach the target point.Figure4(c)shows that the algorithm proposed in[18] successfully reaches the target point through dual-layer path planning; however, it exhibits large turning angles and poor local path following, still suffering from the issue of lengthy paths.In contrast, in Figure4(d), the fused algorithm proposed in this paper successfully avoids unknown obstacles, resulting in smoother paths and stronger environmental adaptability.As indicated in Table3, the runtime of the fused algorithm proposed in this paper is reduced by 58.6% and 61.1% compared to the algorithm in the literature and the DWA algorithm, respectively.Furthermore, the path length is reduced by 29.1% and 51.7%, with smaller turning angles, making it more suitable for UAV flight conditions.To further validate the superiority of the fused algorithm proposed in this paper, comparative experiments were conducted with the algorithm in the literature on a 30×30 random obstacle map, as shown in Figure5.

Figure 6 .
Figure 6.Comparison of speed changes in path planning

Figure 7 .
Figure 7. UAV experiment platformIn Figure8(a), the yellow curve represents the path planned by the improved A* algorithm on a static known map.This path cannot avoid unknown obstacles but provides global guidance.In Figure8(b), the UAV perceives the surrounding environment in real-time through the LiDAR and starts moving under the guidance of the planned path.The white box represents the set detection range of the LiDAR, the colored area represents the detected obstacles, and the blue curve represents the actual flight path.In Figure8(c), the UAV detects unknown obstacles on the flight path, and the improved algorithm immediately avoids them.Eventually, the UAV successfully reaches the specified destination, as shown in Figure8(d).The experimental results demonstrate that the proposed improved A* algorithm exhibits strong adaptability in real-world applications, effectively avoiding unknown obstacles on the path and successfully completing path planning in a safe and efficient manner.
(a) Global path planning (b) Start local path planning (c) Avoid unknown obstacles (d) Reach the final target point

Table 1 .
Weight combination of evaluation function

Table 2 .
Simulation parameters and values

Table 3 .
Performance comparison of global path planning algorithms

Table 4 .
Comparison of algorithm performance indicators