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.
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")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.jax 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")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.warp 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")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.torch import wrap_env
import gymnasium as gym
# load a vectorized environment
env = gym.make_vec("Pendulum-v1", num_envs=10, vectorization_mode="async")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gymnasium")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.jax import wrap_env
import gymnasium as gym
# load a vectorized environment
env = gym.make_vec("Pendulum-v1", num_envs=10, vectorization_mode="async")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gymnasium")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.warp import wrap_env
import gymnasium as gym
# load a vectorized environment
env = gym.make_vec("Pendulum-v1", num_envs=10, vectorization_mode="async")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gymnasium")'
# import the environment wrapper and gym
from skrl.envs.wrappers.torch import wrap_env
import gym
# load the environment
env = gym.make("Pendulum-v1")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gym")'
# import the environment wrapper and gym
from skrl.envs.wrappers.jax import wrap_env
import gym
# load the environment
env = gym.make("Pendulum-v1")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gym")'
# import the environment wrapper and gym
from skrl.envs.wrappers.torch import wrap_env
import gym
# load a vectorized environment
env = gym.vector.make("Pendulum-v1", num_envs=10, asynchronous=False)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gym")'
# import the environment wrapper and gym
from skrl.envs.wrappers.jax import wrap_env
import gym
# load a vectorized environment
env = gym.vector.make("Pendulum-v1", num_envs=10, asynchronous=False)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gym")'
# import the environment wrapper and loader
from skrl.envs.wrappers.torch import wrap_env
from skrl.envs.loaders.torch import load_isaaclab_env
# load the environment
env = load_isaaclab_env(task_name="Isaac-Cartpole-Direct-v0")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="isaaclab")'
# import the environment wrapper and loader
from skrl.envs.wrappers.jax import wrap_env
from skrl.envs.loaders.jax import load_isaaclab_env
# load the environment
env = load_isaaclab_env(task_name="Isaac-Cartpole-Direct-v0")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="isaaclab")'
# import the environment wrapper and loader
from skrl.envs.wrappers.warp import wrap_env
from skrl.envs.loaders.warp import load_isaaclab_env
# load the environment
env = load_isaaclab_env(task_name="Isaac-Cartpole-Direct-v0")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="isaaclab")'
# import the environment wrapper, gymnasium and mani_skill
from skrl.envs.wrappers.torch import wrap_env
import gymnasium as gym
import mani_skill.envs # needed to register the ManiSkill environment entry points
# load the environment
env_kwargs = {"obs_mode": "state", "sim_backend": "physx_cuda", "control_mode": "pd_joint_delta_pos"}
env = gym.make("PushCube", num_envs=1024, **env_kwargs)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="mani-skill")'
# import the environment wrapper, gymnasium and mani_skill
from skrl.envs.wrappers.jax import wrap_env
import gymnasium as gym
import mani_skill.envs # needed to register the ManiSkill environment entry points
# load the environment
env_kwargs = {"obs_mode": "state", "sim_backend": "physx_cuda", "control_mode": "pd_joint_delta_pos"}
env = gym.make("PushCube", num_envs=1024, **env_kwargs)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="mani-skill")'
# import the environment wrapper, gymnasium and mani_skill
from skrl.envs.wrappers.warp import wrap_env
import gymnasium as gym
import mani_skill.envs # needed to register the ManiSkill environment entry points
# load the environment
env_kwargs = {"obs_mode": "state", "sim_backend": "physx_cuda", "control_mode": "pd_joint_delta_pos"}
env = gym.make("PushCube", num_envs=1024, **env_kwargs)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="mani-skill")'
# import the environment wrapper and loader
from skrl.envs.wrappers.torch import wrap_env
from skrl.envs.loaders.torch import load_playground_env
# load the environment
env = load_playground_env(task_name="CartpoleBalance", num_envs=1024, episode_length=300)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="playground")'
# import the environment wrapper and loader
from skrl.envs.wrappers.jax import wrap_env
from skrl.envs.loaders.jax import load_playground_env
# load the environment
env = load_playground_env(task_name="CartpoleBalance", num_envs=1024, episode_length=300)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="playground")'
# import the environment wrapper and loader
from skrl.envs.wrappers.warp import wrap_env
from skrl.envs.loaders.warp import load_playground_env
# load the environment
env = load_playground_env(task_name="CartpoleBalance", num_envs=1024, episode_length=300)
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="playground")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.torch import wrap_env
import gymnasium as gym
# load the environment (API conversion)
env = gym.make("ALE/Pong-v5")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gymnasium")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.jax import wrap_env
import gymnasium as gym
# load the environment (API conversion)
env = gym.make("ALE/Pong-v5")
# wrap the environment
env = wrap_env(env) # or 'env = wrap_env(env, wrapper="gymnasium")'
# import the environment wrapper and gymnasium
from skrl.envs.wrappers.warp import wrap_env
import gymnasium as gym
# load the environment (API conversion)
env = gym.make("ALE/Pong-v5")
# 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¶
Base wrapper class for RL environments. |
|
OpenAI Gym environment wrapper. |
|
Gymnasium environment wrapper. |
|
Isaac Lab environment wrapper. |
|
ManiSkill environment wrapper. |
|
MuJoCo Playground environment wrapper. |
- class skrl.envs.wrappers.torch.Wrapper(env: Any)[source]¶
Bases:
ABCBase 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: torch.device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.torch.gym_envs.GymWrapper(env: Any)[source]¶
Bases:
WrapperOpenAI 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: torch.device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.torch.gymnasium_envs.GymnasiumWrapper(env: Any)[source]¶
Bases:
WrapperGymnasium 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: torch.device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.torch.isaaclab_envs.IsaacLabWrapper(env: Any)[source]¶
Bases:
WrapperIsaac 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: torch.device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.torch.mani_skill_envs.ManiSkillWrapper(env: Any)[source]¶
Bases:
WrapperManiSkill 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: torch.device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.torch.playground_envs.PlaygroundWrapper(env: Any)[source]¶
Bases:
WrapperMuJoCo 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: torch.device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
JAX¶
Base wrapper class for RL environments. |
|
OpenAI Gym environment wrapper. |
|
Gymnasium environment wrapper. |
|
Isaac Lab environment wrapper. |
|
ManiSkill environment wrapper. |
|
MuJoCo Playground environment wrapper. |
- class skrl.envs.wrappers.jax.Wrapper(env: Any)[source]¶
Bases:
ABCBase 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 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 device: jax.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.jax.gym_envs.GymWrapper(env: Any)[source]¶
Bases:
WrapperOpenAI 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- reset() tuple[jax.Array, dict[str, Any]][source]¶
Reset the environment.
- Returns:
Observation, info.
- 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 device: jax.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.jax.gymnasium_envs.GymnasiumWrapper(env: Any)[source]¶
Bases:
WrapperGymnasium 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- reset() tuple[jax.Array, dict[str, Any]][source]¶
Reset the environment.
- Returns:
Observation, info.
- 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 device: jax.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.jax.isaaclab_envs.IsaacLabWrapper(env: Any)[source]¶
Bases:
WrapperIsaac 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- reset() tuple[jax.Array, dict[str, Any]][source]¶
Reset the environment.
- Returns:
Observation, info.
- 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 device: jax.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.jax.mani_skill_envs.ManiSkillWrapper(env: Any)[source]¶
Bases:
WrapperManiSkill 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- reset() tuple[jax.Array, dict[str, Any]][source]¶
Reset the environment.
- Returns:
Observation, info.
- 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 device: jax.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.jax.playground_envs.PlaygroundWrapper(env: Any)[source]¶
Bases:
WrapperMuJoCo 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- reset() tuple[jax.Array, dict[str, Any]][source]¶
Reset the environment.
- Returns:
Observation, info.
- 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 device: jax.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
Warp¶
Base wrapper class for RL environments. |
|
Gymnasium environment wrapper. |
|
Isaac Lab environment wrapper. |
|
ManiSkill environment wrapper. |
|
MuJoCo Playground environment wrapper. |
- class skrl.envs.wrappers.warp.Wrapper(env: Any)[source]¶
Bases:
ABCBase 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 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 device: warp.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.warp.gymnasium_envs.GymnasiumWrapper(env: Any)[source]¶
Bases:
WrapperGymnasium 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: warp.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.warp.isaaclab_envs.IsaacLabWrapper(env: Any)[source]¶
Bases:
WrapperIsaac 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: warp.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.warp.mani_skill_envs.ManiSkillWrapper(env: Any)[source]¶
Bases:
WrapperManiSkill 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- 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 device: warp.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.
- class skrl.envs.wrappers.warp.playground_envs.PlaygroundWrapper(env: Any)[source]¶
Bases:
WrapperMuJoCo 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.
The device used by the environment.
Number of agents.
Number of environments.
Observation space.
State space.
- reset() tuple[warp.array, dict[str, Any]][source]¶
Reset the environment.
- Returns:
Observation, info.
- 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 device: warp.Device[source]¶
The device used by the environment.
If the wrapped environment does not have the
deviceproperty, 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_agentsproperty, it will be set to 1.