Comments (9)
Hi, yes there is. You can call the env.get_obs_render()
method to generate images: https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L1215
Note that this will produce a partial observation still, not a fully observable render. If you want a fully observable render, you can call env.render('rgb_array')
.
from minigrid.
How do you actually use env.get_obs_render()
?
I tried it like this, but got a keyword argument exception on 'mode':
import gym_minigrid
import gym
import numpy as np
import matplotlib.pyplot as plt
env = gym.make("MiniGrid-FourRooms-v0")
obs = env.reset()
env.render()
agent_frame = env.get_obs_render(obs["image"], mode="rgb_array")
plt.imshow(agent_frame)
plt.show()
from minigrid.
I solved the issue by installing gym_minigrid from source. I installed the pip package previously.
@maximecb could you update the pip package?
from minigrid.
Related to that - is there an easy built-in way to mask out those parts of the environment that the agent cannot see from the current position (e.g due to walls, etc)?
EDIT: I see there are built-in methods to mask out cells that are invisible to the agent (https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L1160). That is then translated to an image of environment via decode here https://github.com/maximecb/gym-minigrid/blob/master/gym_minigrid/minigrid.py#L548 .
It seems that an empty or invisible cell have the same representation (I suppose just black). Am I correct with that? If yes, for the agent an empty and invisible cell do not make a difference. I think though semantically, "visible and empty" cell (known to be empty) should deliver a different perception as "non-visible" cell (uncertain whether empty or whatever). For instance, invisible cells could be rendered as "grayed out", "foggy" etc. What do you folks think?
from minigrid.
Hi @JeniaJitsev, the masking should be enabled by default. You are correct that the agent gets a different perception for empty and invisible cells, but right now there is no special rendering for invisible cells in the RGB render.
from minigrid.
@MarcoMeter Thanks for the heads up. I just pushed a package version 0.0.5 to pip
from minigrid.
Hey @maximecb, thanks for quick response and package update. We can have a look whether there is a straighforward simple way to incorporate an option for rendering of empty vs invisible cells to be different in image observation, so it can be then enabled / disabled given corresponding demand.
from minigrid.
@JeniaJitsev can you open a new issue for this and explain what your use case is. That is, why you want them rendered differently/
from minigrid.
Sure, will do
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.