https://github.com/ci-group/revolve2
A python library for optimization, geared towards modular robots and evolutionary computing.
https://github.com/ci-group/revolve2
evolutionary-algorithms evolutionary-computation modular-robots optimization robotics simulation
Last synced: 8 days ago
JSON representation
A python library for optimization, geared towards modular robots and evolutionary computing.
- Host: GitHub
- URL: https://github.com/ci-group/revolve2
- Owner: ci-group
- License: lgpl-3.0
- Created: 2020-07-07T07:54:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-05-09T15:29:38.000Z (9 months ago)
- Last Synced: 2025-11-30T16:22:32.257Z (about 2 months ago)
- Topics: evolutionary-algorithms, evolutionary-computation, modular-robots, optimization, robotics, simulation
- Language: Python
- Homepage: https://ci-group.github.io/revolve2
- Size: 37.6 MB
- Stars: 23
- Watchers: 2
- Forks: 61
- Open Issues: 43
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README

# Revolve2
Revolve2 is a collection of Python packages used for researching evolutionary algorithms and modular robotics.
Its primary features are a modular robot framework, an abstraction layer around physics simulators, and evolutionary algorithms.
**Documentation: [ci-group.github.io/revolve2](https://ci-group.github.io/revolve2)**
**Installation: [ci-group.github.io/revolve2/installation](https://ci-group.github.io/revolve2/installation)**
**Get help: [github.com/ci-group/revolve2/discussions/categories/ask-for-help](https://github.com/ci-group/revolve2/discussions/categories/ask-for-help)**
[](https://doi.org/10.5281/zenodo.8355869) [](./LICENSE) [](https://github.com/ci-group/revolve2/actions)
## Sample
Here we create and simulate a modular robot, and then calculate how far it moved over the xy plane. This is a shortened version of `examples/evaluate_single_robot`.
```python
# (...) Omitted preamble
# Create a modular robot.
body = modular_robots_v1.gecko_v1()
brain = BrainCpgNetworkNeighborRandom(body=body, rng=rng)
robot = ModularRobot(body, brain)
# Create a scene.
scene = ModularRobotScene(terrain=terrains.flat())
scene.add_robot(robot)
# Create a simulator.
simulator = LocalSimulator(headless=False)
# Simulate the scene and obtain states sampled during the simulation.
scene_states = simulate_scenes(
simulator=simulator,
batch_parameters=make_standard_batch_parameters(),
scenes=scene,
)
# Get the state at the beginning and end of the simulation.
scene_state_begin = scene_states[0]
scene_state_end = scene_states[-1]
# Retrieve the states of the modular robot.
robot_state_begin = scene_state_begin.get_modular_robot_simulation_state(robot)
robot_state_end = scene_state_end.get_modular_robot_simulation_state(robot)
# Calculate the xy displacement of the robot.
xy_displacement = fitness_functions.xy_displacement(
robot_state_begin, robot_state_end
)
```