Minigrid icon indicating copy to clipboard operation
Minigrid copied to clipboard

[Bug Report] ViewSizeWrapper ignored with RGBImgPartialObsWrapper

Open lpjiang97 opened this issue 1 year ago • 1 comments

Describe the bug When wrapped after the RGBImgPartialObsWrapper, the agent_view_size set in ViewSizeWrapper is ignored.

Code example

env = gym.make("MiniGrid-Empty-8x8-v0")
env = RGBImgPartialObsWrapper(ViewSizeWrapper(env, agent_view_size=5))
env = ImgObsWrapper(env)

obs, info = env.reset(seed=10)
print(env.agent_view_size) # returns 5
plt.imshow(obs)

The image plotted shows a view size of 7.

System Info

  • minigrid was pip installed.
  • Cent OS with Python 3.10

Checklist

  • [x] I have checked that there is no similar issue in the repo (required)

lpjiang97 avatar Feb 16 '24 22:02 lpjiang97

I created a pull request to resolve this bug. After the ViewSizeWrapper, env.unwrapped.agent_view_size remains at its default value of 7 which the RGBImgPartialObsWrapper uses.

env = gym.make("MiniGrid-Empty-8x8-v0")
env = ViewSizeWrapper(env, agent_view_size=5)

obs, info = env.reset(seed=10)
print(env.agent_view_size)                  # returns 5
print(env.unwrapped.agent_view_size)        # returns 7

vishwassathish avatar Feb 25 '24 10:02 vishwassathish