Unverified Commit bf689435 authored by Kelly Guo's avatar Kelly Guo Committed by GitHub

Adds Kit command line argument support (#1293)

# Description

This change adds the option to pass command line arguments directly to
OV kit. This avoids the need of having to modify the app files to change
settings for OV.


## Type of change

- New feature (non-breaking change which adds functionality)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 77133d54
...@@ -350,7 +350,7 @@ while [[ $# -gt 0 ]]; do ...@@ -350,7 +350,7 @@ while [[ $# -gt 0 ]]; do
python_exe=$(extract_python_exe) python_exe=$(extract_python_exe)
echo "[INFO] Using python from: ${python_exe}" echo "[INFO] Using python from: ${python_exe}"
shift # past argument shift # past argument
${python_exe} $@ ${python_exe} "$@"
# exit neatly # exit neatly
break break
;; ;;
......
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.27.1" version = "0.27.2"
# Description # Description
title = "Isaac Lab framework for Robot Learning" title = "Isaac Lab framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.27.2 (2024-10-21)
~~~~~~~~~~~~~~~~~~~
Added
^^^^^
* Added ``--kit_args`` to :class:`~omni.isaac.lab.app.AppLauncher` to allow passing command line arguments directly to Omniverse Kit SDK.
0.27.1 (2024-10-20) 0.27.1 (2024-10-20)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -185,6 +185,10 @@ class AppLauncher: ...@@ -185,6 +185,10 @@ class AppLauncher:
* If headless and enable_cameras are False, the experience file is set to ``isaaclab.python.kit``. * If headless and enable_cameras are False, the experience file is set to ``isaaclab.python.kit``.
* If headless is True and enable_cameras is False, the experience file is set to ``isaaclab.python.headless.kit``. * If headless is True and enable_cameras is False, the experience file is set to ``isaaclab.python.headless.kit``.
* ``kit_args`` (str): Optional command line arguments to be passed to Omniverse Kit directly.
Arguments should be combined into a single string separated by space.
Example usage: --kit_args "--ext-folder=/path/to/ext1 --ext-folder=/path/to/ext2"
Args: Args:
parser: An argument parser instance to be extended with the AppLauncher specific options. parser: An argument parser instance to be extended with the AppLauncher specific options.
""" """
...@@ -271,6 +275,15 @@ class AppLauncher: ...@@ -271,6 +275,15 @@ class AppLauncher:
" it is resolved relative to the `apps` folder in Isaac Sim and Isaac Lab (in that order)." " it is resolved relative to the `apps` folder in Isaac Sim and Isaac Lab (in that order)."
), ),
) )
arg_group.add_argument(
"--kit_args",
type=str,
default="",
help=(
"Command line arguments for Omniverse Kit as a string separated by a space delimiter."
' Example usage: --kit_args "--ext-folder=/path/to/ext1 --ext-folder=/path/to/ext2"'
),
)
# Corresponding to the beginning of the function, # Corresponding to the beginning of the function,
# if we have removed -h/--help handling, we add it back. # if we have removed -h/--help handling, we add it back.
...@@ -557,6 +570,12 @@ class AppLauncher: ...@@ -557,6 +570,12 @@ class AppLauncher:
" The file does not exist." " The file does not exist."
) )
# Resolve additional arguments passed to Kit
self._kit_args = []
if "kit_args" in launcher_args:
self._kit_args = [arg for arg in launcher_args["kit_args"].split()]
sys.argv += self._kit_args
# Resolve the absolute path of the experience file # Resolve the absolute path of the experience file
self._sim_experience_file = os.path.abspath(self._sim_experience_file) self._sim_experience_file = os.path.abspath(self._sim_experience_file)
print(f"[INFO][AppLauncher]: Loading experience file: {self._sim_experience_file}") print(f"[INFO][AppLauncher]: Loading experience file: {self._sim_experience_file}")
...@@ -595,6 +614,9 @@ class AppLauncher: ...@@ -595,6 +614,9 @@ class AppLauncher:
# remove the threadCount argument from sys.argv if it was added for distributed training # remove the threadCount argument from sys.argv if it was added for distributed training
pattern = r"--/plugins/carb\.tasking\.plugin/threadCount=\d+" pattern = r"--/plugins/carb\.tasking\.plugin/threadCount=\d+"
sys.argv = [arg for arg in sys.argv if not re.match(pattern, arg)] sys.argv = [arg for arg in sys.argv if not re.match(pattern, arg)]
# remove additional OV args from sys.argv
if len(self._kit_args) > 0:
sys.argv = [arg for arg in sys.argv if arg not in self._kit_args]
def _rendering_enabled(self) -> bool: def _rendering_enabled(self) -> bool:
"""Check if rendering is required by the app.""" """Check if rendering is required by the app."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment