-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8206c1d
commit a4d1bcf
Showing
3 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,51 @@ | ||
# Rendering | ||
|
||
Each Meta-World environment uses Gymnasium to handle the rendering functions following the [`gymnasium.MujocoEnv`](https://github.com/Farama-Foundation/Gymnasium/blob/94a7909042e846c496bcf54f375a5d0963da2b31/gymnasium/envs/mujoco/mujoco_env.py#L184) interface. | ||
|
||
['https://gymnasium.farama.org/api/env/#gymnasium.Env.render']#Gymnasium. | ||
|
||
Upon environment creation a user can select a render mode in ('rgb_array', 'human'). | ||
|
||
For example: | ||
|
||
```python | ||
import metaworld | ||
import random | ||
|
||
print(metaworld.ML1.ENV_NAMES) # Check out the available environments | ||
|
||
env_name = '' # Pick an environment name | ||
|
||
render_mode = '' # set a render mode | ||
|
||
ml1 = metaworld.ML1(env_name) # Construct the benchmark, sampling tasks | ||
|
||
env = ml1.train_classes[env_name](render_mode=render_mode) | ||
task = random.choice(ml1.train_tasks) | ||
env.set_task(task) # Set task | ||
|
||
obs = env.reset() # Reset environment | ||
a = env.action_space.sample() # Sample an action | ||
obs, reward, done, info = env.step(a) # Step the environment with the sampled random action | ||
``` | ||
|
||
# Render from specific camera | ||
|
||
In addition to the base render functions, Meta-World supports multiple camera positions. | ||
|
||
```python | ||
camera_name = '' # one of: ['corner', 'corner2', 'corner3', 'topview', 'behindGripper', 'gripperPOV'] | ||
|
||
env = ml1.train_classes[env_name](render_mode=render_mode, camera_name=camera_name) | ||
|
||
``` | ||
|
||
The ID of the camera (from Mujoco) can also be passed if known. | ||
|
||
```python | ||
|
||
camera_id = '' # this is an integer that represents the camera ID from Mujoco | ||
|
||
env = ml1.train_classes[env_name](render_mode=render_mode, camera_id=camera_id) | ||
|
||
``` |