From 9d9bd0f80bbcd916b5fadd5303195224d5c4b7ed Mon Sep 17 00:00:00 2001 From: Bolun <36321182+BolunDai0216@users.noreply.github.com> Date: Sun, 18 Dec 2022 17:09:26 -0500 Subject: [PATCH 1/4] updated part of the docstrings --- miniworld/envs/collecthealth.py | 2 +- miniworld/envs/fourrooms.py | 6 +++--- miniworld/envs/hallway.py | 4 ++-- miniworld/envs/maze.py | 18 ++++++++++++------ miniworld/envs/oneroom.py | 17 +++++++++++------ miniworld/envs/pickupobjects.py | 2 +- miniworld/envs/putnext.py | 2 +- miniworld/envs/roomobjects.py | 2 +- miniworld/envs/sidewalk.py | 4 ++-- miniworld/envs/sign.py | 2 +- miniworld/envs/threerooms.py | 4 ++-- miniworld/envs/tmaze.py | 10 +++++----- miniworld/envs/wallgap.py | 6 +++--- miniworld/envs/ymaze.py | 8 ++++---- 14 files changed, 49 insertions(+), 38 deletions(-) diff --git a/miniworld/envs/collecthealth.py b/miniworld/envs/collecthealth.py index cca110e4..f69611b3 100644 --- a/miniworld/envs/collecthealth.py +++ b/miniworld/envs/collecthealth.py @@ -30,7 +30,7 @@ class CollectHealth(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: diff --git a/miniworld/envs/fourrooms.py b/miniworld/envs/fourrooms.py index 7da85fb4..2e775d01 100644 --- a/miniworld/envs/fourrooms.py +++ b/miniworld/envs/fourrooms.py @@ -21,16 +21,16 @@ class FourRooms(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: - +(1 - 0.2 * (step_count / max_episode_steps)) when red box reached + +(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise. ## Arguments ```python - FourRooms() + env = gym.make("MiniWorld-FourRooms-v0") ``` """ diff --git a/miniworld/envs/hallway.py b/miniworld/envs/hallway.py index 31e9f7dd..5f20c571 100644 --- a/miniworld/envs/hallway.py +++ b/miniworld/envs/hallway.py @@ -11,7 +11,7 @@ class Hallway(MiniWorldEnv, utils.EzPickle): ## Description Environment in which the goal is to go to a red box - at the end of a hallway + at the end of a hallway. ## Action Space @@ -24,7 +24,7 @@ class Hallway(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: diff --git a/miniworld/envs/maze.py b/miniworld/envs/maze.py index e1a58849..dc9d17dc 100644 --- a/miniworld/envs/maze.py +++ b/miniworld/envs/maze.py @@ -9,7 +9,11 @@ class Maze(MiniWorldEnv, utils.EzPickle): """ ## Description - Maze environment in which the agent has to reach a red box + Maze environment in which the agent has to reach a red box. There are a + few variants of the `Maze` environment. The `MazeS2` environment gives + you a 2x2 maze and the `MazeS3` environment gives you a 3x3 maze. The + `MazeS3Fast` also gives you a 2x2 maze, but the turning and moving motion + per action is larger. ## Action Space @@ -22,20 +26,22 @@ class Maze(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: - +(1 - 0.2 * (step_count / max_episode_steps)) when red box reached + +(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise. ## Arguments ```python - MazeS2() + env = gym.make("MiniWorld-Maze-v0") # or - MazeS3() + env = gym.make("MiniWorld-MazeS2-v0") # or - MazeS3Fast() + env = gym.make("MiniWorld-MazeS3-v0") + # or + env = gym.make("MiniWorld-MazeS3Fast-v0") ``` """ diff --git a/miniworld/envs/oneroom.py b/miniworld/envs/oneroom.py index 7789ed47..c34fe9b6 100644 --- a/miniworld/envs/oneroom.py +++ b/miniworld/envs/oneroom.py @@ -9,8 +9,11 @@ class OneRoom(MiniWorldEnv, utils.EzPickle): """ ## Description - Environment in which the goal is to go to a red box - placed randomly in one big room. + Environment in which the goal is to go to a red box placed randomly in one big room. + The `OneRoom` environment has two variants. The `OneRoomS6` environment gives you + a room with size 6 (the `OneRoom` environment has size 10). The `OneRoomS6Fast` + environment also is using a room with size 6, but the turning and moving motion + is larger. ## Action Space @@ -23,18 +26,20 @@ class OneRoom(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: - +(1 - 0.2 * (step_count / max_episode_steps)) when red box reached + +(1 - 0.2 * (step_count / max_episode_steps)) when red box reached and zero otherwise. ## Arguments ```python - OneRoomS6() + env = gym.make("MiniWorld-OneRoom-v0") # or - OneRoomS6Fast() + env = gym.make("MiniWorld-OneRoomS6-v0") + # or + env = gym.make("MiniWorld-OneRoomS6Fast-v0") ``` """ diff --git a/miniworld/envs/pickupobjects.py b/miniworld/envs/pickupobjects.py index f8e52a52..8dcd4d48 100644 --- a/miniworld/envs/pickupobjects.py +++ b/miniworld/envs/pickupobjects.py @@ -24,7 +24,7 @@ class PickupObjects(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: diff --git a/miniworld/envs/putnext.py b/miniworld/envs/putnext.py index f163d0cd..c42191af 100644 --- a/miniworld/envs/putnext.py +++ b/miniworld/envs/putnext.py @@ -27,7 +27,7 @@ class PutNext(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: diff --git a/miniworld/envs/roomobjects.py b/miniworld/envs/roomobjects.py index 02edc5f1..a6e43d91 100644 --- a/miniworld/envs/roomobjects.py +++ b/miniworld/envs/roomobjects.py @@ -31,7 +31,7 @@ class RoomObjects(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: diff --git a/miniworld/envs/sidewalk.py b/miniworld/envs/sidewalk.py index ce7f0c7e..89df53ea 100644 --- a/miniworld/envs/sidewalk.py +++ b/miniworld/envs/sidewalk.py @@ -25,7 +25,7 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: @@ -34,7 +34,7 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle): ## Arguments ```python - Sidewalk() + env = gym.make("MiniWorld-Sidewalk-v0") ``` """ diff --git a/miniworld/envs/sign.py b/miniworld/envs/sign.py index bb819ef8..ae096400 100644 --- a/miniworld/envs/sign.py +++ b/miniworld/envs/sign.py @@ -52,7 +52,7 @@ class Sign(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: diff --git a/miniworld/envs/threerooms.py b/miniworld/envs/threerooms.py index bf6903f6..e5522bcc 100644 --- a/miniworld/envs/threerooms.py +++ b/miniworld/envs/threerooms.py @@ -23,7 +23,7 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: @@ -32,7 +32,7 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle): ## Arguments ```python - ThreeRooms() + env = gym.make("MiniWorld-ThreeRooms-v0") ``` """ diff --git a/miniworld/envs/tmaze.py b/miniworld/envs/tmaze.py index bca3109e..a65c6295 100644 --- a/miniworld/envs/tmaze.py +++ b/miniworld/envs/tmaze.py @@ -10,7 +10,7 @@ class TMaze(MiniWorldEnv, utils.EzPickle): """ ## Description - Two hallways connected in a T-junction + Two hallways connected in a T-junction. ## Action Space @@ -23,18 +23,18 @@ class TMaze(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: - +(1 - 0.2 * (step_count / max_episode_steps)) when box reached + +(1 - 0.2 * (step_count / max_episode_steps)) when box reached and zero otherwise. ## Arguments ```python - TMazeLeft() + env = gym.make("MiniWorld-TMazeLeft-v0") # or - TMazeRight() + env = gym.make("MiniWorld-TMazeRight-v0") ``` diff --git a/miniworld/envs/wallgap.py b/miniworld/envs/wallgap.py index f592c5ed..4dea06c1 100644 --- a/miniworld/envs/wallgap.py +++ b/miniworld/envs/wallgap.py @@ -11,7 +11,7 @@ class WallGap(MiniWorldEnv, utils.EzPickle): """ ## Description - Outside environment with two rooms connected by a gap in a wall + Outside environment with two rooms connected by a gap in a wall. ## Action Space @@ -24,7 +24,7 @@ class WallGap(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: @@ -33,7 +33,7 @@ class WallGap(MiniWorldEnv, utils.EzPickle): ## Arguments ```python - WallGap() + env = gym.make("MiniWorld-WallGap-v0") ``` """ diff --git a/miniworld/envs/ymaze.py b/miniworld/envs/ymaze.py index 120eb577..2d86e856 100644 --- a/miniworld/envs/ymaze.py +++ b/miniworld/envs/ymaze.py @@ -12,7 +12,7 @@ class YMaze(MiniWorldEnv, utils.EzPickle): """ ## Description - Two hallways connected in a Y-junction + Two hallways connected in a Y-junction. ## Action Space @@ -25,7 +25,7 @@ class YMaze(MiniWorldEnv, utils.EzPickle): ## Observation Space The observation space is an `ndarray` with shape `(obs_height, obs_width, 3)` - representing the view the agents sees. + representing a RGB image of what the agents sees. ## Rewards: @@ -34,9 +34,9 @@ class YMaze(MiniWorldEnv, utils.EzPickle): ## Arguments ```python - YMazeLeft() + env = gym.make("MiniWorld-YMazeLeft-v0") # or - YMazeRight() + env = gym.make("MiniWorld-YMazeRight-v0") ``` """ From 3d077c573f44815083a739b12e6609661f05fd14 Mon Sep 17 00:00:00 2001 From: Bolun <36321182+BolunDai0216@users.noreply.github.com> Date: Sun, 1 Jan 2023 08:17:27 -1000 Subject: [PATCH 2/4] updated docstrings for the environments --- miniworld/envs/fourrooms.py | 3 ++- miniworld/envs/hallway.py | 6 +++--- miniworld/envs/putnext.py | 3 ++- miniworld/envs/roomobjects.py | 7 +++---- miniworld/envs/sidewalk.py | 4 ++-- miniworld/envs/threerooms.py | 4 +++- miniworld/envs/tmaze.py | 8 +++++--- miniworld/envs/wallgap.py | 3 ++- miniworld/envs/ymaze.py | 6 +++++- 9 files changed, 27 insertions(+), 17 deletions(-) diff --git a/miniworld/envs/fourrooms.py b/miniworld/envs/fourrooms.py index 2e775d01..25769d0e 100644 --- a/miniworld/envs/fourrooms.py +++ b/miniworld/envs/fourrooms.py @@ -8,7 +8,8 @@ class FourRooms(MiniWorldEnv, utils.EzPickle): """ ## Description - Classic four rooms environment. The agent must reach the red box to get a reward. + Classic four rooms environment. The goal is to reach the red box to get a + reward in as few steps as possible. ## Action Space diff --git a/miniworld/envs/hallway.py b/miniworld/envs/hallway.py index 5f20c571..1887c384 100644 --- a/miniworld/envs/hallway.py +++ b/miniworld/envs/hallway.py @@ -10,8 +10,8 @@ class Hallway(MiniWorldEnv, utils.EzPickle): """ ## Description - Environment in which the goal is to go to a red box - at the end of a hallway. + Environment in which the goal is to go to a red box at the end of a + hallway within as few steps as possible. ## Action Space @@ -33,7 +33,7 @@ class Hallway(MiniWorldEnv, utils.EzPickle): ## Arguments ```python - FourRooms(length=12) + Hallway(length=12) ``` `length`: length of the entire space diff --git a/miniworld/envs/putnext.py b/miniworld/envs/putnext.py index c42191af..52f119eb 100644 --- a/miniworld/envs/putnext.py +++ b/miniworld/envs/putnext.py @@ -9,7 +9,8 @@ class PutNext(MiniWorldEnv, utils.EzPickle): ## Description Single-room environment where a red box must be placed next - to a yellow box. + to a yellow box. The goal is to perform this task in as few + steps as possible. ## Action Space diff --git a/miniworld/envs/roomobjects.py b/miniworld/envs/roomobjects.py index a6e43d91..b90cf48d 100644 --- a/miniworld/envs/roomobjects.py +++ b/miniworld/envs/roomobjects.py @@ -10,9 +10,8 @@ class RoomObjects(MiniWorldEnv, utils.EzPickle): """ ## Description - Single room with multiple objects - Inspired by the single room environment of - the Generative Query Networks paper: + Single room with multiple objects. Inspired by the single room environment + of the Generative Query Networks paper: https://deepmind.com/blog/neural-scene-representation-and-rendering/ ## Action Space @@ -35,7 +34,7 @@ class RoomObjects(MiniWorldEnv, utils.EzPickle): ## Rewards: - +0 + None ## Arguments diff --git a/miniworld/envs/sidewalk.py b/miniworld/envs/sidewalk.py index 89df53ea..a58aeea0 100644 --- a/miniworld/envs/sidewalk.py +++ b/miniworld/envs/sidewalk.py @@ -11,8 +11,8 @@ class Sidewalk(MiniWorldEnv, utils.EzPickle): """ ## Description - Walk on a sidewalk up to an object to be collected. - Don't walk into the street. + Walk on a sidewalk up to an object to be collected. Don't walk into the + street. The goal is to reach the object in as few steps as possible. ## Action Space diff --git a/miniworld/envs/threerooms.py b/miniworld/envs/threerooms.py index e5522bcc..0e43a5b8 100644 --- a/miniworld/envs/threerooms.py +++ b/miniworld/envs/threerooms.py @@ -10,7 +10,9 @@ class ThreeRooms(MiniWorldEnv, utils.EzPickle): """ ## Description - Two small rooms connected to one large room + Two small rooms connected to one large room, with five different items + placed on the ground: a red box, a green box, a white ball, a key, and + a rubber duck. ## Action Space diff --git a/miniworld/envs/tmaze.py b/miniworld/envs/tmaze.py index a65c6295..28b08fb2 100644 --- a/miniworld/envs/tmaze.py +++ b/miniworld/envs/tmaze.py @@ -10,7 +10,11 @@ class TMaze(MiniWorldEnv, utils.EzPickle): """ ## Description - Two hallways connected in a T-junction. + Two hallways connected in a T-junction, the goal is to move the agent + towards a red box within as few steps as possible. In + `MiniWorld-TMazeLeft-v0`, the red box is located on the left wing of + the T-shaped junction. In `MiniWorld-TMazeRight-v0`, the red box is + located on the right wing of the T-shaped junction. ## Action Space @@ -36,8 +40,6 @@ class TMaze(MiniWorldEnv, utils.EzPickle): # or env = gym.make("MiniWorld-TMazeRight-v0") ``` - - """ def __init__(self, goal_pos=None, **kwargs): diff --git a/miniworld/envs/wallgap.py b/miniworld/envs/wallgap.py index 4dea06c1..589a86a8 100644 --- a/miniworld/envs/wallgap.py +++ b/miniworld/envs/wallgap.py @@ -11,7 +11,8 @@ class WallGap(MiniWorldEnv, utils.EzPickle): """ ## Description - Outside environment with two rooms connected by a gap in a wall. + Outside environment with two rooms connected by a gap in a wall. The + goal is to go to a red box within as little steps as possible. ## Action Space diff --git a/miniworld/envs/ymaze.py b/miniworld/envs/ymaze.py index 2d86e856..dd2cf651 100644 --- a/miniworld/envs/ymaze.py +++ b/miniworld/envs/ymaze.py @@ -12,7 +12,11 @@ class YMaze(MiniWorldEnv, utils.EzPickle): """ ## Description - Two hallways connected in a Y-junction. + Two hallways connected in a Y-junction. the goal is to move the agent + towards a red box within as little steps as possible. In + `MiniWorld-YMazeLeft-v0`, the red box is located on the left wing of + the Y-shaped junction. In `MiniWorld-YMazeRight-v0`, the red box is + located on the right wing of the Y-shaped junction. ## Action Space From 5ca7c752a0aafe75bee9219552159ad6ff25dbdc Mon Sep 17 00:00:00 2001 From: Bolun <36321182+BolunDai0216@users.noreply.github.com> Date: Sun, 1 Jan 2023 21:01:06 -1000 Subject: [PATCH 3/4] added no return to human rendering --- miniworld/envs/sign.py | 12 +++++++++--- miniworld/miniworld.py | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/miniworld/envs/sign.py b/miniworld/envs/sign.py index ae096400..5b648b01 100644 --- a/miniworld/envs/sign.py +++ b/miniworld/envs/sign.py @@ -75,7 +75,7 @@ class Sign(MiniWorldEnv, utils.EzPickle): """ - def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0): + def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0, **kwargs): if color_index not in [0, 1, 2]: raise ValueError("Only supported values for color_index are 0, 1, 2.") @@ -91,9 +91,15 @@ def __init__(self, size=10, max_episode_steps=20, color_index=0, goal=0): self._color_index = color_index MiniWorldEnv.__init__( - self, params=params, max_episode_steps=max_episode_steps, domain_rand=False + self, + params=params, + max_episode_steps=max_episode_steps, + domain_rand=False, + **kwargs, + ) + utils.EzPickle.__init__( + self, size, max_episode_steps, color_index, goal, **kwargs ) - utils.EzPickle.__init__(self, size, max_episode_steps, color_index, goal) self.observation_space = Dict(obs=self.observation_space, goal=Discrete(2)) diff --git a/miniworld/miniworld.py b/miniworld/miniworld.py index ef04e398..185fb1cb 100644 --- a/miniworld/miniworld.py +++ b/miniworld/miniworld.py @@ -1417,4 +1417,6 @@ def render(self): self.window.flip() self.window.dispatch_events() + return + return img From 9f5dd47e4428c403ab22f4dec78b6bc0c8916fb2 Mon Sep 17 00:00:00 2001 From: Bolun <36321182+BolunDai0216@users.noreply.github.com> Date: Mon, 2 Jan 2023 06:02:11 -1000 Subject: [PATCH 4/4] skipped render check --- tests/test_miniworld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_miniworld.py b/tests/test_miniworld.py index bfc9734a..1009369d 100755 --- a/tests/test_miniworld.py +++ b/tests/test_miniworld.py @@ -130,7 +130,7 @@ def test_env_checker(env_id): env = gym.make(env_id).unwrapped warnings.simplefilter("always") with warnings.catch_warnings(record=True) as w: - check_env(env) + check_env(env, skip_render_check=True) for warning in w: if warning.message.args[0] not in CHECK_ENV_IGNORE_WARNINGS: