Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.09k stars 604 forks source link

[Question] How to get the position of the agent (self)? #324

Closed liruiluo closed 1 year ago

liruiluo commented 1 year ago

Question

I try to use the SymbolicObsWrapper in the "MiniGrid-Empty-5x5-v0" environment, but only on the agent's tiles and without the agent's logo, I get the following: {'image': array([[[ 0, 0, 2], [ 0, 1, 2], [ 0, 2, 2], [ 0, 3, 2], [ 0, 4, 2]],

    [[ 1, 0, 2],
     [ 1, 1, -1],
     [ 1, 2, -1],
     [ 1, 3, -1],
     [ 1, 4, 2]],

    [[ 2, 0, 2],
     [ 2, 1, -1],
     [ 2, 2, -1],
     [ 2, 3, -1],
     [ 2, 4, 2]],

    [[ 3, 0, 2],
     [ 3, 1, -1],
     [ 3, 2, -1],
     [ 3, 3, 8],
     [ 3, 4, 2]],

    [[ 4, 0, 2],
     [ 4, 1, 2],
     [ 4, 2, 2],
     [ 4, 3, 2],
     [ 4, 4, 2]]]), 'direction': 1, 'mission': 'get to the green goal square'}

It's easy to tell that 2 is the outer tile, -1 is the inner tile, and 8 is the destination. But where is the agent?

pseudo-rnd-thoughts commented 1 year ago

env.agent_pos should be the agent's position