Evolving a locomoting robot

Final project for the EPFL course "Evolutionary Robotics"

At a glance

This is the final project for the EPFL course “Evolutionary Robotics” (Prof. D. Floreano), completed in Spring 2022 with Mariam Hassan, Hadrien Sprumont, and Léo Duggan.

The goal was to use evolutionary algorithms to obtain a robot that can:

  • Locomote efficiently in a challenging arena,
  • Avoid obstacles, and
  • Remain as stable as possible (low roll/pitch/acceleration spikes, robust motion rather than brittle “tricks”).

To assess the simulation-to-reality gap, the final robot was 3D-printed and tested in the real world.

From simulation to reality: the evolved robot navigating obstacles in Webots (left) and its 3D-printed counterpart tested with a physical obstacle (right), demonstrating successful transfer across the simulation-to-reality gap.

Motivation

We framed the task in the spirit of a Mars exploration rover: locomotion in imperfect environments, stability of the core module, and obstacle-aware behavior. Furthermore, we aimed to keep the process scientific and repeatable.


System in a nutshell

Our work followed an iterative pipeline that progressively increased task difficulty and realism:

Exploration of parameters → Starting morphologies → Locomotion optimization → Stability optimization → Obstacle avoidance evolution

Concretely, the project flow was:

  1. Exploration of Robogen parameters and baseline setups
  2. Starting robots (to trade off exploration vs repeatability)
    • Random configurations (more exploration, surprising morphologies)
    • Rolling snake (oscillator-only control, simple geometry, good racing score)
    • Starfish (oscillator-only control, richer geometry, good racing score)
  3. Locomotion (racing) in an arena
    • Start with simple objectives and progressively refine fitness
  4. Stability as an explicit optimization target
  5. Obstacle avoidance, explored via two main tracks:
    • Brain-only OA (manual sensor placement, evolve controller)
    • Body + brain OA with implicit constraints (co-evolve morphology and control)
The flowchart of the project.

Experimental setup

Evolution strategy

We used a classical evolutionary setup (µ/λ evolution with tournament selection), running 200 generations with:

  • µ = 25, λ = 100
  • (µ+λ) replacement
  • Tournament size = 3
  • Controller mutation probability pBrainMutate = 0.5
  • Brain mutation scale BrainSigma = 0.9

Simulation settings included sensor/motor noise (0.03), a simulation horizon of ~12s, and a bounded actuation update rate (16 direction shifts/s), encouraging solutions that remain functional under noise.


Fitness design (what we optimized)

A key learning was that fitness design dominates outcomes: evolution is opportunistic and will exploit loopholes if they exist.

Locomotion (racing)

We tested multiple progressively refined fitness functions, including:

  • Racing distance (final distance of the closest element)
  • Core displacement integrals (encouraging sustained progress, not just end position)
  • Final core position + stability terms
  • Minimum distance constraints + stability

Stability

Stability was introduced explicitly with terms related to roll/pitch and core acceleration, pushing the evolved gaits toward smoother, more controllable motion.

Obstacle avoidance (OA)

We explored OA in two ways:

1) Brain-only OA + manual sensor placement

  • Keep the body fixed, place sensors deliberately,
  • Evolve the controller to use sensory feedback for OA.

2) Body + brain OA (implicit OA)

  • Co-evolve morphology and controller,
  • Enforce constraints such as a minimum number of sensors and preventing “cheating” behaviors (e.g., obstacle despawning, lucky initializations, or exploiting arena artifacts).

This stage required repeated adjustments because evolution will reliably discover unintended exploits unless the environment and constraints are carefully designed.


Key outcomes

Emergent morphologies and controllers

We observed distinct locomotion “families” emerging from different initial conditions:

  • Rolling-snake solutions: simple, effective, highly regular oscillatory motion.
  • Starfish-like solutions: more complex geometry enabling richer gait patterns.
  • A repeated high-performing morphology we nicknamed “GorillaBot”, which appeared multiple times under non-random initializations, illustrating the trade-off between repeatability and novel exploration.
An example of starfish-like (left) and rolling-snake (center) solutions, and our GorillaBot (right) in simulation.

Sim-to-real validation

The final evolved design was 3D-printed and tested physically to compare behavior with simulation, giving direct insight into:

  • Which behaviors transfer robustly,
  • And which are sensitive to real-world friction, compliance, and actuator imperfections.
Our 3D-printed GorillaBot.

Main takeaways

The main takeaways of this project were:

  • Simpler fitness functions worked better (and were harder to exploit).
  • Random starts produced more diverse and surprising robots, but with larger variability.
  • Non-random starts improved repeatability (e.g., GorillaBot emerged multiple times).
  • Evolution is inherently opportunistic: careful arena design + constraints are essential.

Acknowledgements

Course: EPFL — Evolutionary Robotics (Prof. D. Floreano)
Team: Mariam Hassan, Hadrien Sprumont, Léo Duggan, Luca Zunino