Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wangfan04 committed Jun 14, 2022
1 parent 903477c commit 0d534fb
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ MetaGym provides abundant environments for benchmarking Reinforcement Learning a
- [MetaMaze](metagym/metamaze): Meta maze environment for 3D visual navigation (Oct, 2021)

- [Navigator2D](metagym/navigator2d): Simple 2D navigator meta environment (Oct, 2021)

- [MetaLocomotion](metagym/metalocomotion): Locomotion simulator with diverse geometries (June, 2021)
68 changes: 68 additions & 0 deletions metagym/metalocomotion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Introduction

MetaLocomotion implement canonical gym bullet locomotion environments, but with diversed geometries. For instance, in meta ants, different tasks differs in the ant's thigh and thin lengths in its four legs.

Currently we support
#### Meta Ants
#### Meta Humanoids

# Install

```bash
pip install metagym[metalocomotion]
```

#### For local installation, execute following commands:

```bash
git clone https://github.com/PaddlePaddle/MetaGym
cd MetaGym
pip install .[metalocomotion]
```

# Quick Start

## Import

Import and create the meta maze environment with
```python
import gym
import metagym.metalocomotion

loco_env = gym.make("meta-humanoids-v0", enable_render=True) # Running meta humanoids
#loco_env = gym.make("meta-ants-v0", enable_render=True) # Running meta ants
```

## Sampling Geometries

Use the following code to sample an unique geometry
```python
#Sample a task by specifying the configurations
task = loco_env.sample_task(
task_type = "TRAIN" # we provide 256 geometries for training
#task_type = "TEST" # we provide 64 geometries for testing
#task_type = "OOD" # we provide 64 Out-of-distribution geometries, which is exceptionally harder
)
```

## Running Locomotion
```python
#Set the task configuration to the meta environment
loco_env.set_task(task)
loco_env.reset()

#Start the task
done = False
while not done:
action = loco_env.action_space.sample()
observation, reward, done, info = loco_env.step(action)
loco_env.render()
```

# Examples of Different Geometries
<img src="https://github.com/benchmarking-rl/PARL-experiments/blob/master/MetaGym/ant_exp.png" width="600"/>
<img src="https://github.com/benchmarking-rl/PARL-experiments/blob/master/MetaGym/ants_1.gif" width="600"/>
<img src="https://github.com/benchmarking-rl/PARL-experiments/blob/master/MetaGym/ants_2.gif" width="600"/>
<img src="https://github.com/benchmarking-rl/PARL-experiments/blob/master/MetaGym/humanoid_exp.png" width="600"/>
<img src="https://github.com/benchmarking-rl/PARL-experiments/blob/master/MetaGym/humanoids_1.gif" width="600"/>
<img src="https://github.com/benchmarking-rl/PARL-experiments/blob/master/MetaGym/humanoids_2.gif" width="600"/>
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
'six>=1.12.0',
],
extras_require={
'metalocomotion': ['numpy>=1.20.3', 'pybullet>=3.0.7'],
'metamaze': ['pygame>=2.0.2dev2', 'numba>=0.54.0'],
'quadrupedal': ['scipy>=0.12.0', 'pybullet>=3.0.7', 'attrs>=20.3.0'],
'quadrotor': ['scipy>=0.12.0', 'networkx>=2.2', 'trimesh>=3.2.39', 'networkx>=2.2', 'colour>=0.1.5'],
Expand Down

0 comments on commit 0d534fb

Please sign in to comment.