Giter VIP home page Giter VIP logo

Comments (12)

maximecb avatar maximecb commented on July 24, 2024 1

I guess I should point out, if you want a fully observable setting, the quickest "hack" would be to just use the RGB image from the human render, you can produce this with img = env.render('rgb_array').

from minigrid.

d3sm0 avatar d3sm0 commented on July 24, 2024 1

A lazy way of doing it would be something like this?

class FullyObsWrapper(gym.core.ObservationWrapper):
    """
    Fully observable gridworld
    """

    def __init__(self, env):
        super().__init__(env)
        self.__dict__.update(vars(env))
        self.observation_space = spaces.Box(
            low=0,
            high=255,
            shape=(self.env.grid_size * 32, self.env.grid_size * 32, 3),  # number of cells
            dtype="uint8"
        )

    def observation(self, obs):
        if self.env.grid_render is None:
            return np.zeros(shape=self.observation_space.shape)  # dark screen as init state?
        return self.env.grid_render.getArray()

But how do you encode the direction of the agent? Maybe a tiled vector over the last dimension, so you will get the total obs as 800x800x4?

from minigrid.

maximecb avatar maximecb commented on July 24, 2024 1

If you render the whole grid that way and get the pixel data, then the agent will be visually rendered in there already.

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

You'd have to encode the agent in the observation differently, but it seems very doable. Are you volunteering? ;)

from minigrid.

d3sm0 avatar d3sm0 commented on July 24, 2024

By full observability you mean the whole grid-world, the objects, position and orientation of the agent right?

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

Yes, a full view of the grid including the agent.

from minigrid.

MishaLaskin avatar MishaLaskin commented on July 24, 2024

Had the same question about rendering the whole grid. Using img = env.render('rgb_array') was a nice hack. Thanks for the suggestion.

from minigrid.

d3sm0 avatar d3sm0 commented on July 24, 2024

@maximecb there is a little issue about attributes sharing. The env has more attribute than the gym env, thus wrapping requires the attributes update at least for testing purposes, i don't think you use them in the standard setting.

Shall I keep it like this and forget for now, or try to refactor a little bit and submit a PR?

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

@d3sm0 can you clarify what the issue is? May be nice to get a PR :)

from minigrid.

d3sm0 avatar d3sm0 commented on July 24, 2024

@maximecb sure. The issue is that when you wrap some env in a gym.Wrapper instance, you loose access to the attributes of the env. Thus it doesn't pass the test unless you don't share the missing attributes with self.__dict__.update(vars(env)) and your tests breaks.

I'm working on #13 and PR :)

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

Sweet. Thanks @d3sm0 !

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

Working solution contributed by @d3sm0 in #24

from minigrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.