# Modular Robotic Design and Reconfiguring Path Planning
## 2 Robotic Design and Modeling
### Modular Path Planning Based on Optimal Ant Colony Optimization
#### 3.3.2 Optimal ant Colony Algorithm Design  
For the shortcomings of the traditional ant colony algorithm such as slow convergence speed and fall into local optimum easily, in this paper, an improved ant colony algorithm is proposed. First, a non-uniform allocation of initial pheromones based on the traditional ant colony algorithm is adopted to avoid useless search behaviors by ants; Secondly, introducing heuristic factors for node angles to construct multivariate heuristic functions to speed up the search; Then, the deadlock phenomenon is solved by improving the transfer probability; Finally, the avoidance strategy is added to the pre-search process, and the ant backoff strategy is used to deal with the deadlock problem. The optimized ant colony algorithm has better guidance for the reconstruction planning, which can effectively guide the functional module to move along the direction closest to the shortest distance between the initial point and the target point and effectively improve the path planning efficiency. 1. Set non-uniformly distributed initial pheromones  
Since the initial pheromone values are the same at the beginning of the ant colony algorithm, the ants select the next node by the shortest distance in the search path, ignoring the global information, which makes the search less efficient and increases the path length. To solve this problem, this paper delineates a rectangular region with the start and endpoints as diagonal vertices and increases the initial value of pheromone in this region. It makes the robotic module have the initiation to move forward toward the target point in the early movement process, which is helpful to reduce the blind search of ants and improve the convergence speed. 2. Design of the heuristic function  
The heuristic function in the traditional ant colony algorithm usually only takes the inverse of the distance of neighboring nodes, which leads to the tendency of ants to select the nearest optional node to the current node when making path selection. It leads to deadlock and duplicate paths when ants search for and cannot find an optimal route. So we choose to introduce the heuristic factor of node angle to construct a multivariate heuristic function. In the raster environment, the initial point \((x_{0},y_{0})\) is connected to the current point \((x_{i},y_{i})\) to form a line \"\(l_{i}\)\", and the current point \((x_{i},y_{i})\) is connected to the target point \((x_{i+1},y_{i+1})\) to form a line \"\(l_{i}\)\". The new heuristic function is designed according to the angle \"\(\theta\)\" between \"\(l_{i}\) \"and \"\(l_{i}\)\" as well as the distance between the current node and the target node. 1. Distance heuristic factor  
Based on the distance characteristics between two nodes in the two-dimensional space, giving an initial guiding direction for the ant colony algorithm, the attractiveness of the target point for path point selection is used to improve the fast convergence of the algorithm. A distance heuristic formula is established:  
\[Q(x_{i},y_{i})=\frac{1}{1+\sqrt{\left(x_{i+1}-x_{i}\right)^{2}+\left(y_{i+1}-y _{i}\right)^{2}}} \tag{11}\]
2. Target pinch angle heuristic factor  
Set the angle between the ant's starting point \"\(P_{s}\)\", current point \"\(P_{w}\)\" and target point \"\(P_{E}\)\" as \"\(\theta_{E}\)\", and the ant will find the shortest path when it moves in the shortest straight-line direction. The specific definition of the angle \"\(\theta_{E}\)\" is as follows:  
\[\theta_{E}=\arccos\left(\frac{\overset{\rightarrow}{P_{s}P_{E}}\cdot P_{w} ^{\rightarrow}\overset{\rightarrow}{P_{E}}}{\left|P_{s}P_{E}\right|\times \left|P_{w}P_{E}\right|}\right) \tag{12}\]  
where: \"\(\theta_{E}\)\" is the target angle between the vector \"\(P_{s}\overset{\rightarrow}{P_{E}}\)\" and the vector \"\(P_{w}\overset{\rightarrow}{P_{w}P_{E}}\)\".