#### Abstract

Path planning is an important part of the unmanned aerial vehicle (UAV) to realize its autonomous capabilities. Aiming at the shortcomings of the traditional ant colony algorithm-based trajectory planning method, which has slow convergence speed and easy to fall into the local optimum, a path planning method based on the improved ant colony algorithm is proposed. First, a dynamic adjusting factor is added into the heuristic function to improve the directivity of path selection and search speed. Then, the state transition strategy is improved to solve the problem of slow convergence in the initial stage and easy to fall into local optimum in the later stage. Finally, the path inflection point is smoothly optimized through the cubic B-spline curve. Simulation results show that the improved ant colony algorithm can quickly converge to the optimal path and well adapt to the flight requirements of multirotor UAV.

#### 1. Introduction

With the continuous progress of science and technology, especially the continuous development of microelectronic technology and microelectromechanical technology, UAV has been widely used in military and civil fields. Compared with large UAVs, small UAVs have a broader application space in the fields of police, rescue and disaster relief, traffic management, news media, aerial photography, geological survey, environmental evaluation, pipeline inspection, and so on. Among them, the multirotor small UAV, as a typical representative, has developed particularly rapidly in recent years and received the focus of researchers.

Path planning is one of the key technologies for UAV to realize autonomous flight. A large number of scholars have done research on it and achieved a lot of results. In fact, path planning is to find an optimal flight path from initial point to target point under certain constraints. Common planning methods include classical algorithms such as the *A* (*A*-star) algorithm [1, 2], artificial potential field method [3, 4], and optimal control method [5, 6], as well as intelligent algorithms such as the genetic algorithm [7, 8], ant colony algorithm [9, 10], and particle swarm optimization algorithm [11].

The classical algorithm is generally only suitable for simple spatial path planning. In the face of complex problems, the difficulty of solving them increases exponentially with the increase of dimension, which has certain limitations. With the development of computer and big data technology, intelligent algorithms have more and more obvious advantages of good robustness, positive feedback mechanism, and self-organization. Taking the ant colony algorithm as an example, theoretically, it can find the optimal solution of the path, which is suitable for path planning in complex environment. However, in practice, we must consider the problems of how to shorten search time, speed up convergence, and jump out of local optimal. Li et al. [12] introduced a weight factor into the probability transfer function and improved the updating way of information. The simulation results showed that the convergence speed of the improved algorithm is improved, and the optimal path is shorter, but the search results are not stable. Wu et al. [13] adopted the method of integrating the current optimal track pheromone and the historical optimal track update, introduced the pheromone rollback clearing mechanism, and carried out offline calculation, which improved the search efficiency, but did not significantly reduce the number of iterations. Wang et al. [14] used the artificial potential field method to improve the heuristic function of the ant colony algorithm, allocated pheromones reasonably when the algorithm is not running, and improved the volatilization coefficient to find the optimal path of the algorithm.

It can be seen that many research studies are all based on the traditional ant colony algorithm and have achieved certain results. However, the traditional ant colony algorithm has the shortcomings of slow convergence speed and easy to fall into local optimum, which is not applicable to the real flight environment. Aiming at the defects of the basic ant colony algorithm, an improved ant colony algorithm is proposed in this study to make it suitable for path planning of multirotor UAV. First, a dynamic adjusting factor is added into the heuristic function to improve the directivity of path selection and search speed. Then, the state transition strategy is improved to solve the problem of slow convergence in the initial stage and easy to fall into local optimum in the later stage. At the same time, combined with the existing pheromone volatilization factor update strategy, the overall performance of the algorithm is improved. Finally, the path inflection point is smoothly optimized through the cubic B-spline curve, so that the path planning of multirotor UAV is more in line with the flight reality.

The study is organized as follows: Section 2 describes the environment in which the UAV performs its mission. Section 3 introduces the basic principle and deficiency of the ant colony algorithm. Section 4 improves the shortcomings of the ant colony algorithm and proposes the UAV track planning method and smoothing method. In Section 5, the proposed algorithm is simulated and analyzed, which verifies the effectiveness of the proposed algorithm. Finally, the full text work is summarized and the next research direction is pointed out.

#### 2. Environmental Model

In order to accurately describe the path planning process of UAV, its two-dimensional environment map [15, 16] needs to be modeled. The conventional environment modeling methods include the grid method [17, 18], geometric information method, and view method. Considering that the grid method has the advantages of simple drawing, clear data structure, and easy implementation, we select the grid method to complete the UAV flight environment modeling. The grid method decomposes the plane map into a series of grids to facilitate the analysis of map information. The grid map is composed of 0 and 1 matrices with binary values. In the matrix, 0 stands for free grid, in which the UAV can enter and exit freely, represented by white grid, and 1 stands for obstacle grid, in which the UAV needs to move around, and represented by black grid. The grid environment and the electronic map are shown in Figure 1. The map is numbered from left to right and top to bottom. The grid serial number corresponds to coordinates one by one, and the expression of the relationship between them is shown in equation (1). The result obtained is the center point of the grid.where *r* is the grid size, *i* represents the number of the grid, *R* is the number of rows of the grid matrix, mod () is the remainder operation function, and ceil () is the rounding up operation function.

In order to prevent the collision between UAV and obstacles, when the obstacle is less than one grid, it is filled into a complete grid. At this time, the UAV is treated as a particle.

The flight rules of UAV are as follows: it can only appear in the white grid and cannot pass through the black grid, but it can pass through the four corners of the black grid; it is forbidden to repeat the same grid; and in unit time, it can only move between two adjacent grids. We use Euclidean distance to measure the length of the flight path. For example, if moving up, down, left, and right, the path length is 1 unit and if moving to the four corners of the grid, the path length is 1.41 units.

#### 3. Basic Ant Colony Algorithm

Ant colony algorithms are inspired by the foraging behavior of ant populations, in which each ant in the colony leaves pheromones in its movement path to communicate information to the colony. The shorter the moving path is, the higher the pheromone concentration is, and the probability that the path is selected by ants, which forms the positive feedback mechanism for ants to find the shortest path. The basic principle of the ant colony algorithm is as follows.

Ants select paths according to pheromone concentration and heuristic function, and the probability of ant *k* moving from grid *i* to grid *j* can be expressed aswhere is the pheromone heuristic factor and is the distance expectation function factor, which affect the importance of pheromone and distance heuristic function, respectively, indicates the next destinations ants can reach, is the pheromone concentration on the moving path at time *t*, and represents the distance heuristic function. Here,

Each ant will leave a certain amount of pheromone when moving. Therefore, when the algorithm iterates continuously, the pheromone content in the path gradually accumulates and volatilizes at the same time. When all ants in the population complete each round of iteration, the pheromone content on the path will be updated according to the following rules:where is the pheromone volatilization coefficient, represents the sum of pheromones released on the path between the two nodes, denotes the pheromone increment, is the path length of ant *k*, and is the pheromone enhancement coefficient.

#### 4. The Improved Ant Colony Algorithm

##### 4.1. The Improved Heuristic Function

When using the basic algorithm to plan the path, the ant colony has not left pheromone in the initial stage. At this time, the pheromone on the path is scarce. The ant cannot select the next grid according to the pheromone concentration. The search has no purpose and cannot quickly search the feasible path. On the basis of the heuristic function in [19], we add a dynamic regulation factor *ξ*. The new expressions of heuristic function and *ξ* are shown aswhere is the Euclidean distance between *j* and the target point, is the current number of iterations, and is maximum number of iterations.

##### 4.2. The Improved State Transition Rule

In the basic ant colony algorithm, ants mainly rely on the probability function to select the next node. However, in the early stage of the algorithm, the difference between the pheromone concentrations of the path is very small, which cannot effectively guide the ant to choose the path. Based on the initial transition probability, the convergence speed of the algorithm is guaranteed by introducing pseudorandom rules. The ant will select the next node *j* according to the following formula.where represents a random number between (0, 1), and is a design parameter, which is usually determined by previous experience and repeated experiments. Its value determines the path selection mode. If the value of is too large, the path shift is more likely to be a deterministic pattern, and the convergence speed is faster, but the global search capability is reduced. On the contrary, if the value of is very small, the path shift is more inclined to the roulette mode, which not only increases the randomness of the global search but also reduces the convergence speed. Therefore, setting a reasonable value of has an important influence on the convergence process. In order to better improve the problem of slow convergence in the initial stage and easy to fall into local optimization in the later stage, we designed it as a dynamical parameter adjusted with the number of iterations. The details expression is as follows:

##### 4.3. Pheromone Volatilization Factor Update Strategy

Due to the particularity of path planning, different volatilization coefficients are required in different stages: if is too large, ants cannot complete path search according to the pheromone information, resulting in slow convergence speed; if is too small, the pheromone will accumulate excessively, easily make the path search fall into local optimization. Referring to the research ideas of [19], the adaptive updating strategies of pheromone volatile factors are designed as follows:

In order to search as many paths as possible, the pheromone content should be controlled at a low level at the initial stage of algorithm optimization. Therefore, the value of the initial volatile factor should not be too small. At this time, pheromone concentration has little interference in the process of path exploration, and ants can search more possible paths. With algorithm iteration step by step, the value of gradually decreases, and the negative feedback effect is weakened. The pheromone content on the moving path is increased, and the guiding effect of pheromone concentration on ant colony is enhanced. When the number of iterations increases to a certain number, ant colony will converge to the path with a higher pheromone content. Therefore, the improved algorithm can expand the searching range of ant colony and improve the convergence speed. The changing curve of is shown in Figure 2 (initial *ρ* = 0.8).

##### 4.4. Path Smoothing Method

The optimal path generated by the improved ant colony algorithm is not smooth enough and has sharp inflection point. Therefore, cubic *B*-spline smoothing is introduced to optimize the path at the inflection point. The total equation of the *B*-spline curve is [20, 21]

The basis function in cubic *B*-spline curve equation is

Furthermore, the mathematical expression of the basis function of cubic *B*-spline curve is

The cubic *B*-spline curve equation can be converted by bringing the basis function into the general equation:

Based on the above cubic *B*-spline curve equation, the flight path can be smoothed. Figure 3 shows the simulation of local path smoothing results. The red line is the path to be smoothed, and the blue dotted line is the smoothing result. The goal of this strategy is to replace the broken line with a curve near the inflection point, so that the obtained path is smoother and more in line with the reality of UAV flight.

The flow of the improved ant colony algorithm is shown in Figure 4.

#### 5. Simulation Analysis

The simulation hardware environment is the Huawei MateBook Pro laptop equipped with Intel Core I7-8565U processor. Software environment is the Win10 operating system, installed with MATLAB 2017B simulation test environment. BACA, GA (genetic algorithm), and IACA algorithms are implemented in the simulation tests. The basic parameter settings of three algorithms are given in Tables 1 and 2.

##### 5.1. Performance Test

In order to verify the optimization ability of the improved ant colony algorithm in this study, first, the typical single-mode test function Sphere and multimode test function Alpine are used for the optimization comparison test. The dimension value of the two functions is 30, the value range of Sphere is [−100, 100], the value range of Alpine is [−10, 10], and the theoretically achievable minimum value of both functions is 0. The two function expressions are as follows, respectively:

The basic ant colony algorithm (BACA) and the improved ant colony algorithm (IACA) are independently run for 20 times on each test function, and the common parameters of the algorithm remained consistent. The results are given in Table 3.

According to the test results in the above table, the IACA algorithm proposed in this study has a good optimization effect. The theoretical global optimal value can be obtained by searching for Sphere function and Alpine function.

##### 5.2. Comparison Test of Path Planning

In order to verify the effectiveness of IACA in UAV path planning, BACA and GA (genetic algorithm) are used as a comparison to conduct simulation comparison tests in 20 × 20 and 30 × 30 environment maps.

###### 5.2.1. 20 × 20 Simulation Environment

The simulation test is first carried out in a 20 × 20 grid map, with the starting point at the upper left corner of the map and the target point at the lower right corner. BACA, GA, and IACA proposed in this study are used to plan the flight path of UAV, respectively, with the maximum iteration times of 100. Path planning diagram and iterative convergence curve are shown in Figures 5–7. The experimental results are given in Table 4.

**(a)**

**(b)**

**(a)**

**(b)**

**(a)**

**(b)**

It can be seen from the above table that the shortest path length obtained by applying the IACA algorithm proposed in this study is 15.4% shorter than that obtained by applying the BACA algorithm, and the running time is reduced by 14.1%. Compared with GA, IACA is 22.8% shorter, and the running time is reduced by 14.6%.

###### 5.2.2. 30 × 30 Simulation Environment

When the flight environment is large and obstacles are densely distributed, the 100 iteration times of 20 × 20 map cannot be effectively converged to the shortest path. We increase the maximum iteration times to 300. Path planning diagram and iterative convergence curve are shown in Figures 8–10. As given in Table 5, the shortest path obtained by IACA is 14.2% shorter than that obtained by BACA, and the system running time is reduced by 8.7%, respectively. Compared with GA, though the system running time is added by 6.4%, the shortest path obtained by IACA is 13.8% shorter than that obtained by GA.

**(a)**

**(b)**

**(a)**

**(b)**

**(a)**

**(b)**

#### 6. Conclusion

In this study, we proposed an improved ant colony algorithm for multirotor UAV path planning. By redesigning the heuristic function of the ant colony algorithm and improving the state transition matrix, the running time of the algorithm and the distance of the optimal moving path are effectively shortened. At last, we smoothed the final moving path to make it more in line with the flight reality of UAV.

Through the comparison of MATLAB simulation experiments, it can be seen that the improved algorithm has more advantages than the basic algorithm in the optimization effect and reflects the effectiveness of the algorithm in the operation time and the shortest path.

In practical applications, UAVs usually perform tasks in a swarm. Therefore, how to complete the coordinated trajectory planning of UAV swarms on the basis of this study will become the focus of our next research.

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.