The rapid development of UAV technology makes it show great application potential and advantages in the fields of battlefield reconnaissance1, logistics and distribution2, environmental monitoring3and emergency rescue4, especially in military and disaster rescue. UAVs have become an indispensable key tool due to their high efficiency and autonomy. Quad-rotor UAV is suitable for short-range flight and high-timeliness tasks due to its simple structure, strong maneuverability and convenient operation5. However, with the increasingly complex mission environment, existing path planning algorithms6face problems such as too long paths and too many turns, which significantly affect the flight efficiency and resource consumption of UAVs7, making path planning one of the key bottlenecks in UAV applications.

UAV path planning can be regarded as a multi-objective optimization problem, which considers safety8, timeliness, obstacle avoidance, energy consumption9and flight distance in a complex environment10,11while finding the optimal or approximate optimal path. Existing path planning algorithms can be divided into five categories: graph search algorithms, optimization-based algorithms, sampling-based algorithms, local planning algorithms, and deep learning and reinforcement learning algorithms.Graph search algorithms (such as A*12, Dijkstra13, BFS14, and DFS15) rely on node expansion and cost evaluation, often incorporating heuristic functions to guide the search process. These algorithms are suitable for static environments and can find near-optimal global paths. However, when handling large-scale problems, such approaches typically face high computational complexity and may become trapped in local optima. Optimization-based algorithms (such as genetic algorithm16, particle swarm optimization17, ant colony algorithm18) have strong global search ability and adaptability by simulating evolution or swarm cooperation behavior, but their computational overhead is large, and the convergence speed is slow in high-dimensional space, which is easily affected by parameter tuning. Sampling-based algorithms (such as PRM19, RRT20) generate sample points through random or specific rules, which are suitable for the processing of high-dimensional complex environments and can effectively avoid some local optimal problems, but there are still challenges in environment modeling and sample generation. Local planning algorithms (such as the Artificial Potential Field method21, DWA algorithm22) focus on real-time response to dynamic environments and possess high computational efficiency. However, such methods are typically suitable only for local path optimization and may result in local optimal solutions. Deep learning and reinforcement learning algorithms (such as deep Q-learning23and policy gradient methods24) optimize path planning through model learning, and are suitable for high-dimensional and complex dynamic environments. Nevertheless, these methods have high requirements for the quality of training data and computational resources, and the training process is relatively lengthy.

In this context, scholars have proposed various improvement methods. For example, Li et al.25proposed an improved A* algorithm that integrates the dynamics and control characteristics of quadrotor UAVs26,27, designing a new heuristic evaluation function and obstacle penalty mechanism. The improved algorithm is capable of generating paths that align better with the flight characteristics of UAVs. However, this method does not fully account for the impact of environmental changes, which can limit the applicability of path planning results in dynamic environments. Yuan et al.28 proposed a path planning method based on an improved lazy \(\theta\)* algorithm. This method dynamically adjusts the heuristic weights based on the distance between the current node and the target node, effectively balancing search accuracy and speed. Additionally, the algorithm reduces redundant nodes by checking whether obstacles exist between nodes, thus improving search efficiency. Despite using an octree map to reduce the number of search nodes, the algorithm’s computational complexity remains high as the map size increases.Liao et al.29 integrated an adaptive A-star and an improved DWA path planning method, enhancing search efficiency by introducing adaptive weights and removing redundant points. The improved DWA algorithm added functions and optimized the path, making the planning results more reasonable. However, this method also does not consider the avoidance of dynamic obstacles, limiting its application in complex dynamic environments with moving obstacles.

Bionic optimization algorithm has become a popular method in path planning today30,31.Zhou et al.32 proposed a UAV path planning model based on an improved Gray Wolf Optimizer (GWO) algorithm. Compared to the traditional GWO algorithm, the NI-GWO algorithm introduces a nonlinear convergence coefficient mechanism, which enhances the algorithm’s global search capability in the early iteration stages, while improving local search accuracy in the later stages, thus accelerating the convergence process. Lyu et al.33 proposed an improved Dung Beetle Optimization (IDBO) algorithm, which enhances population diversity by initializing the population using cubic chaotic mapping. Additionally, a new global search strategy is introduced to improve information exchange and global search capabilities. By applying adaptive t-distribution disturbances, the algorithm balances exploration and exploitation, enhancing local search ability. However, in certain cases, the algorithm may still fall into local optima. Fan et al.34 proposed an improved North Owl Optimizer (MINGO) algorithm with multi-strategy fusion. The MINGO algorithm integrates Levy flight strategy, Brownian motion strategy, enhanced exploration strategy, and Cauchy mutation strategy, improving the original NGO algorithm in terms of population diversity, exploration efficiency, balance between local and global search, and algorithm stability, thus enhancing its optimization performance. However, compared to other metaheuristic algorithms, MINGO has higher computational complexity and may become a bottleneck when handling large-scale problems. Liu et al.35 proposed a UAV path planning method based on the improved Porcupine Optimization (ICPO) algorithm. This method ensures population diversity through a high-quality point set population initialization strategy, thereby improving the algorithm’s search ability. The ICPO algorithm combines visual and auditory defense mechanisms to balance exploration and development, and helps the algorithm escape from the local optimal solution through a periodic retreat strategy, thereby enhancing the global search capability. However, the parameter setting of the ICPO algorithm mainly relies on experience and experimental adjustment, and lacks theoretical guidance.You et al.36 proposed an improved multi-strategy fusion whale algorithm (IWOA), which effectively balances the relationship between global search and local search through differentiated dynamic weighting in the search strategy. During location updates, the search capabilities are further enhanced by combining dynamic thresholds with an adaptive golden sine strategy. However, the method is computationally inefficient in complex scenarios and does not consider dynamic programming in dynamic environments. He et al.37 proposed an improved chaotic sparrow search algorithm (ICSSA). The algorithm uses piecewise chaotic mapping to initialize the population, improved sine-cosine algorithm to optimize the scavenger update, and dynamic boundary lens imaging reverse learning strategy, which improves the population diversity and global convergence, and effectively avoids falling into the local optimal solution. However, the choice of parameter p has a great influence on population distribution, and this research mainly focuses on global path planning, lacking further discussion on local path planning.Zhou et al.38 proposed the Multi-strategy Improved Snow Avalanching Optimizer (MISAO). Although the MISAO algorithm demonstrates excellent performance in solution accuracy and convergence speed, it still has certain limitations. In terms of time complexity, while it does not significantly increase compared to the original SAO algorithm, it may still be relatively high when dealing with large-scale complex problems.

Deep reinforcement learning has emerged as a frontier technology in the field of modern path planning. Li et al.39 proposed a dynamic value iteration network (DVIN) model based on the value iteration network (VIN). The model is trained using a scenario-based Q-learning algorithm and can generate a state value propagation function based on the connection information of UANET. However, the training time of the model is relatively long, and in practical applications, it is necessary to balance the efficiency of training and deployment.Yin et al.40 proposed the GARTD3 algorithm, which improves the autonomous navigation and obstacle avoidance capabilities of UAVs in complex three-dimensional environments with the help of guided attention mechanism and speed constraint loss function, and its performance is better than other deep reinforcement learning algorithms. However, the algorithm has some shortcomings: it is only suitable for static obstacle environment, and it has poor adaptability to complex situations such as dynamic obstacles, various obstacles and meteorological factors. The practical application effect and safety need to be verified, and due to the characteristics of deep reinforcement learning, the computing resource demand is large, which limits the practical application.The detailed introduction of various cutting-edge methods is shown in Table 1 below.

Although the above research has optimized a variety of algorithms, there are still some common problems, such as many redundant nodes in the path, long planning time in complex environment, and too long path. In addition, these algorithms also face the challenges of computational complexity and dynamic environment, so further improvements are urgently needed to overcome these limitations. Therefore, this paper proposes a dynamic obstacle avoidance algorithm for UAVs that combines adaptive extended neighborhood and inflection point minimization. The main contributions of this paper are as follows.

  • An adaptive extended neighborhood A* algorithm is proposed, which dynamically expands the neighborhood and selects the optimal direction and step size based on the distribution of obstacles around the current position. A bidirectional search mechanism is introduced, starting from both the initial and target points and performing searches toward the opposing current nodes as target points. This approach optimizes the search direction and significantly reduces the search time.

  • A path optimization method based on inflection points is proposed to plan a path with the least inflection points while ensuring path safety.

  • A local tangent circle smoothing algorithm is proposed, which adaptively smooths the path according to the angle at the inflection point of the original path, and only smooths the two sides of the inflection point of the path, so as to keep the optimality of the original path as much as possible.

  • The global optimization path is taken as the guiding trajectory of the improved artificial potential field method, so as to avoid falling into the local optimal solution and realize dynamic obstacle avoidance.

The structure of this paper is arranged as follows: Section 2 introduces the improvement strategy in the initial generation phase of the path. Section 3 elaborates the improvement scheme for the inflection point optimization part. Section 4 presents the optimization strategy for the path smoothing phase. In Section 5, combined with global trajectory optimization, a scheme of fusion improved artificial potential field method for dynamic obstacle avoidance is proposed. Section 6 systematically describes the core content of the MSF-MTPO algorithm through pseudocode and flowcharts. In Section 7, firstly, the static simulation experiments of eight algorithms are compared and analyzed, and then the algorithm in this paper is tested experimentally in dynamic environment. Section 8 summarizes the full text and looks forward to future research directions.

Table 1 Frontier Method Limitations.

Adaptive neighborhood bi-directional A * algorithm

Adaptive neighborhood A* algorithm

The path length planned by the A* algorithm can be expressed as:

$$\begin{aligned} L=\sum _{i=1}^{n} d\left( p_{i}, p_{i+1}\right) \end{aligned}$$
(1)

In the formula, L is the final path length, \(d\left( p_i,p_{i+1}\right)\) is the Euclidean distance from node \(p_{i}\) to node \(p_{i+1}\) and n is the number of nodes on the path.

Under the same heuristic function, the selected optimal nodes will be different due to the different search neighborhoods, which leads to the change of the final path length. Let the search range be R, and the path length is inversely proportional to the search range41, that is:

$$\begin{aligned} & L\propto \frac{1}{R} \end{aligned}$$
(2)

Equation 2 shows that a larger search range corresponds to a larger exploration space, thus having the opportunity to jump out of the local optimum, thus increasing the chance of finding a shorter path. Based on different search neighborhoods, an adaptive A * algorithm for neighborhood expansion is proposed, that is, the algorithm selects the optimal expansion node according to the current distribution state of obstacles. Let the current node coordinate be (xy) and the obstacle be obs, and the extended node constraint is defined on the basis of eight-neighborhood search, as shown in Table 2:

Table 2 Directional Constraints.

Compared with the fixed four-neighborhood or eight-neighborhood, the adaptive neighborhood can dynamically adjust the extended neighborhood of the current point according to the distribution of current environmental obstacles, so as to plan the local optimal path. Under ideal environment, the path length of extended neighborhood search is reduced by 25.46%, 7.38% and 7.38% compared with four neighborhoods, eight neighborhoods and dynamically extended five neighborhoods42, respectively, and the number of inflection points also decreases. The four search neighborhood search paths are shown in the following Figure 1, where the orange square, green square, black square and gray square represent the starting point, end point, obstacle and search area respectively.

Fig. 1
figure 1

Three kinds of neighborhood search paths.

Bidirectional search

In complex environments or when the search space is large, unidirectional search requires traversing a large number of nodes to find the shortest path, especially when the target node is far from the starting point. Unidirectional A* needs to search within a very large space, resulting in high time and space complexity. To improve the search capability of the A* algorithm, this paper adopts a bidirectional search strategy, starting from the original starting point and the endpoint, and using the opposite current node as the target point for searching, thus optimizing the path-finding direction and shortening the search time.

Compared with the one-way A * algorithm, the following points need to be considered:

(1) The algorithm has two heuristic functions: the forward search heuristic function \(h_{start}(p_i)\) , which is used to evaluate the distance from the target node (target) to any node \(p_i\) ; and the reverse search heuristic function \(h_{target}(p_i)\) , which is used to evaluate the distance from the start node (start) to any node \(p_i\) .

(2) Consistency of the heuristic function:\(h_{start}(p_i)+h_{\textrm{target}}(p_i)=C\), where C is the actual minimum cost from the start point to the end point, ensuring that searches in both directions are based on the same estimated shortest path cost.

(3) Average of functions: If \(h_{start}(p_i)\) and \(h_{target}(p_i)\) are inconsistent, the inconsistency can be adjusted by taking the average value to form new heuristic functions \(P_{start}(p_i)\) and \(P_{target}(p_i)\) .

$$\begin{aligned} & p_{start}(p_i)=\frac{1}{2}(h_{start}(p_i)-h_{\textrm{target}}(p_i)) \end{aligned}$$
(3)
$$\begin{aligned} & p_{\textrm{target}}(p_i)=\frac{1}{2}(h_{\textrm{target}}(p_i)-h_{start}(p_i)) \end{aligned}$$
(4)

(4) Search termination condition: When the sum of the estimated distance from the starting node to the top node of the forward queue and the estimated distance from the target node to the top node of the reverse queue is greater than or equal to the known shortest path length of \(\mu\), the algorithm terminates the search. That is,

$$\begin{aligned} & h_{start}(top_{start})+h_{\textrm{target}}(top_{\textrm{target}})\ge \mu \end{aligned}$$
(5)

In the formula, \(h_{start}(top_{start})\)is the estimated distance from the starting node start to the foremost node \(top_{start}\) of the forward queue; \(h_{target}(top_{target})\) is the estimated distance from the target node target to the foremost node \(top_{goal}\) of the reverse queue;\(\mu\) is the shortest path length known. Let p(n) be a point of the final path \(\mu\) between the starting point start and the target point target, then the equation 5 is satisfied.

$$\begin{aligned} & \mu =\min \{d(start,p_i)+d(p_i,\textrm{target})\} \end{aligned}$$
(6)

The final search planning path is shown in Figure 2.

Fig. 2
figure 2

Bidirectional search path.

Inflection point trajectory correction

When generating global paths, global planning algorithms (such as A*, RRT, genetic algorithms, and particle swarm algorithms) often encounter the problem of redundant path turning points, resulting in large path turning angles and a long overall path. Taking the four neighborhoods of the A* algorithm as an example, the planned path is shown in Figure 3 below:

Fig. 3
figure 3

Four-neighborhood search path.

The path generated by the A* algorithm contains five inflection points, as shown in Figure 3. In practical applications, the drone does not need to fly to the inflection point and then to inflection point in sequence, but can fly directly to inflection point because there are no obstacles on the path from the starting point to inflection point . Based on this, this paper proposes an inflection point trajectory correction method so that the planned path has the least number of inflection points. The specific steps are as follows:

Path representation

For the search path \(P=\{p_0,p_1,p_2,...,p_n\}\) , \(p_0\) is the starting point, \(p_n\) is the end point and \(p_i=(x_i,y_i,z_i)\) is the node on the path.

Inflection point calculation

Calculate the direction vector \(\vec {\nu }_i\) of the adjacent point on the path P :

$$\begin{aligned} & \vec {\nu _i}=(x_{i+1}-x_i,y_{i+1}-y_i,z_{i+1}-z_i) \end{aligned}$$
(7)

For adjacent points \(p_i\) and \(p_{i+1}\) , calculate the angle \(\theta _{i}\) between their direction vector and the next direction vector:

$$\begin{aligned} & \theta _i=\arccos (\frac{\overrightarrow{\nu _i}\bullet \overrightarrow{\nu _{i+1}}}{\parallel \overrightarrow{\nu _i}\parallel \bullet \parallel \overrightarrow{\nu _{i+1}}\parallel }) \end{aligned}$$
(8)

In the formula, \(|\vec {\nu }_i|\) represents the magnitude of the i-th direction vector. Set the angle threshold \(\theta _{threshold}\) , if

$$\begin{aligned} & \theta _i>\theta _{threshold} \end{aligned}$$
(9)

Then \(p_i\) is considered to be the inflection point. Calculate each path point and obtain the set of inflection points \(T=\{t_1,t_2,...,t_m\}\).

Inflection point optimization

Add the starting point \(p_0\) and the end point \(p_n\) to the first and last positions of the inflection point set \(P_{new}=\{k_0,k_1,k_2,...,k_{m+1}\}\) respectively to form a new trajectory set.

Gradually connect the points in the set \(P_{new}\) , set the current starting point \(P_{current}=k_0\) , \(i=1\), \(P_{optimize}={k_0}\), check the line segment \(L(P_{current},k_i)\) :

If \(L(P_{current},k_i)\wedge obs=\emptyset\) (that is, the line segment does not pass through the obstacle), then \(i+1\) , \(k_i\) moves to the next point and rechecks whether the new line segment passes through the obstacle. If \(i=m+1\), then finally \(P_{optimize}=\{k_0,k_{m+1}\}\).

If \(L(x_{current},k_i)\wedge obs\ne \emptyset\) (that is, the line segment passes through the obstacle), then go back to the previous turning point, \(P_{current}=k_{i-1}\), \(P_{optimize}=\{P_{optimize},k_{i-1} \}\), and recheck whether the next line segment passes through the obstacle until \(P_{current}=k_{m+1}\) .

The final path can be expressed as the set of all line segments that do not pass through obstacles:

$$\begin{aligned} & P_{optimize}=\bigcup _{j=0}^KL(k_j,k_{j+1}) \end{aligned}$$
(10)

In the formula, \(L(k_j,k_{j+1})\) is the line segment that does not cross obstacles and \(L(k_j,k_{j+1})\wedge obs=\emptyset\), K is the number of optimized line segments. After optimizing the inflection point trajectory of Figure 3, the following Figure 4 is shown:

Fig. 4
figure 4

Trajectory after modification of inflection point.

Local tangential circle smoothing

For the trajectory after correcting the inflection point, because the inflection point is sparse, conventional path smoothing algorithms, such as Bezier curve43 and spline interpolation, may cause the smoothed trajectory to intersect with obstacles. When the number of control points is insufficient, the degree of freedom of Bezier curve is limited, and each control point has a significant global influence on the curve, which leads to the deviation or excessive softening of the path between inflection points, which cannot meet the actual needs. Due to the large spacing between inflection points, spline interpolation may cause high-frequency fluctuations in the middle area, or generate too smooth shortcuts, further deviating from the actual path. These problems may cause smooth trajectories to intersect obstacles, thus reducing the effectiveness and safety of the path. The two smoothing trajectories are shown in Figure 5 below.

Fig. 5
figure 5

Bezier curve and piecewise spline interpolation smooth trajectory.

To address the above issues, this paper proposes a local tangential circle smoothing trajectory method, and the specific implementation steps are as follows: For each inflection point \(p_i\) \((i=1,2,...,n-1)\) on the trajectory \(P_{optimize}=\{p_0,p_1,p_2,...,p_n\}\) after the inflection point correction, let:

$$\begin{aligned} & \begin{aligned}&\vec {\nu _i}=(p_{i-1}-p_i) \\&\overrightarrow{\nu _{i+1}}=(p_{i+1}-p_i) \end{aligned} \end{aligned}$$
(11)

Then the angle \(\alpha\) at the inflection point \(p_i\) is:

$$\begin{aligned} & \alpha =\arccos (\frac{\overrightarrow{\nu _i}\bullet \overrightarrow{\nu _{i+1}}}{\parallel \overrightarrow{\nu _i}\parallel \bullet \parallel \overrightarrow{\nu _{i+1}\parallel }}) \end{aligned}$$
(12)

The unit vector \(\vec {b}\) of the angle bisector at the inflection point \(p_i\) is:

$$\begin{aligned} & \vec {b}=\frac{\vec {\nu _i}}{\parallel \vec {\nu _i}\parallel }+\frac{\vec {\nu _{i+1}}}{\parallel \vec {\nu _{i+1}\parallel }} \end{aligned}$$
(13)

For a circle whose center is on the angle bisector and tangent to the path at both ends of the inflection point, it satisfies:

$$\begin{aligned} & r=x\tan (\frac{\alpha }{2}) \end{aligned}$$
(14)

The visualization diagram is shown in Figure 6 below:

Fig. 6
figure 6

Tangential circle smoothing.

For different x and \(\alpha\) , the radius of the circle tangent to the path is different, resulting in different trajectory smoothness. To ensure that one angle corresponds to only one smooth trajectory, define:

$$\begin{aligned} & x=\alpha ^\lambda & \end{aligned}$$
(15)

Combining equation 14, it follows that:

$$\begin{aligned} & r=\alpha ^\lambda \tan (\frac{\alpha }{2}) & \end{aligned}$$
(16)

In the formula, r represents the radius of the circle whose center lies on the angle bisector and is tangent to the paths on both sides of the inflection point, \(\alpha\) is the angle at the inflection point \(p_i\) , and \(\lambda\) is the smoothing coefficient. From Figure 6, it can be seen that the distance from the center of the circle to the inflection point satisfies:

$$\begin{aligned} & d=\frac{r}{\sin (\frac{\alpha }{2})} & \end{aligned}$$
(17)

Therefore, the coordinates of the center of the circle are:

$$\begin{aligned} & (x_c,y_c)=p_i+d\vec {b} & \end{aligned}$$
(18)

Use the arctangent function to calculate the polar angle \(\beta\) of the unit vector \(-\vec {b}=(x_{ct},y_{ct})\) pointing from the center of the circle to the inflection point.

$$\begin{aligned} & \beta = {\left\{ \begin{array}{ll} \arctan \left( \frac{y_{ct}}{x_{ct}}\right) , & if \quad x_{ct}> 0, y_{ct} \ne 0 \\ \pi + \arctan \left( \frac{y_{ct}}{x_{ct}}\right) , & if \quad x_{ct}< 0, y_{ct}> 0 \\ -\pi + \arctan \left( \frac{y_{ct}}{x_{ct}}\right) , & if \quad x_{ct}, y_{ct} < 0 \end{array}\right. } & \end{aligned}$$
(19)

From the sum of the interior angles of the triangle, we can get the arc angle to be \(\pi -\alpha\), so the range of the arc direction angle \(\varphi\) is:

$$\begin{aligned} & \varphi \in \begin{array}{l} \left[ \beta - \frac{\pi - \alpha }{2}, \beta + \frac{\pi - \alpha }{2}\right] \\ \end{array} & \end{aligned}$$
(20)

By combining equations 1618 and 19, the smooth trajectory of the tangent circle at the inflection point \(p_i\) is obtained:

$$\begin{aligned} & \begin{aligned} x&= x_c + r \cdot \cos (\varphi ) \\ y&= y_c + r \cdot \sin (\varphi ) \end{aligned} & \end{aligned}$$
(21)

The trajectory is smoothed using a local tangent circle as shown in Figure 7,the smooth three-dimensional local tangent circle trajectory is shown in Figure 8.

Fig. 7
figure 7

Smooth trajectory of tangent circle.

Fig. 8
figure 8

Three-dimensional tangent circle smooth trajectory.

Global optimization trajectory combined with artificial potential field method

Considering the influence of dynamic obstacles on UAV in real environment, the improved artificial potential field method is used to avoid local obstacles. The artificial potential field method (APF) regards the target position and the obstacle position as potential fields with attractive and repulsive forces, respectively. The gravitational force exerted by the target position on the UAV, while the obstacle exerts a repulsive force on the UAV, and the direction is far away from the obstacle. Under the combined action of attraction and repulsion, the UAV moves in the direction of the resultant force, thereby avoiding obstacles and advancing towards the target. Different from the traditional artificial potential field, increasing the gravity of the global optimization trajectory on the UAV can effectively guide the UAV to avoid obstacles while maintaining the superiority of the path, as shown in Figure 9.

Fig. 9
figure 9

Artificial potential field method combined with global optimization trajectory.

Gravitational attraction of the target point

The current position of the UAV is \(p_i\) , the target position is \(p_n\) , and the attractive potential field function of the target point \(U_{att\_tar}\) is:

$$\begin{aligned} & U_{att\_tar}(p_i)=\eta _{tar}\parallel p_n-p_i\parallel & \end{aligned}$$
(22)

In the formula, \(\eta _{tar}\) is the attractive gain coefficient of the target point. The gradient of the attractive potential field is:

$$\begin{aligned} & \nabla U_{att\_tar}(p_i)=\frac{p_n-p_i}{||p_n-p_i||} & \end{aligned}$$
(23)

Repulsive force of obstacles

Assuming the obstacle position is \(p_{obs}\), the repulsive potential field function \(U_{rep}\) is:

$$\begin{aligned} & U_{rep}(p_i) = {\left\{ \begin{array}{ll} \eta _{rep}\left( \frac{1}{\parallel p_i-p_{obs}\parallel }-\frac{1}{d_0}\right) \cdot \frac{\parallel p_n-p_i\parallel }{\parallel p_i-p_{obs}\parallel ^2}, & if \; \parallel p_i-p_{obs}\parallel <d_0 \\ 0, & if \; \parallel p_i-p_{obs}\parallel \ge d_0 \end{array}\right. } & \end{aligned}$$
(24)

In the formula, \(d_0\) is the maximum influence range of the repulsive force. The gradient of the repulsive potential field is:

$$\begin{aligned} & \nabla U_{rep}(p_i) = {\left\{ \begin{array}{ll} \frac{p_i-p_{obs}}{\parallel p_i-p_{obs}\parallel }, & if \; \parallel p_i-p_{obs}\parallel < d_0 \\ 0, & if \; \parallel p_i-p_{obs}\parallel \ge d_0 \end{array}\right. } & \end{aligned}$$
(25)

Trajectory attraction

Trajectory attractive potential field function \(U_{att\_tra}\) :

$$\begin{aligned} & U_{att\_tra}(p_i) = {\left\{ \begin{array}{ll} \eta _{tra}\parallel p_{tra}-p_i\parallel \cdot \parallel p_n-p_i\parallel , & if \;\parallel p_{tra}-p_i\parallel < d_1 \\ 0, & if \; \parallel p_{tra}-p_i\parallel \ge d_1 \end{array}\right. } & \end{aligned}$$
(26)

In the formula, \(\eta _{tra}\) is the trajectory attraction gain coefficient, \(p_{tra}\) is a point on the trajectory, and \(d_1\) is the maximum influence range of the trajectory attraction. The gradient of the trajectory potential field is:

$$\begin{aligned} & \nabla U_{att\_tra}(p_i) = {\left\{ \begin{array}{ll} \frac{p_{tra}-p_i}{\parallel p_{tra}-p_i\parallel }, & if \; \parallel p_{tra}-p_i\parallel < d_0 \\ 0, & if \; \parallel p_{tra}-p_i\parallel \ge d_0 \end{array}\right. } & \end{aligned}$$
(27)

The resultant force potential field and resultant force gradient are:

$$\begin{aligned} & U_{sum}(p_i)=U_{att\_tar}(p_i)+\sum U_{rep}(p_i)+\sum U_{att\_tar}(p_i) & \end{aligned}$$
(28)
$$\begin{aligned} & \nabla U_{sum}(p_i)=\nabla U_{att\_tar}(p_i)+\sum \nabla U_{rep}(p_i)+\sum \nabla U_{att\_tra}(p_i) & \end{aligned}$$
(29)

The final resultant force of \(p_i\) at the current position is:

$$\begin{aligned} & F_{sum}(p_i){=}U_{sum}(p_i){\bullet }\nabla U_{sum}(p_i) & \end{aligned}$$
(30)

The improved artificial potential field method can effectively reduce the possibility of falling into local optimum by introducing trajectory gravity. However, in the area with narrow obstacle distribution, local oscillation may still be caused by the interaction between attraction and repulsion. In this paper, the low-pass filtering strategy is used to smooth the resultant force, which makes the path more continuous. Let the coefficients of the low pass filter be \(\omega\), resultant force after filtering:

$$\begin{aligned} & F_{sum}^{smooth}(p_i)=\omega F_{sum}(p_i)+(1-\omega )F_{sum}(p_{i-1}) & \end{aligned}$$
(31)

Algorithm flow

The main program of the adaptive neighborhood and inflection point minimization UAV dynamic obstacle avoidance (MSF-MTPO) algorithm is based on A * algorithm global path planning and artificial potential field method local obstacle avoidance. The specific steps are as follows: (1) Using bidirectional A * algorithm and adaptively expanding the neighborhood according to the distribution of obstacles at the current position, selecting the optimal direction and step size, and planning the initial global trajectory; (2) optimizing the inflection points of the global trajectory planned by the improved algorithm, eliminating redundant inflection points, so that the path has the least number of inflection points under safe conditions; (3) For the path with redundant inflection points eliminated, the local tangential circle smoothing algorithm is used to smooth the path, and the superiority of the original path is retained; (4) The global optimization trajectory is taken as the guide trajectory of artificial potential field method, so as to avoid falling into the local optimum value and realize dynamic obstacle avoidance. The pseudo code and flow chart of the MSF-MTPO algorithm are shown in Table 3 and Figure 10:

Table 3. MSF - MTPO Algorithm.
Fig. 10
figure 10

Algorithm flow chart.

Experimental analysis

Physical constraints

In order to obtain a feasible path, the UAV not only needs to consider the obstacles and target locations in the environment, but also must abide by its own physical constraints. These constraints include factors such as the maximum yaw angle, pitch angle44, flight speed45,46, flight altitude, as well as factors such as battery endurance. These physical constraints limit the maneuverability of the UAV and the flexibility of path planning. These factors must be taken into account when designing the path planning algorithm to ensure that the UAV can complete its mission safely.

Maximum yaw angle and maximum pitch angle

The maximum yaw angle and maximum pitch angle are used to limit the turning angle and climbing/diving angle of the drone. Set the coordinates of waypoint i to \(p(i)=(x_i,y_i,z_i)\) ,

$$\begin{aligned} & \vec {\nu _i}=(p_i-p_{i-1}) & \end{aligned}$$
(32)

The maximum yaw angle is \(\phi _max\), the maximum pitch angle is \(\varphi _max\), and the planned path should meet th following constraints:

$$\begin{aligned} & \operatorname {arccos}(\frac{\vec {\nu _i}\bullet \vec {\nu _{i+1}}}{\Vert \overrightarrow{\nu _i}\Vert \bullet \Vert \overrightarrow{\nu _{i+1}}\Vert })<\phi _{\max } & \end{aligned}$$
(33)
$$\begin{aligned} & \arctan (\frac{\mid z_{i+1}-z_i\mid }{\sqrt{\left( x_{i+1}-x_i\right) ^2+\left( y_{i+1}-y_i\right) ^2}})<\varphi _{\max } & \end{aligned}$$
(34)

Flight speed limitation

The maximum flight speed of the UAV is influenced by multiple constraints, including dynamic pressure (\(V_{max-q}\)), normal load factor (\(V_{max-n}\) ), normal load factor considering the angle of attack (\(V_{max-nz}\) ), and turn radius ( \(V_{max-Q}\)). The minimum speed (\(V_{min}\) ) must ensure stable flight in the air, where the lift must equal the gravity.

$$\begin{aligned} & V_{\max }=\min (V_{\max -{\mathfrak {q}}},V_{\max -{\mathfrak {n}}},V_{\max -nz},V_{\max -Q}) & \end{aligned}$$
(35)

During the movement, the flight speed should meet the following conditions:

$$\begin{aligned} & V_{\min }\le V_i\le V_{\max } & \end{aligned}$$
(36)

Cost function

The cost function47,48 is an important indicator for evaluating the performance of the improved algorithm. The UAV path planning aims to complete the task at the lowest cost. The cost in this article is as follows:

$$\begin{aligned} & J=\alpha _1J_1+\alpha _2J_2+\alpha _3J_3+\alpha _4J_4 & \end{aligned}$$
(37)

In the formula, J , \(J_1\) , \(J_2\) , \(J_3\) and \(J_4\) represent the total path cost, path length cost, height cost, turning angle cost, and safety cost, respectively. \(\alpha _1\) , \(\alpha _2\) , \(\alpha _3\) and \(\alpha _4\)are the cost coefficients49 for each, and their sum is 1.

Length cost

$$\begin{aligned} J_1=\sum _{i=0}^n\sqrt{\left( x_{i+1}-x_i\right) ^2+\left( y_{i+1}-y_i\right) ^2+\left( z_{i+1}-z_i\right) ^2} \end{aligned}$$
(38)

High cost

The stable altitude of the drone when flying can effectively save energy and ensure safety. In addition, when flying at low altitude, it can effectively avoid unknown threats by using ground cover50. Thus, the height cost is:

$$\begin{aligned} & J_2=\sqrt{\frac{1}{n}\sum _{i=0}^{n-1}(z_i-\frac{1}{n}\sum _{i=0}^{n-1}z_i)^2} \end{aligned}$$
(39)

Corner cost

The maneuverability and stability of the UAV are limited by the maximum turning angle between two adjacent waypoints. In addition, frequent turns reduce flight efficiency, so the corner cost in this paper is:

$$\begin{aligned} & J_3=\sum _{i=1}^n\arccos (\frac{\vec {\nu _i}\bullet \vec {\nu _{i+1}}}{|\vec {\nu _i}|\bullet |\vec {\nu _{i+1}}|}) \end{aligned}$$
(40)

Safety costs

An excellent path must first ensure its safety, that is, stay as far away from obstacles as possible. In order to quantify this security, this paper introduces the concept of security cost, which is specifically defined as:

$$\begin{aligned} & J_4=\frac{1}{\min (d(p_i,obs))} \end{aligned}$$
(41)

The dimensions of each cost function are different, so it is necessary to normalize each cost:

$$\begin{aligned} & J_{ij}^{\prime }=\frac{J_{ij}}{\sum _{j=1}^kJ_{ij}} \end{aligned}$$
(42)

Where i is the cost type (\(i={1,2,3,4}\) ), j is the type of comparison algorithm, and k is the total number of comparison algorithms. The final path cost of each algorithm is:

$$\begin{aligned} & J_j=\alpha _1J_{1j}^{\prime }+\alpha _2J_{2j}^{\prime }+\alpha _3J_{3j}^{\prime }+\alpha _4J_{4j}^{\prime } \end{aligned}$$
(43)

Experimental environment setup

Based on the above algorithm design, the simulation experiment was carried out on a notebook computer equipped with Intel ® Core ™i5-9300H processor and 16GB of memory, the operating system is Windows 10, and the programming environment is MATLAB R2023a.

Static scene

In order to evaluate the performance of the algorithm proposed in this paper, its results are compared with the following algorithms: Conventional A * algorithm, Improved A * algorithm (Improved A *) in reference25, BA algorithm, improved WOA algorithm (IWOA) in reference36, improved SSA algorithm (ICSSA) in reference37, improved SAO algorithm (MISAO) in reference38,Improved RRT algorithm (Improved RRT) in reference51and improved particle swarm optimization algorithm (Improved PSO) in reference52.Each algorithm has trajectory planning under different maps and different number of obstacles, and the algorithms participating in the comparison are simulated and tested with their paper parameters to analyze the performance of each algorithm under different maps and obstacles environments.

Static scene 1

Three test scenarios are set on a 20\(\times\)20\(\times\)20 3D map: Map 1 is a custom obstacle distribution, Map 2 and Map 3 are randomly distributed scenarios with 100 obstacles, and the obstacle heights in the three scenarios are randomly generated. The starting position of the drone is (2,2,3), and the target position is (19,19,10). The above algorithm is used for path search, and the path cost coefficients are set to 0.25. The visualization of each algorithm is shown in Figure 11, and the performance statistics are shown in Table 4.

Fig. 11
figure 11

Static scenario 1 Different algorithms plan trajectories.

Table 4 Comparison of Algorithms on Different Maps.

Static scene 2

On a 3D map of size 50\(\times\)50\(\times\)20, three test scenarios are set: the number of obstacles in Map 4, Map 5 and Map 6 is 500 and randomly distributed, and the height is also randomly generated. The starting position of the drone is (2,2,3), and the target position is (49,49,15). The visualization of each algorithm is shown in Figure 12, and the performance statistics are shown in Table 5.

Fig. 12
figure 12

Static scenario 2 Different algorithms plan trajectories.

Table 5 Comparison of Algorithms on Different Maps.

In two distinct scenarios, the original A algorithm and the improved A algorithm are compared. The algorithm proposed in this paper significantly enhances search efficiency by incorporating bidirectional search and an adaptive neighborhood strategy. Specifically, the bidirectional search strategy theoretically enables exponential efficiency improvements by reducing the number of expanded nodes. Although the time required to process individual nodes slightly increases, the overall runtime efficiency of the improved algorithm is superior. At the data structure level, the algorithm combines hash tables with matrix indexing, effectively optimizing obstacle checking and path searching processes. However, the detection of meeting points may become a bottleneck for the algorithm’s runtime efficiency. The application of the adaptive neighborhood strategy allows the algorithm to dynamically adjust the search range based on real-time conditions in complex 3D environments. Moreover, the more complex the environment, the more pronounced the time-saving advantages of this strategy become. By adopting the inflection point trajectory correction method and comparing it with eight algorithms (including original A *, improved A *, improved RRT, improved PSO, ICSSA, BA, IWOA, MISAO), the results show that the number of trajectory inflection points planned by MSF-MTPO algorithm is reduced by 92.53%, 91.14%, 96.76%, 82.96%, 86.92%, 67.33%, 90.02%, 90.93% compared with other algorithms, respectively. Under the condition of ensuring safety, the algorithm effectively minimizes the number of path inflection points, thus reducing the total steering angle of the UAV, improving the path planning efficiency and reducing the resource consumption. In addition, combined with the local tangential smoothing strategy, the MSF-MTPO algorithm optimizes the path length while retaining the superiority of the original path. Compared with the other eight algorithms, the trajectory length planned by this algorithm is reduced by 10.72%, 6.89%, 35.60%, 2.23%, 8.69%, 4.50%, 4.60% and 5.42%, respectively. Since the path corners are significantly fewer than other algorithms, the path planned by the MSF-MTPO algorithm in most complex environments has the smallest path cost, demonstrates excellent performance, and provides an efficient and stable solution for UAV path planning.

Static scene

In map 1 of static scenario 1, add obstacles with starting positions (6, 3, 4) and (9, 9, 3) with a radius of 0.5 m, a moving radius of 3 m, and a moving speed that varies randomly and ranges from (0, 1)m/s. The UAV parameter value settings are shown in Table 6, the dynamic obstacle avoidance visualization is shown in Figure 13.

Table 6 UAV Configuration Parameters.
Fig. 13
figure 13

MSF-MTPO Dynamic Scene Path Planning Trajectory.

After adding the dynamic obstacles, the planned trajectory is shown as the orange curve in the figure, and the actual trajectory is shown as the red curve. The path length is 29.6539 m, the minimum distance from the obstacle is 1.25 m, and the total steering angle is 632.59\(^\circ\).

Conclusion

In this paper, a new multi-strategy fusion method for UAV trajectory planning is proposed, which includes four stages: initial trajectory planning, trajectory optimization, trajectory smoothing and dynamic obstacle avoidance. In the initial planning stage, the traditional A * algorithm is improved by introducing a bidirectional search strategy and dynamically adjusting the search neighborhood according to the distribution of obstacles around the current node, which effectively improves the search efficiency and reduces redundant nodes. For the planned global trajectory, in order to minimize the inflection point of the trajectory, an inflection point trajectory correction method is introduced. The trajectory is regarded as a line segment composed of only the starting point, the end point and the inflection point, and whether there are obstacles between the two points is judged one by one, and the redundant inflection points that have not crossed the obstacles are eliminated until the corrected trajectory does not change, and finally a trajectory with the least inflection point is obtained. In order to smooth the modified trajectory, the local tangential smoothing method is used to smooth the trajectory, only on both sides of each inflection point, so as to keep the superiority of the original trajectory as much as possible and improve the smoothness of the trajectory. Finally, the global optimization trajectory is taken as the guide trajectory of the artificial potential field method, which increases the trajectory gravity. Since the guide trajectory has passed the global optimization, this not only ensures the generation of a better planning trajectory in the dynamic environment, but also significantly reduces the risk of falling into the local optimal solution. The simulation results show that in most scenarios, compared with the original A *, improved A *, improved RRT, improved PSO, ICSSA, BA, IWOA, MISAO and other eight algorithms, the proposed algorithm has the lowest trajectory planning cost, and the number of inflection points is greatly reduced, which reflects the superiority and robustness of the algorithm. However, it is worth noting that all the experimental environments used for trajectory planning in this paper are known environments and no real-world experiments have been conducted. Future work will focus on how to combine local information with artificial potential field method to achieve fast trajectory planning in unknown environments and test it in real environments.