About¶
The principle: say what, never how¶
Evolution needs someone to say what success is; in nature the environment does. Here the score and the terrains say what a robot must achieve (walk straight, turn when told, cross steps and rubble, waste little energy) and never how it should look or move. There is no reward for symmetry, for legs used the way an animal uses them, or for any shape a person would expect; when a score rule lets a robot cheat (spinning on the spot to "obey" a turn), the rule is fixed so it measures what it always meant, and when the simulator allows something the real world does not (a slipping foot, a servo housing dragged on the floor), the fix makes the physics honest instead of forbidding the behaviour. Changes to the search itself (more archive axes, a smarter emitter) give evolution more room, not a direction. A scoring change is accepted only if a short run shows it does not shrink the variety of the archive.
The robots in the README and the Results page are chosen by hand to show the range of what evolved, so they are the tidier ones; the gallery shows every robot in the archive, odd ones included.
Project structure¶
darwinbot/
├── darwinbot/
│ ├── morphology.py # module tree, genome, decode, mutate
│ ├── controller.py # two-harmonic Tegotae CPG, genome, active genes
│ ├── builder.py # module tree + terrain -> MJCF
│ ├── terrain.py # terrain snippets and presets
│ ├── sim.py # Episode: compile once, replay controllers
│ ├── sim_gpu.py # optional MJX batch simulator
│ ├── randomize.py # randomised model variants (sim-to-real)
│ ├── fitness.py # episode score and multi-terrain aggregate
│ ├── inner.py # CMA-ES inner loop
│ ├── evolve.py # behaviour archive (pyribs CVT), novelty selection, outer loop
│ ├── parts.py # printable parts (build123d)
│ ├── control_file.py # JSON control file for the firmware
│ └── export.py # robot -> parts, BOM, assembly, control file
├── experiments/
│ ├── train.py # run evolution
│ ├── replay.py # viewer or video for an elite
│ ├── validate.py # elite on randomised models (sim-to-real check)
│ ├── export.py # export a robot to build
│ ├── plot_archive.py # behaviour scatter and progress plots
│ └── lineage.py # family tree of the elites
├── firmware/ # controller core in C++ for the ESP32, parity-tested
├── tests/ # pytest suite (GPU tests skip without jax)
├── docs/ # hardware data, control file format
├── checkpoints/ # archive.pkl and plots
├── exports/ # export.py output (ignored by git)
└── pyproject.toml
Related work¶
| Project | What it does | Difference from DarwinBot |
|---|---|---|
| RoboGen (EPFL) | Co-evolves bodies and controllers, outputs printable parts and Arduino code | Own ODE-based simulator, hobby micro servos, one winner per run |
| Revolve2 (VU Amsterdam) | Research framework for modular robots, CPG brains, a runtime for physical robots | A library for researchers built around its lab's own modules; no part or BOM export |
| DyRET (Univ. of Oslo) | Open-hardware legged robot that evolves its leg lengths and gait in the real world | One fixed robot design, Dynamixel servos; does not invent bodies |
| Nordmoen et al. 2021 | MAP-Elites on modular robots, stepping-stone analysis | A study, not a tool |
| RoboMorph | LLM-generated morphologies evaluated in simulation | Simulation only |
DarwinBot sits between them: a quality-diversity catalogue instead of a single winner, and every robot in it exports as a kit of current, affordable parts (STS3215 bus servos, printed links, ESP32) with a control file, from one command.
References and credits¶
- J.-B. Mouret and J. Clune, "Illuminating search spaces by mapping elites", arXiv:1504.04909, 2015 (MAP-Elites).
- N. Hansen, "The CMA Evolution Strategy: A Tutorial", arXiv:1604.00772, 2016; implementation: pycma.
- E. Todorov, T. Erez and Y. Tassa, "MuJoCo: A physics engine for model-based control", IROS 2012; MuJoCo and MJX.
- B. Tjanaka et al., "pyribs: A Bare-Bones Python Library for Quality Diversity Optimization", GECCO 2023; pyribs.
- Open Duck Mini: STS3215 joint parameters and hardware recipe used as reference.
- Revolve2 and RoboGen: modular, printable evolved robots, a design reference.
- build123d: parametric CAD for the parts.
Contributing¶
Issues and pull requests are welcome; see CONTRIBUTING.md.
License¶
MIT, see LICENSE. To cite this project, use the "Cite this
repository" button on GitHub (CITATION.cff).