Skip to content

Commit 742d8b4

Browse files
authored
Adds dummy agents to the external task template generator (#2221)
# Description Adds the dummy agents when generating an Isaac Lab's external project. Useful when debugging! ## 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` - [x] 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
1 parent 868d03a commit 742d8b4

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

docs/source/overview/developer-guide/template.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,45 @@ Here are some general commands to get started with it:
179179
.. code-block:: batch
180180
181181
python scripts\reinforcement_learning\<specific-rl-library>\train.py --task=<Task-Name>
182+
183+
* Run a task with dummy agents.
184+
185+
These include dummy agents that output zero or random agents. They are useful to ensure that the environments are configured correctly.
186+
187+
* Zero-action agent
188+
189+
.. tab-set::
190+
:sync-group: os
191+
192+
.. tab-item:: :icon:`fa-brands fa-linux` Linux
193+
:sync: linux
194+
195+
.. code-block:: bash
196+
197+
python scripts/zero_agent.py --task=<Task-Name>
198+
199+
.. tab-item:: :icon:`fa-brands fa-windows` Windows
200+
:sync: windows
201+
202+
.. code-block:: batch
203+
204+
python scripts\zero_agent.py --task=<Task-Name>
205+
206+
* Random-action agent
207+
208+
.. tab-set::
209+
:sync-group: os
210+
211+
.. tab-item:: :icon:`fa-brands fa-linux` Linux
212+
:sync: linux
213+
214+
.. code-block:: bash
215+
216+
python scripts/random_agent.py --task=<Task-Name>
217+
218+
.. tab-item:: :icon:`fa-brands fa-windows` Windows
219+
:sync: windows
220+
221+
.. code-block:: batch
222+
223+
python scripts\random_agent.py --task=<Task-Name>

scripts/environments/random_agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import isaaclab_tasks # noqa: F401
3636
from isaaclab_tasks.utils import parse_env_cfg
3737

38+
# PLACEHOLDER: Extension template (do not remove this comment)
39+
3840

3941
def main():
4042
"""Random actions agent with Isaac Lab environment."""

scripts/environments/zero_agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import isaaclab_tasks # noqa: F401
3636
from isaaclab_tasks.utils import parse_env_cfg
3737

38+
# PLACEHOLDER: Extension template (do not remove this comment)
39+
3840

3941
def main():
4042
"""Zero actions agent with Isaac Lab environment."""

tools/template/generator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ def _external(specification: dict) -> None:
195195
src=os.path.join(ROOT_DIR, "scripts", "environments", "list_envs.py"),
196196
dst=os.path.join(dir, "list_envs.py"),
197197
)
198+
for script in ["zero_agent.py", "random_agent.py"]:
199+
_replace_in_file(
200+
[(
201+
"# PLACEHOLDER: Extension template (do not remove this comment)",
202+
f"import {name}.tasks # noqa: F401",
203+
)],
204+
src=os.path.join(ROOT_DIR, "scripts", "environments", script),
205+
dst=os.path.join(dir, script),
206+
)
198207
# # docker files
199208
# print(" |-- Copying docker files...")
200209
# dir = os.path.join(project_dir, "docker")

tools/template/templates/external/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ It allows you to develop in an isolated environment, outside of the core Isaac L
4444
python scripts/<RL_LIBRARY>/train.py --task=<TASK_NAME>
4545
```
4646

47+
- Running a task with dummy agents:
48+
49+
These include dummy agents that output zero or random agents. They are useful to ensure that the environments are configured correctly.
50+
51+
- Zero-action agent
52+
53+
```bash
54+
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
55+
python scripts/zero_agent.py --task=<TASK_NAME>
56+
```
57+
- Random-action agent
58+
59+
```bash
60+
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
61+
python scripts/random_agent.py --task=<TASK_NAME>
62+
```
63+
4764
### Set up IDE (Optional)
4865

4966
To setup the IDE, please follow these instructions:

0 commit comments

Comments
 (0)