omni.isaac.lab_tasks.utils#
Sub-package with utilities, data collectors and environment wrappers.
Submodules
Sub-module for data collection utilities. |
|
Sub-module for environment wrappers to different learning frameworks. |
Functions:
|
Import all sub-packages in a package recursively. |
|
Get path to the model checkpoint in input directory. |
|
Load default configuration given its entry point from the gym registry. |
|
Parse configuration for an environment and override based on inputs. |
- omni.isaac.lab_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.lab_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 theother_dirs
are intermediate folder names to concatenate. These cannot be regex expressions.If
run_dir
andcheckpoint
are regex expressions then the most recent (highest alphabetical order) run and checkpoint are selected. To disable this behavior, set the flagsort_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.
- Returns:
The path to the model checkpoint.
- Raises:
ValueError – When no runs are found in the input directory.
ValueError – When no checkpoints are found in the input directory.
- omni.isaac.lab_tasks.utils.load_cfg_from_registry(task_name: str, entry_point_key: str) dict | object [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.lab_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. If the entry point is a YAML file, it is parsed into a dictionary. If the entry point is a Python class, it is instantiated and returned.
- Raises:
ValueError – If the entry point key is not available in the gym registry for the task.
- omni.isaac.lab_tasks.utils.parse_env_cfg(task_name: str, device: str = 'cuda:0', num_envs: int | None = None, use_fabric: bool | None = None) ManagerBasedRLEnvCfg | DirectRLEnvCfg [source]#
Parse configuration for an environment and override based on inputs.
- Parameters:
task_name – The name of the environment.
device – The device to run the simulation on. Defaults to “cuda:0”.
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.
- Raises:
RuntimeError – If the configuration for the task is not a class. We assume users always use a class for the environment configuration.