# Optimization of Dynamic Obstacle Avoidance Path of Multirotor UAV Based on Ant Colony Algorithm

Authors: Yuexin Yang; Zhuoxun Chen
Journal: Wireless Communications and Mobile Computing
 (2022)

---

## Abstract

In this paper, the real-time path avoidance problem of multirotor UAV in the case of sudden obstacles in two-dimensional environment is studied. The principle, model, and application of ant colony algorithm are analyzed. On this basis, the adaptive dynamic window ant colony algorithm is proposed, and the adaptive dynamic window method is designed; the heuristic function of adding obstacle detection factors and the double pheromone update strategy are made to the ant colony algorithm, and the improved ant colony algorithm is used to replan the path within the dynamic window that can be automatically adjusted to achieve the purpose of obstacle avoidance. A real-time simulation experiment of path planning was conducted by constructing an environment map in MATLAB. The simulation results show that with the continuous increase of the number of sudden obstacles, the real-time replacement path of multirotor UAV also gradually increases, and when approaching the obstacles, the replacement path is more dense, indicating that the adaptive window ant colony algorithm can be applied to dynamic path replacement, and the multirotor UAV can realize dynamic obstacle avoidance path optimization under the condition of sudden obstacles in a short time.


---

## Body

## 1. Introduction

Unmanned aerial vehicles (UAVs) are generally unmanned. Human-controlled vehicles are particularly prominent in the growing development of aerial vehicle technology. UAVs are usually equipped with a variety of sensors, as well as graphic and communication equipment, in order to achieve tasks such as terrain reconnaissance, patrolling, mapping, and rescue due to their good maneuverability and to complete various flight maneuvers under the operator’s action commands [1]. The common ones in the market are rotary-wing UAVs, of which quadratics and operators are more popular due to their stable flight. The military most of the fixed-wing UAVs are equipped with high-definition cameras and weapon systems for military reconnaissance missions [2]. Drones are exclusive not only in military applications but also in commercial applications to improve human life. Thus, the research topics and commercial applications related to UAVs are constantly emerging with new technological developments. However, with intelligent computers and high technical requirements for collecting and processing transmitted information, the mission of UAVs has become challenging and more difficult for human control, and relying solely on human control of UAVs in the face of unknown environmental situations has placed higher demands on individual capabilities [3, 4]. The development trend of UAVs is toward autonomy, and one of the outstanding issues in the development of autonomous and intelligent systems for UAVs is path planning. The path planning of UAVs is similar to the ground robot path planning problem, where a route is planned from the starting point in the playable area to the target point without contact with obstacles, in how to constitute the route and a better choice of route is the main element explored in the problem [5]. UAVs sometimes need to execute flight paths in fixed height mode free mode due to different operational difficulties and mission requirements, and the use of path planning techniques can not only obtain optimal collision-free paths but also minimize path length, flight time, and energy consumption [6].Currently, UAVs, both in military and civilian applications, mainly perform reconnaissance, aerial photography, and monitoring tasks in the open field plains and high-altitude domains, and path planning lacks autonomy and practicality in the face of unknown environments in cities [7]. Path planning technology is still immature and still requires human control and has a high accident rate. UAVs make poor autonomous flight decisions when facing unknown situations such as neighborhoods, schools, and other buildings, and often collide in the presence of unknown obstacles, which greatly reduce the maneuverability of UAVs. Under the urban low-altitude environment, UAV has weak application ability in rescue reconnaissance, road monitoring, traffic law enforcement and other aspects.In order to solve the above problems, UAV needs to solve the problem of path planning in the face of unknown environment. The first problem to be solved is environmental perception, and the UAV is retrofitted with sensors to realize the perception of the surrounding environment, which is the prerequisite for the UAV to make path planning decisions [8]. Current environmental sensors for UAVs are mainly 2D planar LIDAR, millimeter wave, ultrasonic rangefinders, monocular vision and binocular vision cameras, and infrared range sensors, all of which can sense the 3D external environmental information faced by the UAV. Another major issue is the judgment and detection of obstacles in the environment, whereby the UAV control decision system can make path planning and control the UAV to fly along the planned path [9].In this paper, the research of environment perception problem in path planning is carried out based on binocular vision sensors for rotary-wing UAVs, which perceive the environment with buildings similar to campus community and realize the reconstruction of 3D environment and obstacle detection; meanwhile, the ant colony algorithm is used as the path planning algorithm for UAVs in unknown environment and the applicability is improved so as to realize the autonomous flight in unknown environment.


## 2. Related Work

### 2.1. Environmental Sensing Technology

Since UAVs themselves lack the ability to perceive the environment, in order to ensure the UAV’s understanding and grasp of the environment, it is necessary to enable the UAV to acquire information including the obstacles in the surrounding environment, other actions exhibited by the obstacles, nonobstacle areas that the UAV can pass through, and flexible actions. The technique to obtain this information by fusing data from multiple sensors such as LIDAR, cameras, and millimeter wave radar is the environmental sensing technique [10].In this paper, binocular stereo vision from environmental perception technology is used as the UAV environmental perception function, and since binocular vision relies on computer computing power. It has produced many research results as the technology level improves both at home and abroad. Srikanthakumar S et al. extended the research work on 2D image vision to the visual study of 3D object structures, especially the detailed analysis of the relationship between 3D structures similar to polyhedra such as columns in the spatial coordinate system [3]. Hu J et al. proposed a new vision theory, namely, the Marr stage vision theory, which proposes a three-stage vision processing to obtain a true 3D map, standardizing the visual representation at different angles to relate the specific structures to the actual object realization [11]. Huang X et al. used binocular vision techniques in mobile robots to perform behavioral perception of moving objects in the environment and dynamic processing based on behavioral information of objects that can move in the outside world [12]. Benjamin M R et al. worked out a stereo vision system using dual camera baseline elongation to achieve accurate self-localization and path navigation of the detector [13]. The system logarithmically optimizes and probabilistically estimates the captured images at different locations to obtain high accuracy parallax and calculates the individual 3D spatial coordinates of the objects in the recognized images, allowing the detector to perform real-time 3D reconstruction of the surrounding environment.Lolla T et al. achieved target recognition of a larger number of objects in the environment using a newly developed binocular vision system, which improved the autonomous navigation performance of the soccer robot [14]. Chamitoff G E et al. improved the accuracy of the robot in grasping the target objects through binocular vision multiangle positional fusion estimation and real-time depth estimation [15]. Li H et al. applied binocular vision technology in the measurement of vehicle safety distance, built a binocular parallel lateral system, and calculated the vehicle and camera distances from the left and right images acquired in the high-speed real-time motion of the vehicle, which was applied to the safety warning system of the vehicle [16].


### 2.2. UAV Path Planning Technology

UAV path planning has been an important research area in the western developed countries since 1960. Initially, the UAV flight was controlled by the operator of the vehicle by constantly observing changes in the surrounding environment and thus by radio remote control. With the popularization of artificial intelligence in recent years, intelligent path planning technology began to develop and mature with the extensive use of intelligent algorithms and sensors [17].In [18], the existing SVM and APF algorithms were loaded into the processing computer and a vision system was attached to initially complete the path planning in the room. Ling F et al. used a combination of inertial guidance and vision in path planning technology, and performed a fusion of positional and environmental information processing to achieve UAV path planning under obstructed conditions in an outdoor environment [19].Taghavifar H et al. based on binocular vision technology enables the UAV to obtain obstacle information in an unknown environment by the probabilistic method and determine the planning of 3D paths by the determination rules of obstacle information [20]. Yan B et al. detect and identify obstacles in a complex and variable environment, and make fast commands through the autonomous judgment of the flight control system, thus performing collision-free navigation [21]. Roy S et al. studied the control and path planning methods for micro and small UAVs [22].


### 2.3. Path Planning Algorithm

The main UAV path planning methods are Voronoi diagram method, PRM path planning method, RRT planning method, and so on. Among them, Voronoi diagram method is to use the method of connected geometry in mathematics to turn the obstacle area into a constructible connected graph, and then the boundary of the graph is connected into a flightily path phase, and the minimum initial path is searched in the boundary connection, which greatly reduces the difficulty in path search but at the same time the obtained flight path does not conform to the UAV flight characteristics. The probabilistic map PRM algorithm was proposed in [23]. The algorithm divides the flight space freely, randomly samples the solutions, and connects the sampled adjacent solutions as a path connectivity map.Korayem M H et al. proposed the genetic algorithm, which appropriately encodes each path, followed by randomly generating paths of a certain size, evaluating the paths, and selecting them according to certain rules; simulating the genetic operation and simulating the process of cyclic biological inheritance to obtain the optimal solution (path) [24]. Benjamin M R et al. introduced a differential variation strategy into a genetic algorithm applied to UAV path planning to solve the problem of local minima [25]. In [26], the particle swarm algorithm sets the particles as local attraction points and dynamically corrects the unknown of the particles in the distance of the passable range boundary, which can improve the ability of the algorithm to search for the global optimal solution and get the solution faster.


## 2.1. Environmental Sensing Technology

Since UAVs themselves lack the ability to perceive the environment, in order to ensure the UAV’s understanding and grasp of the environment, it is necessary to enable the UAV to acquire information including the obstacles in the surrounding environment, other actions exhibited by the obstacles, nonobstacle areas that the UAV can pass through, and flexible actions. The technique to obtain this information by fusing data from multiple sensors such as LIDAR, cameras, and millimeter wave radar is the environmental sensing technique [10].In this paper, binocular stereo vision from environmental perception technology is used as the UAV environmental perception function, and since binocular vision relies on computer computing power. It has produced many research results as the technology level improves both at home and abroad. Srikanthakumar S et al. extended the research work on 2D image vision to the visual study of 3D object structures, especially the detailed analysis of the relationship between 3D structures similar to polyhedra such as columns in the spatial coordinate system [3]. Hu J et al. proposed a new vision theory, namely, the Marr stage vision theory, which proposes a three-stage vision processing to obtain a true 3D map, standardizing the visual representation at different angles to relate the specific structures to the actual object realization [11]. Huang X et al. used binocular vision techniques in mobile robots to perform behavioral perception of moving objects in the environment and dynamic processing based on behavioral information of objects that can move in the outside world [12]. Benjamin M R et al. worked out a stereo vision system using dual camera baseline elongation to achieve accurate self-localization and path navigation of the detector [13]. The system logarithmically optimizes and probabilistically estimates the captured images at different locations to obtain high accuracy parallax and calculates the individual 3D spatial coordinates of the objects in the recognized images, allowing the detector to perform real-time 3D reconstruction of the surrounding environment.Lolla T et al. achieved target recognition of a larger number of objects in the environment using a newly developed binocular vision system, which improved the autonomous navigation performance of the soccer robot [14]. Chamitoff G E et al. improved the accuracy of the robot in grasping the target objects through binocular vision multiangle positional fusion estimation and real-time depth estimation [15]. Li H et al. applied binocular vision technology in the measurement of vehicle safety distance, built a binocular parallel lateral system, and calculated the vehicle and camera distances from the left and right images acquired in the high-speed real-time motion of the vehicle, which was applied to the safety warning system of the vehicle [16].


## 2.2. UAV Path Planning Technology

UAV path planning has been an important research area in the western developed countries since 1960. Initially, the UAV flight was controlled by the operator of the vehicle by constantly observing changes in the surrounding environment and thus by radio remote control. With the popularization of artificial intelligence in recent years, intelligent path planning technology began to develop and mature with the extensive use of intelligent algorithms and sensors [17].In [18], the existing SVM and APF algorithms were loaded into the processing computer and a vision system was attached to initially complete the path planning in the room. Ling F et al. used a combination of inertial guidance and vision in path planning technology, and performed a fusion of positional and environmental information processing to achieve UAV path planning under obstructed conditions in an outdoor environment [19].Taghavifar H et al. based on binocular vision technology enables the UAV to obtain obstacle information in an unknown environment by the probabilistic method and determine the planning of 3D paths by the determination rules of obstacle information [20]. Yan B et al. detect and identify obstacles in a complex and variable environment, and make fast commands through the autonomous judgment of the flight control system, thus performing collision-free navigation [21]. Roy S et al. studied the control and path planning methods for micro and small UAVs [22].


## 2.3. Path Planning Algorithm

The main UAV path planning methods are Voronoi diagram method, PRM path planning method, RRT planning method, and so on. Among them, Voronoi diagram method is to use the method of connected geometry in mathematics to turn the obstacle area into a constructible connected graph, and then the boundary of the graph is connected into a flightily path phase, and the minimum initial path is searched in the boundary connection, which greatly reduces the difficulty in path search but at the same time the obtained flight path does not conform to the UAV flight characteristics. The probabilistic map PRM algorithm was proposed in [23]. The algorithm divides the flight space freely, randomly samples the solutions, and connects the sampled adjacent solutions as a path connectivity map.Korayem M H et al. proposed the genetic algorithm, which appropriately encodes each path, followed by randomly generating paths of a certain size, evaluating the paths, and selecting them according to certain rules; simulating the genetic operation and simulating the process of cyclic biological inheritance to obtain the optimal solution (path) [24]. Benjamin M R et al. introduced a differential variation strategy into a genetic algorithm applied to UAV path planning to solve the problem of local minima [25]. In [26], the particle swarm algorithm sets the particles as local attraction points and dynamically corrects the unknown of the particles in the distance of the passable range boundary, which can improve the ability of the algorithm to search for the global optimal solution and get the solution faster.


## 3. Adaptive Dynamic Window Ant Colony Algorithm

In the previous chapters, the UAV environment perception problem was studied, and the UAV was made to have environment perception capability through scene reconstruction and detection of obstacles in the environment by binocular cameras. The autonomous flying rotor UAV has the ability of environment perception and also needs to have the function of intelligent path planning, and needs to have the path planning algorithm applicable to the unknown environment. In this chapter and afterwards, we start to study the application of ant colony algorithm for UAV path planning when there are unknown obstacles in two-dimensional and three-dimensional environments.Currently, UAV path planning in many cases is applicable to offline planning in two-dimensional environments, i.e., static obstacles knew to exist in the environment are considered in advance, and all obstacle information in the environment is mastered in advance. The global path planning is used once in the UAV to follow the planned route and reach the target point. However, due to inadequate understanding of the unknown factors of the actual flight environment, there are still some unexpected situations. In order to ensure that the UAV can perform reasonable obstacle avoidance in the case of sudden obstacle discovery, its ability of replanning the path needs to be improved. This chapter firstly analyzes and introduces the basic principle of ant colony algorithm, and based on this proposes an ant colony algorithm with adaptive dynamic window.


### 3.1. Basic Ant Colony Algorithm

Biologists have observed that ants have single and compound eyes but are unable to obtain information about their surroundings through their eyes in the natural environment, and they use their own secreted pheromones to sense changes in information about their surroundings when searching for food and thus choose their paths. Ants randomly choose unknown intersections in the environment and release pheromones in the path they take, where the change of pheromones is related to the length of the path.


### 3.2. Mathematical Model of the Basic Ant Colony Algorithm

The mathematical model of the ant colony algorithm is based on the combination of random events and the probabilistic selection of ants as they travel, shifting to surrounding points in unit steps, and the path points that have been traveled can be discarded. Assuming that the pheromone concentration of ants isτ and there are a number of m ants from the starting point to the target point in search of food, the probability that the kth ant will travel from a point i to a point j at this point in time t is pijk expressed by the following equation:
(1)pijk=τijαt.τijβt∑S∈allowedτijαt.τijβt,j∈allowedk.In Equation (1), allowedk represents the path node to be chosen by the ant next, α is the information heuristic factor, and α represents the importance of a small section of the path walked by the ant to influence the whole path taken by the ant colony. If the value of α is too large, the higher the degree of influence of the pheromone, the more ants will choose the path with the β larger value. β is the expected heuristic factor, and if β is too large, the importance of the heuristic information is better than the influence of the pheromone. The heuristic information can be interpreted as whether the ants can easily judge the selectivity of the next path node. The contraindication table 888 is used to store the path nodes selected by each ant. allowedk=C−tabuk denotes the next path node chosen by ant k.The mathematical model of the ant colony algorithm also has heuristic functions that enable the ranking of the alternatives in the search algorithm in each branch step according to the available information to decide which branch function to follow, which approximates the exact solution. It can also be understood as the degree of expectation, which in the solution path planning process is defined as:(2)ηijt=1dij,where dij is the distance from a point i to another point j.In the process of ants looking for the target point, there is a process of replacing the old pheromone with the new pheromone. The pheromone volatilization speedρ is used to adjust the pheromone update. The concept of its own speed determines the volatilization speed of pheromone on the path. The larger ρ is, the faster it will be. This regulation state is in a balance state, which neither volatilizes pheromone too fast nor makes its stock too small. The update function of pheromone is as follows:
(3)τijt+n=1−ρτijt+Δτijt,(4)Δτijt=∑k=1mΔτijt.The pheromone retained between two path nodesi, j is Δτijk and the pheromone in t is Δτijt. After another period of time n, the pheromone changes to τijt+n.


### 3.3. Basic Ant Colony Algorithm Path Planning Implementation

The steps for implementing the basic ant colony algorithm applied to path planning are as follows.(1)
Set the target point to be reached at the start point of the planning, set the basic parameters of the algorithm, the number of path nodes, etc., and initialize and establish the abstracted environment model(2)
Reset Tabu, the algorithm starts to search for the path, and then searches for the path node according to the transfer probability formula, keeps the length information from the start point of the selected node to the current path point, and determines whether the target point is reached or the node is zero; if so, the search stops. Otherwise, the search continues(3)
After one search, the pheromone on the path will be updated according to Equation (3) as a whole(4)
End the search path when the number of searches isN(5)
Output saved optimal path information and the algorithm endsThe flow chart of the algorithm is shown in Figure1.Figure 1
Algorithm flow chart.


### 3.4. An Improved Approach to the Ant Colony Algorithm

(1) Improvement based on the algorithm itself, mostly seen in parameter optimization methods, improvement methods of heuristic information, and improvement of pheromone update rules. (2) Adding ant colony types, such as parallel ant colony algorithms and sequential multi-ant colony algorithms. (3) Combining with other algorithms to become fusion algorithms.


## 3.1. Basic Ant Colony Algorithm

Biologists have observed that ants have single and compound eyes but are unable to obtain information about their surroundings through their eyes in the natural environment, and they use their own secreted pheromones to sense changes in information about their surroundings when searching for food and thus choose their paths. Ants randomly choose unknown intersections in the environment and release pheromones in the path they take, where the change of pheromones is related to the length of the path.


## 3.2. Mathematical Model of the Basic Ant Colony Algorithm

The mathematical model of the ant colony algorithm is based on the combination of random events and the probabilistic selection of ants as they travel, shifting to surrounding points in unit steps, and the path points that have been traveled can be discarded. Assuming that the pheromone concentration of ants isτ and there are a number of m ants from the starting point to the target point in search of food, the probability that the kth ant will travel from a point i to a point j at this point in time t is pijk expressed by the following equation:
(1)pijk=τijαt.τijβt∑S∈allowedτijαt.τijβt,j∈allowedk.In Equation (1), allowedk represents the path node to be chosen by the ant next, α is the information heuristic factor, and α represents the importance of a small section of the path walked by the ant to influence the whole path taken by the ant colony. If the value of α is too large, the higher the degree of influence of the pheromone, the more ants will choose the path with the β larger value. β is the expected heuristic factor, and if β is too large, the importance of the heuristic information is better than the influence of the pheromone. The heuristic information can be interpreted as whether the ants can easily judge the selectivity of the next path node. The contraindication table 888 is used to store the path nodes selected by each ant. allowedk=C−tabuk denotes the next path node chosen by ant k.The mathematical model of the ant colony algorithm also has heuristic functions that enable the ranking of the alternatives in the search algorithm in each branch step according to the available information to decide which branch function to follow, which approximates the exact solution. It can also be understood as the degree of expectation, which in the solution path planning process is defined as:(2)ηijt=1dij,where dij is the distance from a point i to another point j.In the process of ants looking for the target point, there is a process of replacing the old pheromone with the new pheromone. The pheromone volatilization speedρ is used to adjust the pheromone update. The concept of its own speed determines the volatilization speed of pheromone on the path. The larger ρ is, the faster it will be. This regulation state is in a balance state, which neither volatilizes pheromone too fast nor makes its stock too small. The update function of pheromone is as follows:
(3)τijt+n=1−ρτijt+Δτijt,(4)Δτijt=∑k=1mΔτijt.The pheromone retained between two path nodesi, j is Δτijk and the pheromone in t is Δτijt. After another period of time n, the pheromone changes to τijt+n.


## 3.3. Basic Ant Colony Algorithm Path Planning Implementation

The steps for implementing the basic ant colony algorithm applied to path planning are as follows.(1)
Set the target point to be reached at the start point of the planning, set the basic parameters of the algorithm, the number of path nodes, etc., and initialize and establish the abstracted environment model(2)
Reset Tabu, the algorithm starts to search for the path, and then searches for the path node according to the transfer probability formula, keeps the length information from the start point of the selected node to the current path point, and determines whether the target point is reached or the node is zero; if so, the search stops. Otherwise, the search continues(3)
After one search, the pheromone on the path will be updated according to Equation (3) as a whole(4)
End the search path when the number of searches isN(5)
Output saved optimal path information and the algorithm endsThe flow chart of the algorithm is shown in Figure1.Figure 1
Algorithm flow chart.


## 3.4. An Improved Approach to the Ant Colony Algorithm

(1) Improvement based on the algorithm itself, mostly seen in parameter optimization methods, improvement methods of heuristic information, and improvement of pheromone update rules. (2) Adding ant colony types, such as parallel ant colony algorithms and sequential multi-ant colony algorithms. (3) Combining with other algorithms to become fusion algorithms.


## 4. Design of Adaptive Dynamic Window Ant Colony Algorithm

There are two methods of path avoidance planning due to sudden obstacles: the first case is to discard all the previously planned paths offline when facing sudden obstacles, and plan a new path from the location to the target point again. In the other case, only the local replanning is carried out within the set range, and after avoiding the obstacles, a suitable path point is chosen nearby to fly back to the previously set path point. Since the global planning effect of ant colony algorithm is good, the Lupin performance is strong, and it is easy to combine with other methods; this paper integrates the advantages of the above two methods and adopts the dynamic window area within the ant colony algorithm replacing—discard the original path—the idea of “outputting the local optimal point and using the secondary planning of ACOA to the target point” is adopted to make full use of the advantage of global planning of ACOA.


### 4.1. Design of Adaptive Dynamic Windows

Based on the analysis of the shortcomings of the general traditional dynamic window method, an adaptive dynamic window is designed in this section, and the specific design process is as follows.(1)
Choosing a suitable window can enable the computational power to be improved and the optimization-seeking effect to meet the real-time UAV path planning. The purpose of automatically adjusting the size of the dynamic window is to ensure that the UAV avoids obstacles while meeting the flight speed, the algorithm takes less time, the planning effect is good, and the UAV completes replanning before reaching a new path point(2)
The determination of the adaptive dynamic window boundary, assuming that the UAV flight process advances according to the unit distance, the determination of the window size is based on the UAV as the starting point, and the determination of the adaptive window boundary4w2 is the distance from the window determination point, i.e., the starting point for local planning, to the local optimal point in the process of local path planning. In general, the dynamic window boundary is fixed. The smaller the window boundary is, the better the path planning is in real time. The adaptive dynamic window takes a range of 0,4w2, where 4w2 represents the range of the area that can be covered by the dynamic window. When using the adaptive dynamic window method, w can be taken to any finite value in the covered subregion. The specific scheme is as followsIn the path planning process, the flight area is divided into a100∗100 raster with three dynamic windows of different sizes are large window 4∗10∗10, medium window 4∗7.5∗7.5, and small window 4∗5∗5. The size of the dynamic window is determined based on the maximization probability and minimization probability. The range of the windows is shown in Figure 2.Figure 2
Window creation and division.The yellow box indicates the small window range, and the yellow triangle represents the current position of the drone. Similarly, the orange window indicates the medium window range, the blue box indicates the large window range, and the triangle is the position of the drone.As shown in Figure3, the adaptive dynamic window selection process is: the initialized window detects new obstacles as it moves with the UAV and determines the replaced dynamic window based on the proportion of the range of the obstacle grid occupying the initial dynamic window, and the size of the dynamic window is constant from the beginning after the optimal local path point is replaced. As the UAV travels to the next path point, a new window is determined. In the window division diagram, the total number of unit grids in the area covered by the yellow box is 100; the number of unit grids in the blue box is 400, and the percentage of obstacles is 0.25 and 0.5. Based on the principle of maximum and minimum probability, a large window is selected when, a medium window is selected when, and a small window is selected when. Where is the upper threshold of the dynamic window, which means that the obstacle cannot occupy the dynamic window completely in the planning, and the UAV has replanned to avoid the obstacle in advance before the obstacle occupies the window completely. When the obstacle occupancy ratio reaches the threshold value, the dynamic window range will be enlarged to the upper limit.Figure 3
Adaptive dynamic window determination rules.


### 4.2. UAV Path Cost Function Design

Firstly, the UAV flight range needs to be rationalized and the path cost function needs to be determined in the UAV path planning. The design of the cost function is good or bad, which determines whether a flight path with less loss can be planned. In this paper, the path cost function should be described as the calculation of the cost function in a weighted manner according to the shortest travel of the path and the path that can be explored in the window to be able to replan. The UAV calculates the path cost of two adjacent points during the flight and then sums the whole path of each section of the city. Its cost function is as follows:(5)F=∑i,j∈NNλ·cfij+1−λ.ctij.All the path points in this path areN, λ is the weight factor, cfij is the path of adjacent points i, j, and ctij is the threat cost of the path between the nodes of all adjacent two points i, j. The threat cost of a path edge is:
(6)ctij=1/minl1,l2,l3,⋯,lend,where l1,l2,l3,⋯,lend is the distance from the path point to the center of the obstacle.


### 4.3. Double Pheromone Update Rule

To improve the ability of the algorithm to find the global optimal solution, a dual pheromone update strategy is used in this paper.In the basic ant colony algorithm, the size of the pheromone concentration residual factorρ has a large impact on the algorithm’s ability to find the optimal solution, especially when the algorithm proceeds to a certain level. If a larger value is set, the algorithm will find the nonoptimal solution faster, i.e., it will select the path nodes that have been searched before. If the value is set to a smaller value, the pheromone concentration decreases rapidly, so that many path nodes are not selected and the optimal path is not found.Therefore, in this paper, when designing the pheromone concentration update rule, the residual factorρ is set within a certain range between the high and low threshold values to avoid the phenomenon of “premature” nonoptimal solutions found too early by the ant colony algorithm. The pheromone update rule combines the variable range of pheromone concentration with the local information of the ratio of maximum and minimum paths in each iteration to achieve the purpose of combining the whole and the part and to improve the algorithm’s ability and speed of finding the best solution. The pheromone concentration update rule is as follows:
(7)τijt+n=ρminτijt+Δτijt+dmax/dmin,τijt>τmaxτijt+n=ρτijt+Δτijt+dmax/dmin,τmint<τt<τmaxτijt+n=ρmaxτijt+Δτijt+dmax/dmin,τijt<τmax,where dmax denotes the longest path in which the algorithm performs the optimal solution process at one time and dmin denotes the shortest distance. τmax is the maximum value of pheromone concentration on the path and τmin is the minimum value of pheromone concentration.


### 4.4. Algorithm Implementation Flow

The flow chart of the adaptive dynamic window-based ant colony planning algorithm is shown above, with the following operational steps.(1)
Determine the departure position of the UAV, as well as the global path with known environmental information(2)
Initialize the dynamic window and determine its initial value as4∗10∗10(3)
The UAV flies according to the path point and judges whether the newly discovered obstacles have intersection with the global path according to the window range; if not, it continues to fly according to the original planned path. If there is, the window range is replanned according to the adaptive dynamic window determination rule(4)
Call the improved ant colony algorithm to output the optimal local path (see Figure4 for the steps of the improved ant colony algorithm).(5)
Update the local path to pass, i.e., ensure that the UAV avoids the obstacle. The drone flies according to the updated path(6)
Determine whether the final target point is reached; if not, return to step (3). If yes, output the updated pathFigure 4
Flow chart of improved ant colony algorithm based on adaptive dynamic window.


## 4.1. Design of Adaptive Dynamic Windows

Based on the analysis of the shortcomings of the general traditional dynamic window method, an adaptive dynamic window is designed in this section, and the specific design process is as follows.(1)
Choosing a suitable window can enable the computational power to be improved and the optimization-seeking effect to meet the real-time UAV path planning. The purpose of automatically adjusting the size of the dynamic window is to ensure that the UAV avoids obstacles while meeting the flight speed, the algorithm takes less time, the planning effect is good, and the UAV completes replanning before reaching a new path point(2)
The determination of the adaptive dynamic window boundary, assuming that the UAV flight process advances according to the unit distance, the determination of the window size is based on the UAV as the starting point, and the determination of the adaptive window boundary4w2 is the distance from the window determination point, i.e., the starting point for local planning, to the local optimal point in the process of local path planning. In general, the dynamic window boundary is fixed. The smaller the window boundary is, the better the path planning is in real time. The adaptive dynamic window takes a range of 0,4w2, where 4w2 represents the range of the area that can be covered by the dynamic window. When using the adaptive dynamic window method, w can be taken to any finite value in the covered subregion. The specific scheme is as followsIn the path planning process, the flight area is divided into a100∗100 raster with three dynamic windows of different sizes are large window 4∗10∗10, medium window 4∗7.5∗7.5, and small window 4∗5∗5. The size of the dynamic window is determined based on the maximization probability and minimization probability. The range of the windows is shown in Figure 2.Figure 2
Window creation and division.The yellow box indicates the small window range, and the yellow triangle represents the current position of the drone. Similarly, the orange window indicates the medium window range, the blue box indicates the large window range, and the triangle is the position of the drone.As shown in Figure3, the adaptive dynamic window selection process is: the initialized window detects new obstacles as it moves with the UAV and determines the replaced dynamic window based on the proportion of the range of the obstacle grid occupying the initial dynamic window, and the size of the dynamic window is constant from the beginning after the optimal local path point is replaced. As the UAV travels to the next path point, a new window is determined. In the window division diagram, the total number of unit grids in the area covered by the yellow box is 100; the number of unit grids in the blue box is 400, and the percentage of obstacles is 0.25 and 0.5. Based on the principle of maximum and minimum probability, a large window is selected when, a medium window is selected when, and a small window is selected when. Where is the upper threshold of the dynamic window, which means that the obstacle cannot occupy the dynamic window completely in the planning, and the UAV has replanned to avoid the obstacle in advance before the obstacle occupies the window completely. When the obstacle occupancy ratio reaches the threshold value, the dynamic window range will be enlarged to the upper limit.Figure 3
Adaptive dynamic window determination rules.


## 4.2. UAV Path Cost Function Design

Firstly, the UAV flight range needs to be rationalized and the path cost function needs to be determined in the UAV path planning. The design of the cost function is good or bad, which determines whether a flight path with less loss can be planned. In this paper, the path cost function should be described as the calculation of the cost function in a weighted manner according to the shortest travel of the path and the path that can be explored in the window to be able to replan. The UAV calculates the path cost of two adjacent points during the flight and then sums the whole path of each section of the city. Its cost function is as follows:(5)F=∑i,j∈NNλ·cfij+1−λ.ctij.All the path points in this path areN, λ is the weight factor, cfij is the path of adjacent points i, j, and ctij is the threat cost of the path between the nodes of all adjacent two points i, j. The threat cost of a path edge is:
(6)ctij=1/minl1,l2,l3,⋯,lend,where l1,l2,l3,⋯,lend is the distance from the path point to the center of the obstacle.


## 4.3. Double Pheromone Update Rule

To improve the ability of the algorithm to find the global optimal solution, a dual pheromone update strategy is used in this paper.In the basic ant colony algorithm, the size of the pheromone concentration residual factorρ has a large impact on the algorithm’s ability to find the optimal solution, especially when the algorithm proceeds to a certain level. If a larger value is set, the algorithm will find the nonoptimal solution faster, i.e., it will select the path nodes that have been searched before. If the value is set to a smaller value, the pheromone concentration decreases rapidly, so that many path nodes are not selected and the optimal path is not found.Therefore, in this paper, when designing the pheromone concentration update rule, the residual factorρ is set within a certain range between the high and low threshold values to avoid the phenomenon of “premature” nonoptimal solutions found too early by the ant colony algorithm. The pheromone update rule combines the variable range of pheromone concentration with the local information of the ratio of maximum and minimum paths in each iteration to achieve the purpose of combining the whole and the part and to improve the algorithm’s ability and speed of finding the best solution. The pheromone concentration update rule is as follows:
(7)τijt+n=ρminτijt+Δτijt+dmax/dmin,τijt>τmaxτijt+n=ρτijt+Δτijt+dmax/dmin,τmint<τt<τmaxτijt+n=ρmaxτijt+Δτijt+dmax/dmin,τijt<τmax,where dmax denotes the longest path in which the algorithm performs the optimal solution process at one time and dmin denotes the shortest distance. τmax is the maximum value of pheromone concentration on the path and τmin is the minimum value of pheromone concentration.


## 4.4. Algorithm Implementation Flow

The flow chart of the adaptive dynamic window-based ant colony planning algorithm is shown above, with the following operational steps.(1)
Determine the departure position of the UAV, as well as the global path with known environmental information(2)
Initialize the dynamic window and determine its initial value as4∗10∗10(3)
The UAV flies according to the path point and judges whether the newly discovered obstacles have intersection with the global path according to the window range; if not, it continues to fly according to the original planned path. If there is, the window range is replanned according to the adaptive dynamic window determination rule(4)
Call the improved ant colony algorithm to output the optimal local path (see Figure4 for the steps of the improved ant colony algorithm).(5)
Update the local path to pass, i.e., ensure that the UAV avoids the obstacle. The drone flies according to the updated path(6)
Determine whether the final target point is reached; if not, return to step (3). If yes, output the updated pathFigure 4
Flow chart of improved ant colony algorithm based on adaptive dynamic window.


## 5. Simulation Experiments and Results Analysis

The experimental simulation environment of this paper is MATLAB2019b and the system environment is Windows 7. In order to visually simulate the real-time replanning process of UAV, this paper calls the range Sensor module in MATLAB Navigation Toolbox to simulate the dynamic window, whose detectable range is 0-20 unit distances and the detecting range is adjustable (simulating adaptive window). The maximum horizontal detection angle is−π,π. The flight environment is simulated by setting up a 100∗100 grid map with distance units in meters. Set up the flight environment as shown in Figure 5.Figure 5
Initial map.The Matlab real-time dynamic reprogramming simulation process is shown in Figure6.Figure 6
Matlab real-time simulation process diagram.The path has been planned in the simulation environment. When the number of newly discovered obstacles is 1, the simulation result is shown in Figure7.Figure 7
Simulation results of path replanning for a single sudden obstacle.
(a)
The number of newly detected obstacles is 1(b)
UAV replanning pathWhen the number of newly detected obstacles is 2, the simulation results are shown in Figure8.Figure 8
Simulation results of path replanning with the number of sudden obstacles being 2.
(a)
The number of newly detected obstacles is 2(b)
The UAV replans its pathWhen the number of newly detected obstacles is 3, the simulation result is shown in Figure9.Figure 9
Simulation results of path replanning with the number of sudden obstacles being 3.
(a)
The number of new obstacle detections is 3(b)
Replanning the path 3In Figures7–9, obstacles are marked with orange boxes, and orange solid lines represent the replacement path of real-time update recorded in the case of sudden obstacles. It can be seen that the real-time replanning paths are less in the case of the number of burst obstacles is 1. As the number of burst obstacles increases, the real-time replacing paths gradually increase and are denser when they are close to the obstacles, indicating that the adaptive window ant colony algorithm can be applied to dynamic path replacing.Table1 shows that the number of planning increases with increasing obstacles and the time consumed by the algorithm increases. As mentioned in the previous section, the purpose of this paper is to improve the replanting effect and make the time-consuming decrease. The data show that the ACO with adaptive window can obtain a better replacing path under the condition of reasonable obstacle avoidance of the UAV, i.e., the final output replacing path is shorter and the replanting times are less, i.e., the algorithm is better than the ACO with fixed window in terms of time consumption.Table 1
Comparison of the results of different methods under the same initial conditions.
ProjectNumber of sudden obstaclesNumber of replanningOptimal replanning path length (m)Simulation run timeUse fixed window12132.56915.25687Ant colony25150.08927.54623Replanning38161.25837.26534Adaptive window11125.60513.82569Ant colony22136.78925.59299Replanning34145.14032.45474


## 6. Conclusions

In this paper, UAV real-time path replanning problem in the case of sudden obstacles in a two-dimensional environment is studied. The principle, model, and application of ant colony algorithm are analyzed. On this basis, the adaptive dynamic window ant colony algorithm is proposed, and the adaptive dynamic window method is designed; the heuristic function of adding obstacle detection factors and the double pheromone update strategy are made to the ant colony algorithm, and the improved ant colony algorithm is used to replan the path within the dynamic window that can be automatically adjusted to achieve the purpose of obstacle avoidance. A real-time simulation experiment of path planning was conducted by constructing an environment map in the matter. The simulation results show that the UAV has a strong path-replacing capability under sudden obstacle conditions, and the time consumption is short.



---

*Source: 1299434-2022-07-07.xml*