From 1eb36170368638c99b3cc698f8bdc9712ba9fcc7 Mon Sep 17 00:00:00 2001 From: Bolun Dai <36321182+BolunDai0216@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:32:10 -0500 Subject: [PATCH] Fixed issue when generating documentation (#414) --- .github/workflows/build-docs-dev.yml | 2 +- .github/workflows/build-docs-version.yml | 2 +- .github/workflows/manual-build-docs-version.yml | 2 +- minigrid/__init__.py | 8 ++++---- minigrid/envs/__init__.py | 1 + minigrid/envs/obstructedmaze_v1.py | 2 +- minigrid/minigrid_env.py | 5 +++++ 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-docs-dev.yml b/.github/workflows/build-docs-dev.yml index 84cb18270..194ce26e7 100644 --- a/.github/workflows/build-docs-dev.yml +++ b/.github/workflows/build-docs-dev.yml @@ -21,7 +21,7 @@ jobs: run: pip install -r docs/requirements.txt - name: Register Envs - run: pip install -e . + run: pip install -e .[wfc] - name: Build Envs Docs run: python docs/_scripts/gen_env_docs.py diff --git a/.github/workflows/build-docs-version.yml b/.github/workflows/build-docs-version.yml index 56112a823..631e87271 100644 --- a/.github/workflows/build-docs-version.yml +++ b/.github/workflows/build-docs-version.yml @@ -26,7 +26,7 @@ jobs: run: pip install -r docs/requirements.txt - name: Register Envs - run: pip install -e . + run: pip install -e .[wfc] - name: Build Envs Docs run: python docs/_scripts/gen_env_docs.py diff --git a/.github/workflows/manual-build-docs-version.yml b/.github/workflows/manual-build-docs-version.yml index 4cd95d081..a99cba639 100644 --- a/.github/workflows/manual-build-docs-version.yml +++ b/.github/workflows/manual-build-docs-version.yml @@ -37,7 +37,7 @@ jobs: run: pip install -r docs/requirements.txt - name: Register Envs - run: pip install -e . + run: pip install -e .[wfc] - name: Build Envs Docs run: python docs/_scripts/gen_env_docs.py diff --git a/minigrid/__init__.py b/minigrid/__init__.py index be2f75264..d98e6ed0c 100644 --- a/minigrid/__init__.py +++ b/minigrid/__init__.py @@ -478,7 +478,7 @@ def register_minigrid_envs(): register( id="MiniGrid-ObstructedMaze-2Dlhb-v1", - entry_point="minigrid.envs.obstructedmaze_v1:ObstructedMaze_Full", + entry_point="minigrid.envs:ObstructedMaze_Full_V1", kwargs={ "agent_room": (2, 1), "key_in_box": True, @@ -490,7 +490,7 @@ def register_minigrid_envs(): register( id="MiniGrid-ObstructedMaze-1Q-v1", - entry_point="minigrid.envs.obstructedmaze_v1:ObstructedMaze_Full", + entry_point="minigrid.envs:ObstructedMaze_Full_V1", kwargs={ "agent_room": (1, 1), "key_in_box": True, @@ -502,7 +502,7 @@ def register_minigrid_envs(): register( id="MiniGrid-ObstructedMaze-2Q-v1", - entry_point="minigrid.envs.obstructedmaze_v1:ObstructedMaze_Full", + entry_point="minigrid.envs:ObstructedMaze_Full_V1", kwargs={ "agent_room": (2, 1), "key_in_box": True, @@ -514,7 +514,7 @@ def register_minigrid_envs(): register( id="MiniGrid-ObstructedMaze-Full-v1", - entry_point="minigrid.envs.obstructedmaze_v1:ObstructedMaze_Full", + entry_point="minigrid.envs:ObstructedMaze_Full_V1", ) # Playground diff --git a/minigrid/envs/__init__.py b/minigrid/envs/__init__.py index 5401e7157..7962f1e78 100644 --- a/minigrid/envs/__init__.py +++ b/minigrid/envs/__init__.py @@ -20,6 +20,7 @@ ObstructedMaze_Full, ObstructedMazeEnv, ) +from minigrid.envs.obstructedmaze_v1 import ObstructedMaze_Full_V1 from minigrid.envs.playground import PlaygroundEnv from minigrid.envs.putnear import PutNearEnv from minigrid.envs.redbluedoors import RedBlueDoorEnv diff --git a/minigrid/envs/obstructedmaze_v1.py b/minigrid/envs/obstructedmaze_v1.py index 08f6022b5..cae181e93 100644 --- a/minigrid/envs/obstructedmaze_v1.py +++ b/minigrid/envs/obstructedmaze_v1.py @@ -6,7 +6,7 @@ from minigrid.envs.obstructedmaze import ObstructedMazeEnv -class ObstructedMaze_Full(ObstructedMazeEnv): +class ObstructedMaze_Full_V1(ObstructedMazeEnv): """ A blue ball is hidden in one of the 4 corners of a 3x3 maze. Doors are locked, doors are obstructed by a ball and keys are hidden in diff --git a/minigrid/minigrid_env.py b/minigrid/minigrid_env.py index 23ae5e18b..b50499b40 100755 --- a/minigrid/minigrid_env.py +++ b/minigrid/minigrid_env.py @@ -200,6 +200,11 @@ def pprint_grid(self): output = "" + # check if self.agent_pos & self.agent_dir is None + # should not be after env is reset + if self.agent_pos is None: + return super().__str__() + for j in range(self.grid.height): for i in range(self.grid.width): if i == self.agent_pos[0] and j == self.agent_pos[1]: