# An Improved Ant Colony Algorithm of Robot Path Planning for Obstacle Avoidance

Authors: Hong-Jun Wang; Yong Fu; Zhuo-Qun Zhao; You-Jun Yue
Journal: Journal of Robotics
 (2019)

---

## Abstract

The obstacle avoidance in path planning, a hot topic in mobile robot control, has been extensively investigated. The existing ant colony algorithms, however, remain as drawbacks including failing to cope with narrow aisles in working areas, large amount of calculation, etc. To address above technical issues, an improved ant colony algorithm is proposed for path planning. In this paper, a new weighted adjacency matrix is presented to determine the walking direction and the narrow aisles therefore are avoided by redesigning the walking rules. Also, the best ant and the worst ant are introduced for the adjustment of pheromone to facilitate the searching process. The proposed algorithm guarantees that robots are able to find a satisfying path in the presence of narrow aisles. The simulation results show the effectiveness of the proposed algorithm.


---

## Body

## 1. Introduction

The past decades have witnessed a rapid development of the robot control. Nowadays, robots are expected to be capable of various tasks, e.g., collecting the environmental information, avoiding obstacles accurately, fast path planning, etc. At the aspect of path planning, much of work concentrates on artificial potential field method [1], ant colony algorithm [2], and genetic algorithm [3]. Aiming at the convergence speed of ant colony algorithm and the problem of easy to fall into local optimum, [4] proposes to add artificial local potential optimization algorithm for specific problems in the ant colony algorithm search process, which reduces the blindness of ant colony algorithm and enhances search capabilities. Reference [5] adds the local path information in the environment to initialize pheromone and path selection probability and the convergence of the algorithm is improved and the premature of algorithm is overcome. In [6], a new dynamic search inducing factor is proposed to change the performance of the ant colony algorithm. The dynamic search model improves the quality of the optimal solution as well as increases the convergence speed of the algorithm. Reference [7] proposes adaptive model and the evolution strategy of the survival of the fittest are introduced on the basis of max-min ant system to achieve parameter adjustment and pheromone update, which accelerates the convergence speed of the algorithm. Reviewing existing literature, in spite of the considerable achievement of the ant colony algorithm in dealing with path planning, one may notice that some flaws remain, including exponential explosion [8] and failure of bypassing narrow aisle [9]. The exponential explosion refers to the fact that the fine grid division exponentially increases the search range, resulting in a time-consuming calculation. Some articles simply regard robots as a mass point in absence of the consideration of narrow aisles. The problem of narrow aisles refers to the fact that the robot cannot pass through the narrow aisle due to the limitation of its own volume, rigid structure, and trajectory. To address the problem, some articles propose the approaches of environment map reconstruction, where an obstacle is intentionally mapped to occupy one or more grids. Specifically, if it is less than one grid, it is counted as one grid. It is also proposed to extend the boundary of the obstacle outward to the appropriate size [7, 10]. The approaches of map construction are reasonably effective except some drawbacks. It is reported that when the distance between two obstacles is larger than the width of the robot and less than twice width of it, the simulated path works well. When two obstacles, however, are close to each other and the actual distance is less than or equal to the width of the robot itself, the simulation path is invalid. Alternatively, the approach of detours is proposed. Reference [9] constructs a grid map by expanding the obstacle outward, and accordingly the obstacles is avoided by the mean of right-angle bypass and diagonal travel. The approach of right-angle bypass essentially is to stay away from obstacles by walking between the centers of the safety grid only. Reference [11] expands the outward in six selectable directions: up, down, left, right, bottom left, and top right. In these six directions, the robot prefers to move forward obliquely [12, 13]. According to the different positions of the obstacles, the corresponding modes of bypass are defined, respectively. Although both of the methods are aiming at bypassing the narrow aisle, the performance is of conservativeness. It can be observed that planned paths by these methods are relatively long. How to reduce the overall length of paths while effectively avoiding narrow aisles motivates the investigation of this paper. In this paper, the directions of motion of a robot are expanded to eight and the movement direction of the robot is analyzed for different positions, an improved ant colony algorithm is proposed by setting new walking rules.The contribution of this paper can be summarized as the following aspects. (a) The outwards of grids are extended to eight directions for a better path plan. (b) The new walking rules were proposed for bypassing the narrow aisle. (c) The amount of calculation is reduced by proposing analytical calculation method.


## 2. The Basic Principle of the Algorithm

### 2.1. Grid-Based Environment Map Modeling

In order to accurately collect the environment and detect the narrow aisle, the 2D-SDF-SLAM method proposed in [14] is used to construct the map, which can obtain the environmental shape information and ensure the accuracy of the result. The safe zone and the danger zone are defined in the grids, where the safe zones are represented by the areas without the obstacle and the danger zones are represented by the obstacles [15]. When the grid is plotted in rectangular coordinates, the black area represents the crop growing area (dangerous area) and the white area represents the open area (safe area). The grid center coordinate of the dangerous area (black part) is the center point of an obstacle, and the grid center point of safe area (white part) is the feasible path point of the robot [16].


### 2.2. Environmental Formulation

It is well-known that the distribution of obstacles determines the trafficability for a robot, which is easily clarified in Figure1. It is observed that the distributions A, B, and C guarantee the high trafficability of one robot. However, the distribution D is the case with a quite narrow aisle for a robot bypassing, which means the low trafficability.Figure 1
Obstacle distribution.
(a) (b) (c) (d)From a global perspective, the position of the robot in the grid is different as well as the direction. Typically, the positions can be categorized into the nine different cases as Figure2 shows.Figure 2
Global motion direction.According to the positions, the motion of a robot is subdivided into different directions, which eliminates unnecessary calculations and accelerates the searching process.


## 2.1. Grid-Based Environment Map Modeling

In order to accurately collect the environment and detect the narrow aisle, the 2D-SDF-SLAM method proposed in [14] is used to construct the map, which can obtain the environmental shape information and ensure the accuracy of the result. The safe zone and the danger zone are defined in the grids, where the safe zones are represented by the areas without the obstacle and the danger zones are represented by the obstacles [15]. When the grid is plotted in rectangular coordinates, the black area represents the crop growing area (dangerous area) and the white area represents the open area (safe area). The grid center coordinate of the dangerous area (black part) is the center point of an obstacle, and the grid center point of safe area (white part) is the feasible path point of the robot [16].


## 2.2. Environmental Formulation

It is well-known that the distribution of obstacles determines the trafficability for a robot, which is easily clarified in Figure1. It is observed that the distributions A, B, and C guarantee the high trafficability of one robot. However, the distribution D is the case with a quite narrow aisle for a robot bypassing, which means the low trafficability.Figure 1
Obstacle distribution.
(a) (b) (c) (d)From a global perspective, the position of the robot in the grid is different as well as the direction. Typically, the positions can be categorized into the nine different cases as Figure2 shows.Figure 2
Global motion direction.According to the positions, the motion of a robot is subdivided into different directions, which eliminates unnecessary calculations and accelerates the searching process.


## 3. The Improved Ant Colony Algorithm

### 3.1. The Walking Rules

As aforementioned, there exist difficulties in the existing ant colony algorithms of searching a satisfying path when it has a narrow aisle only to get through. The solution will be presented in this subsection, which follows the following two steps.Step 1.
Consider that the directions of a robot’s motion are eight: the upper left, the lower left, the upper right, the lower right, upper, lower, left, and right.(1)im+jn=1(2)im=1jn=1i represents the coordinates of the current grid on X-axis, andj represents the coordinates of the current grid on Y-axis. In order to calculate the distance between arbitrarily two grids,m represents the coordinates of the surrounding grid on X-axis, and n represents the coordinates of the surrounding grid on Y-axis. When the condition (1) is satisfied, the direction of the next motion will be the upper, or lower, or left, or right directions. When condition (2) holds, it will be the upper left, lower left, upper right, or lower right directions.In Figure3,im represents the distance of arbitrarily two grids on X-axis andjn represents the distance of arbitrarily two grids on Y-axis. When the two safety grids are side by side, the lateral distanceim is 1 and the longitudinal distancejn is 0; when the two safety grids are juxtaposed, the lateral distanceim is 0; the longitudinal distancejn is 1; if the two safety grids are diagonal, the lateral distanceim is 1, and the longitudinal distancejn is 1. Both distances are 0.Figure 3
The distance between two grids on the X-axis and Y-axis.Step 2.
According to the robot's eight directions of motion [17], we may mark the eight directions of the current grid, see Figure 4, and distinguish the narrow aisle according to formulas (3), (4), (5), and (6). Then we may calculate the distance in each direction.Figure 4
An ant’s current position with 8 possibly positions for next.The following equations give the criteria for the existence of narrow aisle:(3)Gm,n-1≠1∥Gm-1,n≠1(4)Gm,n-1≠1∥Gm+1,n≠1(5)Gm,n+1≠1∥Gm+1,n≠1(6)Gm,n+1≠1∥Gm-1,n≠1where the scalarG(m,n)∈R denotes an indicator of obstacles which is also an element in the environmental matrix. It indicates an obstacle, when its value is 1; it equals 0, otherwise.When the condition in (3) is met, it shows that a narrow aisle is in the upper left direction. Likewise, the condition in (4) is corresponding to the lower left; (5) is corresponding to the right lower; (6) is corresponding to the upper right.


### 3.2. The Global Motion Direction

For the ant colony algorithm path planning based on raster graph, there is an exponential explosion problem when calculating the weighted adjacency matrix, and the meaning of the weighted adjacency matrix is too single. To address the problem, this paper proposes an analytical calculation method to optimize. Compared with the previous method, the proposed method is more flexible, and different walking principles can be defined according to the requirements and it is also possible to process and calculate the higher precision grid in the same time.As aforementioned, with the 9 different positions, the movements of the robot are formulated respectively. For instance, the robot at the position 5 possesses eight different directions of motion. According to Figure1, it can be seen that narrow aisle may appear in the upper left, upper right, lower left, and lower right directions. When (3)-(6) is true, it means there is no narrow aisle around; and otherwise a narrow aisle exists. By this mean, the narrow aisle and the nonnarrow aisle are easily identified.To calculate the distance between adjacent two safety grids in raster, the following equation is necessary:(7)Di-1∗l+j,m-1∗l+n=im2+jn20.5,where matrix D is used to store the distance between the grids; l represents the size of the environment matrix. The right side of (7) is the distance formula, and the left side is the new additive group adjacency matrix, where the horizontal and vertical coordinates of the matrix represent a grid of the environmental matrix defined by the numbering method.


### 3.3. Design of the Heuristic Function

It is a common knowledge that, in the basic ant colony algorithm, the direction of the next step is locally solved without the consideration of the overall information. As a result, it yields the locally optimal solution rather than the globally optimal solution.In order to use the global information, the objective guidance factor is introduced into the heuristic function. The probability of robot-k from the grid-i to grid-j can be obtained by(8)pijk=τijtαηijtβλjotγ∑k∈N-Tabukτijtαηijtβλjotγ,j∈N-Tabuk0,otherwhereτij(t) denotes pheromone concentration on the path(i,j) at time t;ηij denotes the visibility to from grid-i to grid-j;λjo denotes the grid-j proceeds to the extent desired target point o; α denotes the information heuristic factor coefficient; β denotes the expected heuristic factor coefficient; γ denotes the guiding factor coefficient;Tabuk denotes the Tabu list of ant-k. For more information about the Tabu list, see [18]. {N-Tabuk} represents a collection of grids that ant-k can currently select, whereN represents a collection of all rasters [19].The objective guidance factor is obtained by to the ant in the path planning process, according to the current position from the global direction of the next step. The formula of the target guidance factor is obtained by(9)λjo=1SjowhereSjo represents the shortest safe distance between the current grid-j and the target grid-o, obtained by searching for a new weighted adjacency matrixD.λjo represents the reciprocal of the shortest safe distance between the current grid and the target grid. The larger the shortest safe distance is, the smaller the guidance factor is, the smaller the shortest safe distance is, the larger the guidance factor is, and the greater the possibility of selection is.


### 3.4. Design of the Optimal Worst Pheromone Update Function

In the process of the path searching, pheromones on the path will not only volatilize and decrease with time but also increase with the number of ants passing through the path. Because the pheromone in the ant colony algorithm is affected by all the ants, many ants have an impact on pheromone updating, which will accelerate the evolution process and accelerate the search speed. Therefore, pheromone updating function is designed, as shown in formulas (10), (11), and (12).(10)τi,j=1-ρτi,j∗τi,j+ψi,j∗Δτi,j(11)ψi,j=Q,i,j∈Globaloptimum-Q,i,j∈Globalworst0,i,j∈other(12)Δτi,j=lgb-1,i,j∈Globaloptimumlgw-1,i,j∈Globalworst whereρ(τ(i,j)) is the global pheromone volatilization coefficient;lgb is the length of the best path of the robot;lgw is the length of the worst path taken by the ant; andQ is the pheromone increasing strength.


### 3.5. The Flow of the Proposed Algorithm

Specifically, the steps of the improved ant colony algorithm can be concluded as follows.Step 1.
Collect the environment information and get the grid map of the environment. Then, set the starting point and the ending point; initialize the ant colony parameters.Step 2.
From (1)-(6), determine the current location and whether there is a narrow aisle around the grid.Step 3.
Calculate the distance between all the grids and the surrounding grids according to the different positions of the grids in Figure2 and the corresponding walking rules and construct a new weighted adjacency matrix.Step 4.
Set m ants at the start and choose the next node-j basing on the distance of the new weighted adjacency matrix with the pheromone distribution in different positions in Figure2.Step 5.
Add node-j into the Tabu list of ant-k.Step 6.
Repeat Steps 4 to 5. The ant reaches the target point, and saves the pathrouth (n, m) and the path length (n, m) of each ant, from which the optimal pathrouth (n,m) and the optimal path length (length) are selected, and the average path length average_n. of m ants in this cycle is calculated.Step 7.
Update path pheromones according to formula (10), (11), and (12).Step 8.
Determine whether the algorithm reaches the maximum number of iterations, then the algorithm terminates and outputs the optimal path routh_best, otherwise repeat Steps 3 to 7.The flowchart of the improved ant colony algorithm path planning is shown in Figure5.Figure 5
Algorithm flowchart.


## 3.1. The Walking Rules

As aforementioned, there exist difficulties in the existing ant colony algorithms of searching a satisfying path when it has a narrow aisle only to get through. The solution will be presented in this subsection, which follows the following two steps.Step 1.
Consider that the directions of a robot’s motion are eight: the upper left, the lower left, the upper right, the lower right, upper, lower, left, and right.(1)im+jn=1(2)im=1jn=1i represents the coordinates of the current grid on X-axis, andj represents the coordinates of the current grid on Y-axis. In order to calculate the distance between arbitrarily two grids,m represents the coordinates of the surrounding grid on X-axis, and n represents the coordinates of the surrounding grid on Y-axis. When the condition (1) is satisfied, the direction of the next motion will be the upper, or lower, or left, or right directions. When condition (2) holds, it will be the upper left, lower left, upper right, or lower right directions.In Figure3,im represents the distance of arbitrarily two grids on X-axis andjn represents the distance of arbitrarily two grids on Y-axis. When the two safety grids are side by side, the lateral distanceim is 1 and the longitudinal distancejn is 0; when the two safety grids are juxtaposed, the lateral distanceim is 0; the longitudinal distancejn is 1; if the two safety grids are diagonal, the lateral distanceim is 1, and the longitudinal distancejn is 1. Both distances are 0.Figure 3
The distance between two grids on the X-axis and Y-axis.Step 2.
According to the robot's eight directions of motion [17], we may mark the eight directions of the current grid, see Figure 4, and distinguish the narrow aisle according to formulas (3), (4), (5), and (6). Then we may calculate the distance in each direction.Figure 4
An ant’s current position with 8 possibly positions for next.The following equations give the criteria for the existence of narrow aisle:(3)Gm,n-1≠1∥Gm-1,n≠1(4)Gm,n-1≠1∥Gm+1,n≠1(5)Gm,n+1≠1∥Gm+1,n≠1(6)Gm,n+1≠1∥Gm-1,n≠1where the scalarG(m,n)∈R denotes an indicator of obstacles which is also an element in the environmental matrix. It indicates an obstacle, when its value is 1; it equals 0, otherwise.When the condition in (3) is met, it shows that a narrow aisle is in the upper left direction. Likewise, the condition in (4) is corresponding to the lower left; (5) is corresponding to the right lower; (6) is corresponding to the upper right.


## 3.2. The Global Motion Direction

For the ant colony algorithm path planning based on raster graph, there is an exponential explosion problem when calculating the weighted adjacency matrix, and the meaning of the weighted adjacency matrix is too single. To address the problem, this paper proposes an analytical calculation method to optimize. Compared with the previous method, the proposed method is more flexible, and different walking principles can be defined according to the requirements and it is also possible to process and calculate the higher precision grid in the same time.As aforementioned, with the 9 different positions, the movements of the robot are formulated respectively. For instance, the robot at the position 5 possesses eight different directions of motion. According to Figure1, it can be seen that narrow aisle may appear in the upper left, upper right, lower left, and lower right directions. When (3)-(6) is true, it means there is no narrow aisle around; and otherwise a narrow aisle exists. By this mean, the narrow aisle and the nonnarrow aisle are easily identified.To calculate the distance between adjacent two safety grids in raster, the following equation is necessary:(7)Di-1∗l+j,m-1∗l+n=im2+jn20.5,where matrix D is used to store the distance between the grids; l represents the size of the environment matrix. The right side of (7) is the distance formula, and the left side is the new additive group adjacency matrix, where the horizontal and vertical coordinates of the matrix represent a grid of the environmental matrix defined by the numbering method.


## 3.3. Design of the Heuristic Function

It is a common knowledge that, in the basic ant colony algorithm, the direction of the next step is locally solved without the consideration of the overall information. As a result, it yields the locally optimal solution rather than the globally optimal solution.In order to use the global information, the objective guidance factor is introduced into the heuristic function. The probability of robot-k from the grid-i to grid-j can be obtained by(8)pijk=τijtαηijtβλjotγ∑k∈N-Tabukτijtαηijtβλjotγ,j∈N-Tabuk0,otherwhereτij(t) denotes pheromone concentration on the path(i,j) at time t;ηij denotes the visibility to from grid-i to grid-j;λjo denotes the grid-j proceeds to the extent desired target point o; α denotes the information heuristic factor coefficient; β denotes the expected heuristic factor coefficient; γ denotes the guiding factor coefficient;Tabuk denotes the Tabu list of ant-k. For more information about the Tabu list, see [18]. {N-Tabuk} represents a collection of grids that ant-k can currently select, whereN represents a collection of all rasters [19].The objective guidance factor is obtained by to the ant in the path planning process, according to the current position from the global direction of the next step. The formula of the target guidance factor is obtained by(9)λjo=1SjowhereSjo represents the shortest safe distance between the current grid-j and the target grid-o, obtained by searching for a new weighted adjacency matrixD.λjo represents the reciprocal of the shortest safe distance between the current grid and the target grid. The larger the shortest safe distance is, the smaller the guidance factor is, the smaller the shortest safe distance is, the larger the guidance factor is, and the greater the possibility of selection is.


## 3.4. Design of the Optimal Worst Pheromone Update Function

In the process of the path searching, pheromones on the path will not only volatilize and decrease with time but also increase with the number of ants passing through the path. Because the pheromone in the ant colony algorithm is affected by all the ants, many ants have an impact on pheromone updating, which will accelerate the evolution process and accelerate the search speed. Therefore, pheromone updating function is designed, as shown in formulas (10), (11), and (12).(10)τi,j=1-ρτi,j∗τi,j+ψi,j∗Δτi,j(11)ψi,j=Q,i,j∈Globaloptimum-Q,i,j∈Globalworst0,i,j∈other(12)Δτi,j=lgb-1,i,j∈Globaloptimumlgw-1,i,j∈Globalworst whereρ(τ(i,j)) is the global pheromone volatilization coefficient;lgb is the length of the best path of the robot;lgw is the length of the worst path taken by the ant; andQ is the pheromone increasing strength.


## 3.5. The Flow of the Proposed Algorithm

Specifically, the steps of the improved ant colony algorithm can be concluded as follows.Step 1.
Collect the environment information and get the grid map of the environment. Then, set the starting point and the ending point; initialize the ant colony parameters.Step 2.
From (1)-(6), determine the current location and whether there is a narrow aisle around the grid.Step 3.
Calculate the distance between all the grids and the surrounding grids according to the different positions of the grids in Figure2 and the corresponding walking rules and construct a new weighted adjacency matrix.Step 4.
Set m ants at the start and choose the next node-j basing on the distance of the new weighted adjacency matrix with the pheromone distribution in different positions in Figure2.Step 5.
Add node-j into the Tabu list of ant-k.Step 6.
Repeat Steps 4 to 5. The ant reaches the target point, and saves the pathrouth (n, m) and the path length (n, m) of each ant, from which the optimal pathrouth (n,m) and the optimal path length (length) are selected, and the average path length average_n. of m ants in this cycle is calculated.Step 7.
Update path pheromones according to formula (10), (11), and (12).Step 8.
Determine whether the algorithm reaches the maximum number of iterations, then the algorithm terminates and outputs the optimal path routh_best, otherwise repeat Steps 3 to 7.The flowchart of the improved ant colony algorithm path planning is shown in Figure5.Figure 5
Algorithm flowchart.


## 4. The Simulation Result

To verify the effectiveness and superiority of the proposed algorithm, the following simulation is conducted by Matlab platform. In this simulation, the number of robots per generation,M, is set to be 30; the iterating time K=200; besides parameters in (8, 11) are set to be α=1, β=7, ρ=0.43, γ=3, and Q=100. The considered surrounding in this simulation is with a narrow aisle.The simulation results are shown in Figures6–9. It can be observed from Figure 6(a) that three paths generated by three different algorithms are different in the same environment with narrow aisle. Through the comparison of the proposed algorithm and its counterpart in [7], one may see that the path planned by the method of this paper bypasses two narrow aisles and reaches the target point, but [7] fails to avoid the narrow aisles. Compared with [11], both paths of the proposed method and [11] avoid narrow aisles but the former is relatively short.Figure 6
Results of path planning.
(a)
Path planning contrast (b)
Comparison of convergence curves of path planningFigure 7
Results of path planning.
(a)
Path planning contrast (b)
Comparison of convergence curves of path planningFigure 8
Results of path planning.
(a)
Path planning contrast (b)
Comparison of convergence curves of path planningFigure 9
Comparison of the time cost by the analytical approach and the global approach.For the comparison of the convergence speed, two working environments without narrow aisle are chosen. From Figure7, one may see that the path of the three algorithms is basically the same in Figure 7(a) graph. From Figure 7(b), however, it can be observed that the proposed algorithm converges around the point of 20 generations. The algorithm of [7] converges around 40-generation and [11] around 30 -generation. Based on the simulation, one may conclude that the convergence of the proposed algorithm is faster than the counterparts in the [7, 11].Besides, the environment used in [7] is also employed for simulation. Figure 8(a) shows that the paths generated by the proposed algorithm and [11] are identical. The convergence speeds of them, however, are different; the former is faster which can be seen from Figure 8(b).Select the same size of the environmental information matrix as 20∗20. Now, compare the two methods for calculating a new adjacency matrix. Different methods cost different duration. The results are shown in Table 1.Table 1
Comparison of calculation time.
Experiment Global Calculation (t/s) Analytical calculation (t/s) 1 0.0038 8.4192e-04 2 0.0037 8.9884e-04 3 0.0037 8.3912e-04 4 0.0037 8.2730e-04 5 0.0038 8.2637e-04 6 0.0037 8.4752e-04 7 0.0037 8.4223e-04 8 0.0037 9.9027e-04 9 0.0037 8.9479e-04 10 0.0037 9.6508e-04 average 0.0037 8.7734e-04In order to further verify the superiority of the proposed analytical calculation method, a comparison of the different size of the environmental matrix is given in Figure9.It can be seen from Figure9 that the analysis method proposed in this paper consumes less time than the global method. And with the increase of the environment matrix, the consumption time of the global method increases exponentially, while the time consumed by the analysis method increases proportionally with a smaller coefficient, which is more efficient and less time-consuming.


## 5. Conclusion

With the help of 2D-SDF-SLAM, taking the narrow aisles into account, this paper realizes the collection of environmental information; a precise environmental raster map is obtained. At the same time, the narrow aisle is bypassed by changing the walking rules. Based on the walking rules, the new weighted adjacency matrix around the narrow aisle is obtained from the different positions at all aspects, which reduces the calculation amount and calculation time. The proposed method improves the precision by selecting a fine grid. Although the search range is exponentially increasing, the search time does not show exponential growth, but rather a proportional growth with a small coefficient. Compared with the existing algorithms, the proposed algorithm can find a satisfying path to reach the workplace around the narrow aisle in the shortest time among the considered approaches.



---

*Source: 6097591-2019-06-09.xml*