Revolve2: Physics simulation abstraction layer.
Project description
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
Installation: ci-group.github.io/revolve2/installation
Get help: github.com/ci-group/revolve2/discussions/categories/ask-for-help
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
.
# (...) 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
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for revolve2_simulation-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d78484ef161d5176d6a16b5a2d91d6c6f9a1aa060859bbf7efd9e4c49aca3fda |
|
MD5 | f6ef169a8b360504581f35df29be981c |
|
BLAKE2b-256 | a04359107e195eee75c529c6c6218912be862526625d00569b516d5fe9c962c6 |