Comments (12)
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.
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.
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.
You'd have to encode the agent in the observation differently, but it seems very doable. Are you volunteering? ;)
from minigrid.
By full observability you mean the whole grid-world, the objects, position and orientation of the agent right?
from minigrid.
Yes, a full view of the grid including the agent.
from minigrid.
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.
@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.
@d3sm0 can you clarify what the issue is? May be nice to get a PR :)
from minigrid.
@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.
Sweet. Thanks @d3sm0 !
from minigrid.
Working solution contributed by @d3sm0 in #24
from minigrid.
Related Issues (20)
- [Bug Report] Spec.to_json() of SimpleCrossing fails
- [Question] Getting total number of unique states HOT 1
- [Question] How to create vectorized envs for minigrid HOT 3
- [Bug Report] Unlock Pickup env is actually just Unlock HOT 4
- [Question] Difference between Minigrid and BabyAI envs HOT 1
- [Question] Is `ActionBonus` wrapper correct ? HOT 1
- [Question] How to build custom environment with custom action space HOT 1
- Python 3.11 support is missing from the README
- [Proposal] Update documentation HOT 3
- [Proposal] Add relevant project
- [Proposal] Discrete observations
- [Bug Report] ViewSizeWrapper ignored with RGBImgPartialObsWrapper HOT 1
- [Question] Get demonstration for 'MiniGrid-MultiRoom-N4-S5-v0' HOT 1
- [Bug Report] Cannot decode obs['image'] because of no implementation of agent in minigrid/core/world_object.py
- Accessing Specific Mission in BabyAI HOT 2
- [Question] Is there any existing expert agent that can provide correct demonstration? HOT 2
- Possible bug when generating non-square DoorKey environments. HOT 4
- Relational Deep RL for minigrid HOT 2
- [Bug Report] Docu link to `minigrid/core/constants.py` broken HOT 3
- [Bug Report] FlatObsWrapper lets to Crashes Due to Concatenation of uint8 and float32 Arrays in observation Method HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from minigrid.