GenesisEnv¶
- torchrl.envs.GenesisEnv(*args, num_workers: int | None = None, **kwargs)[source]¶
Genesis environment built from a named configuration.
- Parameters:
env_name (str) – registered environment name. Currently one of
'franka_reach'or'franka_grab'.task_name (str, optional) – task name; unused by the built-in configs.
num_workers (int, optional) – when
> 1, returns a lazyParallelEnvwrapping per-worker Genesis envs. Defaults to1.max_steps (int, optional) – truncation horizon. Defaults to
1000.frame_skip (int, optional) – physics steps per env step. Defaults to
1.from_pixels (bool, optional) – if
True, a default camera is added to the scene before it is built and apixelsentry is added to the observation. Defaults toFalse.pixels_key (str, optional) – key for the rendered frame. Defaults to
"pixels".pixels_res (tuple[int, int], optional) –
(H, W)of the auto-added camera. Ignored whenfrom_pixels=False. Defaults to(320, 320).device (torch.device, optional) – torch device. When
None(the default), usestorch.get_default_device()and callsgenesis.init()with the matching backend (gs.cpu,gs.cuda, orgs.metal). If Genesis is already initialized with a different device, raisesRuntimeError.batch_size (torch.Size, optional) – env batch size. Defaults to
().allow_done_after_reset (bool, optional) – Defaults to
False.
For task-specific obs / reward / action, subclass
GenesisWrapperdirectly – see its docstring for the hook list.Examples
>>> from torchrl.envs import GenesisEnv >>> env = GenesisEnv(env_name="franka_reach") >>> td = env.rollout(10)