-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Required prerequisites
- I have read the documentation https://safety-gymnasium.readthedocs.io.
- I have searched the Issue Tracker and Discussions that this hasn't already been reported. (+1 or comment there if it has.)
- Consider asking first in a Discussion.
Questions
I copy a code that writes the get_obs() as follows. However the state = self.env.task.obs() return the global observation. However, the base_task.py only give the obs(), which reture the global obs. This mean the training and execution are conducted under centrialized-training-centrialized-execution framework. But, I want the centrialized-training-decentrialized-execution framwork. Therfore, is there any methods to get the local observation of each agent?
Here is the code (get_obs() ):
_def get_obs(self):
state = self.env.task.obs() # This is global obs.
obs_n = []
for a in range(self.num_agents):
agent_id_feats = np.zeros(self.num_agents, dtype=np.float32)
agent_id_feats[a] = 1.0
obs_i = np.concatenate([state, agent_id_feats])
obs_i = (obs_i - np.mean(obs_i)) / (np.std(obs_i) + 1e-8)
obs_n.append(obs_i)
return obs_n