Skip to content

Commit

Permalink
Add wrappers to website (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudo-rnd-thoughts authored Jan 12, 2025
1 parent 2a84bcf commit 2bf4977
Show file tree
Hide file tree
Showing 20 changed files with 93 additions and 93 deletions.
2 changes: 1 addition & 1 deletion docs/_scripts/gen_envs_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
def create_grid_cell(env_id):
env_name = env_id.split("-")[-2]
return f"""
<a href="{env_name.lower()}">
<a href="environments/{env_name.lower()}">
<div class="env-grid__cell">
<div class="cell__image-container">
<img src="/_static/environments/{env_name.lower()}.jpg">
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@

# -- Project information -----------------------------------------------------
import os
import time

import miniworld

project = "Miniworld"
copyright = "2023 Farama Foundation"
copyright = f"{time.localtime().tm_year} Farama Foundation"
author = "Farama Foundation"

# The full version, including alpha/beta/rc tags
Expand All @@ -34,7 +35,6 @@
# ones.
extensions = [
"sphinx.ext.napoleon",
"sphinx.ext.doctest",
"sphinx.ext.autodoc",
"sphinx.ext.githubpages",
"sphinx.ext.viewcode",
Expand Down
9 changes: 9 additions & 0 deletions docs/content/wrappers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Wrapper

Miniworld include several built in wrapper available to researchers in `miniworld.wrappers`

```{eval-rst}
.. autoclass:: miniworld.wrappers.PyTorchObsWrapper
.. autoclass:: miniworld.wrappers.GreyscaleWrapper
.. autoclass:: miniworld.wrappers.StochasticActionWrapper
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lastpage:
content/design
environments
content/wrappers
content/create_env
content/troubleshooting
content/installation
Expand Down
11 changes: 5 additions & 6 deletions miniworld/envs/collecthealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,20 @@ class CollectHealth(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+2 for each time step
-100 for dying
## Arguments
* `size`: size of the room
```python
CollectHealth(size=16)
env = gymnasium.make("Miniworld-CollectHealth-v0", size=16)
```
`size`: size of the room
"""

def __init__(self, size=16, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions miniworld/envs/fourrooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ class FourRooms(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise.
## Arguments
```python
env = gym.make("MiniWorld-FourRooms-v0")
env = gymnasium.make("MiniWorld-FourRooms-v0")
```
"""
Expand Down
10 changes: 6 additions & 4 deletions miniworld/envs/hallway.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,21 @@ class Hallway(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached
## Arguments
* `length`: length of the entire space
```python
Hallway(length=12)
env = gymnasium.make("Miniworld-Hallway-v0", length=12)
```
`length`: length of the entire space
"""

Expand Down
13 changes: 6 additions & 7 deletions miniworld/envs/maze.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,23 @@ class Maze(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise.
## Arguments
```python
env = gym.make("MiniWorld-Maze-v0")
env = gymnasium.make("MiniWorld-Maze-v0")
# or
env = gym.make("MiniWorld-MazeS2-v0")
env = gymnasium.make("MiniWorld-MazeS2-v0")
# or
env = gym.make("MiniWorld-MazeS3-v0")
env = gymnasium.make("MiniWorld-MazeS3-v0")
# or
env = gym.make("MiniWorld-MazeS3Fast-v0")
env = gymnasium.make("MiniWorld-MazeS3Fast-v0")
```
"""

def __init__(
Expand Down
11 changes: 5 additions & 6 deletions miniworld/envs/oneroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,21 @@ class OneRoom(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise.
## Arguments
```python
env = gym.make("MiniWorld-OneRoom-v0")
env = gymnasium.make("MiniWorld-OneRoom-v0")
# or
env = gym.make("MiniWorld-OneRoomS6-v0")
env = gymnasium.make("MiniWorld-OneRoomS6-v0")
# or
env = gym.make("MiniWorld-OneRoomS6Fast-v0")
env = gymnasium.make("MiniWorld-OneRoomS6Fast-v0")
```
"""

def __init__(self, size=10, max_episode_steps=180, **kwargs):
Expand Down
14 changes: 6 additions & 8 deletions miniworld/envs/pickupobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@ class PickupObjects(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+1 when agent picked up object
## Arguments
* `size`: size of world
* `num_objs`: number of objects
```python
PickupObjects(size=12, num_objs=5)
env = gymnasium.make("Miniworld-PickupObjects-v0", size=12, num_objs=5)
```
`size`: size of world
`num_objs`: number of objects
"""

def __init__(self, size=12, num_objs=5, **kwargs):
Expand Down
10 changes: 6 additions & 4 deletions miniworld/envs/putnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,21 @@ class PutNext(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when red box is next to yellow box
## Arguments
* `size`: size of world
```python
PutNext(size=12)
env = gymnasium.make("Miniworld-PutNext-v0", size=12)
```
`size`: size of world
"""

Expand Down
11 changes: 5 additions & 6 deletions miniworld/envs/roomobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@ class RoomObjects(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
None
## Arguments
* `size`: size of world
```python
RoomObjects(size=16)
env = gymnasium.make("Miniworld-RoomObjects-v0", size=16)
```
`size`: size of world
"""

def __init__(self, size=10, **kwargs):
Expand Down
7 changes: 3 additions & 4 deletions miniworld/envs/sidewalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when object reached
## Arguments
```python
env = gym.make("MiniWorld-Sidewalk-v0")
env = gymnasium.make("MiniWorld-Sidewalk-v0")
```
"""

def __init__(self, **kwargs):
Expand Down
20 changes: 8 additions & 12 deletions miniworld/envs/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,23 @@ class Sign(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+1 for touching the object where the color matches the sign and the shape matches the goal
-1 for touching any other object
## Arguments
* `size`: size of the square room.
* `max_episode_steps`: number of steps before the episode ends.
* `color_index`: specifies whether the sign says blue (0), green (1), or red (2).
* `goal`: specifies box (0) or key (1).
```python
Sign(size=10, max_episode_steps=20, color_index=0, goal=0)
env = gymnasium.make("Miniworld-Sign-v0", size=10, max_episode_steps=20, color_index=0, goal=0)
```
`size`: size of the square room.
`max_episode_steps`: number of steps before the episode ends.
`color_index`: specifies whether the sign says blue (0), green (1), or red (2).
`goal`: specifies box (0) or key (1).
"""

def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0, **kwargs):
Expand Down
7 changes: 3 additions & 4 deletions miniworld/envs/threerooms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
None
## Arguments
```python
env = gym.make("MiniWorld-ThreeRooms-v0")
env = gymnasium.make("MiniWorld-ThreeRooms-v0")
```
"""

def __init__(self, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions miniworld/envs/tmaze.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ class TMaze(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when box reached and zero otherwise.
## Arguments
```python
env = gym.make("MiniWorld-TMazeLeft-v0")
env = gymnasium.make("MiniWorld-TMazeLeft-v0")
# or
env = gym.make("MiniWorld-TMazeRight-v0")
env = gymnasium.make("MiniWorld-TMazeRight-v0")
```
"""

Expand Down
6 changes: 3 additions & 3 deletions miniworld/envs/wallgap.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ class WallGap(MiniWorldEnv, utils.EzPickle):
## Observation Space
The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)`
representing a RGB image of what the agents sees.
representing an RGB image of what the agents see.
## Rewards:
## Rewards
+(1 - 0.2 * (step_count / max_episode_steps)) when box reached
## Arguments
```python
env = gym.make("MiniWorld-WallGap-v0")
env = gymnasium.make("MiniWorld-WallGap-v0")
```
"""

Expand Down
Loading

0 comments on commit 2bf4977

Please sign in to comment.