Skip to content

[Bug Report] Cannot decode obs['image'] because of no implementation of agent in minigrid/core/world_object.py #422

@EC2EZ4RD

Description

@EC2EZ4RD
  • Bug description
    Cannot decode obs['image'] because of no implementation of agent in minigrid/core/world_object.py

  • Code

First, create an environment

import gymnasium as gym
from minigrid.wrappers import FullyObsWrapper
env = gym.make("MiniGrid-Empty-5x5-v0")
env = FullyObsWrapper(env)
obs, _ = env.reset()

Then, run

env.grid.decode(obs['image'])[0].render(env.tile_size, [0,0])

and return error:

File [~/miniconda3/envs/minigrid/lib/python3.10/site-packages/minigrid/core/world_object.py:101] in WorldObj.decode(type_idx, color_idx, state)
     99     v = Lava()
    100 else:
--> 101     assert False, "unknown object type in decode '%s'" % obj_type
    103 return v
  • Solution
    Should add the render code of agent in minigrid/core/world_object.py

Checklist

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions