# Automatic Generation of Locomotion Patterns for Soft Modular Reconfigurable Robots
## 3 Method
### Evolutionary Algorithm and Control Method  
Some previous research [6; 7; 9; 29] demonstrates the fact that multi-soft-modules can make a straight motion and turning motion by intermittent contact and friction with the ground, and our soft modular robot also takes the advantage of the method. The different phaseoffset of each module leads to an asynchronous contraction and expansion law, which realizes their intermittent contact with the ground surface. Therefore, the phaseoffset was set to be the genotype in our evolutionary algorithm, and the locomotion distance within the set time was set as fitness. The principle of the evolutionary algorithm was described in previous research [30], and a simple description is made here. When the algorithm is initialized, a set of random values is set for the genotype of each individual in the initial population. The soft robots in the initial population use this set of random control parameters to move at the same time, and the displacement during the set time represents the speed of the robots. The displacement can be measured by VOXCAD and read by the evolutionary algorithm as the evaluation index of the algorithm.  
Figure 6: (**a**) Method of measuring the deformation of the soft cube in simulation software. (**b**) Diagram of measuring the deformation of the soft cube in the experiment.  
Figure 7: Comparison between simulation and experiment deformation curves of the single soft cube.  
Individuals with poor performance are eliminated, while individuals with excellent performance can be preserved into the next generation, and the genotypes of these individuals cross and regroup to produce other individuals of this generation. As a result, the overall performance of the population gets better and better. In order to improve the search ability of the algorithm, the random mutation is also set for the individuals. Such a process iterates multiple times until the set number of iterations is reached. Our algorithm was run for 500 generations with a population size of 150. The genotype of the individual with the best motion ability in the final population is selected as the control parameters of the actual soft robot, and this set of parameters was transmitted to Arduino via serial to control the on-off time of the solenoid valve set so as to control the deformation sequence of the soft cubes. Figure 8 shows three displacement curves exported by VOXCAD when using three different gaits of worm configuration (Please see more details in the next section). The optimized gait pattern was calculated by an evolutionary algorithm. In the experiential gait pattern, the five soft cubes are actuated in sequence, just like a real worm. The arbitrary gait pattern was actuated by a set of arbitrary control parameters. It can be seen from the displacement curve that the gait pattern calculated by our evolutionary algorithm has outstanding performance.  
In the experiment of measuring the deformation of the soft cube, we obtained the result that the deformation of the soft cube in the experiment and the simulation can reach the most fitting degree when the pressure values of the air compressor and the vacuum pump are set to 63.2 kg and \(-\)63.4 kg. Therefore, the same output air pressure of the air compressor and the vacuum pump are set when we conduct the multi-module coordinated motion experiment. Since the output flow of the air compressor and the vacuum pump is much larger than the input flow of the soft cube, the set air pressure value can be regarded as constant. Therefore, we just use open loop control strategy for the air pressure, and regarded the on-off time sequence of the solenoid valve set as the control variables.