Closed ggplz closed 11 months ago
@ggplz, I am not certain what you are asking for. I will try to guess.
Observations will only come from the agents that currently have actors in the environment. There is a different option that returns all agents but the agents with an active actor can be determined by if it is "active".
env = gym.make(
"smarts.env:hiway-v1",
...,
observation_options=ObservationOptions.full, # default is `ObservationOptions.formatted`
)
observations, _ = env.reset()
for agent_id, ob in observations.items():
print(f"'{agent_id}' {ob['active']=}")
# 'Agent 0' ob['active']=False
# 'Agent 1' ob['active']=False
# 'Agent 2' ob['active']=True
# 'Agent 3' ob['active']=False
Hi @ggplz,
Consider reading this https://smarts.readthedocs.io/en/latest/sim/env.html#multi-agent-scenario on multi-agent scenarios, which might be helpful.
High Level Description
Version
smarts 1.4.0
Operating System
No response
Problems
In this examples , there are four agents
When I debug the code for the first time, the result of the code “observations, _ = env.reset() " have some problems as follows:
There are 4 agents at the initial moment, but the observation information obtained after initialization is only the information of a random agent. After the subsequent code is executed, the observation information of all agents will be updated. Moreover, sometimes the observation information of the agent cannot be obtained, and the entire dictionary is empty. Help me and how to solve the problem?