Farama-Foundation / Minigrid

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

[Question] What is the difference between FullyObsWrapper and SymbolicObsWrapper? #351

Closed SkittlePox closed 1 year ago

SkittlePox commented 1 year ago

Question

What is the difference between the observations provided by these two wrappers? Here is an obs from FullyObsWrapper:

{'image': array([[[ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 1,  0,  0],
        [10,  0,  0],
        [ 5,  4,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 2,  5,  0],
        [ 4,  4,  2],
        [ 2,  5,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 1,  0,  0],
        [ 1,  0,  0],
        [ 8,  1,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0]]], dtype=uint8), 'direction': 0, 'mission': 'use the key to open the door and then get to the goal'}

And here is an obs from SymbolicObsWrapper:

{'image': array([[[ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [10,  0,  2],
        [ 1,  0,  0],
        [ 5,  4,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 2,  5,  0],
        [ 4,  4,  2],
        [ 2,  5,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 1,  0,  0],
        [ 1,  0,  0],
        [ 8,  1,  0],
        [ 2,  5,  0]],

       [[ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0],
        [ 2,  5,  0]]], dtype=uint8), 'direction': 2, 'mission': 'use the key to open the door and then get to the goal'}
pseudo-rnd-thoughts commented 1 year ago

Sorry for taking a while to get back to you

The symbolic wrapper provides the full observable grid with a symbolic state representation. The symbol is a triple of (X, Y, IDX), where X and Y are the coordinates on the grid, and IDX is the id of the object.

For the fully obs wrapper providing the encoding of the grid with the addition of the agent encoding which is special https://github.com/Farama-Foundation/Minigrid/blob/26b4f647bc55c73d1101c67da99c198a62142d36/minigrid/wrappers.py#L413

Does this help?

BolunDai0216 commented 1 year ago

I will close this issue since there are no additional comments, please feel free to reopen it if anyone has any related questions.