Skip to content

Commit 80e3964

Browse files
Toni-SMkellyguo11
andauthored
Adds new external project / internal task template generator (#2039)
# Description This PR adds the implementation to generate Isaac Lab's external project or internal task. Just run `./isaaclab.sh --new` or `isaaclab.bat --new` (or `-n`) and let yourself go! ## Type of change - New feature (non-breaking change which adds functionality) - This change requires a documentation update ## 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 - [ ] 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 <!-- As you go through the checklist above, you can mark something as done by putting an x character in it For example, - [x] I have done this task - [ ] I have not done this task --> --------- Signed-off-by: Toni-SM <[email protected]> Signed-off-by: Kelly Guo <[email protected]> Co-authored-by: Kelly Guo <[email protected]>
1 parent f774425 commit 80e3964

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+2687
-41
lines changed
Lines changed: 69 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,92 @@
1-
Building your Own Project
2-
=========================
1+
.. _template-generator:
2+
3+
Build your Own Project or Task
4+
==============================
35

46
Traditionally, building new projects that utilize Isaac Lab's features required creating your own
57
extensions within the Isaac Lab repository. However, this approach can obscure project visibility and
6-
complicate updates from one version of Isaac Lab to another. To circumvent these challenges, we now
7-
provide a pre-configured and customizable `extension template <https://github.com/isaac-sim/IsaacLabExtensionTemplate>`_
8-
for creating projects in an isolated environment.
8+
complicate updates from one version of Isaac Lab to another. To circumvent these challenges,
9+
we now provide a command-line tool (**template generator**) for creating Isaac Lab-based projects and tasks.
910

10-
This template serves three distinct use cases:
11+
The template generator enables you to create an:
1112

12-
* **Project Template**: Provides essential access to Isaac Sim and Isaac Lab's features, making it ideal for projects
13-
that require a standalone environment.
14-
* **Python Package**: Facilitates integration with Isaac Sim's native or virtual Python environment, allowing for
15-
the creation of Python packages that can be shared and reused across multiple projects.
16-
* **Omniverse Extension**: Supports direct integration into Omniverse extension workflow.
13+
* **External project** (recommended): An isolated project that is not part of the Isaac Lab repository. This approach
14+
works outside of the core Isaac Lab repository, ensuring that your development efforts remain self-contained. Also,
15+
it allows your code to be run as an extension in Omniverse.
1716

18-
.. note::
17+
.. hint::
18+
19+
For the external project, the template generator will initialize a new Git repository in the specified directory.
20+
You can push the generated content to your own remote repository (e.g. GitHub) and share it with others.
21+
22+
* **Internal task**: A task that is part of the Isaac Lab repository. This approach should only be used to create
23+
new tasks within the Isaac Lab repository in order to contribute to it.
24+
25+
Running the template generator
26+
------------------------------
27+
28+
Install Isaac Lab by following the `installation guide <../../setup/installation/index.html>`_.
29+
We recommend using conda installation as it simplifies calling Python scripts from the terminal.
30+
31+
Then, run the following command to generate a new external project or internal task:
32+
33+
.. tab-set::
34+
:sync-group: os
35+
36+
.. tab-item:: :icon:`fa-brands fa-linux` Linux
37+
:sync: linux
1938

20-
We recommend using the extension template for new projects, as it provides a more streamlined and
21-
efficient workflow. Additionally it ensures that your project remains up-to-date with the latest
22-
features and improvements in Isaac Lab.
39+
.. code-block:: bash
2340
41+
./isaaclab.sh --new # or "./isaaclab.sh -n"
2442
25-
Installation
26-
------------
43+
.. tab-item:: :icon:`fa-brands fa-windows` Windows
44+
:sync: windows
2745

28-
Install Isaac Lab by following the `installation guide <../../setup/installation/index.html>`_. We recommend using the conda installation as it simplifies calling Python scripts from the terminal.
46+
.. code-block:: batch
47+
48+
isaaclab.bat --new :: or "isaaclab.bat -n"
49+
50+
The generator will guide you in setting up the project/task for your needs by asking you the following questions:
51+
52+
* Type of project/task (external or internal), and project/task path or names according to the selected type.
53+
* Isaac Lab workflows (see :ref:`feature-workflows`).
54+
* Reinforcement learning libraries (see :ref:`rl-frameworks`), and algorithms (if the selected libraries support multiple algorithms).
55+
56+
External project usage (once generated)
57+
---------------------------------------
58+
59+
Once the external project is generated, a ``README.md`` file will be created in the specified directory.
60+
This file will contain instructions on how to install the project and run the tasks.
61+
62+
Here are some general commands to get started with it:
63+
64+
.. note::
2965

30-
Clone the extension template repository separately from the Isaac Lab installation (i.e. outside the IsaacLab directory):
66+
If Isaac Lab is not installed in a conda environment or in a (virtual) Python environment, use ``FULL_PATH_TO_ISAACLAB/isaaclab.sh -p``
67+
(or ``FULL_PATH_TO_ISAACLAB\isaaclab.bat -p`` on Windows) instead of ``python`` to run the commands below.
3168

32-
.. code:: bash
69+
* Install the project (in editable mode).
3370

34-
# Option 1: HTTPS
35-
git clone https://github.com/isaac-sim/IsaacLabExtensionTemplate.git
71+
.. code:: bash
3672
37-
# Option 2: SSH
38-
git clone [email protected]:isaac-sim/IsaacLabExtensionTemplate.git
73+
python -m pip install -e source/<given-project-name>
3974
40-
Throughout the repository, the name ``ext_template`` only serves as an example and we provide a script to rename all the references to it automatically:
75+
* List the tasks available in the project.
4176

42-
.. code:: bash
77+
.. warning::
4378

44-
# Enter the repository
45-
cd IsaacLabExtensionTemplate
79+
If the task names change, it may be necessary to update the search pattern ``"Template-"``
80+
(in the ``scripts/list_envs.py`` file) so that they can be listed.
4681

47-
# Rename all occurrences of ext_template (in files/directories) to your_fancy_extension_name
48-
python scripts/rename_template.py your_fancy_extension_name
82+
.. code:: bash
4983
50-
Using a python interpreter that has Isaac Lab installed, install the library:
84+
python scripts/list_envs.py
5185
52-
.. code:: bash
86+
* Run a task.
5387

54-
python -m pip install -e source/ext_template
88+
.. code:: bash
5589
90+
python scripts/<specific-rl-library>/train.py --task=<Task-Name>
5691
57-
For more details, please follow the instructions in the `extension template repository <https://github.com/isaac-sim/IsaacLabExtensionTemplate>`_.
92+
For more details, please follow the instructions in the generated project's ``README.md`` file.

docs/source/overview/reinforcement-learning/rl_frameworks.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _rl-frameworks:
2+
13
Reinforcement Learning Library Comparison
24
=========================================
35

docs/source/setup/installation/binaries_installation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ Clone the Isaac Lab repository into your workspace:
203203
204204
./isaaclab.sh --help
205205
206-
usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
206+
usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-n] [-c] -- Utility to manage Isaac Lab.
207207
208208
optional arguments:
209209
-h, --help Display the help content.
@@ -215,6 +215,7 @@ Clone the Isaac Lab repository into your workspace:
215215
-o, --docker Run the docker container helper script (docker/container.sh).
216216
-v, --vscode Generate the VSCode settings file from template.
217217
-d, --docs Build the documentation from source using sphinx.
218+
-n, --new Create a new external project or internal task from template.
218219
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
219220
220221
.. tab-item:: :icon:`fa-brands fa-windows` Windows
@@ -224,7 +225,7 @@ Clone the Isaac Lab repository into your workspace:
224225
225226
isaaclab.bat --help
226227
227-
usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
228+
usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-n] [-c] -- Utility to manage Isaac Lab.
228229
229230
optional arguments:
230231
-h, --help Display the help content.
@@ -235,6 +236,7 @@ Clone the Isaac Lab repository into your workspace:
235236
-t, --test Run all python unittest tests.
236237
-v, --vscode Generate the VSCode settings file from template.
237238
-d, --docs Build the documentation from source using sphinx.
239+
-n, --new Create a new external project or internal task from template.
238240
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
239241
240242

docs/source/setup/installation/isaaclab_pip_installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ that are built on top of Isaac Lab. Isaac Lab pip packages **do not** include an
77
training, inferencing, or running standalone workflows such as demos and examples. Therefore, users are required
88
to define your own runner scripts when installing Isaac Lab from pip.
99

10-
To learn about how to set up your own extension project on top of Isaac Lab, visit `Extension Template <../../overview/developer-guide/template.html>`_.
10+
To learn about how to set up your own project on top of Isaac Lab, see :ref:`template-generator`.
1111

1212
.. note::
1313

docs/source/setup/installation/pip_installation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Clone the Isaac Lab repository into your workspace:
211211
212212
./isaaclab.sh --help
213213
214-
usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
214+
usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-n] [-c] -- Utility to manage Isaac Lab.
215215
216216
optional arguments:
217217
-h, --help Display the help content.
@@ -223,6 +223,7 @@ Clone the Isaac Lab repository into your workspace:
223223
-o, --docker Run the docker container helper script (docker/container.sh).
224224
-v, --vscode Generate the VSCode settings file from template.
225225
-d, --docs Build the documentation from source using sphinx.
226+
-n, --new Create a new external project or internal task from template.
226227
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
227228
228229
.. tab-item:: :icon:`fa-brands fa-windows` Windows
@@ -232,7 +233,7 @@ Clone the Isaac Lab repository into your workspace:
232233
233234
isaaclab.bat --help
234235
235-
usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
236+
usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-n] [-c] -- Utility to manage Isaac Lab.
236237
237238
optional arguments:
238239
-h, --help Display the help content.
@@ -243,6 +244,7 @@ Clone the Isaac Lab repository into your workspace:
243244
-t, --test Run all python unittest tests.
244245
-v, --vscode Generate the VSCode settings file from template.
245246
-d, --docs Build the documentation from source using sphinx.
247+
-n, --new Create a new external project or internal task from template.
246248
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
247249
248250
Installation

isaaclab.bat

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ goto :eof
236236
rem Print the usage description
237237
:print_help
238238
echo.
239-
echo usage: %~nx0 [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-c] -- Utility to manage extensions in Isaac Lab.
239+
echo usage: %~nx0 [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-n] [-c] -- Utility to manage extensions in Isaac Lab.
240240
echo.
241241
echo optional arguments:
242242
echo -h, --help Display the help content.
@@ -247,6 +247,7 @@ echo -s, --sim Run the simulator executable (isaac-sim.bat) provi
247247
echo -t, --test Run all python unittest tests.
248248
echo -v, --vscode Generate the VSCode settings file from template.
249249
echo -d, --docs Build the documentation from source using sphinx.
250+
echo -n, --new Create a new external project or internal task from template.
250251
echo -c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'.
251252
echo.
252253
goto :eof
@@ -463,6 +464,44 @@ if "%arg%"=="-i" (
463464
)
464465
!isaacsim_exe! --ext-folder %ISAACLAB_PATH%\source !allArgs1
465466
goto :end
467+
) else if "%arg%"=="-n" (
468+
rem run the template generator script
469+
call :extract_python_exe
470+
set "allArgs="
471+
for %%a in (%*) do (
472+
REM Append each argument to the variable, skip the first one
473+
if defined skip (
474+
set "allArgs=!allArgs! %%a"
475+
) else (
476+
set "skip=1"
477+
)
478+
)
479+
echo [INFO] Installing template dependencies...
480+
!python_exe! -m pip install -q -r tools\template\requirements.txt
481+
echo.
482+
echo [INFO] Running template generator...
483+
echo.
484+
!python_exe! tools\template\cli.py !allArgs!
485+
goto :end
486+
) else if "%arg%"=="--new" (
487+
rem run the template generator script
488+
call :extract_python_exe
489+
set "allArgs="
490+
for %%a in (%*) do (
491+
REM Append each argument to the variable, skip the first one
492+
if defined skip (
493+
set "allArgs=!allArgs! %%a"
494+
) else (
495+
set "skip=1"
496+
)
497+
)
498+
echo [INFO] Installing template dependencies...
499+
!python_exe! -m pip install -q -r tools\template\requirements.txt
500+
echo.
501+
echo [INFO] Running template generator...
502+
echo.
503+
!python_exe! tools\template\cli.py !allArgs!
504+
goto :end
466505
) else if "%arg%"=="-t" (
467506
rem run the python provided by Isaac Sim
468507
call :extract_python_exe

isaaclab.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ update_vscode_settings() {
241241

242242
# print the usage description
243243
print_help () {
244-
echo -e "\nusage: $(basename "$0") [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-c] -- Utility to manage Isaac Lab."
244+
echo -e "\nusage: $(basename "$0") [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-n] [-c] -- Utility to manage Isaac Lab."
245245
echo -e "\noptional arguments:"
246246
echo -e "\t-h, --help Display the help content."
247247
echo -e "\t-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks as extra dependencies. Default is 'all'."
@@ -252,6 +252,7 @@ print_help () {
252252
echo -e "\t-o, --docker Run the docker container helper script (docker/container.sh)."
253253
echo -e "\t-v, --vscode Generate the VSCode settings file from template."
254254
echo -e "\t-d, --docs Build the documentation from source using sphinx."
255+
echo -e "\t-n, --new Create a new external project or internal task from template."
255256
echo -e "\t-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'env_isaaclab'."
256257
echo -e "\n" >&2
257258
}
@@ -375,6 +376,17 @@ while [[ $# -gt 0 ]]; do
375376
# exit neatly
376377
break
377378
;;
379+
-n|--new)
380+
# run the template generator script
381+
python_exe=$(extract_python_exe)
382+
shift # past argument
383+
echo "[INFO] Installing template dependencies..."
384+
${python_exe} -m pip install -q -r ${ISAACLAB_PATH}/tools/template/requirements.txt
385+
echo -e "\n[INFO] Running template generator...\n"
386+
${python_exe} ${ISAACLAB_PATH}/tools/template/cli.py $@
387+
# exit neatly
388+
break
389+
;;
378390
-t|--test)
379391
# run the python provided by isaacsim
380392
python_exe=$(extract_python_exe)

scripts/reinforcement_learning/rl_games/play.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
import isaaclab_tasks # noqa: F401
6868
from isaaclab_tasks.utils import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg
6969

70+
# PLACEHOLDER: Extension template (do not remove this comment)
71+
7072

7173
def main():
7274
"""Play with RL-Games agent."""

scripts/reinforcement_learning/rl_games/train.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@
7070
import isaaclab_tasks # noqa: F401
7171
from isaaclab_tasks.utils.hydra import hydra_task_config
7272

73+
# PLACEHOLDER: Extension template (do not remove this comment)
74+
7375

7476
@hydra_task_config(args_cli.task, "rl_games_cfg_entry_point")
7577
def main(env_cfg: ManagerBasedRLEnvCfg | DirectRLEnvCfg | DirectMARLEnvCfg, agent_cfg: dict):

scripts/reinforcement_learning/rsl_rl/play.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
import isaaclab_tasks # noqa: F401
6262
from isaaclab_tasks.utils import get_checkpoint_path, parse_env_cfg
6363

64+
# PLACEHOLDER: Extension template (do not remove this comment)
65+
6466

6567
def main():
6668
"""Play with RSL-RL agent."""

0 commit comments

Comments
 (0)