A Real-Time Path Planning Method for Urban Low-Altitude Logistics UAVs

To solve the problem of poor real-time performance in path planning algorithms for unmanned aerial vehicles (UAVs) in low-altitude urban logistics, a path planning method combining modified Beetle Antennae Search (BAS) with the Simulated Annealing (SA) algorithm is proposed. Firstly, based on the requirements of task execution and constraints of UAV flight, a fitness function for real-time search of waypoints is designed while ensuring the safety and obstacle avoidance of the UAV. Then, to improve the search accuracy and real-time performance, determining the initial search direction in the BAS algorithm is improved, while the search step size and antennae sensing length are updated in real-time according to the distance between the UAV and the obstacle. Finally, the SA algorithm is combined with the BAS algorithm to update the waypoints, expanding the search range of each waypoint, avoiding the process of updating the waypoints from becoming trapped in the local optimal waypoints. Meanwhile, the effectiveness of the next waypoint is evaluated based on the Metropolis criterion. This paper generates a virtual urban logistics distribution environment based on the density and distribution of urban buildings, and compares the performance of algorithms in obstacle-sparse, obstacle-moderate, and obstacle-dense environments. The simulation results demonstrate that the improved method in this paper has a more significant capacity for environmental adaptation. In terms of the path length, waypoints, safety obstacle avoidance, and smoothness, the planned path outperforms the original BAS method. It satisfies the needs of real-time path planning for UAVs involved in urban low-altitude logistics.


Introduce
With the rapid development of e-commerce, the demand for logistics and the pressure of urban ground transportation is constantly increasing.Therefore, the efficiency of logistics distribution has begun to attract attention [1,2].UAVs, known for their high speed, strong maneuverability, and wide delivery range [3][4][5], have been applied in the delivery of medical supplies, mail, food, and more, becoming one of the tools for urban logistics distribution [6].Logistics UAVs have been supported and practiced globally [7].As the world's largest user of UAVs, China has approved several express delivery companies to conduct pilot UAV delivery services [8].The sustainable development of aviation transportation is continuously advancing [9].Therefore, it is crucial to address the challenge of enabling UAVs to complete delivery tasks safely and efficiently in urban low-altitude environments.Among the challenges, the key to solving the problem lies in planning a flight path, which ensures both safety by avoiding obstacles and a relatively short path length.
Thus, the logistics UAV path planning methods have attracted many scholars' attention.In reference [10], an improved A* algorithm was used to quickly plan feasible paths for urban logistics UAVs, while considering the delivery efficiency and costs.Ref. [11] proposed an algorithm based on the combination of the ant colony algorithm and unnecessary point deletion strategy, which solves the problem of logistics UAV path planning These studies indicate that the SA algorithm holds a significant advantage in addressing the problem of other algorithms easily becoming trapped in local optima.
Therefore, a path planning method is proposed, named the Beetle Antennae Search Simulated Annealing (SABAS) algorithm, in response to real-time path planning for urban low-altitude logistics UAVs.This algorithm improves based on the BAS algorithm, which has low complexity and high search capability, and combines with the SA algorithm which can expand the search range to avoid becoming trapped in local optima.
The main contributions of this paper can be summarized as follows: (1) Considering the constraints during UAV flight, design a fitness function that satisfies safe obstacle avoidance, shortest path, and real-time planning requirements.
(2) Improving the BAS algorithm.To enhance search safety and real-time performance, the search step size and antennal sensing length are dynamically updated based on the distance between the UAV and obstacles.When the UAV is far from obstacles, larger step sizes and antennal sensing lengths are used for searching.In comparison, smaller step sizes and antennal sensing lengths are employed when the UAV is closer to obstacles.
(3) Applying the SA algorithm to the position updating of the BAS algorithm.The search range is expanded by generating neighboring solutions for the next position, preventing the position update process from falling into local optima.Additionally, assessing whether the next position meets the movement criteria based on the Metropolis criterion, to enhances the accuracy of the search.
(4) Comparing with the BAS algorithm in three urban low-altitude scenarios, where the only difference among these scenarios is the obstacle density and distribution.Test the algorithm's performance in terms of safe obstacle avoidance, number of waypoints, and flight path length.

Algorithm Principle
The BAS algorithm is a metaheuristic algorithm that simulates the behavior of beetles searching for mates or prey [16].When beetles hunt for prey or search for potential mates, they swing their body's two antennae to detect the scent of prey or potential mates, indicating that beetles use their two antennae to search the surrounding area randomly.When the concentration of scent detected by one side of the beetle's antenna is higher than that detected by the other side, the beetle will move to the side with the higher concentration.In the BAS algorithm, the fitness function represents the concentration of the scent, and the beetle's position represents the solution to the problem.The fitness function's optimal value corresponds to the odor's source point, and the optimal solution corresponds to the beetle's optimal position.Because the algorithm's computation process is relatively simple, initial conditions do not constrain it, and it has fewer constraints.Therefore, this algorithm is widely used in fields such as image processing and intelligent control.However, the search strategy employed by the algorithm is local search, which can lead to the algorithm becoming trapped in optimal local solutions.The SA algorithm expands the search range, improves the search efficiency, and effectively avoids local convergence by randomly generating multiple neighborhood solutions and selecting the solution that makes the fitness function optimal.Therefore, for the problem of poor realtime path planning algorithm, this paper proposes an improved SABAS algorithm, which can meet the demand of real-time obstacle avoidance, and searching of waypoints for urban low-altitude logistics UAVs.

Algorithm Flow
The steps to improve the SABAS are as follows: Step 1 Initialization.Initialize the variables, determine the starting and ending positions, and read the simulated map data.
Step 2 Design the fitness function.According to the specific requirements of UAV path planning, to ensure the safe flight of UAV, design the fitness function of the BAS algorithm to update the waypoints during the path planning process.
Step 3 Initialize the search direction.Initialize the search direction of the beetle according to the starting and ending positions.
Step 4 Calculate the left and right antennae positions.Calculate the beetle's left and right antennae positions based on the current position and the sensing length of antennae.
Step 5 Update beetle position.Update the next position according to the current position and the position of the left and right antennae, and determine whether the beetle reaches the endpoint.If it reaches the endpoint, go to step 9, otherwise, go to step 6.
Step 6 Expand the search range.The SA algorithm is introduced to generate the neighborhood solutions of the next position obtained from Step 5, and the best next position is selected from the neighborhood solutions.
Step 7 Move evaluation.If the filtering in Step 6 meets the move condition, move to the next step and go to Step 8; if the move condition is not met, go back to Step 6.
Step 8 Update the step size and the sensing length of antennae.According to the distance between the UAV and the obstacle, update the search's step size and the sensing length of antennae.
Step 9 Obtain the path.
In the formula The constraints are: d t,b ≥ d min (10) where, q t , h t , and l t are respectively the danger cost, altitude cost, and distance cost from the endpoint for the UAV when it is at position X t , High max is the maximum flight altitude, High min is the minimum flight altitude, β max is the maximum turning angle, µ max is the maximum pitch angle, c 1 , c 2 , and c 3 are the danger cost weight, altitude cost weight, and distance cost weight between the current position and the endpoint, respectively, and c 1 , c 2 , and c 3 satisfies is the minimum safe distance between the UAV and the obstacle, d min is the distance between the UAV and the obstacle detected by the sensor when the UAV is in position X t , z t,t−1 and d t,t−1 are the height difference and distance between waypoints X t and X t−1 , x t , y t , z t is the coordinates of the waypoint X t , x t+1 , y t+1 , z t+1 is the coordinates of the waypoint X t+1 , x b , y b , z b is the coordinates of obstacles, x T , y T , z T is the coordinates of the endpoint and X T of the UAV.Equations ( 7)-( 10) are the flight height constraint, steering angle constraint, pitch angle constraint and the minimum safe distance from the obstacle respectively.

Search Direction
The search direction is a crucial factor affecting the accuracy of beetle position updates.In the original BAS algorithm, the initial search direction is randomly generated using Equation (11), resulting in a relatively arbitrary search direction.The ideal flight path of the UAV is a straight line path from the starting point to the endpoint, so the ideal search direction is the direction from the starting point to the endpoint.The search direction obtained through Equation ( 11) could be opposite or perpendicular to that direction.Searching in these initial directions would cause the UAV to deviate from the ideal flight path right from the start.Subsequent positions updated in this search direction would also increasingly deviate from the ideal path, leading to increased path length and time, resulting in significant resource wastage.Therefore, to improve the search's accuracy and shorten the flight's path length and time of the flight, the search direction is set as the direction from the starting point to the endpoint, and the calculation formula is shown in Equation (12).The beetle moves towards the destination right from the first step.Although it may need to deviate from the ideal path direction due to obstacles along the way, once the beetle bypasses the obstacle, it continues to approach the ideal path direction.This method avoids unnecessary increases in path length and enhances search efficiency.
where, → b is the search direction, k is the spatial dimension, the spatial dimension considered in this paper is three dimensions, X 0 is the starting position and its coordinates are x 0 , y 0 , z 0 , X T is the end position and its coordinates are x T , y T , z T .

Update Position
Beetles update their position based on the concentration difference between the odors detected by their two antennae.Therefore, the position of the beetle's left and right antennae must be obtained first, and the calculation formula is given in Equation (13).The formula for updating the beetle's position is given in Equation ( 14): where, d t , δ t , X t r and X t l are the lengths of the antennae sensing, search step size, right antenna position, and left antenna position of the beetle at position X t , respectively, F(X t r ) and F(X t l ) represent the fitness values of the right and left antennae of the beetle at position X t , respectively, → b is the search direction, and sign(•) is a sign function.The original BAS algorithm consists of Equations ( 13) and ( 14) to update the beetle's next position, which compares the three forward directions of left front, right front, and right front.It selects the optimal direction to move forward by one step to obtain the position of the next move.The updated position is only obtained by adding one step along the better direction among the three directions, and there is no guarantee that this position is the best moving position.Such a way of updating positions has significant limitations and low accuracy, leading to inaccurate position updates or choosing an unfavorable path to reach the goal.
The SA algorithm can expand the search range by generating neighboring solutions to avoid becoming trapped in local optima.The algorithm uses the Metropolis criterion to handle the obtained solutions, accepting better and worse solutions with a certain probability.Therefore, to compensate for the shortcomings of the BAS algorithm, the SA algorithm is combined with the BAS algorithm to update the position.During the position updating, neighborhood search is used to screen the best moving position while optimizing the moving judgment criteria.

Neighborhood Search Optimization
In this paper, we use the SA algorithm to generate neighborhood solutions to expand the range of the BAS, i.e., after obtaining the next position X t+1 to be moved according to Equation ( 14), we introduce the SA algorithm to generate M neighborhood solutions X t+1 m |1 ≤ m ≤ M .To obtain a better moving position, obtain ball O M using Equation (15), and X t+1 m is taken on the hemisphere boundary of sphere O M in the − −−− → X t X t+1 direction.Then, the best next moving position is screened by comparing the difference in the fitness function between the neighborhood solution X t+1 m and the initial solution X t+1 of the position to be moved, and the screening position is calculated by Equations ( 16) and (17).
where X t+1 is the next position to be moved by Equation ( 14), x t , y t , z t is the coordinates of the position X t , x t+1 , y t+1 , z t+1 is the coordinates of the position X t+1 , X t+1 m is the mth neighborhood solution of X t+1 , ∆F is the difference between the fitness function of the neighborhood solution and the position to be moved, ∆F < 0 indicates that the neighborhood solution is better, The neighborhood solution is replaced with the position to be moved.Otherwise, the original position is kept.

Optimization of Moving Conditions
To ensure the effectiveness of beetle position updates, an evaluation of the upcoming position that the beetle is about to move to is required before the beetle's movement.If the upcoming position to move to is better than the current position or meets certain conditions, the beetle will move to that position.Otherwise, it is necessary to find the optimal moving position by increasing the neighboring solutions.Therefore, this paper assesses whether the next position meets the moving criteria according to the Metropolis criterion.Let the difference in fitness function between the upcoming moving position and the current position be denoted as ∆F = F(X t+1 ) − F(X t ), the judgment process is as follows: If ∆F < 0, indicating that the upcoming moving position is superior to the current position in terms of a weighted combination of safety and distance to the endpoint, the beetle moves to the next position.Otherwise, calculate where P is the probability of a move and r is the probability of an acceptable move.When P > r, although the position to be moved is worse than the current position, the beetle can still move to the next position with probability P. When P < r, in order to ensure the accuracy of the search, the beetle needs to re-search its next position to obtain the path that satisfies the highest safety and the shortest voyage.

Update Search Step Size and Sensing Length of Antennae
The search step size and the sensing length of antennae are crucial in determining the algorithm's search speed and search accuracy, as well as the prerequisites for implementing safe obstacle avoidance and real-time search for waypoints.In this case, the larger the search step, the fewer positions need to be updated, so the search speed of the algorithm is faster.However, the search accuracy could be higher and the path obtained could be more precise and long.On the contrary, the smaller the search step, the more waypoints are planned, the shorter and smoother the path obtained, and the slower the algorithm's search speed will be.Similarly, the longer sensing length of antennae, the larger the search range, but the lower the search accuracy.The shorter sensing length of antennae, the higher the accuracy of the search.Therefore, this paper improves the update method of the search step and the sensing length of antennae.
In solving other function optimization problems, how the BAS algorithm updates the step size is shown in Equation (19), where the step size attenuation factor α is generally set to 0.95 [16].With each position update, the step size is reduced once by the attenuation factor.Therefore, the search precision gradually improves and converges to the optimal solution to the problem.When solving UAV path planning problems, the optimal value for the step size attenuation factor α is 0.99 [18], which can prevent the step size from decreasing too quickly to a small search step.The position updates of the beetle correspond to the search for waypoints for the UAV.The waypoints of the UAV are updated based on the step size.Significant differences in the search step size before and after may lead to unstable searching.The step size is too small in the later stage, which greatly reduces the search speed and may even prevent the beetle from reaching the target position.In response to this issue, this paper proposes a search strategy that interacts with fixed and variable step sizes, as shown in Equation (20):  (20) where, δ 0 is the initial step size, δ t and δ t+1 are the step sizes of the beetle at positions X t and X t+1 , d min represents the minimum safe distance between the UAV and the obstacle, and d t,d is the distance between the UAV and the obstacle.D location represents the position of the obstacle, and O λd min represents the area where danger exists.The range of the O λd min area is a forward hemisphere with the current position of the beetle as the center and a radius of λd min .D location / ∈ O λd min represents that there is no obstacle in the O λd min area.Otherwise, D location ∈ O λd min represents the existence of an obstacle in the O λd min area.According to the above equation, when the UAV is in the area without any obstacles, that is, far away from the obstacles, the current position of the UAV is relatively safe, and the UAV maintains its initial step size to search for the waypoint.When there are obstacles within range O λd min of the UAV, which means the UAV is closer to the obstacle and there is a risk of flight.To ensure the flight safety of the UAV, it is necessary to reduce the search step size and search with a variable step size.The closer the UAV is to the obstacle, the more dangerous it is.Therefore, the search step size decreases as the distance between the UAV and the obstacle decreases, the closer the UAV is to an obstacle, the smaller the search step size, ensuring the safety of the UAV's flight.
The original BAS algorithm updates the sensing length of the beetle's antennae similarly to the update method of the search step size, as shown in Equation ( 21), which gradually decreases with the number of updates to the position.In the early stage of the search, the antennae use a longer sensing length to expand the search range, while in the later stage, a smaller sensing length is used to improve the search accuracy.However, considering the actual situation of UAV path planning, if the sensing length is too small, it will limit the search range and reduce the accuracy of the search.When solving the problem of UAV path planning, the updating method of the sensing length of antennae, like the updating method of the search step size, will reduce the search speed.Therefore, updating the sensing length of antennae in this paper is the same as the update method of the search step size mentioned above, which is determined based on the distance between the UAV and the obstacle, using alternating search with fixed sensing length and reduced sensing length.When no obstacles are detected in the area, exploring with a longer sensing length can accelerate the search speed.The closer the obstacle is, the more dangerous it becomes.Therefore, when there are obstacles in the area, the length of the antennae sensing needs to be reduced, based on the distance between the UAV and the obstacle.Therefore, the update of antennae sensing length is shown in Equation (22): where, d t and d t+1 are the step sizes of the beetle at positions X t and X t+1 .The Beetle Antennae Search Simulated Annealing algorithm is given in Algorithm 1.
The initial search direction of the BAS algorithm is randomly generated, leading to a relatively haphazard search with low accuracy.The concentration difference between its two antennae determines the beetle's position update, resulting in high limitations and low accuracy, making it susceptible to getting trapped in local optimal positions.Both search step size and antennae sensing length gradually decrease, which makes the search speed fast and low accuracy in the early stage, and slow and high accuracy in the later stage.Addressing the issues with the BAS algorithm, the SABAS algorithm sets the search direction as the direction from the starting point to the destination, to enhance search accuracy.Moreover, to prevent falling into local optima, the process of updating positions incorporates the SA algorithm, which can introduce neighboring solutions to expand the search range.The Metropolis criterion of the SA algorithm is used to determine whether the updated position meets the conditions for movement, avoiding the beetle from advancing mindlessly.In areas far from obstacles, a larger step size and antennae sensing length are used for search.In areas close to obstacles, a gradually decreasing variable step size and antennae sensing length are employed for search.This method of using variable step size and antennae sensing length for search ensures accuracy and speed in the search process.Therefore, the SABAS algorithm can meet logistics UAVs' requirements for real-time path planning in low-altitude urban environments.increasing the UAV energy consumption and threatening flight safety.In order to make the flight path smoother, more studies will smooth the path after algorithm planning.But this method is only suitable for offline path planning and vastly reduces planning efficiency.Table 1 shows the data of the path results planned by the SABAS algorithm and BAS algorithm for the three scenarios, respectively.The difference between the flight waypoints planned by the two algorithms is the most noticeable.Among them, the BAS algorithm searched 1.7 times more waypoints than the SABAS algorithm in the obstaclesparse environment, 1.35 times more in the obstacle-moderate environment, and 1.23 times more in the obstacle-dense environment.The SABAS algorithm searched 127 waypoints in the obstacle-dense environment, 26 more than in the obstacle-moderate environment and 41 more than in the obstacle-sparse environment.The BAS algorithm searched 157 waypoints in the obstacle-dense environment, 5 more than in the obstacle-moderate and 10 more than in the obstacle-sparse environment.It can be concluded that the waypoints planned by the SABAS algorithm have advantages over those planned by the BAS algorithm in all three scenarios.Among them, the number of waypoints that need to be searched has a more obvious advantage in obstacle-sparse environments.That is because the search step size of the BAS algorithm gradually decreases, resulting in smaller step sizes for subsequent searches.Therefore, in all three scenarios, there are more waypoints to search for and the difference is relatively small.In contrast, the search step size of the SABAS algorithm is updated based on the distance between the UAV and obstacles, searching for waypoints with a longer step size in areas far from obstacles, resulting in fewer waypoints that need to be searched compared to the BAS algorithm.Meanwhile, the search step needs to be reduced close to the obstacle, so the number of waypoints to be searched by the SABAS algorithm in the obstacle-dense environment increases more than that in the obstaclesparse environment.In addition, in the obstacle-sparse environment, the path length planned by the SABAS algorithm is 33 m less than that planned by the BAS algorithm.In the obstacle-moderate environment, the path length planned by the SABAS algorithm is 41 m less than that planned by the BAS algorithm.In the obstacle-dense environment, the path length planned by the SABAS algorithm is 46 m less than that planned by the BAS algorithm.As a result, the paths obtained by the SABAS algorithm are significantly better than the BAS algorithm in terms of path length in both environments, and the advantage is more evident in the obstacle-dense environment.That is because the BAS algorithm only updates the position based on the concentration of left and right antennae, resulting in relatively random and low-accuracy searches.Furthermore, moving with a larger step size in the front leads to inaccurate search and deviation from the optimal route, which increases the path length and cannot better avoid obstacles; moving in smaller steps later slows down the search speed.The SABAS algorithm sets the initial search direction as the direction from the starting point to the endpoint, ensuring that the UAV is searching toward the endpoint, improving the accuracy of the search.The SA algorithm is combined with the BAS algorithm to update the waypoints, expanding the search range of each waypoint to avoid falling into the local optimal waypoints in updating the waypoint process.Moreover, the effectiveness of the next waypoint is evaluated based on Metropolis criteria, effectively avoiding the blind advance of UAVs.The search step size and the sensing length of antennae are updated according to the distance between the beetle and the obstacle, and the speed of search is improved by moving with a fixed step size within a safe range from the obstacle, while moving with a smaller step size in the place of the obstacle improves the real-time performance of path planning and the accuracy of the search.It can be obtained that, compared with the original algorithm, the SABAS algorithm is more adaptable to environments with different obstacle complexities, and the more prominent the advantage is in complex urban environments.
From the above analysis, the path planned by the algorithm in this paper is smoother.It has advantages over the BAS algorithm in terms of path length and waypoints, which can meet the needs of logistics UAVs for real-time path planning at low altitudes in cities.

Conclusions
A modified path planning method SABAS algorithm is proposed, which combines the BAS with SA, to address the issue of poor real-time performance in path planning algorithms for urban low-altitude logistics UAVs.This algorithm is designed with a fitness function, which considers safety obstacle avoidance and the shortest path requirement, effectively meeting the demands of real-time path planning.The method of determining the initial direction in the BAS algorithm is improved, enabling the search step length and antennae sensing length to be updated in real time based on the distance between the UAV and obstacles.This enhancement significantly enhances the safety and real-time performance of the search process.Integrating the SA algorithm into the BAS algorithm for waypoint updates, the process is prevented from becoming trapped in the local optimal waypoint.Moreover, utilizing the Metropolis criterion to evaluate the next waypoint, the accuracy of the search is improved.From the simulation results, in the three complex urban environments with sparse, medium, and dense obstacles, the path length planned by the SABAS algorithm is reduced by 33 m, 41 m, and 46 m than that planned by the BAS algorithm, respectively, and the waypoints searched by the SABAS algorithm are reduced by 61, 40 and 30 more than that searched by the BAS algorithm, respectively.Comparing the simulation results, it is evident that the SABAS algorithm exhibits greater versatility in low-altitude urban environments.It is capable of generating safe obstacle avoidance and smooth paths.The planned paths of the SABAS algorithm outperform the BAS algorithm in terms of both waypoints and path length.As a result, the SABAS algorithm can effectively achieve real-time path planning for urban low-altitude logistics UAVs.

Sensors 2023 , 11 Figure 1 .
Figure 1.Three-dimensional map of path in the obstacle-sparse environment.

Figure 2 .
Figure 2. Top view of the path in the obstacle-sparse environment.

Figure 1 .
Figure 1.Three-dimensional map of path in the obstacle-sparse environment.

Figure 1 .
Figure 1.Three-dimensional map of path in the obstacle-sparse environment.

Figure 2 .
Figure 2. Top view of the path in the obstacle-sparse environment.Figure 2. Top view of the path in the obstacle-sparse environment.

Figure 2 .
Figure 2. Top view of the path in the obstacle-sparse environment.Figure 2. Top view of the path in the obstacle-sparse environment.

Figure 3 .
Figure 3. Three-dimensional map of path in the obstacle-moderate environment.

Figure 4 .
Figure 4. Top view of the path in the obstacle-moderate environment.

Figure 3 .
Figure 3. Three-dimensional map of path in the obstacle-moderate environment.

Figure 3 .
Figure 3. Three-dimensional map of path in the obstacle-moderate environment.

Figure 4 .
Figure 4. Top view of the path in the obstacle-moderate environment.Figure 4. Top view of the path in the obstacle-moderate environment.

Figure 4 .
Figure 4. Top view of the path in the obstacle-moderate environment.Figure 4. Top view of the path in the obstacle-moderate environment.

Figure 5 .
Figure 5. Three-dimensional map of path planning in the obstacle-dense environment.

Figure 6 .
Figure 6.Top view of path planning in the obstacle-dense environment.

Figure 5 .
Figure 5. Three-dimensional map of path planning in the obstacle-dense environment.

Figure 5 .
Figure 5. Three-dimensional map of path planning in the obstacle-dense environment.

Figure 6 .
Figure 6.Top view of path planning in the obstacle-dense environment.Figure 6. Top view of path planning in the obstacle-dense environment.

Figure 6 .
Figure 6.Top view of path planning in the obstacle-dense environment.Figure 6. Top view of path planning in the obstacle-dense environment.

Table 1 .
Path Planning Result Data Table.