Unverified Commit 742d8b44 authored by Louis LE LAY's avatar Louis LE LAY Committed by GitHub

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
parent 868d03ad
......@@ -179,3 +179,45 @@ Here are some general commands to get started with it:
.. code-block:: batch
python scripts\reinforcement_learning\<specific-rl-library>\train.py --task=<Task-Name>
* Run a task with dummy agents.
These include dummy agents that output zero or random agents. They are useful to ensure that the environments are configured correctly.
* Zero-action agent
.. tab-set::
:sync-group: os
.. tab-item:: :icon:`fa-brands fa-linux` Linux
:sync: linux
.. code-block:: bash
python scripts/zero_agent.py --task=<Task-Name>
.. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows
.. code-block:: batch
python scripts\zero_agent.py --task=<Task-Name>
* Random-action agent
.. tab-set::
:sync-group: os
.. tab-item:: :icon:`fa-brands fa-linux` Linux
:sync: linux
.. code-block:: bash
python scripts/random_agent.py --task=<Task-Name>
.. tab-item:: :icon:`fa-brands fa-windows` Windows
:sync: windows
.. code-block:: batch
python scripts\random_agent.py --task=<Task-Name>
......@@ -35,6 +35,8 @@ import torch
import isaaclab_tasks # noqa: F401
from isaaclab_tasks.utils import parse_env_cfg
# PLACEHOLDER: Extension template (do not remove this comment)
def main():
"""Random actions agent with Isaac Lab environment."""
......
......@@ -35,6 +35,8 @@ import torch
import isaaclab_tasks # noqa: F401
from isaaclab_tasks.utils import parse_env_cfg
# PLACEHOLDER: Extension template (do not remove this comment)
def main():
"""Zero actions agent with Isaac Lab environment."""
......
......@@ -195,6 +195,15 @@ def _external(specification: dict) -> None:
src=os.path.join(ROOT_DIR, "scripts", "environments", "list_envs.py"),
dst=os.path.join(dir, "list_envs.py"),
)
for script in ["zero_agent.py", "random_agent.py"]:
_replace_in_file(
[(
"# PLACEHOLDER: Extension template (do not remove this comment)",
f"import {name}.tasks # noqa: F401",
)],
src=os.path.join(ROOT_DIR, "scripts", "environments", script),
dst=os.path.join(dir, script),
)
# # docker files
# print(" |-- Copying docker files...")
# dir = os.path.join(project_dir, "docker")
......
......@@ -44,6 +44,23 @@ It allows you to develop in an isolated environment, outside of the core Isaac L
python scripts/<RL_LIBRARY>/train.py --task=<TASK_NAME>
```
- Running a task with dummy agents:
These include dummy agents that output zero or random agents. They are useful to ensure that the environments are configured correctly.
- Zero-action agent
```bash
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
python scripts/zero_agent.py --task=<TASK_NAME>
```
- Random-action agent
```bash
# use 'FULL_PATH_TO_isaaclab.sh|bat -p' instead of 'python' if Isaac Lab is not installed in Python venv or conda
python scripts/random_agent.py --task=<TASK_NAME>
```
### Set up IDE (Optional)
To setup the IDE, please follow these instructions:
......
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