3D trajectory planning based on the Rapidly-exploring Random Tree–Connect and artificial potential fields method for unmanned aerial vehicles

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 highdimensional 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][12][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: 1. Hierarchical planning method is proposed for path planning method of UAVs in complex threedimensional space. 2. 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. 3. 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 v t is the movement speed of the UAV at t À 1*t; DT is the time interval at t À 1*t; q t is the pitch angle of the UAV's movement direction at t À 1*t; t is the yaw angle of the UAV's movement direction at t À 1*t. Let G t be the position coordinate of the UAV at t; G tÀ1 be the position coordinate of the UAV at t À 1 where v max is the maximum flight speed of the UAV; q max is the maximum pitch angle; max is the maximum yaw angle.

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 X ðtÞ, and the coordinate point of the kth dynamic obstacle is X k ðtÞ, then the coordinates between the UAV and the dynamic obstacle must satisfy the following relationship where jjX ðtÞÀX k ðtÞjj is the Euclidean distance between the UAV and the kth dynamic obstacle, and d min is the safety distance.

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 d ij , where i ¼ 1; 2; . . . ; n À 1; j ¼ i þ 1, n is the number of nodes in the global path. For example, when, i ¼ 3; j ¼ 4, the fourth node of the global path is selected as the local target point, and the distance between the UAV and the local target point is d 34 . Therefore, the distance constraint between the UAV and the local target point should satisfy where jjX j À X i jj represents the Euclidean distance from the j node to i node. 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.

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.

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 b rand , the attraction of target points is introduced, and the range of random tree node selection is controlled within the rectangular range of the UAV position and the target position as diagonal points, in order to prevent the obstacle range between the two from exceeding the rectangular range, making it impossible to plan a suitable trajectory, and an expandable margin r is set for the range In order to obtain the optimal trajectory, the idea of target attraction is introduced in the selection of b new , and the selection of b new is determined as where l 1 is the step length of the random tree expansion in the direction of any point, l 2 is the step length of the random tree expansion in the direction of the target point, jb goal Àb nearest j is the Euclidean distance between the target point b goal and the growth point b nearest (the closest point in the tree), when the tree grows, b goal ¼ b init . After adding the target gravitational function in the basic RRT algorithm, the selection of b new is inclined to b goal . When l 1 is larger, the randomness of b new is stronger, when l 2 is larger, the deviation of b new to the target is stronger. The construction process is shown in Figure 2.
When the distance between b new and b 0 new of the two trees T 1 ; T 2 is less than the minimum growth step length minfl 1 ; l 2 g, the exploration of the new node is ended, and the shortest path is recorded as the desired trajectory.
Since the UAV has a maximum speed v max constraint, there are corresponding constraints on the step length of the random tree expansion 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 q max and the maximum yaw angle max , if the selected angle between b new and b nearest and b nearest and the previous node is greater than the maximum yaw angle max in the horizontal plane or greater than the maximum pitch angle q max in the vertical plane, the b rand is reselected.

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 jjU ! att jj ¼ In the formula, K att represents the gravitational gain constant, dðP; P goal Þ represents the distance between the current position of the UAV and the target point.
Assuming that the UAV is moving in a threedimensional space, let P ¼ ðx; y; zÞ be the coordinates of the current position,P goal ¼ ðx goal ; y goal ; z goal Þ be the coordinates of the target point. Gravity is the negative gradient of the gravitational potential field The gravitational direction angle q att is the angle between the straight line pointing from the current position of the UAV to the target point and the horizontal straight line to the right, as shown in Figure 3.
Repulsion potential field function In the formula, K rep represents the repulsion gain constant; k represents the kth obstacle; d o represents the effective range radius of the obstacle; dðP; P o k Þ represents the distance between the drone and the kth obstacle, and The repulsion is the negative gradient of the repulsion potential field The repulsive force direction angle q rep is the angle between the straight line pointing from the obstacle point to the current position of the UAV and the horizontal right straight line, as shown in Figure 3.
Resultant force field The direction angle q of the resultant force is shown in Figure 3.

Improved artificial potential field method
In order to solve the problem of unreachable target, the repulsion potential field function is improved 29,30 jj U ! rep k jj ¼ 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 dðP; P goal Þ and dðP; P o k Þ two variables in the repulsion potential field, so the repulsion is composed of two components F ! ½1 rep k and F ! ½2 rep k . The angles of the two components are different. As shown in Figure 4, the direction angle q ½1 rep k of the component F

! ½1
rep k is the angle between the straight line from the drone pointing to the target point and the straight line horizontal to the right, while the direction angle q ½2 rep k of the component F ! ½2 rep k is the angle between the straight line pointing from the obstacle to the UAV and the horizontal straight line to the right.
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 F ! .

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 d min as the radius. l is half of the minimum step Once the dynamic obstacle appears in the red line area in Figure 5, an artificial potential field is established for the dynamic obstacle. Then according to the assumptions in Distance constraints between UAVs and local target point, the appropriate local target points are determined, and the local path planning is carried out.
However, the generated trajectory at this time is a polyline. Ultimately, the last step is to perform cubic B-spline fitting smoothing 35  rep k θ [ 2] rep k   ðÀ1Þ m m k þ 1 ðt þ k À mÞ k (22) where P is the current trajectory point i ¼ 1; 2; 3 and F i;k ðtÞ is the k-order B-spline basis function, where k ¼ 3 is the factorial. By substituting the trajectory points P 0 ; P 1 ; P 2 ; P 3 , a section of cubic B-spline curve approximated by the four points can be obtained. 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 b new and b nearest , and the included angle a 0 is the included angle between b new and the previous node of b nearest .
The pseudo code of the whole algorithm is shown in Table 1.

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 liminf n!1 Pðf9b goal 2 T ALG n \ X goal such that b trit is connected to b goal in G ALG n gÞ ¼ 1 for any path planning problem ðX f ree ; b trit ; X goal Þ with feasible solution. Where X f ree ¼ X \X obs is the barrier free area; X obs is the obstacle area; X goal is the target area; b trit is the initial position and an element in X f ree ; b goal is the target location. Through the analysis of the combined algorithm, it can be obtained that for any path planning problem ðX f ree ; b trit ; X goal Þ with feasible solution, there is always a constant a > 0; n 0 2 N PðfT n \ X goal 6 ¼ gÞ > 1 À e Àan ; 8n > n 0 : In other words, when n 0 2 N is large enough, 8n > n 0 . Can make 9b goal 2 T n \ X goal , which means b trit can be connected to b goal .

Asymptotic optimality
Let c : P X f ree ! R ! 0 be a function, called cost function, which assigns a nonnegative cost to all collision free paths. The optimality problem of path planning is to find a feasible path with the lowest cost.
The definition of asymptotic optimality is that if an algorithm has asymptotic optimality, there is an optimal solution for any path planning problem ðX f ree ; b trit ; X goal Þ, and its cost function c : P X f ree ! R ! 0 will be equal to a finite path cost, that is s Ã represents an optimal path. For n 2 N , construct a cuboid with sequence fB n g n2N to cover s n , which is recorded as B n ¼ fB n;1 ; B n;2 ; . . . ;B n;M n g :¼ covering Cuboidðs n ; r n Þ, where r n is the diagonal of the cuboid whose current position and target position are the diagonal points respectively For m 2 f1; 2; . . . ; M n g, A n;m event is defined as the existence of two nodes b i ; b i 0 2 T n , where b i 2 B n;m ; b i 0 2 B n;mþ1 and Y i 0 < Y i . In this case, b i and b i 0 will be connected to the boundary of feasible path graph G n .

Fast convergence to the optimal path
Given a random node b rand and the minimum path cost functions s a ½0; s a :¼ The sample insertion process of the combined algorithm can be summarized as fb rand 2 T a : cðs a Þ cðs b Þg or fb rand 2 T b : cðs b Þ < cðs a Þg, that is, the random node b rand is always inserted into the nearest random tree. This measure ensures that the random node b rand is always inserted into the area with high density of adjacent nodes. The combined algorithm inserts nodes into the adjacent areas with high density, so that the reorganized search tree plays the greatest role in each cycle. At the same time, the combined algorithm grows two random trees at the same time, so that the convergence speed of the combined algorithm is much faster than that of RRT.

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 100 Â 100 Â 100 as shown in Figure 7, there are nine sphere obstacles distributed, assuming that the coordinates of the starting point of the drone flight is ð5; 5; 5Þ and the coordinates of the target point is ð95; 95; 95Þ, respectively, the basic RRT-Connect algorithm and the improved RRT-Connect algorithm are used for path planning. The experimental results are as follows: 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.
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 100 Â 100 Â 100, choose the best path in it, and use the nodes of this path as the local target points to plan the local path. There are 12 nodes in this path. The coordinates of the first four nodes are listed here as shown in Table 3.
The starting point coordinates is ð5; 5; 5Þ, the 12 nodes on the global path are respectively used as local target points, and the artificial potential field method is used for local path planning. Figure 8 below is the simulation result of selecting the first four nodes as the local target points: Figure 8's a; b; c; d is a simple environment divided from the complex environment of 100 Â 100 Â 100. It can be seen intuitively from the figure that the artificial potential field method can accurately avoid dynamic obstacles in a simple three-dimensional environment.

18
:   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. 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. 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. 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.

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 ð5; 5; 5Þ as the starting position and ð95; 95; 95Þ as the target position, conduct 50 simulation experiments, and select the best four simulation results, as shown in Figure 12.
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 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 replaned 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  100 Â 100 Â 100. In the end, the combination of the two improved algorithms realizes that the UAV has strong path search capabilities and dynamic obstacle avoidance capabilities at the same time. 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.