Environment Maker#

Single-Agent Environment#

MuJoCo Environment

safepo.common.env.make_sa_mujoco_env(num_envs: int, env_id: str, seed: int | None = None)#

Creates and wraps an environment based on the specified parameters.

Parameters:
  • num_envs (int) – Number of parallel environments.

  • env_id (str) – ID of the environment to create.

  • seed (int or None, optional) – Seed for the random number generator. Default is None.

Returns:
  • env – The created and wrapped environment.

  • obs_space – The observation space of the environment.

  • act_space – The action space of the environment.

Examples

>>> from safepo.common.env import make_sa_mujoco_env
>>>
>>> env, obs_space, act_space = make_sa_mujoco_env(
>>>     num_envs=1,
>>>     env_id="SafetyPointGoal1-v0",
>>>     seed=0
>>> )

Isaac Gym Environment

safepo.common.env.make_sa_isaac_env(args, cfg, sim_params)#

Creates and returns a VecTaskPython environment for the single agent Isaac Gym task.

Parameters:
  • args – Command-line arguments.

  • cfg – Configuration for the environment.

  • cfg_train – Training configuration.

  • sim_params – Parameters for the simulation.

Returns:

env – VecTaskPython environment for the single agent Isaac Gym task.

Warning

SafePO’s single agent Isaac Gym task is not ready for use yet.

Multi-Agent Environment#

MuJoCo Environment

safepo.common.env.make_ma_mujoco_env(scenario, agent_conf, seed, cfg_train)#

Creates and returns a multi-agent environment using MuJoCo scenarios.

Parameters:
  • args – Command-line arguments.

  • cfg_train – Training configuration.

Returns:

env – A multi-agent environment.

Isaac Gym Environment

safepo.common.env.make_ma_isaac_env(args, cfg, cfg_train, sim_params, agent_index)#

Creates and returns a multi-agent environment for the Isaac Gym task.

Parameters:
  • args – Command-line arguments.

  • cfg – Configuration for the environment.

  • cfg_train – Training configuration.

  • sim_params – Parameters for the simulation.

  • agent_index – Index of the agent within the multi-agent environment.

Returns:

env – A multi-agent environment for the Isaac Gym task.