Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update metrics.py #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TachikakaMin
Copy link

Bug

obstacles is local information

traversable_cells = np.size(obs['obstacles']) - np.count_nonzero(obs['obstacles'])

@TachikakaMin
Copy link
Author

@Tviskaron

Hi Alexey,

Please check this bug

@Tviskaron
Copy link
Contributor

Hi Yimin,

Could you explain why this is a bug? The wrapper calculates density based on the agent’s field of view. The number of global obstacles and the number of free cells are constants.

@TachikakaMin
Copy link
Author

TachikakaMin commented Feb 13, 2025

Hi Yimin,

Could you explain why this is a bug? The wrapper calculates density based on the agent’s field of view. The number of global obstacles and the number of free cells are constants.

It seems if there is no obstacle, obs['obstacles'] will be [].

traversable_cells will be 0

@Tviskaron
Copy link
Contributor

obs['obstacles'] is a boolean matrix, so its size should not be empty. However, to use the wrapper, you need to set observation_type to either POMAPF or MAPF.

Here is a small example where I tried to reproduce the wrapper behaviour:

from pogema import pogema_v0, GridConfig
from pogema.wrappers.metrics import AgentsDensityWrapper
import numpy as np

grid = """
......
......
..a...
...A..
......
"""
env = AgentsDensityWrapper(pogema_v0(grid_config=GridConfig(map=grid, observation_type='POMAPF', obs_radius=2)))
obs, info = env.reset()

env.render()

print('Obstacles matrix size:', np.size(obs[0]['obstacles']))

@TachikakaMin
Copy link
Author

TachikakaMin commented Feb 14, 2025

It seems if I change add_artificial_boarder to be false, the obs['obstacles'] will become empty. When I run pogema_benchmark.

@Tviskaron
Copy link
Contributor

global or local ones? Could you provide the minimal code to reproduce the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants