Rsl_RL#

class genesis_forge.wrappers.RslRlWrapper(env: GenesisEnv, cfg: dict | object = {})[source]#

Bases: Wrapper

A wrapper that makes your genesis forge environment compatible with the rsl_rl training framework.

IMPORTANT: This should be the last wrapper, as the change in the step and get_observations methods might break other wrappers.

What it does:
  • Combines the terminated and truncated tensors into a single tensor (i.e. terminated | truncated).

  • Add the truncated tensor to the extras dictionary as “time_outs”.

  • Returns observations and extras from the get_observations method.

Parameters:
  • env – The environment to wrap.

  • cfg – The configuration for the wrapper that will be passed to the neptune or wandb logger

Initialize the logging wrapper with the function to use for data logging.

build() None#

Builds the scene and other supporting components necessary for the training environment. This assumes that the scene has already been constructed and assigned to the <env>.scene attribute.

close()#

Closes the wrapper and env.

get_observations()[source]#

Returns observations as well as an extras dictionary with the observations added to the extras[“observations”][“critic”] key.

reset()[source]#

Converts observations into a TensorDict for rsl_rl 3.0+

step(actions: torch.Tensor) tuple[torch.Tensor, torch.Tensor, torch.Tensor, dict[str, Any]][source]#

Returns a single “dones” tensor, instead of the terminated and truncated tensors (via terminated | truncated). Add the truncated tensor to the extras dictionary as “time_outs”.

property action_space: gymnasium.spaces#

The action space of the environment.

can_be_wrapped: bool = False#
property device: str#
property dt: float#

The time step of the environment.

env: GenesisEnv = None#
property extras: dict#

The extras/infos dictionary that should be returned by the step and reset functions. This dictionary will be cleared at the start of every step.

property num_actions: int#

The number of actions for each environment.

property num_envs: int#

The number of parallel environments.

property num_observations: int#

The number of observations for each environment.

property observation_space: gymnasium.spaces#

The observation space of the environment.

property robot: Any#

Get the environment robot.

property scene: genesis.Scene#

Get the environment scene.

property unwrapped: GenesisEnv#

Returns the base environment of the wrapper.

This will be the bare ManagedEnvironment or GenesisEnv environment, underneath all layers of wrappers.