diff --git a/docs/_static/img/favicon.svg b/docs/_static/img/favicon.svg index 48f928193..743f52246 100644 --- a/docs/_static/img/favicon.svg +++ b/docs/_static/img/favicon.svg @@ -1,115 +1,161 @@ - - - - - - - - - - - - - - - - - - - - - + id="namedview8724" + pagecolor="#ffffff" + bordercolor="#000000" + borderopacity="0.25" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="11.424183" + inkscape:cx="-1.0504033" + inkscape:cy="10.110132" + inkscape:window-width="1280" + inkscape:window-height="698" + inkscape:window-x="-6" + inkscape:window-y="1074" + inkscape:window-maximized="1" + inkscape:current-layer="svg2575" /> + + + + + + + + + + + + + + + + + + diff --git a/docs/_static/img/metaworld_black.svg b/docs/_static/img/metaworld_black.svg index c0bb7eb46..473a6ba01 100644 --- a/docs/_static/img/metaworld_black.svg +++ b/docs/_static/img/metaworld_black.svg @@ -1,111 +1,161 @@ - - - - - - - + - - - - - - - - - - - - - - + id="namedview2577" + pagecolor="#ffffff" + bordercolor="#000000" + borderopacity="0.25" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="0.1827871" + inkscape:cx="-590.85131" + inkscape:cy="659.23688" + inkscape:window-width="1280" + inkscape:window-height="698" + inkscape:window-x="-6" + inkscape:window-y="-6" + inkscape:window-maximized="1" + inkscape:current-layer="svg2575" /> + + + + + + + + + + + + + + + + + diff --git a/docs/_static/img/metaworld_white.svg b/docs/_static/img/metaworld_white.svg index bd41903e4..8c6a92a31 100644 --- a/docs/_static/img/metaworld_white.svg +++ b/docs/_static/img/metaworld_white.svg @@ -1,115 +1,162 @@ - - - - - - - + - - - - - - - - - - - - - - + id="namedview2577" + pagecolor="#ffffff" + bordercolor="#000000" + borderopacity="0.25" + inkscape:showpageshadow="2" + inkscape:pageopacity="0.0" + inkscape:pagecheckerboard="0" + inkscape:deskcolor="#d1d1d1" + showgrid="false" + inkscape:zoom="0.1827871" + inkscape:cx="-590.85131" + inkscape:cy="659.23688" + inkscape:window-width="1280" + inkscape:window-height="698" + inkscape:window-x="-6" + inkscape:window-y="-6" + inkscape:window-maximized="1" + inkscape:current-layer="svg2575" + showguides="false" /> + + + + + + + + + + + + + + + + + diff --git a/docs/_static/metaworld-text.svg b/docs/_static/metaworld-text.svg new file mode 100644 index 000000000..9afe04e2b --- /dev/null +++ b/docs/_static/metaworld-text.svg @@ -0,0 +1,198 @@ + + + + + + + + + Metaworld + diff --git a/docs/_static/mt10.gif b/docs/_static/mt10.gif new file mode 100644 index 000000000..bea6ce710 Binary files /dev/null and b/docs/_static/mt10.gif differ diff --git a/docs/index.md b/docs/index.md index d6c57e091..db5239eb4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,7 +4,7 @@ firstpage: lastpage: --- -```{project-logo} _static/metaworld-text.png +```{project-logo} _static/metaworld-text.svg :alt: Metaworld Logo ``` @@ -12,7 +12,7 @@ lastpage: Meta-World is an open-source simulated benchmark for meta-reinforcement learning and multi-task learning consisting of 50 distinct robotic manipulation tasks. ``` -```{figure} _static/REPLACE_ME.gif +```{figure} _static/mt10.gif :alt: REPLACE ME :width: 500 ``` @@ -40,8 +40,10 @@ obs, reward, done, info = env.step(a) :hidden: :caption: Introduction -introduction/installation introduction/basic_usage +installation/installation +rendering/rendering + ``` diff --git a/docs/installation/installation.md b/docs/installation/installation.md new file mode 100644 index 000000000..ec1785c4c --- /dev/null +++ b/docs/installation/installation.md @@ -0,0 +1,21 @@ +# Installation + +To install everything, run: + + +``` +pip install git+https://github.com/Farama-Foundation/Metaworld.git@master#egg=metaworld +``` + +Alternatively, you can clone the repository and install an editable version locally: + +```sh +git clone https://github.com/Farama-Foundation/Metaworld.git +cd Metaworld +pip install -e . +``` + +For users attempting to reproduce results found in the [Meta-World paper](https://arxiv.org/abs/1910.10897) please use this command: +``` +pip install git+https://github.com/Farama-Foundation/Metaworld.git@04be337a12305e393c0caf0cbf5ec7755c7c8feb +``` diff --git a/docs/introduction/basic_usage.md b/docs/introduction/basic_usage.md index 3580e733d..b5e424707 100644 --- a/docs/introduction/basic_usage.md +++ b/docs/introduction/basic_usage.md @@ -24,11 +24,6 @@ For each of those environments, a task must be assigned to it using respectively. `Tasks` can only be assigned to environments which have a key in `benchmark.train_classes` or `benchmark.test_classes` matching `task.env_name`. -Please see the sections [Running ML1, MT1](#running-ml1-or-mt1) and [Running ML10, ML45, MT10, MT50](#running-a-benchmark) -for more details. - -You may wish to only access individual environments used in the Metaworld benchmark for your research. See the -[Accessing Single Goal Environments](#accessing-single-goal-environments) for more details. ### Seeding a Benchmark Instance @@ -56,7 +51,7 @@ 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 +obs, reward, terminate, truncate, info = env.step(a) # Step the environment with the sampled random action ``` __MT1__ can be run the same way except that it does not contain any `test_tasks` @@ -80,7 +75,7 @@ for name, env_cls in ml10.train_classes.items(): for env in training_envs: 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 + obs, reward, terminate, truncate, info = env.step(a) # Step the environment with the sampled random action ``` Create an environment with test tasks (this only works for ML10 and ML45, since MT10 and MT50 don't have a separate set of test tasks): ```python @@ -100,7 +95,7 @@ for name, env_cls in ml10.test_classes.items(): for env in testing_envs: 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 + obs, reward, terminate, truncate, info = env.step(a) # Step the environment with the sampled random action ``` ## Accessing Single Goal Environments @@ -124,7 +119,7 @@ door_open_goal_hidden_cls = ALL_V2_ENVIRONMENTS_GOAL_HIDDEN["door-open-v2-goal-h env = door_open_goal_hidden_cls() 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 +obs, reward, terminate, truncate, info = env.step(a) # Step the environment with the sampled random action assert (obs[-3:] == np.zeros(3)).all() # goal will be zeroed out because env is HiddenGoal # You can choose to initialize the random seed of the environment. @@ -136,7 +131,7 @@ env1.reset() # Reset environment env2.reset() a1 = env1.action_space.sample() # Sample an action a2 = env2.action_space.sample() -next_obs1, _, _, _ = env1.step(a1) # Step the environment with the sampled random action +next_obs1, _, _, _, _ = env1.step(a1) # Step the environment with the sampled random action next_obs2, _, _, _ = env2.step(a2) assert (next_obs1[-3:] == next_obs2[-3:]).all() # 2 envs initialized with the same seed will have the same goal @@ -147,8 +142,8 @@ env1.reset() # Reset environment env3.reset() a1 = env1.action_space.sample() # Sample an action a3 = env3.action_space.sample() -next_obs1, _, _, _ = env1.step(a1) # Step the environment with the sampled random action -next_obs3, _, _, _ = env3.step(a3) +next_obs1, _, _, _, _ = env1.step(a1) # Step the environment with the sampled random action +next_obs3, _, _, _, _ = env3.step(a3) assert not (next_obs1[-3:] == next_obs3[-3:]).all() # 2 envs initialized with different seeds will have different goals assert not (next_obs1[-3:] == np.zeros(3)).all() # The env's are goal observable, meaning the goal is not zero'd out diff --git a/docs/introduction/installation.md b/docs/introduction/installation.md index 8eb172a43..ec1785c4c 100644 --- a/docs/introduction/installation.md +++ b/docs/introduction/installation.md @@ -15,7 +15,7 @@ cd Metaworld pip install -e . ``` -For users attempting to reproduce results found in the Meta-World paper please use this command: +For users attempting to reproduce results found in the [Meta-World paper](https://arxiv.org/abs/1910.10897) please use this command: ``` pip install git+https://github.com/Farama-Foundation/Metaworld.git@04be337a12305e393c0caf0cbf5ec7755c7c8feb ``` diff --git a/docs/rendering/rendering.md b/docs/rendering/rendering.md new file mode 100644 index 000000000..33087f222 --- /dev/null +++ b/docs/rendering/rendering.md @@ -0,0 +1,49 @@ +# 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. + +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, terminate, truncate, info = env.step(a) # Step the environment with the sampled random action +``` + +You can also render from a 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) + +```