Morphological Evolution of Physical Robots through Model-Free Phenotype Development

Artificial evolution of physical systems is a stochastic optimization method in which physical machines are iteratively adapted to a target function. The key for a meaningful design optimization is the capability to build variations of physical machines through the course of the evolutionary process. The optimization in turn no longer relies on complex physics models that are prone to the reality gap, a mismatch between simulated and real-world behavior. We report model-free development and evaluation of phenotypes in the artificial evolution of physical systems, in which a mother robot autonomously designs and assembles locomotion agents. The locomotion agents are automatically placed in the testing environment and their locomotion behavior is analyzed in the real world. This feedback is used for the design of the next iteration. Through experiments with a total of 500 autonomously built locomotion agents, this article shows diversification of morphology and behavior of physical robots for the improvement of functionality with limited resources.

.1: Evolutionary process. A first generation is initialized. All agents are built and evaluated, and their fitness is used to select candidates for the next generation. The selected agents can be adapted for the next generation through mutation and crossover. Table S1.1 summarizes the general parameters for the evolutionary process. These default parameters were applied to all experiments, unless otherwise stated for individual experiments in the respective sections in the main text.  Table S1.3)

Algorithm Details & Parameters Parameters
Probability of each different mutation to be executed Additionally, the chances for each individual to be selected for evolution are proportional to its fitness.

Assembly Process Encoding
The building sequence encoded in each agent's genome is executed step by step as listed below. An example is illustrated in Fig. 2 and all parameters are summarized in Table S1.2.
1. Rotation of the already existing structure. If no structure exists, ignore this step. 2. Pick the specified module from the storage. 3. If it is an active element, rotate the element. If the element is a wooden cube, ignore this step (wooden cubes do not have a specific orientation). 4. Glue the element to the defined position on the structure. If the element is the first element, place it without gluing. The element now becomes part of the structure. 5. Repeat steps 1-4 for every gene in the genome. 6. If specified, execute one more rotation of the whole agent. 7. Place the agent in the testing area. 8. Assign the motor controls to each servo module and initialize the testing procedure.

Mutation Probabilities
The following mutations to the parameters specified in a genome are available:  Add a gene (add)  Delete a gene (del)  Change one rotation in the structure parameter (struct)  Change one rotation in the orientation parameter (ori)  Change one position in the relative position parameter (rel_pos)  Change the amplitude of a servo module (amp)  Change the phase shift of a servo module (ps)  Change the end-rotation parameter (rot_end) Depending on the phenotype, not all mutations are available (e.g. if the agent only consists of one single servo module, the delete gene mutation cannot be selected).

Validation Step
Although designed to generate buildable structures, the chosen encoding can produce genomes which cannot be built in real-world. Therefore, a validation step is introduced, which checks for some constraints every time a new genome is generated, e.g. after mutation. Invalid genomes are removed and regenerated. The following types of agents are removed:  Unstable agents  Agents where servo-shafts collide with other modules  Agents with zero elements  Agents with more than five elements  Agents with more than three servo modules  Agents with less than one servo module The stability condition has to be fulfilled not only by the final agent but also by all intermediate substructures. It is therefore checked after every operation of the building sequence. As soon as one of the operations fails to be stable, the agent is recognized as unstable. Stability is achieved if the center of mass of an agent lies within its support polygon with a margin of 8 mm to the closest boundary.
The collision check detects statically in the final phenotype, if the rotating planes of the servo modules are colliding with another module of the agent. A dynamical check simulating the complete motion of the agent is not performed.

Fitness Evaluation Procedure
The fitness of an agent is defined as the distance travelled from the initial position divided by the testing time.
Computer vision was used to automatically measure the distance travelled by the agents. The testing time was initially set to 8 s, but reduced to 4 s due to the increasing speed of agents in the last two experiments. Two webcams (Logitech Webcam C930e) record the agent during locomotion, one at an angled view to show the movement and one recording the agent directly from top. The top view was used to run the image analysis, which determines the center of the projected area of an agent before and after the given testing time. A fixed pixel-to-centimeter ratio is applied to calculate the distance travelled in real-world. The detailed steps for the evaluation procedure are described below: 1. Run the servos for 1s to force the agent into a stable position. Some agents initially fall, producing some displace. This movement shall not be considered in the fitness. 2. Move all servos to the initial position and stop. 3. Activate all servos again for the given testing time and record the movement of the agent. 4. Extract the first and last frame taken and transform them to the Hue, Saturation, Value (HSV) color space. The HSV color space is less prone to noise when detecting a certain color. A beige (in later experiments black) color filter finds the wooden cubes and a blue color filter finds the servo modules, converting the complex images to a binary images as shown in Figure S1.2. 5. Combine the objects found, erode the white patches by a square mask of 3 pixels to get rid of noise, dilute the same patches by a square mask of 7 pixels to combine the single patches to one connected patch and fill in holes (missing pixels of a closed shape) to generate a complete patch of the whole agent. 6. Find the center of area in both frames and calculate the distance travelled with a fixed pixelto-cm ratio (0.11 cm/pixel).
In Figure S1.2, an example of the image analysis procedure can be seen. Figure S1.2: Image analysis process. The first column displays the real agent with the patch of the image analysis overlaid after the following three processes: 1. Onto the raw image data, the column titled "servo color filter" applies a blue color filter in the HSV color space to find the servo modules. 2. The next column applies a beige (in later experiments black) color filter to find the wooden cubes.
3. The last column shows the final patch of the agent as the image analysis computes it after combining, eroding, diluting and filling. Indicated in both the start and end frame is the center of area which is used to compute the distance travelled by a pixel-to-cm ratio.
In about 4% of all trials, the construction process failed. In such a case, zero fitness is awarded to the agent, i.e. it is eliminated in the step to the next generations. In the generation maps, a negative error code is indicated (-5: unspecified, -13: glue connection failure, -14: collision, -16: other).

Shape factor bounds
For the modules used in our experiments, a lower and upper bound of the shape factor can be calculated for a given number of elements. With one cubic element, only c = 1 can be achieved. With two elements, depending on their configuration, 0.65 < c < 0.9 can be achieved. As the number of components s increases, the lower bound of c approaches 0, which is achieved with one type of modules connected diagonally. The upper bound fluctuates below or equal to 1. The upper bound was calculated testing all combinations of active and passive modules, e.g. a perfect cube can be obtained with 8 active modules (= 8 elements) or 7 active modules and 8 wooden cubes (= 15 elements). In the plots in Fig. 4, this area is shown in grey.