Skip to content

Commit

Permalink
Update Orbit-related source code and docs to Isaac Lab (#159)
Browse files Browse the repository at this point in the history
* Rename Isaac Orbit loaders and wrappers files to Isaac Lab

* Rename Orbit wrapper to Isaac Lab

* Rename Orbit examples to Isaac Lab

* Update the Isaac Lab environment loader

* Rename Orbit environment loader to Isaac Lab

* Improve auto wrapper detection implementation

* Replace Orbit by Isaac Lab in docs

* Rename Orbit files to Isaac Lab in docs

* Update README

* Update CHANGELOG
  • Loading branch information
Toni-SM authored Jun 21, 2024
1 parent d80b964 commit cf9e6ad
Show file tree
Hide file tree
Showing 43 changed files with 385 additions and 398 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add support to automatically compute the write and checkpoint intervals and make it the default option
- Single forward-pass in shared models

### Changed
- Update Orbit-related source code and docs to Isaac Lab

### Fixed
- Move the batch sampling inside gradient step loop for DDPG and TD3

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h2 align="center" style="border-bottom: 0 !important;">SKRL - Reinforcement Learning library</h2>
<br>

**skrl** is an open-source modular library for Reinforcement Learning written in Python (on top of [PyTorch](https://pytorch.org/) and [JAX](https://jax.readthedocs.io)) and designed with a focus on modularity, readability, simplicity, and transparency of algorithm implementation. In addition to supporting the OpenAI [Gym](https://www.gymlibrary.dev) / Farama [Gymnasium](https://gymnasium.farama.org) and [DeepMind](https://github.com/deepmind/dm_env) and other environment interfaces, it allows loading and configuring [NVIDIA Isaac Gym](https://developer.nvidia.com/isaac-gym/), [NVIDIA Isaac Orbit](https://isaac-orbit.github.io/orbit/index.html) and [NVIDIA Omniverse Isaac Gym](https://docs.omniverse.nvidia.com/isaacsim/latest/tutorial_gym_isaac_gym.html) environments, enabling agents' simultaneous training by scopes (subsets of environments among all available environments), which may or may not share resources, in the same run.
**skrl** is an open-source modular library for Reinforcement Learning written in Python (on top of [PyTorch](https://pytorch.org/) and [JAX](https://jax.readthedocs.io)) and designed with a focus on modularity, readability, simplicity, and transparency of algorithm implementation. In addition to supporting the OpenAI [Gym](https://www.gymlibrary.dev) / Farama [Gymnasium](https://gymnasium.farama.org) and [DeepMind](https://github.com/deepmind/dm_env) and other environment interfaces, it allows loading and configuring [NVIDIA Isaac Gym](https://developer.nvidia.com/isaac-gym/), [NVIDIA Omniverse Isaac Gym](https://docs.omniverse.nvidia.com/isaacsim/latest/tutorial_gym_isaac_gym.html) and [NVIDIA Isaac Lab](https://isaac-sim.github.io/IsaacLab/index.html) environments, enabling agents' simultaneous training by scopes (subsets of environments among all available environments), which may or may not share resources, in the same run.

<br>

Expand Down
12 changes: 6 additions & 6 deletions docs/source/api/envs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Environments
Wrapping (single-agent) <envs/wrapping>
Wrapping (multi-agents) <envs/multi_agents_wrapping>
Isaac Gym environments <envs/isaac_gym>
Isaac Orbit environments <envs/isaac_orbit>
Omniverse Isaac Gym environments <envs/omniverse_isaac_gym>
Isaac Lab environments <envs/isaaclab>

The environment plays a fundamental and crucial role in defining the RL setup. It is the place where the agent interacts, and it is responsible for providing the agent with information about its current state, as well as the rewards/penalties associated with each action.

.. raw:: html

<br><hr>

Grouped in this section you will find how to load environments from NVIDIA Isaac Gym, Isaac Orbit and Omniverse Isaac Gym with a simple function.
Grouped in this section you will find how to load environments from NVIDIA Isaac Gym, Omniverse Isaac Gym and Isaac Lab with a simple function.

In addition, you will be able to :doc:`wrap single-agent <envs/wrapping>` and :doc:`multi-agent <envs/multi_agents_wrapping>` RL environment interfaces.

Expand All @@ -29,10 +29,10 @@ In addition, you will be able to :doc:`wrap single-agent <envs/wrapping>` and :d
* - :doc:`Isaac Gym environments <envs/isaac_gym>`
- .. centered:: :math:`\blacksquare`
- .. centered:: :math:`\blacksquare`
* - :doc:`Isaac Orbit environments <envs/isaac_orbit>`
* - :doc:`Omniverse Isaac Gym environments <envs/omniverse_isaac_gym>`
- .. centered:: :math:`\blacksquare`
- .. centered:: :math:`\blacksquare`
* - :doc:`Omniverse Isaac Gym environments <envs/omniverse_isaac_gym>`
* - :doc:`Isaac Lab environments <envs/isaaclab>`
- .. centered:: :math:`\blacksquare`
- .. centered:: :math:`\blacksquare`

Expand All @@ -57,10 +57,10 @@ In addition, you will be able to :doc:`wrap single-agent <envs/wrapping>` and :d
* - Isaac Gym (previews)
- .. centered:: :math:`\blacksquare`
- .. centered:: :math:`\blacksquare`
* - Isaac Orbit
* - Omniverse Isaac Gym |_5| |_5| |_5| |_5| |_2|
- .. centered:: :math:`\blacksquare`
- .. centered:: :math:`\blacksquare`
* - Omniverse Isaac Gym |_5| |_5| |_5| |_5| |_2|
* - Isaac Lab
- .. centered:: :math:`\blacksquare`
- .. centered:: :math:`\blacksquare`
* - PettingZoo
Expand Down
90 changes: 0 additions & 90 deletions docs/source/api/envs/isaac_orbit.rst

This file was deleted.

90 changes: 90 additions & 0 deletions docs/source/api/envs/isaaclab.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Isaac Lab environments
======================

.. image:: ../../_static/imgs/example_isaaclab.png
:width: 100%
:align: center
:alt: Isaac Lab environments

.. raw:: html

<br><br><hr>

Environments
------------

The repository https://github.com/isaac-sim/IsaacLab provides the example reinforcement learning environments for Isaac Lab (Orbit and Omniverse Isaac Gym unification).

These environments can be easily loaded and configured by calling a single function provided with this library. This function also makes it possible to configure the environment from the command line arguments (see Isaac Lab's `Training with an RL Agent <https://isaac-sim.github.io/IsaacLab/source/tutorials/03_envs/run_rl_training.html>`_) or from its parameters (:literal:`task_name`, :literal:`num_envs`, :literal:`headless`, and :literal:`cli_args`).

.. note::

The command line arguments has priority over the function parameters.

.. note::

Isaac Lab environments implement a functionality to get their configuration from the command line. Setting the :literal:`headless` option from the trainer configuration will not work. In this case, it is necessary to set the load function's :literal:`headless` argument to True or to invoke the scripts as follows: :literal:`isaaclab -p script.py --headless`.

.. raw:: html

<br>

Usage
^^^^^

.. tabs::

.. tab:: Function parameters

.. tabs::

.. group-tab:: |_4| |pytorch| |_4|

.. literalinclude:: ../../snippets/loaders.py
:language: python
:emphasize-lines: 2, 5
:start-after: [start-isaaclab-envs-parameters-torch]
:end-before: [end-isaaclab-envs-parameters-torch]

.. group-tab:: |_4| |jax| |_4|

.. literalinclude:: ../../snippets/loaders.py
:language: python
:emphasize-lines: 2, 5
:start-after: [start-isaaclab-envs-parameters-jax]
:end-before: [end-isaaclab-envs-parameters-jax]

.. tab:: Command line arguments (priority)

.. tabs::

.. group-tab:: |_4| |pytorch| |_4|

.. literalinclude:: ../../snippets/loaders.py
:language: python
:emphasize-lines: 2, 5
:start-after: [start-isaaclab-envs-cli-torch]
:end-before: [end-isaaclab-envs-cli-torch]

.. group-tab:: |_4| |jax| |_4|

.. literalinclude:: ../../snippets/loaders.py
:language: python
:emphasize-lines: 2, 5
:start-after: [start-isaaclab-envs-cli-jax]
:end-before: [end-isaaclab-envs-cli-jax]

Run the main script passing the configuration as command line arguments. For example:

.. code-block::
isaaclab -p main.py --task Isaac-Cartpole-v0
.. raw:: html

<br>

API
^^^

.. autofunction:: skrl.envs.loaders.torch.load_isaaclab_env
42 changes: 21 additions & 21 deletions docs/source/api/envs/wrapping.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This library works with a common API to interact with the following RL environme
* `DeepMind <https://github.com/deepmind/dm_env>`_
* `robosuite <https://robosuite.ai/>`_
* `NVIDIA Isaac Gym <https://developer.nvidia.com/isaac-gym>`_ (preview 2, 3 and 4)
* `NVIDIA Isaac Orbit <https://isaac-orbit.github.io/orbit/index.html>`_
* `NVIDIA Omniverse Isaac Gym <https://docs.omniverse.nvidia.com/isaacsim/latest/tutorial_gym_isaac_gym.html>`_
* `NVIDIA Isaac Lab <https://isaac-sim.github.io/IsaacLab/index.html>`_

To operate with them and to support interoperability between these non-compatible interfaces, a **wrapping mechanism is provided** as shown in the diagram below

Expand Down Expand Up @@ -44,6 +44,24 @@ Usage

.. tabs::

.. tab:: Isaac Lab

.. tabs::

.. group-tab:: |_4| |pytorch| |_4|

.. literalinclude:: ../../snippets/wrapping.py
:language: python
:start-after: [pytorch-start-isaaclab]
:end-before: [pytorch-end-isaaclab]

.. group-tab:: |_4| |jax| |_4|

.. literalinclude:: ../../snippets/wrapping.py
:language: python
:start-after: [jax-start-isaaclab]
:end-before: [jax-end-isaaclab]

.. tab:: Omniverse Isaac Gym

.. tabs::
Expand Down Expand Up @@ -84,24 +102,6 @@ Usage
:start-after: [jax-start-omniverse-isaacgym-mt]
:end-before: [jax-end-omniverse-isaacgym-mt]

.. tab:: Isaac Orbit

.. tabs::

.. group-tab:: |_4| |pytorch| |_4|

.. literalinclude:: ../../snippets/wrapping.py
:language: python
:start-after: [pytorch-start-isaac-orbit]
:end-before: [pytorch-end-isaac-orbit]

.. group-tab:: |_4| |jax| |_4|

.. literalinclude:: ../../snippets/wrapping.py
:language: python
:start-after: [jax-start-isaac-orbit]
:end-before: [jax-end-isaac-orbit]

.. tab:: Isaac Gym

.. tabs::
Expand Down Expand Up @@ -365,7 +365,7 @@ Internal API (PyTorch)

.. automethod:: __init__

.. autoclass:: skrl.envs.wrappers.torch.IsaacOrbitWrapper
.. autoclass:: skrl.envs.wrappers.torch.IsaacLabWrapper
:undoc-members:
:show-inheritance:
:members:
Expand Down Expand Up @@ -443,7 +443,7 @@ Internal API (JAX)

.. automethod:: __init__

.. autoclass:: skrl.envs.wrappers.jax.IsaacOrbitWrapper
.. autoclass:: skrl.envs.wrappers.jax.IsaacLabWrapper
:undoc-members:
:show-inheritance:
:members:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/api/utils/omniverse_isaacgym_utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Control of robotic manipulators
Differential inverse kinematics
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This implementation attempts to unify under a single and reusable function the whole set of procedures used to compute the inverse kinematics of a robotic manipulator, originally shown in the Isaac Orbit framework's task space controllers section, but this time for Omniverse Isaac Gym.
This implementation attempts to unify under a single and reusable function the whole set of procedures used to compute the inverse kinematics of a robotic manipulator, originally shown in the Isaac Lab (Orbit then) framework's task space controllers section, but this time for Omniverse Isaac Gym.

:math:`\Delta\theta =` :guilabel:`scale` :math:`J^\dagger \, \vec{e}`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# import the skrl components to build the RL system
from skrl import config
from skrl.agents.jax.ddpg import DDPG, DDPG_DEFAULT_CONFIG
from skrl.envs.loaders.jax import load_isaac_orbit_env
from skrl.envs.loaders.jax import load_isaaclab_env
from skrl.envs.wrappers.jax import wrap_env
from skrl.memories.jax import RandomMemory
from skrl.models.jax import DeterministicMixin, Model
Expand Down Expand Up @@ -69,8 +69,8 @@ def __call__(self, inputs, role):
return x, {}


# load and wrap the Isaac Orbit environment
env = load_isaac_orbit_env(task_name="Isaac-Ant-v0", num_envs=64)
# load and wrap the Isaac Lab environment
env = load_isaaclab_env(task_name="Isaac-Ant-v0", num_envs=64)
env = wrap_env(env)

device = env.device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# import the skrl components to build the RL system
from skrl import config
from skrl.agents.jax.ppo import PPO, PPO_DEFAULT_CONFIG
from skrl.envs.loaders.jax import load_isaac_orbit_env
from skrl.envs.loaders.jax import load_isaaclab_env
from skrl.envs.wrappers.jax import wrap_env
from skrl.memories.jax import RandomMemory
from skrl.models.jax import DeterministicMixin, GaussianMixin, Model
Expand Down Expand Up @@ -72,8 +72,8 @@ def __call__(self, inputs, role):
return x, {}


# load and wrap the Isaac Orbit environment
env = load_isaac_orbit_env(task_name="Isaac-Ant-v0")
# load and wrap the Isaac Lab environment
env = load_isaaclab_env(task_name="Isaac-Ant-v0")
env = wrap_env(env)

device = env.device
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# import the skrl components to build the RL system
from skrl import config
from skrl.agents.jax.sac import SAC, SAC_DEFAULT_CONFIG
from skrl.envs.loaders.jax import load_isaac_orbit_env
from skrl.envs.loaders.jax import load_isaaclab_env
from skrl.envs.wrappers.jax import wrap_env
from skrl.memories.jax import RandomMemory
from skrl.models.jax import DeterministicMixin, GaussianMixin, Model
Expand Down Expand Up @@ -70,8 +70,8 @@ def __call__(self, inputs, role):
return x, {}


# load and wrap the Isaac Orbit environment
env = load_isaac_orbit_env(task_name="Isaac-Ant-v0", num_envs=64)
# load and wrap the Isaac Lab environment
env = load_isaaclab_env(task_name="Isaac-Ant-v0", num_envs=64)
env = wrap_env(env)

device = env.device
Expand Down
Loading

0 comments on commit cf9e6ad

Please sign in to comment.