Multi-robot PyTorchRL Environment

Contents

Multi-robot PyTorchRL Environment#

enki_env.torch_rl.env(scenario: Scenario, config: dict[str, GroupConfig], time_step: float = 0.1, physics_substeps: int = 3, max_duration: float = -1, render_mode: str | None = None, render_fps: float = 10.0, render_kwargs: dict[str, Any] = {}, notebook: bool | None = None, terminate_on: Literal['any', 'all'] | None = 'all', success_info: bool = True, default_success: bool | None = None, device: str = 'cpu', seed: int = 0) PettingZooWrapper#

Creates a PyTorchRL environment, passing all arguments to enki_env.ParallelEnkiEnv before wrapping it with torchrl.envs.PettingZooWrapper().

Parameters:
  • scenario – The scenario that generates worlds at gymnasium.Env.reset().

  • config – The configuration for all groups. Robots with a pyenki.PhysicalObject.name equal to the group will be assigned to the group and use its configuration. The group with name “” will catch the remaining robots, if it appears in config.

  • time_step – The time step of the simulation [s].

  • max_duration – The maximum duration of the episodes [s].

  • physics_substeps – The number of physics sub-steps for each simulation step, see pyenki.World.step().

  • render_mode – The render mode (one of None, rgb_array or human).

  • render_fps – The render fps (only relevant when render_mode="human".

  • render_kwargs – The render keywords arguments arguments forwarded to pyenki.viewer.render() when rendering an environment.

  • notebook – Whether to use a notebook-compatible renderer. If None, it will select it if we are running a notebook.

  • terminate_on – Whether to terminate the episode as soon as the first robot terminates ("any") or whether to wait for all agents to terminate before removing all of them at once ("all". If set to None, it will terminate robots independently from each other and remove them from the environment before the episode terminates.

  • success_info – Whether to include key "is_success" in the final info dictionary for each robot. It will be included only if it has been set by one of enki_env.GroupConfig.terminations or if default_success is not None.

  • default_success – The value associated with "is_success" in the final info dictionary when, at the end of the episode, the robot has not been yet terminated.

  • seed – The random seed passed to torchrl.envs.PettingZooWrapper().

  • device – The device passed to torchrl.envs.PettingZooWrapper().