# Modular Robotic Design and Reconfiguring Path Planning
## 2 Robotic Design and Modeling
### Module Reconfiguration Campaign Definition
#### 3.2.2 Establishment and Solution of the Functional Module Collision Avoidance Model  
The reconfiguration platform plans the set of paths for n functional modules based on the number of modules of the reconfiguring robotic configuration, \"\(p_{n}=\{p_{1},\,p_{2},\,\ldots,\,p_{n}\}\)\", The new set of paths \"\(p_{n}^{*}=\{p_{1}^{*},\,p_{2}^{*},\,\ldots,\,p_{n}^{*}\}\)\" is obtained by the module collision avoidance criterion. The objective function is:  
\[L=\sum_{i=1}^{n}\emph{length}(p_{i}^{*})=l\cdot\tau \tag{9}\]  
where: \"\(L\)\" is the length of the moving path of n functional modules; \"\(\tau\)\" is the number of grids; \"\(l\)\" is the length of a grid.  
When multiple modules are used for path planning in the reconfiguration platform, the platform defaults all modules that are not the priority to obstacles, thus ensuring the accuracy of the robot's confirmation order. The function module searches the surrounding grid according to the forward direction during the path planning and defines the next ready-to-move grid location as the waiting area. When two modules explore the same waiting area, the distance between modules should be greater than the minimum collision distance. Three module collision avoidance forms are defined according to the relative positions of modules in the reconfigured platform.  
The first type is that after two modules search the same waiting area, the next movement direction between modules is opposite and at an angle of 0\({}^{\circ}\) to the original movement direction, as shown in Figure 5a-c, (\"\(S_{1}\)\" represents the higher priority module's path and \"\(S_{2}\)\" represents the low priority module's motion path.) \"\(S_{1}\)\" moves to the waiting area and waits one raster movement time, \"\(S_{2}\)\" moves to the blank raster position and then returns to the original position after \"\(S_{1}\)\" passes and continues in the original direction. If the situation in Figure 5d is encountered, \"\(S_{2}\)\" moves one grid in the opposite direction of the original movement, and searches whether there are obstacles above and below the grid. If there is no obstacle, it follows the first type of collision avoidance form; if there is still an obstacle, it continues to search the next position grid, and \"\(S_{1}\)\" still follows the original route movement.  
The second form is that two modules search to the same waiting area, and the subsequent movement direction between modules is opposite, and 90\({}^{\circ}\) from the original movement direction or the module movement direction remains the same, and the movement angle between modules is 90\({}^{\circ}\). As shown in Figure 6, \"\(S_{2}\)\" waits for one grid distance at the previous grid position in the waiting area and continues to move after \"\(S_{1}\)\" passes through the waiting area.  
The third type is that one of the two modules moves at 90\({}^{\circ}\) to the original direction or both modules move at 90\({}^{\circ}\) to the original direction after passing through the waiting area. As shown in Figure 7, after \"\(S_{1}\)\" enters the waiting area, \"\(S_{2}\)\" moves one grid in the opposite direction of the original motion or moves to a blank grid around the waiting area, and \"\(S_{2}\)\" continues to move in the original direction after \"\(S_{1}\)\" finishes moving the grid.  
Figure 5: Schematic diagram of the first type of collision avoidance. (**a**) Situation 1; (**b**) Situation 2; (**c**) Situation 3; (**d**) Situation 4.  
Figure 6: Schematic diagram of the second type of collision avoidance. (**a**) Situation 1; (**b**) Situation 2; (**c**) Situation 3.