Isaac Gym environments#

Omniverse Isaac Gym environments


Environments (preview 4)#

The repository https://github.com/NVIDIA-Omniverse/IsaacGymEnvs provides the example reinforcement learning environments for Isaac Gym (preview 4).

With the release of Isaac Gym (preview 4), NVIDIA developers provide an easy-to-use API for creating/loading preset vectorized environments (see IsaacGymEnvs’s creating-an-environment).

import isaacgymenvs

env = isaacgymenvs.make(seed=0,
                        task="Cartpole",
                        num_envs=2000,
                        sim_device="cuda:0",
                        rl_device="cuda:0",
                        graphics_device_id=0,
                        headless=False)

Nevertheless, in order to maintain the loading style of previous versions, skrl provides its own implementation for loading such environments. The environments can be easily loaded and configured by calling a single function provided with this library. This function also makes it possible to configure the environment from the command line arguments (see IsaacGymEnvs’s configuration-and-command-line-arguments) or from its parameters (task_name, num_envs, headless, and cli_args).

Note

Only the configuration related to the environment will be used. The configuration related to RL algorithms are discarded since they do not belong to this library.

Note

Isaac Gym environments implement a functionality to get their configuration from the command line. Setting the headless option from the trainer configuration will not work. In this case, it is necessary to set the load function’s headless argument to True or to invoke the scripts as follows: python script.py headless=True.


Usage#

# import the environment loader
from skrl.envs.loaders.torch import load_isaacgym_env_preview4

# load environment
env = load_isaacgym_env_preview4(task_name="Cartpole")

API#

skrl.envs.loaders.torch.load_isaacgym_env_preview4(task_name: str = '', num_envs: int | None = None, headless: bool | None = None, cli_args: Sequence[str] = [], isaacgymenvs_path: str = '', show_cfg: bool = True)#

Load an Isaac Gym environment (preview 4)

Isaac Gym benchmark environments: https://github.com/NVIDIA-Omniverse/IsaacGymEnvs

Parameters:
  • task_name (str, optional) – The name of the task (default: ""). If not specified, the task name is taken from the command line argument (task=TASK_NAME). Command line argument has priority over function parameter if both are specified

  • num_envs (int, optional) – Number of parallel environments to create (default: None). If not specified, the default number of environments defined in the task configuration is used. Command line argument has priority over function parameter if both are specified

  • headless (bool, optional) – Whether to use headless mode (no rendering) (default: None). If not specified, the default task configuration is used. Command line argument has priority over function parameter if both are specified

  • cli_args (list of str, optional) – IsaacGymEnvs configuration and command line arguments (default: [])

  • isaacgymenvs_path (str, optional) – The path to the isaacgymenvs directory (default: ""). If empty, the path will obtained from isaacgymenvs package metadata

  • show_cfg (bool, optional) – Whether to print the configuration (default: True)

Raises:
  • ValueError – The task name has not been defined, neither by the function parameter nor by the command line arguments

  • RuntimeError – The isaacgymenvs package is not installed or the path is wrong

Returns:

Isaac Gym environment (preview 4)

Return type:

isaacgymenvs.tasks.base.vec_task.VecTask



Environments (preview 3)#

The repository https://github.com/NVIDIA-Omniverse/IsaacGymEnvs provides the example reinforcement learning environments for Isaac Gym (preview 3).

These environments can be easily loaded and configured by calling a single function provided with this library. This function also makes it possible to configure the environment from the command line arguments (see IsaacGymEnvs’s configuration-and-command-line-arguments) or from its parameters (task_name, num_envs, headless, and cli_args).

Note

Only the configuration related to the environment will be used. The configuration related to RL algorithms are discarded since they do not belong to this library.

Note

Isaac Gym environments implement a functionality to get their configuration from the command line. Setting the headless option from the trainer configuration will not work. In this case, it is necessary to set the load function’s headless argument to True or to invoke the scripts as follows: python script.py headless=True.


Usage#

# import the environment loader
from skrl.envs.loaders.torch import load_isaacgym_env_preview3

# load environment
env = load_isaacgym_env_preview3(task_name="Cartpole")

API#

skrl.envs.loaders.torch.load_isaacgym_env_preview3(task_name: str = '', num_envs: int | None = None, headless: bool | None = None, cli_args: Sequence[str] = [], isaacgymenvs_path: str = '', show_cfg: bool = True)#

Load an Isaac Gym environment (preview 3)

Isaac Gym benchmark environments: https://github.com/NVIDIA-Omniverse/IsaacGymEnvs

Parameters:
  • task_name (str, optional) – The name of the task (default: ""). If not specified, the task name is taken from the command line argument (task=TASK_NAME). Command line argument has priority over function parameter if both are specified

  • num_envs (int, optional) – Number of parallel environments to create (default: None). If not specified, the default number of environments defined in the task configuration is used. Command line argument has priority over function parameter if both are specified

  • headless (bool, optional) – Whether to use headless mode (no rendering) (default: None). If not specified, the default task configuration is used. Command line argument has priority over function parameter if both are specified

  • cli_args (list of str, optional) – IsaacGymEnvs configuration and command line arguments (default: [])

  • isaacgymenvs_path (str, optional) – The path to the isaacgymenvs directory (default: ""). If empty, the path will obtained from isaacgymenvs package metadata

  • show_cfg (bool, optional) – Whether to print the configuration (default: True)

Raises:
  • ValueError – The task name has not been defined, neither by the function parameter nor by the command line arguments

  • RuntimeError – The isaacgymenvs package is not installed or the path is wrong

Returns:

Isaac Gym environment (preview 3)

Return type:

isaacgymenvs.tasks.base.vec_task.VecTask



Environments (preview 2)#

The example reinforcement learning environments for Isaac Gym (preview 2) are located within the same package (in the python/rlgpu directory).

These environments can be easily loaded and configured by calling a single function provided with this library. This function also makes it possible to configure the environment from the command line arguments or from its parameters (task_name, num_envs, headless, and cli_args).

Note

Isaac Gym environments implement a functionality to get their configuration from the command line. Setting the headless option from the trainer configuration will not work. In this case, it is necessary to set the load function’s headless argument to True or to invoke the scripts as follows: python script.py --headless.


Usage#

# import the environment loader
from skrl.envs.loaders.torch import load_isaacgym_env_preview2

# load environment
env = load_isaacgym_env_preview2(task_name="Cartpole")

API#

skrl.envs.loaders.torch.load_isaacgym_env_preview2(task_name: str = '', num_envs: int | None = None, headless: bool | None = None, cli_args: Sequence[str] = [], isaacgymenvs_path: str = '', show_cfg: bool = True)#

Load an Isaac Gym environment (preview 2)

Parameters:
  • task_name (str, optional) – The name of the task (default: ""). If not specified, the task name is taken from the command line argument (--task TASK_NAME). Command line argument has priority over function parameter if both are specified

  • num_envs (int, optional) – Number of parallel environments to create (default: None). If not specified, the default number of environments defined in the task configuration is used. Command line argument has priority over function parameter if both are specified

  • headless (bool, optional) – Whether to use headless mode (no rendering) (default: None). If not specified, the default task configuration is used. Command line argument has priority over function parameter if both are specified

  • cli_args (list of str, optional) – Isaac Gym environment configuration and command line arguments (default: [])

  • isaacgymenvs_path (str, optional) – The path to the rlgpu directory (default: ""). If empty, the path will obtained from isaacgym package metadata

  • show_cfg (bool, optional) – Whether to print the configuration (default: True)

Raises:
  • ValueError – The task name has not been defined, neither by the function parameter nor by the command line arguments

  • RuntimeError – The isaacgym package is not installed or the path is wrong

Returns:

Isaac Gym environment (preview 2)

Return type:

tasks.base.vec_task.VecTask