Giter VIP home page Giter VIP logo

Comments (4)

maximecb avatar maximecb commented on July 24, 2024

There's no built-in provision to do it, but it wouldn't be too hard to modify the code to make it happen.

This piece of code determines the extents of the box the agent can see. The code would actually become simpler if it were centered around the agent: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L1044

You'll want to either disable or modify the visibility checking algorithm. There's a piece of code to make it so the agent can't see through walls: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L601

This can also be disabled by setting see_through_walls=True: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L673

from minigrid.

mzwang828 avatar mzwang828 commented on July 24, 2024

Thank you! I think I got it.
I made 2 changes in the minigrid.py file.
I changed the get_view_exts() method as you suggested so that the observation box is centered at the agent.
I didn't change the process_vis() method. Instead, I change agent_pos parameter passed to process_vis() so that the mask is also generated with the agent as center: https://github.com/maximecb/gym-minigrid/blob/081982e0652f25f814bdb5e6ecdeb6a8b08e45d0/gym_minigrid/minigrid.py#L1193

I think these 2 changes are enough to achieve the agent centered observation. Do you think if there's anything I'm missing? Thanks again!

from minigrid.

maximecb avatar maximecb commented on July 24, 2024

I think that process_vis might not quite work right with the agent position at the center, because it propagates visibility forward in the direction the agent is facing, so it won't handle what's behind.

from minigrid.

mzwang828 avatar mzwang828 commented on July 24, 2024

I see. You are right about this. I will just set it to see through the walls for now.

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.