|
| 1 | +# For Heterogeneous Agent Reinforcement Learning |
| 2 | + |
| 3 | +Use these instructions to install isaac sim -> [here](https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_python.html#install-isaac-sim-using-pip) |
| 4 | + |
| 5 | +Make sure to run all the following commands with your isaaclab conda environment activated, as highlighted in the instruction provided above. |
| 6 | + |
| 7 | +```bash |
| 8 | +cd IsaacLab |
| 9 | +./isaaclab.sh -i |
| 10 | +pip install gymnasium==0.29.0 |
| 11 | +``` |
| 12 | + |
| 13 | +At this point you should be able to run the trained multi-agent homogeneous environment. |
| 14 | + |
| 15 | +```bash |
| 16 | +cd IsaacLab |
| 17 | +python source/standalone/workflows/harl/play_keyboard.py --task Isaac-Multi-Agent-Flat-Anymal-C-Direct-v0 --num_envs 1 --algorithm happo --dir source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/anymal_c_multi_agent/best_model |
| 18 | +``` |
| 19 | + |
| 20 | +Which will allow you to interact with the trained by using the keyboard to give velocity commands. |
| 21 | + |
| 22 | +``` |
| 23 | +a,d = angular velocity commands (left, right) |
| 24 | +arrow keys = x,y velocity commands (forward, backward, left, right) |
| 25 | +``` |
| 26 | + |
| 27 | +If you are just interested in running the environment and seeing how the environment resets, training works etc. You can use the `play.py` script instead. |
| 28 | + |
| 29 | +# Training custom environment |
| 30 | + |
| 31 | + |
| 32 | +```bash |
| 33 | +python source/standalone/workflows/harl/train.py --task Isaac-Multi-Agent-Flat-Anymal-C-Direct-v0 --video_interval 10_000 --num_envs 2048 --save_interval 10 --log_interval 10 --algorithm happo --headless --num_env_steps 2_000_000_000 |
| 34 | +``` |
| 35 | + |
| 36 | +You can run `python play.py -h` to see all arguments. Also note that the configuration for the algorithms can be found in their yaml files, an |
| 37 | +example of which can be found at `source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/anymal_c_multi_agent/agents/harl_ppo_cfg.yaml`, however, these will be overwritten with any parameters you define in the `train.py` script. |
| 38 | + |
| 39 | + |
| 40 | +# Registering a New Environment in Isaac Lab |
| 41 | + |
| 42 | +Isaac Lab allows you to register custom environments in the Gym framework, enabling efficient use with Gym's `make` command. This guide provides steps to register a new environment, using the example of the `DirectEnvRL`-based Piano Movers environment. |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Environment Registration Example |
| 47 | + |
| 48 | +The environment `DirectEnvRL` is used as the base for the multi agent anymal c bar carrying environment, and it is registered in the Gym environments through the `__init__.py` file. To better understand the process, you can explore the following example folder: |
| 49 | + |
| 50 | +``` |
| 51 | +IsaacLab/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/anymal_c_multi_agent |
| 52 | +``` |
| 53 | + |
| 54 | +This folder contains the environment code and the necessary registration logic. To register your custom environment, follow these steps: |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## Steps to Register a New Environment |
| 59 | + |
| 60 | +### 1. **Modify Extensions** |
| 61 | + |
| 62 | +If you are adding a new `DirectEnvRL` environment, place your code in the following directory: |
| 63 | + |
| 64 | +``` |
| 65 | +IsaacLab/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/ |
| 66 | +``` |
| 67 | + |
| 68 | +### 2. **Update `__init__.py`** |
| 69 | + |
| 70 | +Ensure that your new environment is registered in the Gym framework by adding the appropriate registration logic to the `__init__.py` file in the corresponding directory. |
| 71 | + |
| 72 | +Now you can use the instructions provided at the beginning of this README for training the environment. We advise you also utilize the debugging tools provided in Visual Studio Code and setup the corresponding `launch.json` file to aid in your development. |
| 73 | + |
| 74 | + |
1 | 75 | 
|
2 | 76 | # Isaac Lab
|
3 | 77 |
|
|
0 commit comments