We have now released v0.3.0! Please use the latest version for the best experience.

orbit_tasks.utils#

Sub-package with utilities, data collectors and environment wrappers.

Submodules

data_collector

Sub-module for data collection utilities.

wrappers

Sub-module for environment wrappers to different learning frameworks.

Functions:

import_packages(package_name[, blacklist_pkgs])

Import all sub-packages in a package recursively.

get_checkpoint_path(log_path[, run_dir, ...])

Get path to the model checkpoint in input directory.

load_cfg_from_registry(task_name, ...)

Load default configuration given its entry point from the gym registry.

parse_env_cfg(task_name[, use_gpu, ...])

Parse configuration for an environment and override based on inputs.

omni.isaac.orbit_tasks.utils.import_packages(package_name: str, blacklist_pkgs: list[str] | None = None)[source]#

Import all sub-packages in a package recursively.

It is easier to use this function to import all sub-packages in a package recursively than to manually import each sub-package.

It replaces the need of the following code snippet on the top of each package’s __init__.py file:

import .locomotion.velocity
import .manipulation.reach
import .manipulation.lift
Parameters:
  • package_name – The package name.

  • blacklist_pkgs – The list of blacklisted packages to skip. Defaults to None, which means no packages are blacklisted.

omni.isaac.orbit_tasks.utils.get_checkpoint_path(log_path: str, run_dir: str = '.*', checkpoint: str = '.*', other_dirs: list[str] | None = None, sort_alpha: bool = True) str[source]#

Get path to the model checkpoint in input directory.

The checkpoint file is resolved as: <log_path>/<run_dir>/<*other_dirs>/<checkpoint>, where the other_dirs are intermediate folder names to concatenate. These cannot be regex expressions.

If run_dir and checkpoint are regex expressions then the most recent (highest alphabetical order) run and checkpoint are selected. To disable this behavior, set the flag sort_alpha to False.

Parameters:
  • log_path – The log directory path to find models in.

  • run_dir – The regex expression for the name of the directory containing the run. Defaults to the most recent directory created inside log_path.

  • other_dirs – The intermediate directories between the run directory and the checkpoint file. Defaults to None, which implies that checkpoint file is directly under the run directory.

  • checkpoint – The regex expression for the model checkpoint file. Defaults to the most recent torch-model saved in the run_dir directory.

  • sort_alpha – Whether to sort the runs by alphabetical order. Defaults to True. If False, the folders in run_dir are sorted by the last modified time.

Raises:
  • ValueError – When no runs are found in the input directory.

  • ValueError – When no checkpoints are found in the input directory.

Returns:

The path to the model checkpoint.

Reference:

leggedrobotics/legged_gym

omni.isaac.orbit_tasks.utils.load_cfg_from_registry(task_name: str, entry_point_key: str) dict | RLTaskEnvCfg[source]#

Load default configuration given its entry point from the gym registry.

This function loads the configuration object from the gym registry for the given task name. It supports both YAML and Python configuration files.

It expects the configuration to be registered in the gym registry as:

gym.register(
    id="My-Awesome-Task-v0",
    ...
    kwargs={"env_entry_point_cfg": "path.to.config:ConfigClass"},
)

The parsed configuration object for above example can be obtained as:

from omni.isaac.orbit_tasks.utils.parse_cfg import load_cfg_from_registry

cfg = load_cfg_from_registry("My-Awesome-Task-v0", "env_entry_point_cfg")
Parameters:
  • task_name – The name of the environment.

  • entry_point_key – The entry point key to resolve the configuration file.

Returns:

The parsed configuration object. This is either a dictionary or a class object.

Raises:

ValueError – If the entry point key is not available in the gym registry for the task.

omni.isaac.orbit_tasks.utils.parse_env_cfg(task_name: str, use_gpu: bool | None = None, num_envs: int | None = None, use_fabric: bool | None = None) dict | RLTaskEnvCfg[source]#

Parse configuration for an environment and override based on inputs.

Parameters:
  • task_name – The name of the environment.

  • use_gpu – Whether to use GPU/CPU pipeline. Defaults to None, in which case it is left unchanged.

  • num_envs – Number of environments to create. Defaults to None, in which case it is left unchanged.

  • use_fabric – Whether to enable/disable fabric interface. If false, all read/write operations go through USD. This slows down the simulation but allows seeing the changes in the USD through the USD stage. Defaults to None, in which case it is left unchanged.

Returns:

The parsed configuration object. This is either a dictionary or a class object.

Raises:

ValueError – If the task name is not provided, i.e. None.