Isaac Gym: Overview & Getting Started

Learning Objectives

Set up our reinforcement learning example repository: OmniIsaacGymEnvs
1.Install OmniIsaacGymEnvs for Isaac Sim
2.Run inferencing and training examples in OmniIsaacGymEnvs
3.Install OmniIsaacGymEnvs in Docker
4.Run OmniIsaacGymEnvs examples with LiveStream

Getting started

Default Python Environment
Learn about Isaac Sim’s python environment and locate the python executable in Isaac Sim
Isaac Sim provides a built-in Python 3.10 environment that packages can use, similar to a system-level Python install
Recommended to use this Python environment when running the Python scripts

./python.sh path/to/script.py

Run the following from the Isaac Sim root folder to start a Python script in this environment
Workstation Installation
=> Already Done

Installing Examples Repository

(1)First clone the repository

git clone https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs.git

(2)Install the examples as a python module in Isaac Sim
(2)-1 Locate the Isaac Sim python executable, which by default should be python.sh on Linux or python.bat on Windows, located at the root of the Isaac Sim directory

cd ~/.local/share/ov/pkg/isaac_sim-*/
ls -l python.sh
pwd

IsaacGymOverview1
(2)-2 Refer to the Isaac Sim python executable path as PYTHON_PATH

alias PYTHON_PATH=~/.local/share/ov/pkg/isaac_sim-*/python.sh

(2)-3 Add it to .bashrc

nano ~/.bashrc
alias PYTHON_PATH='~/.local/share/ov/pkg/isaac_sim-*/python.sh'

IsaacGymOverview2

(2)-4 Install OmniIsaacGymEnvs to PYTHON_PATH by running the following from the root of OmniIsaacGymEnvs

cd OmniIsaacGymEnvs/
PYTHON_PATH -m pip install -e .

IsaacGymOverview3
=> The following error may appear during the initial installation. This error is harmless and can be ignored
(2)-5 List of current environments in OmniIsaacGymEnvs:
IsaacGymOverview4
What I intend to test
=> Anymal & AnymalTerrain

Running Examples

Example scripts should be launched from OmniIsaacGymEnvs/omniisaacgymenvs

Launching Training Examples

Train your first policy

cd ~/OmniIsaacGymEnvs/omniisaacgymenvs
ls -l
PYTHON_PATH scripts/rlgames_train.py task=Cartpole

IsaacGymOverview5
We will see an Isaac Sim window pop up
Once Isaac Sim initialization completes (which may take a few minutes if launching for the first time), the Cartpole scene will be constructed and simulation will start running automatically
IsaacGymOverview6
The process will terminate once training finishes
IsaacGymOverview7
IsaacGymOverview8
IsaacGymOverview9
IsaacGymOverview10
IsaacGymOverview11
The process will terminate once training finishes
Result
In the path /home/rosexpert1/OmniIsaacGymEnvs/omniisaacgymenvs/runs/, a Cartpole file is generated and the model with the best rewards is stored every 25, 50, 75, and 100 epochs
Anymal
Train your policy

cd ~/OmniIsaacGymEnvs/omniisaacgymenvs
PYTHON_PATH scripts/rlgames_train.py task=Anymal

We will see an Isaac Sim window pop up
Once Isaac Sim initialization completes (which may take a few minutes if launching for the first time), the Anymal scene will be constructed and simulation will start running automatically
IsaacGymOverview14
Terminal
IsaacGymOverview13
IsaacGymOverview15
IsaacGymOverview16
IsaacGymOverview17
IsaacGymOverview18
50 Epochs
IsaacGymOverview19 79bdd6d86a)
100 Epochs
IsaacGymOverview20
150 Epochs
IsaacGymOverview21
200 Epochs
IsaacGymOverview22
Checkpoint
IsaacGymOverview23
250 Epochs & Checkpoint
IsaacGymOverview24
300 Epochs
IsaacGymOverview25
350 Epochs
IsaacGymOverview26
400 Epochs
IsaacGymOverview27
450 Epochs
IsaacGymOverview28
500 Epochs
IsaacGymOverview29
550 Epochs
IsaacGymOverview30
600 Epochs
IsaacGymOverview31
650 Epochs
IsaacGymOverview32
700 Epochs
IsaacGymOverview33
750 Epochs
IsaacGymOverview34
800 Epochs
IsaacGymOverview35
850 Epochs
IsaacGymOverview36
900 Epochs
IsaacGymOverview37
950 Epochs
IsaacGymOverview38
1000 Epochs
IsaacGymOverview39
Training Completed
IsaacGymOverview40
Result
IsaacGymOverview41
=> New Anymal file generated in the runs folder
IsaacGymOverview42
=> Models generated per epochs is identified
Anymal Terrain
We will see an Isaac Sim window pop up
Once Isaac Sim initialization completes (which may take a few minutes if launching for the first time), the Anymal scene will be constructed and simulation will start running automatically
IsaacGymOverview43
Terminal
IsaacGymOverview44
IsaacGymOverview45
IsaacGymOverview46
IsaacGymOverview47
50 Epochs
IsaacGymOverview48
100 Epochs
IsaacGymOverview49
Saving Checkpoint
IsaacGymOverview50
150 Epochs
IsaacGymOverview51
200 Epochs
IsaacGymOverview52
250 Epochs
IsaacGymOverview53
300 Epochs
IsaacGymOverview54
350 Epochs
IsaacGymOverview55
400 Epochs
IsaacGymOverview56
450 Epochs
IsaacGymOverview57
500 Epochs
IsaacGymOverview58
550 Epochs
IsaacGymOverview59
600 Epochs
IsaacGymOverview60
650 Epochs
IsaacGymOverview61
700 Epochs
IsaacGymOverview62
750 Epochs
IsaacGymOverview63
800 Epochs
IsaacGymOverview64
850 Epochs
IsaacGymOverview65
900 Epochs
IsaacGymOverview66
950 Epochs
IsaacGymOverview67
1000 Epochs
IsaacGymOverview68
1050 Epochs
IsaacGymOverview69
1100 Epochs
IsaacGymOverview70
1150 Epochs
IsaacGymOverview71
1200 Epochs
IsaacGymOverview72
1250 Epochs
IsaacGymOverview73
1300 Epochs
IsaacGymOverview74
1350 Epochs
IsaacGymOverview75
1400 Epochs
IsaacGymOverview76
1450 Epochs
IsaacGymOverview77
1500 Epochs
IsaacGymOverview78
1550 Epochs
IsaacGymOverview79
1600 Epochs
IsaacGymOverview80
1650 Epochs
IsaacGymOverview81
1700 Epochs
IsaacGymOverview82
1750 Epochs
IsaacGymOverview83
1800 Epochs
IsaacGymOverview84
1850 Epochs
IsaacGymOverview85
1900 Epochs
IsaacGymOverview86
1950 Epochs
IsaacGymOverview87
2000 Epochs
IsaacGymOverview88
Training Completed
IsaacGymOverview89
Result

cd ~/OmniIsaacGymEnvs/omniisaacgymenvs/runs/AnymalTerrain/nn/
ls -l

In the path /home/rosexpert1/OmniIsaacGymEnvs/omniisaacgymenvs/runs/, an AnymalTerrain file is generated and the model with the best rewards is stored every 25, 50, 75, and 100 epochs
IsaacGymOverview90

Running Inference

cd ~/OmniIsaacGymEnvs/omniisaacgymenvs
PYTHON_PATH scripts/rlgames_train.py task=Cartpole test=True checkpoint=omniverse://localhost/NVIDIA/Assets/Isaac/2023.1.1/Isaac/Samples/OmniIsaacGymEnvs/Checkpoints/cartpole.pth

Error
IsaacGymOverview12
Solution(Searching for it…)
https://forums.developer.nvidia.com/t/assistance-required-error-with-inferencing-using-pre-trained-checkpoints-in-isaac-gym/286386

Reference:
https://docs.omniverse.nvidia.com/isaacsim/latest/isaac_gym_tutorials/tutorial_gym_isaac_gym.html
https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/main/docs/examples/rl_examples.md#anymal-anymalpy