Abstract
This research proposes a multifaceted approach of three-dimensional trajectory planning based on the combination of Rapidly-exploring Random Tree–Connect algorithm and artificial potential field method to improve the path search ability and dynamic obstacles avoidance capability of unmanned aerial vehicles. Firstly, an improved method of the target gravity is developed by controlling the sampling range to reduce invalid sampling and speed up the convergence speed of the algorithm so as to lessen the restriction of low efficiency and random sampling of the Rapidly-exploring Random Tree–Connect algorithm. Moreover, the regulation factor is introduced into the artificial potential field method to deal with the problem of target unreachable in the trajectory planning. Then the improved Rapidly-exploring Random Tree–Connect algorithm is implemented to plan the global path in a complex environment. This step is carried out via selecting the local target point on the global path found in the global plan, dividing the complex environment into simple environment and utilizing the artificial potential field method to achieve the effect of avoiding unknown dynamic obstacles in the simple environment. Finally, cubic B-spline is employed to smoothing of the planned trajectory. The simulation results demonstrate that the combination of two improved algorithms improves the path search ability and dynamic barrier avoidance capability of the unmanned aerial vehicles.
Introduction
Unmanned aerial vehicles (UAVs) have several advantages such as the advancement of small volume, cost efficiency, low requirements for combat environment and precise battlefield survivability. Thus, UAVs plays an irreplaceable role in executing tasks in high-risk environments.
Path planning for UAVs is to find the optimal or suboptimal path under certain constraints. Trajectory planning is one of the key issues in UAVs mission planning. 1 Conventional path planning methods include, but are not limited to, genetic algorithm, 2 fuzzy rule method, 3 artificial neural network, 4 simulated annealing algorithm, 5 ant colony optimization algorithm, 6 and particle swarm optimization algorithm. 7 Although these methods have certain advantages in solving general path planning problems, they have several deficiencies associated with applying to nonholonomic constraint planning problems. These methods need to model obstacles in a certain space, 8 while Rapidly-exploring Random Tree (RRT) algorithm 9,10 tends to expand to open unexplored areas. As long as the time is long enough and the number of iterations is large enough, there will be no unexplored areas. RRT algorithm is widely used in path planning. RRT algorithm does not need to model the space and has fast search speed. It is suitable for solving the path planning problem of UAVs in high-dimensional space and complex environment. However, the search space based on RRT is blind and the node expansion link lacks memory. A number of studies suggested application of RRT-Connect algorithm 11 –13 to improve the search efficiency in the space. RRT-Connect algorithm is a motion planning algorithm based on sampling. It adds the guidance strategy of two tree two-way search on the basis of RRT algorithm, and adds the greedy strategy on the basis of growth mode, which substantially improves the search speed and efficiency of RRT-Connect algorithm compared with RRT algorithm. However, RRT-Connect algorithm has some drawbacks partly due to the randomness of RRT-Connect algorithm. For example, instability, that is, repeated planning for the same task will lead to different paths. There is no directionality and the convergence speed is slow.
The artificial potential field method can be used to solve the local path planning problem because of its simple principle and fast path planning speed. 14 However, it is easy to fall into the local minimum during path planning, resulting in oscillation or flight termination. 15,16 In the potential field method, the potential function carries the information of obstacles and targets. If such information can be transmitted to RRT-Connect, the RRT-Connect algorithm would tend to move forward along the direction of the potential field when exploring the space. At the same time, the excellent exploration ability of RRT-Connect can just make up for the disadvantage that the potential field method is easy to fall into local minima. To the above end, the intent of this research was to develop an improved algorithm combining RRT-Connect algorithm and artificial potential field method for path planning. This framework was established based on hierarchical idea, 17 which was the novelty of this research, to mitigate complexity of the environment. The path planning of UAVs is divided into two layers: upper and lower layers. The upper layer carries out global path planning and uses RRT connect algorithm to identify a global path. The lower layer carries out local path planning for dynamic obstacles in the environment on the global path planned by the upper layer, and this layer employs the artificial potential field method to optimize the local path.
The specific contributions of this research are: Hierarchical planning method is proposed for path planning method of UAVs in complex three-dimensional space. RRT-Connect algorithm and artificial potential field method are combined to plan the path in complex environment so as to improve the path search ability and dynamic obstacle avoidance ability of UAVs. RRT-Connect algorithm and artificial potential field are also improved to achieve appropriate planning effects.
The overall structure of this article is as follows: In introduction, the relevant algorithms, research novelty, main contributions, and the overall structure of the article is introduced. The first section describes the related work. The second section proposes the problem and establishes following models. The third section introduces the method used in global path planning and its improvement. The fourth section introduces the methods used in local path planning and the improvement of this method. In the fifth section, the two improved algorithms are combined with the idea of hierarchical programming. The sixth section gives the mathematical basis for the convergence analysis of the combined algorithm. The experimental results are given in the seventh section. Finally, the conclusion and discussion are summarized in the eighth section.
Related work
In the past decade, many researchers have explored trajectory planning. The main related works in this field are listed below.
Hebecker et al. 18 discretized the field of view of UAV sensor into grid map, and then used wavefront algorithm to realize local three-dimensional path planning based on the distribution of obstacles in grid map. Li et al. 19 proposed an adaptive particle swarm optimization algorithm with different learning strategies for finding the optimal path of mobile robot in complex environment. The search strategy is adjusted at different stages of the search process, which improves the search ability of particle swarm optimization algorithm. Radmanesh et al. 20 proposed that the algorithm of UAV autonomous track needs to obtain accurate information about the environmental state. Therefore, a UAV trajectory optimization algorithm based on wolf swarm algorithm is designed, an efficient Bayesian form is used, and the unit weighting concept based on distance value function is used to achieve good results. Steiner et al. 21 proposed a reactive obstacle avoidance path planning method for UAV based on open sector, which designed a series of avoidance rules according to the two-dimensional scanning information of airborne lidar and the short-term memory information of UAV’s past maneuver behavior. Wei Nianwei et al. 22 designed DP algorithm to extract the key nodes of the initial trajectory generated by PRM algorithm, and then smoothed it with clothoid curve to achieve the purpose of path planning. Lindqvist et al. 23 used the nonlinear model predictive control method to directly generate the control input to avoid maneuver. Wu et al. 24 combined the potential field class path planning method with the receding horizon control (RHC) strategy to online optimize the parameters of the potential field class method through the RHC strategy to deal with the complex and changeable obstacle environment. Hu Qiang et al. 25 combined the dubins curve with A* algorithm and considered the angle constraint of the autonomous underwater vehicle (AUV) to apply it to path planning. Li Shichang 17 proposed a path planning algorithm based on A* and artificial potential field method according to the flight characteristics of four rotor UAV and the demand of avoiding obstacles in real time. We take inspiration from Li Shichang 17 and introduce the idea of hierarchical planning for trajectory planning in complex environment, and realize the global path planning based on RRT connect algorithm. We also improve the force field function for the local minimum problem of the artificial potential field method, and realize the local path planning based on the artificial potential field method.
Problem and modeling
The following models are established for the kinematics of UAVs, the constraints of UAVs and dynamic obstacles, and the constraints of UAVs and the local target points.
Kinematics constraints of UAVs
During the flight, the kinematics equation of a UAV can be expressed as
where vt
is the movement speed of the UAV at
Let Gt
be the position coordinate of the UAV at t;
where
Distance constraints between UAVs and dynamic obstacles
To safely fly to the target location, the UAV needs to maintain a proper safe distance from dynamic obstacles. Suppose that at time t, the coordinate point of the UAV is
where
Distance constraints between UAVs and local target point
In the local trajectory planning of the UAV, the distance between the UAV and the local target point needs to be considered. The local target points selected in this research are all nodes of the optimal path found in the global plan. When the UAV is between the first node and the second node, the second node is selected as the local target point; when the UAV is between the second node and the third node, the third node is selected as the local target point; in the same way, select the fourth node, the fifth node,…, the last node as the local target point respectively. Since the local target point is determined by the current position of the UAV, the distance between the UAV and the local target point is assumed to be
where
When the UAV flies near the local target position, the selection of the local target point is easy to be confused thereby reset the constraint distance between the UAV and the local target point. Take the current local target point as the center and make a circle with a radius of r, where r is infinitesimal. When the UAV is in the circle, the current local target point is selected as the target point, otherwise the next node is selected as the local target point.
Global path planning based on RRT-Connect algorithm
Basic RRT-Connect algorithm principle
The RRT-Connect algorithm 26 first initializes two trees T 1 and T 2. T 1 and T 2 respectively expand toward each other until the two trees meet, even if they successfully find a trajectory; but if they do not meet after reaching the set number of N iterations, it is judged that the path planning has failed. The algorithm flow chart is shown in Figure 1.

The flowchart of RRT-Connect algorithm.
Improved RRT-Connect algorithm design
The basic RRT-Connect algorithm is improved 27 for reducing excessive exploration of useless space and reduce planning time.
In the selection of random tree nodes
In order to obtain the optimal trajectory, the idea of target attraction is introduced in the selection of
where
After adding the target gravitational function in the basic RRT algorithm, the selection of

The principle of improve RRT-Connect.
When the distance between
Since the UAV has a maximum speed
where t is the time it takes for the UAV to move from the current node to the next node. Since the UAV’s trajectory planning has the constraints of the maximum pitch angle
Local path planning based on artificial potential field method
The basic principle of traditional artificial potential field method
The traditional artificial potential field (TAPF) assumes that the UAV moves under a virtual force field; obstacles repel the UAV, and the target point generates gravitation on the UAV, and the combined force of the gravitational and repulsive forces guides the UAV forward and avoids obstacles in the environment. 28
Gravitational potential field function
In the formula,
Assuming that the UAV is moving in a three-dimensional space, let
The gravitational direction angle

The UAV under the artificial potential field method is being sought.
Repulsion potential field function
In the formula,
The repulsive force direction angle
Resultant force field
The direction angle
Improved artificial potential field method
In order to solve the problem of unreachable target, the repulsion potential field function is improved 29,30
This repulsive force field function introduces an adjustment factor. When the target and obstacles are close to each other, it can avoid the situation that the repulsive force is too large to bypass the target. This article will use an improved repulsive force field function. 31 The repulsion function is as follows
It can be found that there are

The UAV under improving artificial potential field methods is being sought.
The combined repulsion force is the sum of the repulsion forces of all obstacles in the environment
where n is the number of obstacles in the environment. As shown in Figure 4, the resultant force received by the UAV in the entire potential field is
Hierarchical planning approach
As far as the function of UAV avoiding dynamic obstacles in complex environments, 32 the artificial potential field method is widely used. 33,34 However, considering advantages of artificial potential field for local path planning in a simple environment, this article adopts the hierarchical idea for path planning.
The upper layer uses the RRT-Connect algorithm to plan the global path; then on the found global path, the artificial potential field method is used to plan the lower layer local path.
After finding a better global path with the RRT-Connect algorithm, the path node is regarded as the center coordinate, and a safe area for drone flight is established around it. As shown in Figure 5, the dots in the figure are the planned trajectory nodes, the dotted line is a circle drawn with the path node as the center and the safety distance

The flight safety zone of the UAV.
However, the generated trajectory at this time is a polyline. Ultimately, the last step is to perform cubic B-spline fitting smoothing 35 processing on the trajectory
where P is the current trajectory point
The flow chart of the implementation steps of the trajectory planning method is shown in Figure 6. In the figure, the included angle a is the included angle between

Trail planning flowchart.
The pseudo code of the whole algorithm is shown in Table 1.
The pseudo code of the algorithm.
Theoretical analysis of combination algorithm
In any state space, if an algorithm can converge to the feasible solution, it is said that the algorithm has probability completeness, and if it can find the optimal solution in finite iterations, it is said that the algorithm has asymptotic optimality. This section provides the mathematical basis for the convergence proof of the proposed combination algorithm. 36,37
Probabilistic completeness
The definition of probabilistic completeness is that if an algorithm has probabilistic completeness, there is
for any path planning problem
Through the analysis of the combined algorithm, it can be obtained that for any path planning problem
In other words, when
Asymptotic optimality
Let
The definition of asymptotic optimality is that if an algorithm has asymptotic optimality, there is an optimal solution for any path planning problem
For
Fast convergence to the optimal path
Given a random node
Simulation results and analysis
Hierarchical planning experiment
The processor of the hardware platform used in the simulation experiment is Intel(R) Core(TM) i7-6700HQ CPU @ 2.60 GHz, the memory is 8 GB; the analysis software is Matlab 2020b.
In the environment of

Effect diagram comparison. (a) Effect diagram of basic RRT-Connect algorithm planning and (b) effect diagram of improved RRT-Connect algorithm planning.
Comparing the graph in Figure 7, it can be clearly seen that the improved RRT-Connect algorithm reduces the useless search in the blank area compared to the original algorithm. The red line segment in Figure 7 is the path of useless search.
Due to the randomness of the RRT-Connect algorithm, 50 simulation experiments were carried out in this environment. Compare the average running time of the original RRT-Connect algorithm and the improved RRT-Connect algorithm, the average number of nodes explored each time, and the average number of path nodes. The results are shown in Table 2.
The algorithm compares the indicators.a
a ART is average running time, ANNEET is average number of nodes explored each time, and ANPN is average number of path nodes in the table, respectively.
According to the results in Table 2, the improved algorithm reduces the average number of exploration nodes by about 52%, effectively reduces invalid sampling, and shortens the average running time by about 20%, speeds up the search speed.
Our results indicated that UAV can reach the desired target location when the RRT-Connect algorithm has employed for planning a global path. Moreover, we proposed the artificial potential field technique for aiming at the dynamic obstacles encountered during the flight of the UAV. Each pair of adjacent nodes in the global path is locally planned to ensure the safety of the UAV flight.
Carry out 50 simulation experiments in the environment of
The local path node.
The starting point coordinates is

Simulation results for the first four nodes. (a) First node, (b) second node, (c) third node, and (d) fourth node.
Figure 8‘s
Figure 9 shows the trajectory planning simulation through combining the two algorithms. The blue line is the trajectory planned by the combination of RRT-Connect and the artificial potential field; the red line is the trajectory smoothed by the cubic B-spline fitting of the combined algorithm; the dots are the dynamic obstacles. The Figure 9 illustrate that the path planned by the combined algorithm is a polyline and is not smooth; after cubic B-spline fitting, the trajectory is very smooth, and it has a high degree of fit with the original trajectory.

The results of trajectory planning simulation. (a) 3D trajectory and (b) trajectory on X–Y plane.
Figure 10 shows the cost of each iteration of the best path, where the cost function is set to the time of each iteration. It can be seen from the figure that for this specific scenario, after thousands of iterations, the time cost of the best path of the combined algorithm decreases significantly, and finally converges to the best cost, which is about 15. According to the time cost convergence of the best path in the figure, it can be concluded that the combined algorithm improves the search speed of the path.

The cost of the best paths in the combined algorithm.
Figure 11 shows the curvature of the track. It can be seen from the Figure 10 that the curvature value of the whole track is continuous, and when encountering obstacles, the UAV will bypass in order to avoid obstacles. At this time, the curvature of the track will suddenly change, as shown in the sharp point in the figure. Therefore, through the continuity and change of the curvature value of the track, it can be concluded that the proposed method can effectively avoid static and dynamic obstacles. At present, the research on avoiding static obstacles has been very mature, so avoiding dynamic obstacles is the focus and difficulty of the current research. It can be clearly seen in Figure 11 that the curvature of avoiding dynamic obstacles and avoiding static obstacles is continuous and changes reasonably. Therefore, the ability to avoid dynamic obstacles is proved.

Curvature of track.
Table 4 shows the curvature of the cusps in the curvature graph. The curvature of cusps 2, 3, and 6 in the table is larger than that of other cusps. Because the corresponding path avoids dynamic obstacles and the dynamic obstacles are very close to the global planning path, the turning radius of UAV is small, so the curvature of planning path is large. The curvatures of cusps 1, 4, 5, 7, 8, 9, and 10 in the table are small. The obstacles avoided at the path corresponding to these curvatures are static obstacles or dynamic obstacles at a certain distance from the global path, which makes the turning radius of UAV larger and the curvature of the planned path smaller. In the experimental design, the volume of static obstacles is much larger than that of dynamic obstacles, so the turning radius of UAV when avoiding static obstacles is larger than that when avoiding dynamic obstacles. The path without avoiding obstacles has a curvature of 0 and moves along a straight line.
Curvature value of track.
Comparative experiment
This research also scrutinized difference between combined algorithm and the improved RRT-Connect algorithm to reveal the effectiveness of the algorithm. Due to the randomness of RRT-Connect algorithm, under the same obstacle environment, take

Optimal four times simulation results. (a) Simulation result 1, (b) simulation result 2, (c) simulation result 3, and (d) simulation result 4.
The simulation results of these four times (Figure 12) are compared with the simulation results of the combined algorithm (Figure 9). The careful comparison showed that it can be seen the path planned with the combined algorithm was more reasonable and optimized.
Table 5 show the path length, algorithm calculation time and response time of the algorithm when the environment changes (dynamic obstacles) and the average cost of the path of these four simulation results and combined algorithm simulation results.
The performance of the combined algorithm is compared with the improved RRT-Connect algorithm.a
a PL is the path length, ACT is the algorithm computation time, RT is the algorithm’s reaction time, and PC is the average cost of the path.
The path planning time of the combined algorithm includes global path planning time, local path planning time, and path smoothing time. The simulation results showed that the shortest calculation time of the four paths planned by the improved RRT-Connect algorithm was 0.05256s. The calculation time of the combined algorithm was shortened by about 6%, and from the average cost value of the path in the table, it can be seen that the cost value of the improved RRT-Connect algorithm is more than twice that of the combined algorithm. Therefore, our findings suggested that the combined algorithm improved the speed of path planning.
In terms of the length of the planned path, the length of the four paths planned by the improved RRT-Connect algorithm was 170.10, 183.89, 202.72, and 179.95 m, respectively. However, these four paths were not the best in comparison with the path length planned by the combined algorithm. Moreover, the path planned by the combined algorithm was more appropriate compared to the improved RRT-Connect algorithm.
The ability to avoid dynamic obstacles is the ability of the algorithm to adjust the path in time according to the changes of the surrounding environment. In the main, the shorter the calculation time of the algorithm could result in the stronger the obstacle avoidance ability. When the surrounding environment changes, the improved RRT-Connect algorithm needs to be re-planed the path according to the global environment, so the response time of the algorithm to the environment change is the time of path planning. For the combined algorithm, since the actual path planning is carried out by the artificial potential field method, the response time to environmental changes is the time of path planning by the artificial potential field method. The time of local path planning by the artificial potential field method is very short, only 0.02458s as shown in Table 5 Therefore, the combined algorithm can act precisely and smartly avoiding dynamic obstacles in comparison with is more precise than the improved RRT-Connect algorithm.
The findings of this research demonstrated that, the proposed combined algorithm yielded promising in the speed, length, and real-time of path planning. The combined algorithm can carry out efficiently global path planning and avoid dynamic obstacles. Therefore, this algorithm can be used in Multirotor UAV path planning.
Conclusion
The improved RRT-Connect algorithm proposed in this article can quickly expand toward the target point when trajectory planning in a space with no obstacles. When trajectory planning in a space with obstacles, by controlling the sampling range, after introducing the target gravity, it can also expand to the target point faster. The improved artificial potential field method proposed in this article can effectively avoid dynamic obstacles in the simple environment after dividing the complex environment of
This article mainly studies the avoidance of UAVs from dynamic and static obstacles in the environment and the reasonable route planning. Because UAVs has the ability of three-dimensional space movement, mobile robots with three-dimensional space movement ability, such as unmanned airship and unmanned underwater robot, can use this structure to deal with the problem of path planning. Robots with two-dimensional space motion ability, such as unmanned ship and unmanned vehicle, can be used after dimensionality reduction of the algorithm and model in this article.
Footnotes
Acknowledgments
The authors would like to thank Dr. Amir Reza Shahtahmassebi and the anonymous reviewers for their helpful suggestions.
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work is supported by Sichuan Science and Technology Program (No. 2020YJ0368), Zigong Science and Technology Program (No. 2019YYJC03), Graduate innovation fund project of Sichuan University of Science & Engineering (No. y2021066), Opening Project of Sichuan Province University Key Laboratory of Bridge Non-destruction Detecting and Engineering Computing (No. 2021QZJ01).
