Wrapping (single-agent)



This library works with a common API to interact with the following RL environments:

To operate with them, out-of-the-box, and to support interoperability between these non-compatible interfaces, a wrapping mechanism is provided as shown in the following image.


Environment wrapping Environment wrapping

Usage

The following snippets show how to wrap environments from the different supported libraries:


# import the environment wrapper and gymnasium
from skrl.envs.wrappers.torch import wrap_env
import gymnasium as gym

# load the environment
env = gym.make("Pendulum-v1")

# wrap the environment
env = wrap_env(env)  # or 'env = wrap_env(env, wrapper="gymnasium")'

API


PyTorch

skrl.envs.wrappers.torch.wrap_env(env: Any, wrapper: Literal['auto', 'gym', 'gymnasium', 'isaaclab', 'isaaclab-single-agent', 'isaaclab-multi-agent', 'mani-skill', 'pettingzoo', 'playground'] = 'auto', verbose: bool = True) Wrapper | MultiAgentEnvWrapper[source]

Wrap an environment to use a common interface.

Example:

>>> from skrl.envs.wrappers.torch import wrap_env
>>>
>>> # assuming that there is an environment called "env"
>>> env = wrap_env(env)
Parameters:
  • env – The environment instance to be wrapped.

  • wrapper

    The type of wrapper to use. If "auto", the wrapper will be automatically selected based on the environment class. The supported wrappers are described in the following table:

    Single-agent environments

    Environment

    Wrapper tag

    OpenAI Gym

    "gym"

    Gymnasium

    "gymnasium"

    Isaac Lab

    "isaaclab" ("isaaclab-single-agent")

    ManiSkill

    "mani-skill"

    MuJoCo Playground

    "playground"

    Multi-agent environments

    Environment

    Wrapper tag

    PettingZoo

    "pettingzoo"

    Isaac Lab

    "isaaclab" ("isaaclab-multi-agent")

  • verbose – Whether to print verbose information about the environment and the wrapper.

Returns:

Wrapped environment instance.

Raises:

ValueError – Unknown wrapper type.


JAX

skrl.envs.wrappers.jax.wrap_env(env: Any, wrapper: Literal['auto', 'gym', 'gymnasium', 'isaaclab', 'isaaclab-single-agent', 'isaaclab-multi-agent', 'mani-skill', 'pettingzoo', 'playground'] = 'auto', verbose: bool = True) Wrapper | MultiAgentEnvWrapper[source]

Wrap an environment to use a common interface.

Example:

>>> from skrl.envs.wrappers.jax import wrap_env
>>>
>>> # assuming that there is an environment called "env"
>>> env = wrap_env(env)
Parameters:
  • env – The environment instance to be wrapped.

  • wrapper

    The type of wrapper to use. If "auto", the wrapper will be automatically selected based on the environment class. The supported wrappers are described in the following table:

    Single-agent environments

    Environment

    Wrapper tag

    OpenAI Gym

    "gym"

    Gymnasium

    "gymnasium"

    Isaac Lab

    "isaaclab" ("isaaclab-single-agent")

    ManiSkill

    "mani-skill"

    MuJoCo Playground

    "playground"

    Multi-agent environments

    Environment

    Wrapper tag

    PettingZoo

    "pettingzoo"

    Isaac Lab

    "isaaclab" ("isaaclab-multi-agent")

  • verbose – Whether to print verbose information about the environment and the wrapper.

Returns:

Wrapped environment instance.

Raises:

ValueError – Unknown wrapper type.


Warp

skrl.envs.wrappers.warp.wrap_env(env: Any, wrapper: Literal['auto', 'gym', 'gymnasium', 'isaaclab', 'isaaclab-single-agent', 'isaaclab-multi-agent', 'mani-skill', 'pettingzoo', 'playground'] = 'auto', verbose: bool = True) Wrapper | MultiAgentEnvWrapper[source]

Wrap an environment to use a common interface.

Example:

>>> from skrl.envs.wrappers.warp import wrap_env
>>>
>>> # assuming that there is an environment called "env"
>>> env = wrap_env(env)
Parameters:
  • env – The environment instance to be wrapped.

  • wrapper

    The type of wrapper to use. If "auto", the wrapper will be automatically selected based on the environment class. The supported wrappers are described in the following table:

    Single-agent environments

    Environment

    Wrapper tag

    OpenAI Gym

    "gym"

    Gymnasium

    "gymnasium"

    Isaac Lab

    "isaaclab" ("isaaclab-single-agent")

    ManiSkill

    "mani-skill"

    MuJoCo Playground

    "playground"

    Multi-agent environments

    Environment

    Wrapper tag

    PettingZoo

    "pettingzoo"

    Isaac Lab

    "isaaclab" ("isaaclab-multi-agent")

  • verbose – Whether to print verbose information about the environment and the wrapper.

Returns:

Wrapped environment instance.

Raises:

ValueError – Unknown wrapper type.


Internal API


PyTorch

Wrapper

Base wrapper class for RL environments.

GymWrapper

OpenAI Gym environment wrapper.

GymnasiumWrapper

Gymnasium environment wrapper.

IsaacLabWrapper

Isaac Lab environment wrapper.

ManiSkillWrapper

ManiSkill environment wrapper.

PlaygroundWrapper

MuJoCo Playground environment wrapper.

class skrl.envs.wrappers.torch.Wrapper(env: Any)[source]

Bases: ABC

Base wrapper class for RL environments.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

abstractmethod close() None[source]

Close the environment.

abstractmethod render(*args, **kwargs) Any[source]

Render the environment.

Returns:

Any value from the wrapped environment.

abstractmethod reset() tuple[torch.Tensor, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

abstractmethod state() torch.Tensor | None[source]

Get the environment state.

Returns:

State.

abstractmethod step(actions: torch.Tensor) tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: torch.device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.torch.gym_envs.GymWrapper(env: Any)[source]

Bases: Wrapper

OpenAI Gym environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) Any[source]

Render the environment.

reset() tuple[torch.Tensor, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() torch.Tensor | None[source]

Get the environment state.

Returns:

State.

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

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: torch.device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.torch.gymnasium_envs.GymnasiumWrapper(env: Any)[source]

Bases: Wrapper

Gymnasium environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) Any[source]

Render the environment.

reset() tuple[torch.Tensor, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() torch.Tensor | None[source]

Get the environment state.

Returns:

State.

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

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: torch.device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.torch.isaaclab_envs.IsaacLabWrapper(env: Any)[source]

Bases: Wrapper

Isaac Lab environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[torch.Tensor, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() torch.Tensor | None[source]

Get the environment state.

Returns:

State.

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

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: torch.device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

class skrl.envs.wrappers.torch.mani_skill_envs.ManiSkillWrapper(env: Any)[source]

Bases: Wrapper

ManiSkill environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[torch.Tensor, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() torch.Tensor | None[source]

Get the environment state.

Returns:

State.

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

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: torch.device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

class skrl.envs.wrappers.torch.playground_envs.PlaygroundWrapper(env: Any)[source]

Bases: Wrapper

MuJoCo Playground environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[torch.Tensor, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() torch.Tensor | None[source]

Get the environment state.

Returns:

State.

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

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: torch.device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.


JAX

Wrapper

Base wrapper class for RL environments.

GymWrapper

OpenAI Gym environment wrapper.

GymnasiumWrapper

Gymnasium environment wrapper.

IsaacLabWrapper

Isaac Lab environment wrapper.

ManiSkillWrapper

ManiSkill environment wrapper.

PlaygroundWrapper

MuJoCo Playground environment wrapper.

class skrl.envs.wrappers.jax.Wrapper(env: Any)[source]

Bases: ABC

Base wrapper class for RL environments.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

abstractmethod close() None[source]

Close the environment.

abstractmethod render(*args, **kwargs) Any[source]

Render the environment.

Returns:

Any value from the wrapped environment.

abstractmethod reset() tuple[jax.Array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

abstractmethod state() jax.Array | None[source]

Get the environment state.

Returns:

State.

abstractmethod step(actions: jax.Array) tuple[jax.Array, jax.Array, jax.Array, jax.Array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: jax.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.jax.gym_envs.GymWrapper(env: Any)[source]

Bases: Wrapper

OpenAI Gym environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) Any[source]

Render the environment.

reset() tuple[jax.Array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() jax.Array | None[source]

Get the environment state.

Returns:

State.

step(actions: jax.Array) tuple[jax.Array, jax.Array, jax.Array, jax.Array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: jax.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.jax.gymnasium_envs.GymnasiumWrapper(env: Any)[source]

Bases: Wrapper

Gymnasium environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) Any[source]

Render the environment.

reset() tuple[jax.Array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() jax.Array | None[source]

Get the environment state.

Returns:

State.

step(actions: jax.Array) tuple[jax.Array, jax.Array, jax.Array, jax.Array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: jax.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.jax.isaaclab_envs.IsaacLabWrapper(env: Any)[source]

Bases: Wrapper

Isaac Lab environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[jax.Array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() jax.Array | None[source]

Get the environment state.

Returns:

State.

step(actions: jax.Array) tuple[jax.Array, jax.Array, jax.Array, jax.Array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: jax.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

class skrl.envs.wrappers.jax.mani_skill_envs.ManiSkillWrapper(env: Any)[source]

Bases: Wrapper

ManiSkill environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[jax.Array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() jax.Array | None[source]

Get the environment state.

Returns:

State.

step(actions: jax.Array) tuple[jax.Array, jax.Array, jax.Array, jax.Array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: jax.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

class skrl.envs.wrappers.jax.playground_envs.PlaygroundWrapper(env: Any)[source]

Bases: Wrapper

MuJoCo Playground environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[jax.Array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() jax.Array | None[source]

Get the environment state.

Returns:

State.

step(actions: jax.Array) tuple[jax.Array, jax.Array, jax.Array, jax.Array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: jax.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.


Warp

Wrapper

Base wrapper class for RL environments.

GymnasiumWrapper

Gymnasium environment wrapper.

IsaacLabWrapper

Isaac Lab environment wrapper.

ManiSkillWrapper

ManiSkill environment wrapper.

PlaygroundWrapper

MuJoCo Playground environment wrapper.

class skrl.envs.wrappers.warp.Wrapper(env: Any)[source]

Bases: ABC

Base wrapper class for RL environments.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

abstractmethod close() None[source]

Close the environment.

abstractmethod render(*args, **kwargs) Any[source]

Render the environment.

Returns:

Any value from the wrapped environment.

abstractmethod reset() tuple[warp.array, Any][source]

Reset the environment.

Returns:

Observation, info.

abstractmethod state() wp.array | None[source]

Get the environment state.

Returns:

State.

abstractmethod step(actions: warp.array) tuple[warp.array, warp.array, warp.array, warp.array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: warp.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.warp.gymnasium_envs.GymnasiumWrapper(env: Any)[source]

Bases: Wrapper

Gymnasium environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) Any[source]

Render the environment.

reset() tuple[warp.array, Any][source]

Reset the environment.

Returns:

Observation, info.

state() wp.array | None[source]

Get the environment state.

Returns:

State.

step(actions: warp.array) tuple[warp.array, warp.array, warp.array, warp.array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: warp.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

If the wrapped environment does not have the state_space property, None will be returned.

class skrl.envs.wrappers.warp.isaaclab_envs.IsaacLabWrapper(env: Any)[source]

Bases: Wrapper

Isaac Lab environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[warp.array, Any][source]

Reset the environment.

Returns:

Observation, info.

state() wp.array | None[source]

Get the environment state.

Returns:

State.

step(actions: warp.array) tuple[warp.array, warp.array, warp.array, warp.array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: warp.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

class skrl.envs.wrappers.warp.mani_skill_envs.ManiSkillWrapper(env: Any)[source]

Bases: Wrapper

ManiSkill environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[warp.array, Any][source]

Reset the environment.

Returns:

Observation, info.

state() wp.array | None[source]

Get the environment state.

Returns:

State.

step(actions: warp.array) tuple[warp.array, warp.array, warp.array, warp.array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: warp.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.

class skrl.envs.wrappers.warp.playground_envs.PlaygroundWrapper(env: Any)[source]

Bases: Wrapper

MuJoCo Playground environment wrapper.

Parameters:

env – The environment instance to wrap.

Methods:

close()

Close the environment.

render(*args, **kwargs)

Render the environment.

reset()

Reset the environment.

state()

Get the environment state.

step(actions)

Perform a step in the environment.

Attributes:

action_space

Action space.

device

The device used by the environment.

num_agents

Number of agents.

num_envs

Number of environments.

observation_space

Observation space.

state_space

State space.

close() None[source]

Close the environment.

render(*args, **kwargs) None[source]

Render the environment.

reset() tuple[warp.array, dict[str, Any]][source]

Reset the environment.

Returns:

Observation, info.

state() wp.array | None[source]

Get the environment state.

Returns:

State.

step(actions: warp.array) tuple[warp.array, warp.array, warp.array, warp.array, Any][source]

Perform a step in the environment.

Parameters:

actions – The actions to perform.

Returns:

Observation, reward, terminated, truncated, info.

property action_space: gymnasium.Space[source]

Action space.

property device: warp.Device[source]

The device used by the environment.

If the wrapped environment does not have the device property, the value of this property will be "cuda" or "cpu" depending on the device availability.

property num_agents: int[source]

Number of agents.

If the wrapped environment does not have the num_agents property, it will be set to 1.

property num_envs: int[source]

Number of environments.

If the wrapped environment does not have the num_envs property, it will be set to 1.

property observation_space: gymnasium.Space[source]

Observation space.

property state_space: gymnasium.Space | None[source]

State space.