Unverified Commit 3ad18a8e authored by David Hoeller's avatar David Hoeller Committed by GitHub

Updates code to Isaac Lab release (#444)

Updates code to Isaac Lab release

## Type of change

- New feature
- Breaking change

## 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
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have run all the tests with `./isaaclab.sh --test` and they pass
- [x] 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 c1b17b31
......@@ -38,7 +38,7 @@ repos:
- id: pyupgrade
args: ["--py310-plus"]
# FIXME: This is a hack because Pytorch does not like: torch.Tensor | dict aliasing
exclude: "source/extensions/omni.isaac.lab/omni/isaac/lab/envs/base_env.py"
exclude: "source/extensions/omni.isaac.lab/omni/isaac/lab/envs/types.py"
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
......
......@@ -22,6 +22,9 @@ ISAACLAB_DIR = pathlib.Path(__file__).parents[2]
"""Path to the Isaac Lab directory."""
ISAACSIM_DIR = os.path.join(ISAACLAB_DIR, "_isaac_sim")
"""Path to the isaac-sim directory."""
# check if ISAACSIM_DIR is valid:
if not os.path.isdir(ISAACSIM_DIR):
ISAACSIM_DIR = os.environ.get("ISAACSIM_PATH", "")
def overwrite_python_analysis_extra_paths(isaaclab_settings: str) -> str:
......
......@@ -24,7 +24,8 @@ Guidelines for modifications:
* Hunter Hansen
* James Smith
* James Tigue
* **Mayank Mittal** (maintainer)
* Kelly Guo
* Mayank Mittal
* Nikita Rudin
* Pascal Roth
......
![Example Tasks created with Isaac Lab](docs/source/_static/tasks.jpg)
![Isaac Lab](docs/source/_static/isaaclab.jpg)
---
# Isaac Lab
[![IsaacSim](https://img.shields.io/badge/IsaacSim-2023.1.1-silver.svg)](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html)
[![IsaacSim](https://img.shields.io/badge/IsaacSim-4.0-silver.svg)](https://docs.omniverse.nvidia.com/isaacsim/latest/overview.html)
[![Python](https://img.shields.io/badge/python-3.10-blue.svg)](https://docs.python.org/3/whatsnew/3.10.html)
[![Linux platform](https://img.shields.io/badge/platform-linux--64-orange.svg)](https://releases.ubuntu.com/20.04/)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/)
......@@ -54,20 +54,3 @@ or opening a question on its [forums](https://forums.developer.nvidia.com/c/agx-
NVIDIA Isaac Sim is available freely under [individual license](https://www.nvidia.com/en-us/omniverse/download/). For more information about its license terms, please check [here](https://docs.omniverse.nvidia.com/app_isaacsim/common/NVIDIA_Omniverse_License_Agreement.html#software-support-supplement).
The Isaac Lab framework is released under [BSD-3 License](LICENSE). The license files of its dependencies and assets are present in the [`docs/licenses`](docs/licenses) directory.
## Citing
If you use this framework in your work, please cite [this paper](https://arxiv.org/abs/2301.04195):
```text
@article{mittal2023orbit,
author={Mittal, Mayank and Yu, Calvin and Yu, Qinxi and Liu, Jingzhou and Rudin, Nikita and Hoeller, David and Yuan, Jia Lin and Singh, Ritvik and Guo, Yunrong and Mazhar, Hammad and Mandlekar, Ajay and Babich, Buck and State, Gavriel and Hutter, Marco and Garg, Animesh},
journal={IEEE Robotics and Automation Letters},
title={Orbit: A Unified Simulation Framework for Interactive Robot Learning Environments},
year={2023},
volume={8},
number={6},
pages={3740-3747},
doi={10.1109/LRA.2023.3270034}
}
```
......@@ -4,8 +4,8 @@
# Accept the NVIDIA Omniverse EULA by default
ACCEPT_EULA=Y
# NVIDIA Isaac Sim version to use (e.g. 2023.1.1, 2023.1.0-hotfix.1)
ISAACSIM_VERSION=2023.1.1
# NVIDIA Isaac Sim version to use (e.g. 4.0.0, 2023.1.1)
ISAACSIM_VERSION=4.0.0
# Derived from the default path in the NVIDIA provided Isaac Sim container
DOCKER_ISAACSIM_ROOT_PATH=/isaac-sim
# The Isaac Lab path in the container
......
......@@ -22,7 +22,7 @@ LABEL description="Dockerfile for building and running the Isaac Lab framework i
# Path to Isaac Sim root folder
ARG ISAACSIM_ROOT_PATH_ARG
ENV ISAACSIM_ROOT_PATH=${ISAACSIM_ROOT_PATH_ARG}
# Path to Isaac Lab directory
# Path to the Isaac Lab directory
ARG ISAACLAB_PATH_ARG
ENV ISAACLAB_PATH=${ISAACLAB_PATH_ARG}
# Home dir of docker user, typically '/root'
......@@ -33,6 +33,8 @@ ENV DOCKER_USER_HOME=${DOCKER_USER_HOME_ARG}
ENV LANG=C.UTF-8
ENV DEBIAN_FRONTEND=noninteractive
USER root
# Install dependencies and remove cache
RUN --mount=type=cache,target=/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
......@@ -50,12 +52,6 @@ COPY ../ ${ISAACLAB_PATH}
# Set up a symbolic link between the installed Isaac Sim root folder and _isaac_sim in the Isaac Lab directory
RUN ln -sf ${ISAACSIM_ROOT_PATH} ${ISAACLAB_PATH}/_isaac_sim
# Install apt dependencies for extensions that declare them in their extension.toml
RUN --mount=type=cache,target=/var/cache/apt \
${ISAACLAB_PATH}/isaaclab.sh --install-deps apt && \
apt -y autoremove && apt clean autoclean && \
rm -rf /var/lib/apt/lists/*
# for singularity usage, have to create the directories that will binded
RUN mkdir -p ${ISAACSIM_ROOT_PATH}/kit/cache && \
mkdir -p ${DOCKER_USER_HOME}/.cache/ov && \
......@@ -79,10 +75,11 @@ RUN touch /bin/nvidia-smi && \
# installing Isaac Lab dependencies
# use pip caching to avoid reinstalling large packages
RUN --mount=type=cache,target=${DOCKER_USER_HOME}/.cache/pip \
${ISAACLAB_PATH}/isaaclab.sh --install --extra
${ISAACLAB_PATH}/isaaclab.sh --install
# aliasing isaaclab.sh and python for convenience
RUN echo "alias isaaclab=${ISAACLAB_PATH}/isaaclab.sh" >> ${HOME}/.bashrc && \
RUN echo "export ISAACLAB_PATH=${ISAACLAB_PATH}" >> ${HOME}/.bashrc && \
echo "alias isaaclab=${ISAACLAB_PATH}/isaaclab.sh" >> ${HOME}/.bashrc && \
echo "alias python=${ISAACLAB_PATH}/_isaac_sim/python.sh" >> ${HOME}/.bashrc && \
echo "alias python3=${ISAACLAB_PATH}/_isaac_sim/python.sh" >> ${HOME}/.bashrc && \
echo "alias pip='${ISAACLAB_PATH}/_isaac_sim/python.sh -m pip'" >> ${HOME}/.bashrc && \
......
......@@ -22,9 +22,6 @@ RUN --mount=type=cache,target=/var/cache/apt \
ros-humble-rmw-fastrtps-cpp \
# This includes various dev tools including colcon
ros-dev-tools && \
# Install rosdeps for extensions that declare a ros_ws in
# their extension.toml
${ISAACLAB_PATH}/isaaclab.sh --install-deps rosdep && \
apt -y autoremove && apt clean autoclean && \
rm -rf /var/lib/apt/lists/* && \
# Add sourcing of setup.bash to .bashrc
......
......@@ -363,7 +363,7 @@ case $mode in
# make sure target directory exists
ssh $CLUSTER_LOGIN "mkdir -p $CLUSTER_ISAACLAB_DIR"
# Sync Isaac Lab code
echo "[INFO] Syncing ISaac Lab code..."
echo "[INFO] Syncing Isaac Lab code..."
rsync -rh --exclude="*.git*" --filter=':- .dockerignore' /$SCRIPT_DIR/.. $CLUSTER_LOGIN:$CLUSTER_ISAACLAB_DIR
# execute job script
echo "[INFO] Executing job script..."
......
......@@ -128,7 +128,7 @@ volumes:
isaac-carb-logs:
isaac-data:
isaac-docs:
# isaaclab
# isaac-lab
isaac-lab-docs:
isaac-lab-logs:
isaac-lab-data:
......@@ -51,6 +51,7 @@ extensions = [
"sphinxcontrib.bibtex",
"sphinx_copybutton",
"sphinx_design",
"sphinx_tabs.tabs",
]
# mathjax hacks
......@@ -159,8 +160,8 @@ autodoc_mock_imports = [
# List of zero or more Sphinx-specific warning categories to be squelched (i.e.,
# suppressed, ignored).
suppress_warnings = [
# FIXME: *THIS IS TERRIBLE.* Generally speaking, we do want Sphinx to inform
# us about cross-referencing failures. Remove this hack entirely after Sphinx
# Generally speaking, we do want Sphinx to inform
# us about cross-referencing failures. Remove this entirely after Sphinx
# resolves this open issue:
# https://github.com/sphinx-doc/sphinx/issues/4961
# Squelch mostly ignorable warnings resembling:
......@@ -224,7 +225,7 @@ html_theme_options = {
{
"name": "Isaac Sim",
"url": "https://developer.nvidia.com/isaac-sim",
"icon": "https://img.shields.io/badge/IsaacSim-2023.1.1-silver.svg",
"icon": "https://img.shields.io/badge/IsaacSim-4.0-silver.svg",
"type": "url",
},
{
......
Overview
========
.. figure:: source/_static/isaaclab.jpg
:width: 100%
:alt: H1 Humanoid example using Isaac Lab
**Isaac Lab** is a unified and modular framework for robot learning that aims to simplify common workflows
in robotics research (such as RL, learning from demonstrations, and motion planning). It is built upon
`NVIDIA Isaac Sim`_ to leverage the latest simulation capabilities for photo-realistic scenes, and fast
......@@ -11,6 +15,10 @@ and efficient simulation. The core objectives of the framework are:
- **Openness**: Remain open-sourced to allow the community to contribute and extend the framework.
- **Battery-included**: Include a number of environments, sensors, and tasks that are ready to use.
Key features available in Isaac Lab include fast and accurate physics simulation provided by PhysX,
tiled rendering APIs for vectorized rendering, domain randomization for improving robustness and adaptability,
and support for running in the cloud.
For more information about the framework, please refer to the `paper <https://arxiv.org/abs/2301.04195>`_
:cite:`mittal2023orbit`. For clarifications on NVIDIA Isaac ecosystem, please check out the
:doc:`/source/setup/faq` section.
......@@ -20,25 +28,6 @@ For more information about the framework, please refer to the `paper <https://ar
:alt: Example tasks created using Isaac Lab
Citing
======
If you use Isaac Lab in your research, please use the following BibTeX entry:
.. code:: bibtex
@article{mittal2023orbit,
author={Mittal, Mayank and Yu, Calvin and Yu, Qinxi and Liu, Jingzhou and Rudin, Nikita and Hoeller, David and Yuan, Jia Lin and Singh, Ritvik and Guo, Yunrong and Mazhar, Hammad and Mandlekar, Ajay and Babich, Buck and State, Gavriel and Hutter, Marco and Garg, Animesh},
journal={IEEE Robotics and Automation Letters},
title={Orbit: A Unified Simulation Framework for Interactive Robot Learning Environments},
year={2023},
volume={8},
number={6},
pages={3740-3747},
doi={10.1109/LRA.2023.3270034}
}
License
=======
......@@ -54,7 +43,7 @@ Table of Contents
:maxdepth: 2
:caption: Getting Started
source/setup/installation
source/setup/installation/index
source/setup/developer
source/setup/sample
source/setup/template
......@@ -64,6 +53,9 @@ Table of Contents
:maxdepth: 2
:caption: Features
source/features/workflows
source/features/multi_gpu
source/features/tiled_rendering
source/features/environments
source/features/actuators
.. source/features/motion_generators
......@@ -73,6 +65,7 @@ Table of Contents
:caption: Resources
:titlesonly:
source/migration/index
source/tutorials/index
source/how-to/index
source/deployment/index
......
Copyright (c) 2021, ETH Zurich, Nikita Rudin
Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
See licenses/assets for license information for assets included in this repository.
See licenses/dependencies for license information of dependencies of this package.
MIT License
Copyright (c) 2022 MIT Improbable AI Lab
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
See licenses/legged_gym and licenses/rsl_rl for additional license information for some files in this package.
Files associated with these additional licenses indicate so in the header.
......@@ -6,6 +6,7 @@ autodocsumm
sphinx-copybutton
sphinx_design
sphinxemoji
sphinx-tabs
# basic python
numpy
......
......@@ -17,7 +17,6 @@
id="svg8"
sodipodi:docname="actuator_groups.svg"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
inkscape:export-filename="/home/mayank/Documents/Reports/orbit_corl_2022/images/actuator_groups.png"
inkscape:export-xdpi="247.10857"
inkscape:export-ydpi="247.10857">
<defs
......
......@@ -4,7 +4,7 @@ API Reference
This page gives an overview of all the modules and classes in the Isaac Lab extensions.
omni.isaac.lab extension
--------------------------
------------------------
The following modules are available in the ``omni.isaac.lab`` extension:
......
......@@ -16,25 +16,23 @@ Environment variables
The following details the behavior of the class based on the environment variables:
* **Headless mode**: If the environment variable ``HEADLESS=1``, then SimulationApp will be started in headless mode.
If ``LIVESTREAM={1,2,3}``, then it will supersede the ``HEADLESS`` envvar and force headlessness.
If ``LIVESTREAM={1,2}``, then it will supersede the ``HEADLESS`` envvar and force headlessness.
* ``HEADLESS=1`` causes the app to run in headless mode.
* **Livestreaming**: If the environment variable ``LIVESTREAM={1,2,3}`` , then `livestream`_ is enabled. Any
* **Livestreaming**: If the environment variable ``LIVESTREAM={1,2}`` , then `livestream`_ is enabled. Any
of the livestream modes being true forces the app to run in headless mode.
* ``LIVESTREAM=1`` enables streaming via the Isaac `Native Livestream`_ extension. This allows users to
connect through the Omniverse Streaming Client.
* ``LIVESTREAM=2`` enables streaming via the `Websocket Livestream`_ extension. This allows users to
connect in a browser using the WebSocket protocol.
* ``LIVESTREAM=3`` enables streaming via the `WebRTC Livestream`_ extension. This allows users to
* ``LIVESTREAM=2`` enables streaming via the `WebRTC Livestream`_ extension. This allows users to
connect in a browser using the WebRTC protocol.
* **Offscreen Render**: If the environment variable ``OFFSCREEN_RENDER`` is set to 1, then the
offscreen-render pipeline is enabled. This is useful for running the simulator without a GUI but
still rendering the viewport and camera images.
* **Enable cameras**: If the environment variable ``ENABLE_CAMERAS`` is set to 1, then the
cameras are enabled. This is useful for running the simulator without a GUI but still rendering the
viewport and camera images.
* ``OFFSCREEN_RENDER=1``: Enables the offscreen-render pipeline which allows users to render
* ``ENABLE_CAMERAS=1``: Enables the offscreen-render pipeline which allows users to render
the scene without launching a GUI.
.. note::
......@@ -49,7 +47,7 @@ To set the environment variables, one can use the following command in the termi
.. code:: bash
export REMOTE_DEPLOYMENT=3
export OFFSCREEN_RENDER=1
export ENABLE_CAMERAS=1
# run the python script
./isaaclab.sh -p source/standalone/demo/play_quadrupeds.py
......@@ -57,7 +55,7 @@ Alternatively, one can set the environment variables to the python script direct
.. code:: bash
REMOTE_DEPLOYMENT=3 OFFSCREEN_RENDER=1 ./isaaclab.sh -p source/standalone/demo/play_quadrupeds.py
REMOTE_DEPLOYMENT=3 ENABLE_CAMERAS=1 ./isaaclab.sh -p source/standalone/demo/play_quadrupeds.py
Overriding the environment variables
......
......@@ -14,19 +14,21 @@
.. autosummary::
BaseEnv
BaseEnvCfg
ManagerBasedEnv
ManagerBasedEnvCfg
ViewerCfg
RLTaskEnv
RLTaskEnvCfg
ManagerBasedRLEnv
ManagerBasedRLEnvCfg
DirectRLEnv
DirectRLEnvCfg
Base Environment
----------------
Manager Based Environment
-------------------------
.. autoclass:: BaseEnv
.. autoclass:: ManagerBasedEnv
:members:
.. autoclass:: BaseEnvCfg
.. autoclass:: ManagerBasedEnvCfg
:members:
:exclude-members: __init__, class_type
......@@ -34,15 +36,29 @@ Base Environment
:members:
:exclude-members: __init__
RL Task Environment
-------------------
Manager Based RL Environment
----------------------------
.. autoclass:: RLTaskEnv
.. autoclass:: ManagerBasedRLEnv
:members:
:inherited-members:
:show-inheritance:
.. autoclass:: RLTaskEnvCfg
.. autoclass:: ManagerBasedRLEnvCfg
:members:
:inherited-members:
:show-inheritance:
:exclude-members: __init__, class_type
Direct RL Environment
---------------------
.. autoclass:: DirectRLEnv
:members:
:inherited-members:
:show-inheritance:
.. autoclass:: DirectRLEnvCfg
:members:
:inherited-members:
:show-inheritance:
......
......@@ -8,7 +8,7 @@
.. autosummary::
BaseEnvWindow
RLTaskEnvWindow
ManagerBasedRLEnvWindow
ViewportCameraController
Base Environment UI
......@@ -17,10 +17,10 @@ Base Environment UI
.. autoclass:: BaseEnvWindow
:members:
RL Task Environment UI
----------------------
Config Based RL Environment UI
------------------------------
.. autoclass:: RLTaskEnvWindow
.. autoclass:: ManagerBasedRLEnvWindow
:members:
:show-inheritance:
......
......@@ -29,6 +29,8 @@
RayCasterCfg
RayCasterCamera
RayCasterCameraCfg
TiledCamera
TiledCameraCfg
Sensor Base
-----------
......@@ -135,3 +137,17 @@ Ray-Cast Camera
:inherited-members:
:show-inheritance:
:exclude-members: __init__, class_type
Tiled Rendering
---------------
.. autoclass:: TiledCamera
:members:
:inherited-members:
:show-inheritance:
.. autoclass:: TiledCameraCfg
:members:
:inherited-members:
:show-inheritance:
:exclude-members: __init__, class_type
......@@ -159,7 +159,7 @@ ANYmal rough terrain locomotion training can be executed with the following comm
.. code:: bash
./docker/container.sh job --task Isaac-Velocity-Rough-Anymal-C-v0 --headless --video --offscreen_render
./docker/container.sh job --task Isaac-Velocity-Rough-Anymal-C-v0 --headless --video --enable_cameras
The above will, in addition, also render videos of the training progress and store them under ``isaaclab/logs`` directory.
......
......@@ -31,6 +31,11 @@ We recommend using these versions or newer.
* To build and run GPU-accelerated containers, you also need install the `NVIDIA Container Toolkit`_.
Please follow the instructions on the `Container Toolkit website`_ for installation steps.
.. note::
Due to limitations with `snap <https://snapcraft.io/docs/home-outside-home>`_, please make sure
the Isaac Lab directory is placed under the ``/home`` directory tree when using docker.
Obtaining the Isaac Sim Container
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......@@ -253,12 +258,12 @@ versions installed on your machine. To fix this, you can try the following:
* Install the latest version of docker based on the instructions in the setup section.
WebRTC and WebSocket Streaming
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WebRTC Streaming
~~~~~~~~~~~~~~~~
When streaming the GUI from Isaac Sim, there are `several streaming clients`_ available. There is a `known issue`_ when
attempting to use WebRTC streaming client on Google Chrome and Safari while running Isaac Sim inside a container.
To avoid this problem, we suggest using either the Native Streaming Client or WebSocket options, or using the
To avoid this problem, we suggest using the Native Streaming Client or using the
Mozilla Firefox browser on which WebRTC works.
Streaming is the only supported method for visualizing the Isaac GUI from within the container. The Omniverse Streaming Client
......
This diff is collapsed.
Multi-GPU and Multi-Node Training
=================================
.. currentmodule:: omni.isaac.lab
Isaac Lab supports multi-GPU and multi-node reinforcement learning on Linux.
Multi-GPU Training
------------------
For complex reinforcement learning environments, it may be desirable to scale up training across multiple GPUs.
This is possible in Isaac Lab with the ``rl_games`` RL library through the use of the
`PyTorch distributed <https://pytorch.org/docs/stable/distributed.html>`_ framework.
In this workflow, ``torch.distributed`` is used to launch multiple processes of training, where the number of
processes must be equal to or less than the number of GPUs available. Each process runs on
a dedicated GPU and launches its own instance of Isaac Sim and the Isaac Lab environment.
Each process collects its own rollouts during the training process and has its own copy of the policy
network. During training, gradients are aggregated across the processes and broadcasted back to the process
at the end of the epoch.
.. image:: ../_static/multigpu.png
:align: center
:alt: Multi-GPU training paradigm
To train with multiple GPUs, use the following command, where ``--proc_per_node`` represents the number of available GPUs:
.. code-block:: shell
python -m torch.distributed.run --nnodes=1 --nproc_per_node=2 source/standalone/workflows/rl_games/train.py --task=Isaac-Cartpole-v0 --headless --distributed
Due to limitations of NCCL on Windows, this feature is currently supported on Linux only.
Multi-Node Training
-------------------
To scale up training beyond multiple GPUs on a single machine, it is also possible to train across multiple nodes.
To train across multiple nodes/machines, it is required to launch an individual process on each node.
For the master node, use the following command, where ``--proc_per_node`` represents the number of available GPUs, and ``--nnodes`` represents the number of nodes:
.. code-block:: shell
python -m torch.distributed.run --nproc_per_node=2 --nnodes=2 --node_rank=0 --rdzv_id=123 --rdzv_backend=c10d --rdzv_endpoint=localhost:5555 source/standalone/workflows/rl_games/train.py --task=Isaac-Cartpole-v0 --headless --distributed
Note that the port (``5555``) can be replaced with any other available port.
For non-master nodes, use the following command, replacing ``--node_rank`` with the index of each machine:
.. code-block:: shell
python -m torch.distributed.run --nproc_per_node=2 --nnodes=2 --node_rank=1 --rdzv_id=123 --rdzv_backend=c10d --rdzv_endpoint=ip_of_master_machine:5555 source/standalone/workflows/rl_games/train.py --task=Isaac-Cartpole-v0 --headless --distributed
For more details on multi-node training with PyTorch, please visit the `PyTorch documentation <https://pytorch.org/tutorials/intermediate/ddp_series_multinode.html>`_. As mentioned in the PyTorch documentation, "multinode training is bottlenecked by inter-node communication latencies". When this latency is high, it is possible multi-node training will perform worse than running on a single node instance.
Due to limitations of NCCL on Windows, this feature is currently supported on Linux only.
Tiled Rendering and Recording
=============================
.. currentmodule:: omni.isaac.lab
Tiled Rendering
---------------
.. note::
This feature is only available from Isaac Sim version 4.0.0.
Tiled rendering APIs provide a vectorized interface for collecting data from camera sensors.
This is useful for reinforcement learning environments requiring vision in the loop.
Tiled rendering works by concatenating camera outputs from multiple cameras and rendering
one single large image instead of multiple smaller images that would have been produced
by each individual camera. This reduces the amount of time required for rendering and
provides a more efficient API for working with vision data.
Isaac Lab provides tiled rendering APIs for RGB and depth data through the :class:`~sensors.TiledCamera`
class. Configurations for the tiled rendering APIs can be defined through the :class:`~sensors.TiledCameraCfg`
class, specifying parameters such as the regex expression for all camera paths, the transform
for the cameras, the desired data type, the type of cameras to add to the scene, and the camera
resolution.
.. code-block:: python
tiled_camera: TiledCameraCfg = TiledCameraCfg(
prim_path="/World/envs/env_.*/Camera",
offset=TiledCameraCfg.OffsetCfg(pos=(-7.0, 0.0, 3.0), rot=(0.9945, 0.0, 0.1045, 0.0), convention="world"),
data_types=["rgb"],
spawn=sim_utils.PinholeCameraCfg(
focal_length=24.0, focus_distance=400.0, horizontal_aperture=20.955, clipping_range=(0.1, 20.0)
),
width=80,
height=80,
)
To access the tiled rendering interface, a :class:`~sensors.TiledCamera` object can be created and used
to retrieve data from the cameras.
.. code-block:: python
tiled_camera = TiledCamera(cfg.tiled_camera)
data_type = "rgb"
data = tiled_camera.data.output[data_type]
The returned data will be transformed into the shape (num_cameras, height, width, num_channels), which
can be used directly as observation for reinforcement learning.
When working with rendering, make sure to add the ``--enable_cameras`` argument when launching the
environment. For example:
.. code-block:: shell
python source/standalone/workflows/rl_games/train.py --task=Isaac-Cartpole-RGB-Camera-Direct-v0 --headless --enable_cameras
Recording during training
-------------------------
Isaac Lab supports recording video clips during training using the `gymnasium.wrappers.RecordVideo <https://gymnasium.farama.org/main/_modules/gymnasium/wrappers/record_video/>`_ class.
This feature can be enabled by using the following command line arguments with the training script:
* ``--video`` - enables video recording during training
* ``--video_length`` - length of each recorded video (in steps)
* ``--video_interval`` - interval between each video recording (in steps)
Make sure to also add the ``--enable_cameras`` argument when running headless.
Note that enabling recording is equivalent to enabling rendering during training, which will slow down both startup and runtime performance.
Example usage:
.. code-block:: shell
python source/standalone/workflows/rl_games/train.py --task=Isaac-Cartpole-v0 --headless --enable_cameras --video --video_length 100 --video_interval 500
Recorded videos will be saved in the same directory as the training checkpoints, under ``IsaacLab/logs/<rl_workflow>/<task>/<run>/videos``.
This diff is collapsed.
Adding your own learning library
================================
Isaac Lab comes pre-integrated with a number of libraries (such as RSL-RL , RL-Games, Stable Baselines, etc.).
Isaac Lab comes pre-integrated with a number of libraries (such as RSL-RL, RL-Games, SKRL, Stable Baselines, etc.).
However, you may want to integrate your own library with Isaac Lab or use a different version of the libraries than
the one installed by Isaac Lab. This is possible as long as the library is available as Python package that supports
the Python version used by the underlying simulator. For instance, if you are using Isaac Sim 2023.1.1, you need
......
......@@ -92,7 +92,7 @@ To run the accompanying script, execute the following command:
./isaaclab.sh -p source/standalone/tutorials/04_sensors/run_usd_camera.py --save --draw
# Usage with saving only in headless mode
./isaaclab.sh -p source/standalone/tutorials/04_sensors/run_usd_camera.py --save --headless --offscreen_render
./isaaclab.sh -p source/standalone/tutorials/04_sensors/run_usd_camera.py --save --headless --enable_cameras
The simulation should start, and you can observe different objects falling down. An output folder will be created
......
......@@ -10,7 +10,7 @@ Environment wrappers are a way to modify the behavior of an environment without
This can be used to apply functions to modify observations or rewards, record videos, enforce time limits, etc.
A detailed description of the API is available in the :class:`gymnasium.Wrapper` class.
At present, all RL environments inheriting from the :class:`~envs.RLTaskEnv` class
At present, all RL environments inheriting from the :class:`~envs.ManagerBasedRLEnv` class
are compatible with :class:`gymnasium.Wrapper`, since the base class implements the :class:`gymnasium.Env` interface.
In order to wrap an environment, you need to first initialize the base environment. After that, you can
wrap it with as many wrappers as you want by calling ``env = wrapper(env, *args, **kwargs)`` repeatedly.
......@@ -97,7 +97,7 @@ for 200 steps, and saves it in the ``videos`` folder at a step interval of 1500
from omni.isaac.lab.app import AppLauncher
# launch omniverse app in headless mode with off-screen rendering
app_launcher = AppLauncher(headless=True, offscreen_render=True)
app_launcher = AppLauncher(headless=True, enable_cameras=True)
simulation_app = app_launcher.app
"""Rest everything follows."""
......@@ -125,9 +125,9 @@ Wrapper for learning frameworks
Every learning framework has its own API for interacting with environments. For example, the
`Stable-Baselines3`_ library uses the `gym.Env <https://gymnasium.farama.org/api/env/>`_
interface to interact with environments. However, libraries like `RL-Games`_ or `RSL-RL`_
interface to interact with environments. However, libraries like `RL-Games`_, `RSL-RL`_ or `SKRL`_
use their own API for interfacing with a learning environments. Since there is no one-size-fits-all
solution, we do not base the :class:`~envs.RLTaskEnv` class on any particular learning framework's
solution, we do not base the :class:`~envs.ManagerBasedRLEnv` class on any particular learning framework's
environment definition. Instead, we implement wrappers to make it compatible with the learning
framework's environment definition.
......@@ -154,12 +154,13 @@ Adding new wrappers
-------------------
All new wrappers should be added to the :mod:`omni.isaac.lab_tasks.utils.wrappers` module.
They should check that the underlying environment is an instance of :class:`omni.isaac.lab.envs.RLTaskEnv`
They should check that the underlying environment is an instance of :class:`omni.isaac.lab.envs.ManagerBasedRLEnv`
before applying the wrapper. This can be done by using the :func:`unwrapped` property.
We include a set of wrappers in this module that can be used as a reference to implement your own wrappers.
If you implement a new wrapper, please consider contributing it to the framework by opening a pull request.
.. _Stable-Baselines3: https://stable-baselines3.readthedocs.io/en/master/
.. _SKRL: https://skrl.readthedocs.io
.. _RL-Games: https://github.com/Denys88/rl_games
.. _RSL-RL: https://github.com/leggedrobotics/rsl_rl
Migration Guides
================
The following guides show the migration process from previous frameworks that are now deprecated,
including IsaacGymEnvs, OmniIsaacGymEnvs, and Orbit.
.. toctree::
:maxdepth: 1
:titlesonly:
migrating_from_isaacgymenvs
migrating_from_omniisaacgymenvs
migrating_from_orbit
This diff is collapsed.
This diff is collapsed.
.. _migrating-from-orbit:
Migrating from Orbit
====================
.. currentmodule:: omni.isaac.lab
Since Orbit was used as basis for Isaac Lab, migrating from Orbit to Isaac Lab is straightforward.
The following sections describe the changes that need to be made to your code to migrate from Orbit to Isaac Lab.
Updates to scripts
~~~~~~~~~~~~~~~~~~
The script ``orbit.sh`` has been renamed to ``isaaclab.sh``.
Updates to extensions
~~~~~~~~~~~~~~~~~~~~~
The extensions ``omni.isaac.orbit``, ``omni.isaac.orbit_tasks``, and ``omni.isaac.orbit_assets`` have been renamed
to ``omni.isaac.lab``, ``omni.isaac.lab_tasks``, and ``omni.isaac.lab_assets``, respectively. Thus, the new folder structure looks like this:
- ``source/extensions/omni.isaac.lab/omni/isaac/lab``
- ``source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks``
- ``source/extensions/omni.isaac.lab_assets/omni/isaac/lab_assets``
The high level imports have to be updated as well:
+-------------------------------------+-----------------------------------+
| Orbit | Isaac Lab |
+=====================================+===================================+
| ``from omni.isaac.orbit...`` | ``from omni.isaac.lab...`` |
+-------------------------------------+-----------------------------------+
| ``from omni.isaac.orbit_tasks...`` | ``from omni.isaac.lab_tasks...`` |
+-------------------------------------+-----------------------------------+
| ``from omni.isaac.orbit_assets...`` | ``from omni.isaac.lab_assets...`` |
+-------------------------------------+-----------------------------------+
Updates to class names
~~~~~~~~~~~~~~~~~~~~~~
In Isaac Lab, we introduced the concept of task design workflows (see :ref:`feature-workflows`). The Orbit code is using
the manager-based workflow and the environment specific class names have been updated to reflect this change:
+------------------------+---------------------------------------------------------+
| Orbit | Isaac Lab |
+========================+=========================================================+
| ``BaseEnv`` | :class:`omni.isaac.lab.envs.ManagerBasedEnv` |
+------------------------+---------------------------------------------------------+
| ``BaseEnvCfg`` | :class:`omni.isaac.lab.envs.ManagerBasedEnvCfg` |
+------------------------+---------------------------------------------------------+
| ``RLTaskEnv`` | :class:`omni.isaac.lab.envs.ManagerBasedRLEnv` |
+------------------------+---------------------------------------------------------+
| ``RLTaskEnvCfg`` | :class:`omni.isaac.lab.envs.ManagerBasedRLEnvCfg` |
+------------------------+---------------------------------------------------------+
| ``RLTaskEnvWindow`` | :class:`omni.isaac.lab.envs.ui.ManagerBasedRLEnvWindow` |
+------------------------+---------------------------------------------------------+
Updates to the tasks folder structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To support the manager-based and direct workflows, we have added two folders in the tasks extension:
- ``source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based``
- ``source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct``
The tasks from Orbit can now be found under the ``manager_based`` folder.
This change must also be reflected in the imports for your tasks. For example,
.. code-block:: python
from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg ...
should now be
.. code-block:: python
from omni.isaac.lab_tasks.manager_based.locomotion.velocity.velocity_env_cfg ...
Other Breaking changes
~~~~~~~~~~~~~~~~~~~~~~
Offscreen rendering
-------------------
The input argument ``--offscreen_render`` given to :class:`omni.isaac.lab.app.AppLauncher` and the environment variable ``OFFSCREEN_RENDER``
have been renamed to ``--enable_cameras`` and ``ENABLE_CAMERAS`` respectively.
Event term distribution configuration
-------------------------------------
Some of the event functions in `events.py <https://github.com/isaac-sim/IsaacLab/blob/isaac-lab/source/extensions/omni.isaac.lab/omni/isaac/lab/envs/mdp/events.py>`_
accepted a ``distribution`` parameter and a ``range`` to sample from. In an effort to support arbitrary distributions,
we have renamed the input argument ``AAA_range`` to ``AAA_distribution_params`` for these functions.
Therefore, event term configurations whose functions have a ``distribution`` argument should be updated. For example,
.. code-block:: python
:emphasize-lines: 6
add_base_mass = EventTerm(
func=mdp.randomize_rigid_body_mass,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names="base"),
"mass_range": (-5.0, 5.0),
"operation": "add",
},
)
should now be
.. code-block:: python
:emphasize-lines: 6
add_base_mass = EventTerm(
func=mdp.randomize_rigid_body_mass,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names="base"),
"mass_distribution_params": (-5.0, 5.0),
"operation": "add",
},
)
......@@ -54,6 +54,16 @@ environment stepping commences.
For more information, please refer to the `PhysX Determinism documentation`_.
In addition, due to floating point precision, states across different environments in the simulation
may be non-deterministic when the same set of actions are applied to the same initial
states. This occurs as environments are placed further apart from the world origin at (0, 0, 0).
As actors get placed at different origins in the world, floating point errors may build up
and result in slight variance in results even when starting from the same initial states. One
possible workaround for this issue is to place all actors/environments at the world origin
at (0, 0, 0) and filter out collisions between the environments. Note that this may induce
a performance degradation of around 15-50%, depending on the complexity of actors and
environment.
Blank initial frames from the camera
------------------------------------
......@@ -90,3 +100,18 @@ are stored in the instanceable asset's USD file and not in its stage reference's
.. _instanceable assets: https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/tutorial_gym_instanceable_assets.html
.. _Omniverse Isaac Sim documentation: https://docs.omniverse.nvidia.com/isaacsim/latest/known_issues.html
.. _PhysX Determinism documentation: https://nvidia-omniverse.github.io/PhysX/physx/5.3.1/docs/BestPractices.html#determinism
Exiting the process
-------------------
When exiting a process with ``Ctrl+C``, occasionally the below error may appear:
.. code-block:: bash
[Error] [omni.physx.plugin] Subscribtion cannot be changed during the event call.
This is due to the termination occurring in the middle of a physics event call and
should not affect the functionality of Isaac Lab. It is safe to ignore the error
message and continue with terminating the process. On Windows systems, please use
``Ctrl+Break`` or ``Ctrl+fn+B`` to terminate the process.
......@@ -30,7 +30,7 @@ and include the following files:
To setup the IDE, please follow these instructions:
1. Open the ``IsaacLab`` directory on Visual Studio Code IDE
1. Open the ``Isaac Lab`` directory on Visual Studio Code IDE
2. Run VSCode `Tasks <https://code.visualstudio.com/docs/editor/tasks>`__, by
pressing ``Ctrl+Shift+P``, selecting ``Tasks: Run Task`` and running the
``setup_python_env`` in the drop down menu.
......
......@@ -28,6 +28,8 @@ Isaac Sim.
that aims to unite complex 3D workflows. Isaac Sim leverages the latest advances in graphics and
physics simulation to provide a high-fidelity simulation environment for robotics. It supports
ROS/ROS2, various sensor simulation, tools for domain randomization and synthetic data creation.
Tiled rendering support in Isaac Sim allows for vectorized rendering across environments, along with
support for running in the cloud using `Isaac Automator`_.
Overall, it is a powerful tool for roboticists and is a huge step forward in the field of robotics
simulation.
......@@ -38,7 +40,7 @@ a starting point to understand what is possible with the simulators for robot le
can be used for benchmarking but are not designed for developing and testing custom environments and algorithms.
This is where Isaac Lab comes in.
Isaac Lab :cite:`mittal2023orbit` is built on top of Isaac Sim to provide a unified and flexible framework
Isaac Lab is built on top of Isaac Sim to provide a unified and flexible framework
for robot learning that exploits latest simulation technologies. It is designed to be modular and extensible,
and aims to simplify common workflows in robotics research (such as RL, learning from demonstrations, and
motion planning). While it includes some pre-built environments, sensors, and tasks, its main goal is to
......@@ -47,6 +49,10 @@ and robot learning algorithms. It not only inherits the capabilities of Isaac Si
of new features that pertain to robot learning research. For example, including actuator dynamics in the
simulation, procedural terrain generation, and support to collect data from human demonstrations.
Isaac Lab replaces the previous `IsaacGymEnvs`_, `OmniIsaacGymEnvs`_ and `Orbit`_ frameworks and will
be the single robot learning framework for Isaac Sim. Previously released frameworks are deprecated
and we encourage users to follow our `migration guides`_ to transition over to Isaac Lab.
Why should I use Isaac Lab?
---------------------------
......@@ -76,3 +82,6 @@ to Isaac Lab, please reach out to us.
.. _Isaac Gym: https://developer.nvidia.com/isaac-gym
.. _IsaacGymEnvs: https://github.com/NVIDIA-Omniverse/IsaacGymEnvs
.. _OmniIsaacGymEnvs: https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs
.. _Orbit: https://isaac-orbit.github.io/orbit
.. _Isaac Automator: https://github.com/isaac-sim/IsaacAutomator
.. _migration guides: ../migration/index.html
This diff is collapsed.
Installation using Isaac Sim Binaries
=====================================
Installing Isaac Sim
--------------------
Downloading pre-built binaries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please follow the Isaac Sim
`documentation <https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_workstation.html>`__
to install the latest Isaac Sim release.
To check the minimum system requirements,refer to the documentation
`here <https://docs.omniverse.nvidia.com/isaacsim/latest/installation/requirements.html>`__.
.. note::
We have tested Isaac Lab with Isaac Sim 4.0 release on Ubuntu
20.04LTS with NVIDIA driver 525.147.
.. tabs::
.. tab:: Linux
On Linux systems, by default, Isaac Sim is installed in the directory
``${HOME}/.local/share/ov/pkg/isaac_sim-*``, with ``*`` corresponding to the Isaac Sim version.
.. tab:: Windows
On Windows systems, by default,Isaac Sim is installed in the directory
``C:\Users\user\AppData\Local\ov\pkg\isaac_sim-*``, with ``*`` corresponding to the Isaac Sim version.
Installing Isaac Lab
--------------------
Cloning Isaac Lab
~~~~~~~~~~~~~~~~~
.. note::
We recommend making a `fork <https://github.com/isaac-sim/IsaacLab/fork>`_ of the Isaac Lab repository to contribute
to the project but this is not mandatory to use the framework. If you
make a fork, please replace ``isaac-sim`` with your username
in the following instructions.
Clone the Isaac Lab repository into your workspace:
.. code:: bash
# Option 1: With SSH
git clone git@github.com:isaac-sim/IsaacLab.git
# Option 2: With HTTPS
git clone https://github.com/isaac-sim/IsaacLab.git
.. note::
We provide a helper executable `isaaclab.sh <https://github.com/isaac-sim/IsaacLab/blob/main/isaaclab.sh>`_ that provides
utilities to manage extensions:
.. tabs::
.. tab:: Linux
.. code:: text
./isaaclab.sh --help
usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
optional arguments:
-h, --help Display the help content.
-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks (rl-games, rsl-rl, sb3, skrl) as extra dependencies. Default is 'all'.
-f, --format Run pre-commit to format the code and check lints.
-p, --python Run the python executable provided by Isaac Sim or virtual environment (if active).
-s, --sim Run the simulator executable (isaac-sim.sh) provided by Isaac Sim.
-t, --test Run all python unittest tests.
-o, --docker Run the docker container helper script (docker/container.sh).
-v, --vscode Generate the VSCode settings file from template.
-d, --docs Build the documentation from source using sphinx.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'isaaclab'.
.. tab:: Windows
.. code:: text
isaaclab.bat --help
usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
optional arguments:
-h, --help Display the help content.
-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks (rl-games, rsl-rl, sb3, skrl) as extra dependencies. Default is 'all'.
-f, --format Run pre-commit to format the code and check lints.
-p, --python Run the python executable provided by Isaac Sim or virtual environment (if active).
-s, --sim Run the simulator executable (isaac-sim.bat) provided by Isaac Sim.
-t, --test Run all python unittest tests.
-v, --vscode Generate the VSCode settings file from template.
-d, --docs Build the documentation from source using sphinx.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'isaaclab'.
Creating the Isaac Sim Symbolic Link
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set up a symbolic link between the installed Isaac Sim root folder
and ``_isaac_sim`` in the Isaac Lab directory. This makes it convenient
to index the python modules and look for extensions shipped with Isaac Sim.
.. tabs::
.. tab:: Linux
.. code:: bash
# enter the cloned repository
cd IsaacLab
# create a symbolic link
ln -s path_to_isaac_sim _isaac_sim
# For example: ln -s /home/nvidia/.local/share/ov/pkg/isaac-sim-4.0.0 _isaac_sim
.. tab:: Windows
.. code:: batch
:: enter the cloned repository
cd IsaacLab
:: create a symbolic link - requires launching Command Prompt with Administrator access
mklink /D _isaac_sim path_to_isaac_sim
# For example: mklink /D _isaac_sim C:/Users/nvidia/AppData/Local/ov/pkg/isaac-sim-4.0.0
Setting up the conda environment (optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. attention::
This step is optional. If you are using the bundled python with Isaac Sim, you can skip this step.
The executable ``isaaclab.sh`` automatically fetches the python bundled with Isaac
Sim, using ``./isaaclab.sh -p`` command (unless inside a virtual environment). This executable
behaves like a python executable, and can be used to run any python script or
module with the simulator. For more information, please refer to the
`documentation <https://docs.omniverse.nvidia.com/isaacsim/latest/manual_standalone_python.html#isaac-sim-python-environment>`__.
Although using a virtual environment is optional, we recommend using ``conda``. To install
``conda``, please follow the instructions `here <https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html>`__.
In case you want to use ``conda`` to create a virtual environment, you can
use the following command:
.. tabs::
.. tab:: Linux
.. code:: bash
# Option 1: Default name for conda environment is 'isaaclab'
./isaaclab.sh --conda # or "./isaaclab.sh -c"
# Option 2: Custom name for conda environment
./isaaclab.sh --conda my_env # or "./isaaclab.sh -c my_env"
.. tab:: Windows
.. code:: batch
:: Option 1: Default name for conda environment is 'isaaclab'
isaaclab.bat --conda :: or "isaaclab.bat -c"
:: Option 2: Custom name for conda environment
isaaclab.bat --conda my_env :: or "isaaclab.bat -c my_env"
If you are using ``conda`` to create a virtual environment, make sure to
activate the environment before running any scripts. For example:
.. code:: bash
conda activate isaaclab # or "conda activate my_env"
Once you are in the virtual environment, you do not need to use ``./isaaclab.sh -p`` / ``isaaclab.bat -p``
to run python scripts. You can use the default python executable in your environment
by running ``python`` or ``python3``. However, for the rest of the documentation,
we will assume that you are using ``./isaaclab.sh -p`` / ``isaaclab.bat -p`` to run python scripts. This command
is equivalent to running ``python`` or ``python3`` in your virtual environment.
Installation
~~~~~~~~~~~~
- Install dependencies using ``apt`` (on Ubuntu):
.. code:: bash
sudo apt install cmake build-essential
- Run the install command that iterates over all the extensions in ``source/extensions`` directory and installs them
using pip (with ``--editable`` flag):
.. tabs::
.. tab:: Linux
.. code:: bash
./isaaclab.sh --install # or "./isaaclab.sh -i"
.. tab:: Windows
.. code:: bash
isaaclab.bat --install :: or "isaaclab.bat -i"
.. note::
By default, this will install all the learning frameworks. If you want to install only a specific framework, you can
pass the name of the framework as an argument. For example, to install only the ``rl_games`` framework, you can run
.. tabs::
.. tab:: Linux
.. code:: bash
./isaaclab.sh --install rl_games
.. tab:: Windows
.. code:: bash
isaaclab.bat --install rl_games :: or "isaaclab.bat -i"
The valid options are ``rl_games``, ``rsl_rl``, ``sb3``, ``skrl``, ``robomimic``, ``none``.
Running Isaac Lab in the Cloud
==============================
Isaac Lab can be run in various cloud infrastructures with the use of `Isaac Automator <https://github.com/isaac-sim/IsaacAutomator>`__.
Isaac Automator allows for quick deployment of Isaac Sim and Isaac Lab onto the public clouds (AWS, GCP, Azure, and Alibaba Cloud are currently supported).
The result is a fully configured remote desktop cloud workstation, which can be used for development and testing of Isaac Lab within minutes and on a budget. Isaac Automator supports variety of GPU instances and stop-start functionality to save on cloud costs and a variety of tools to aid the workflow (like uploading and downloading data, autorun, deployment management, etc).
Installing Isaac Automator
--------------------------
To use Isaac Automator, first clone the repo:
.. code-block:: bash
git clone https://github.com/isaac-sim/IsaacAutomator.git
Isaac Automator requires having ``docker`` pre-installed on the system.
* To install Docker, please follow the instructions for your operating system on the `Docker website`_.
* Follow the post-installation steps for Docker on the `post-installation steps`_ page. These steps allow you to run
Docker without using ``sudo``.
Isaac Automator also requires obtaining a NGC API key.
* Get access to the `Isaac Sim container`_ by joining the NVIDIA Developer Program credentials.
* Generate your `NGC API key`_ to access locked container images from NVIDIA GPU Cloud (NGC).
* This step requires you to create an NGC account if you do not already have one.
* Once you have your generated API key, you need to log in to NGC
from the terminal.
.. code:: bash
docker login nvcr.io
* For the username, enter ``$oauthtoken`` exactly as shown. It is a special username that is used to
authenticate with NGC.
.. code:: text
Username: $oauthtoken
Password: <Your NGC API Key>
Running Isaac Automator
-----------------------
To run Isaac Automator, first build the Isaac Automator container:
.. code-block:: bash
./build
Next, run the deployed script for your preferred cloud:
.. code-block:: bash
# AWS
./deploy-aws
# Azure
./deploy-azure
# GCP
./deploy-gcp
# Alibaba Cloud
./deploy-alicloud
Follow the prompts for entering information regarding the environment setup and credentials.
Once successful, instructions for connecting to the cloud instance will be available in the terminal.
Connections can be made using SSH, noVCN, or NoMachine.
For details on the credentials and setup required for each cloud, please visit the
`Isaac Automator <https://github.com/isaac-sim/IsaacAutomator?tab=readme-ov-file#deploying-isaac-sim>`__
page for more instructions.
Running Isaac Lab on the Cloud
------------------------------
Once connected to the cloud instance, the desktop will have an icon showing ``isaaclab.sh``.
Launch the ``isaaclab.sh`` executable, which will open a new Terminal. Within the terminal,
Isaac Lab commands can be executed in the same way as running locally.
For example:
.. code-block:: bash
./isaaclab.sh -p source/standalone/workflows/rl_games/train.py --task=Isaac-Cartpole-v0
Destroying a Development
-------------------------
To save costs, deployments can be destroyed when not being used.
This can be done from within the Automator container, which can be entered with command ``./run``.
To destroy a deployment, run:
.. code:: bash
./destroy <deployment-name>
.. _`Docker website`: https://docs.docker.com/desktop/install/linux-install/
.. _`post-installation steps`: https://docs.docker.com/engine/install/linux-postinstall/
.. _`Isaac Sim container`: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/isaac-sim
.. _`NGC API key`: https://docs.nvidia.com/ngc/gpu-cloud/ngc-user-guide/index.html#generating-api-key
Installation Guide
===================
.. image:: https://img.shields.io/badge/IsaacSim-4.0-silver.svg
:target: https://developer.nvidia.com/isaac-sim
:alt: IsaacSim 4.0
.. image:: https://img.shields.io/badge/python-3.10-blue.svg
:target: https://www.python.org/downloads/release/python-31013/
:alt: Python 3.10
.. image:: https://img.shields.io/badge/platform-linux--64-orange.svg
:target: https://releases.ubuntu.com/20.04/
:alt: Ubuntu 20.04
.. image:: https://img.shields.io/badge/platform-windows--64-orange.svg
:target: https://www.microsoft.com/en-ca/windows/windows-11
:alt: Windows 11
.. caution::
We have dropped support for Isaac Sim versions 2023.1.0 and below. We recommend using the latest
Isaac Sim 4.0 release to benefit from the latest features and improvements.
For more information, please refer to the
`Isaac Sim release notes <https://docs.omniverse.nvidia.com/isaacsim/latest/release_notes.html>`__.
.. note::
We recommend system requirements with at least 32GB RAM and 16GB VRAM for Isaac Lab.
For the full list of system requirements for Isaac Sim, please refer to the
`Isaac Sim system requirements <https://docs.omniverse.nvidia.com/isaacsim/latest/installation/requirements.html#system-requirements>`_.
As an experimental feature in Isaac Sim 4.0 release, Isaac Sim can also be installed through pip.
This simplifies the installation
process by avoiding the need to download the Omniverse Launcher and installing Isaac Sim through
the launcher. Therefore, there are two ways to install Isaac Lab:
.. toctree::
:maxdepth: 2
Installation using Isaac Sim pip (experimental) <pip_installation>
binaries_installation
verifying_installation
cloud_installation
Installation using Isaac Sim pip
================================
Installing Isaac Sim
--------------------
.. note::
Installing Isaac Sim from pip is currently an experimental feature.
If errors occur, please report them to the
`Isaac Sim Forums <https://docs.omniverse.nvidia.com/isaacsim/latest/common/feedback.html>`_
and install Isaac Sim from pre-built binaries.
- To use the pip installation approach for Isaac Sim, we recommend first creating a virtual environment.
Ensure that the python version of the virtual environment is **Python 3.10**.
.. tabs::
.. tab:: Conda
.. code-block:: bash
conda create -n isaaclab python=3.10
conda activate isaaclab
.. tab:: Virtual environment (venv)
.. code-block:: bash
python3.10 -m venv isaaclab
# on Linux
source isaaclab/bin/activate
# on Windows
isaaclab\Scripts\activate
- Next, install a CUDA-enabled PyTorch 2.2.2 build based on the CUDA version available on your system.
.. tabs::
.. tab:: CUDA 11
.. code-block:: bash
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cu118
.. tab:: CUDA 12
.. code-block:: bash
pip install torch==2.2.2 --index-url https://download.pytorch.org/whl/cu121
- Then, install the Isaac Sim packages necessary for running Isaac Lab:
.. code-block:: bash
pip install isaacsim-rl isaacsim-replicator --index-url https://pypi.nvidia.com/
Installing Isaac Lab
--------------------
Cloning Isaac Lab
~~~~~~~~~~~~~~~~~
.. note::
We recommend making a `fork <https://github.com/isaac-sim/IsaacLab/fork>`_ of the Isaac Lab repository to contribute
to the project but this is not mandatory to use the framework. If you
make a fork, please replace ``isaac-sim`` with your username
in the following instructions.
Clone the Isaac Lab repository into your workspace:
.. code:: bash
# Option 1: With SSH
git clone git@github.com:isaac-sim/IsaacLab.git
# Option 2: With HTTPS
git clone https://github.com/isaac-sim/IsaacLab.git
.. note::
We provide a helper executable `isaaclab.sh <https://github.com/isaac-sim/IsaacLab/blob/main/isaaclab.sh>`_ that provides
utilities to manage extensions:
.. tabs::
.. tab:: Linux
.. code:: text
./isaaclab.sh --help
usage: isaaclab.sh [-h] [-i] [-f] [-p] [-s] [-t] [-o] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
optional arguments:
-h, --help Display the help content.
-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks (rl_games, rsl_rl, sb3, skrl) as extra dependencies. Default is 'all'.
-f, --format Run pre-commit to format the code and check lints.
-p, --python Run the python executable provided by Isaac Sim or virtual environment (if active).
-s, --sim Run the simulator executable (isaac-sim.sh) provided by Isaac Sim.
-t, --test Run all python unittest tests.
-o, --docker Run the docker container helper script (docker/container.sh).
-v, --vscode Generate the VSCode settings file from template.
-d, --docs Build the documentation from source using sphinx.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'isaaclab'.
.. tab:: Windows
.. code:: text
isaaclab.bat --help
usage: isaaclab.bat [-h] [-i] [-f] [-p] [-s] [-v] [-d] [-c] -- Utility to manage Isaac Lab.
optional arguments:
-h, --help Display the help content.
-i, --install [LIB] Install the extensions inside Isaac Lab and learning frameworks (rl_games, rsl_rl, sb3, skrl) as extra dependencies. Default is 'all'.
-f, --format Run pre-commit to format the code and check lints.
-p, --python Run the python executable provided by Isaac Sim or virtual environment (if active).
-s, --sim Run the simulator executable (isaac-sim.bat) provided by Isaac Sim.
-t, --test Run all python unittest tests.
-v, --vscode Generate the VSCode settings file from template.
-d, --docs Build the documentation from source using sphinx.
-c, --conda [NAME] Create the conda environment for Isaac Lab. Default name is 'isaaclab'.
Installation
~~~~~~~~~~~~
- Install dependencies using ``apt`` (on Ubuntu):
.. code:: bash
sudo apt install cmake build-essential
- Run the install command that iterates over all the extensions in ``source/extensions`` directory and installs them
using pip (with ``--editable`` flag):
.. tabs::
.. tab:: Linux
.. code:: bash
./isaaclab.sh --install # or "./isaaclab.sh -i"
.. tab:: Windows
.. code:: bash
isaaclab.bat --install :: or "isaaclab.bat -i"
.. note::
By default, this will install all the learning frameworks. If you want to install only a specific framework, you can
pass the name of the framework as an argument. For example, to install only the ``rl_games`` framework, you can run
.. tabs::
.. tab:: Linux
.. code:: bash
./isaaclab.sh --install rl_games
.. tab:: Windows
.. code:: bash
isaaclab.bat --install rl_games :: or "isaaclab.bat -i"
The valid options are ``rl_games``, ``rsl_rl``, ``sb3``, ``skrl``, ``robomimic``, ``none``.
Verifying the Installation
==========================
Verifying the Isaac Sim installation
------------------------------------
Isaac Sim installed from pip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Make sure that your virtual environment is activated (if applicable)
- Check that the simulator runs as expected:
.. code:: bash
# note: you can pass the argument "--help" to see all arguments possible.
isaacsim
By default, this will launch an empty mini Kit window.
- To run with a specific experience file, run:
.. code:: bash
# experience files can be absolute path, or relative path searched in isaacsim/apps or omni/apps
isaacsim omni.isaac.sim.python.kit
.. attention::
When running Isaac Sim for the first time, all dependent extensions will be pulled from the registry.
This process can take upwards of 10 minutes and is required on the first run of each experience file.
Once the extensions are pulled, consecutive runs using the same experience file will use the cached extensions.
In addition, the first run will prompt users to accept the Nvidia Omniverse License Agreement.
To accept the EULA, reply ``Yes`` when prompted with the below message:
.. code:: bash
By installing or using Isaac Sim, I agree to the terms of NVIDIA OMNIVERSE LICENSE AGREEMENT (EULA)
in https://docs.omniverse.nvidia.com/isaacsim/latest/common/NVIDIA_Omniverse_License_Agreement.html
Do you accept the EULA? (Yes/No): Yes
If the simulator does not run or crashes while following the above
instructions, it means that something is incorrectly configured. To
debug and troubleshoot, please check Isaac Sim
`documentation <https://docs.omniverse.nvidia.com/dev-guide/latest/linux-troubleshooting.html>`__
and the
`forums <https://docs.omniverse.nvidia.com/isaacsim/latest/isaac_sim_forums.html>`__.
Isaac Sim installed from binaries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To avoid the overhead of finding and locating the Isaac Sim installation
directory every time, we recommend exporting the following environment
variables to your terminal for the remaining of the installation instructions:
.. tabs::
.. tab:: Linux
.. code:: bash
# Isaac Sim root directory
export ISAACSIM_PATH="${HOME}/.local/share/ov/pkg/isaac_sim-4.0"
# Isaac Sim python executable
export ISAACSIM_PYTHON_EXE="${ISAACSIM_PATH}/python.sh"
.. tab:: Windows
.. code:: batch
:: Isaac Sim root directory
set ISAACSIM_PATH="C:\Users\user\AppData\Local\ov\pkg\isaac_sim-4.0"
:: Isaac Sim python executable
set ISAACSIM_PYTHON_EXE="%ISAACSIM_PATH%\python.bat"
For more information on common paths, please check the Isaac Sim
`documentation <https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_faq.html#common-path-locations>`__.
- Check that the simulator runs as expected:
.. tabs::
.. tab:: Linux
.. code:: bash
# note: you can pass the argument "--help" to see all arguments possible.
${ISAACSIM_PATH}/isaac-sim.sh
.. tab:: Windows
.. code:: batch
:: note: you can pass the argument "--help" to see all arguments possible.
%ISAACSIM_PATH%\isaac-sim.bat
- Check that the simulator runs from a standalone python script:
.. tabs::
.. tab:: Linux
.. code:: bash
# checks that python path is set correctly
${ISAACSIM_PYTHON_EXE} -c "print('Isaac Sim configuration is now complete.')"
# checks that Isaac Sim can be launched from python
${ISAACSIM_PYTHON_EXE} ${ISAACSIM_PATH}/standalone_examples/api/omni.isaac.core/add_cubes.py
.. tab:: Windows
.. code:: batch
:: checks that python path is set correctly
%ISAACSIM_PYTHON_EXE% -c "print('Isaac Sim configuration is now complete.')"
:: checks that Isaac Sim can be launched from python
%ISAACSIM_PYTHON_EXE% %ISAACSIM_PATH%\standalone_examples\api\omni.isaac.core\add_cubes.py
.. attention::
If you have been using a previous version of Isaac Sim, you
need to run the following command for the *first* time after
installation to remove all the old user data and cached variables:
.. tabs::
.. tab:: Linux
.. code:: bash
${ISAACSIM_PATH}/isaac-sim.sh --reset-user
.. tab:: Windows
.. code:: batch
%ISAACSIM_PATH%\isaac-sim.bat --reset-user
If the simulator does not run or crashes while following the above
instructions, it means that something is incorrectly configured. To
debug and troubleshoot, please check Isaac Sim
`documentation <https://docs.omniverse.nvidia.com/dev-guide/latest/linux-troubleshooting.html>`__
and the
`forums <https://docs.omniverse.nvidia.com/isaacsim/latest/isaac_sim_forums.html>`__.
Verifying the Isaac Lab installation
------------------------------------
To verify that the installation was successful, run the following command from the
top of the repository:
.. tabs::
.. tab:: Linux
.. code:: bash
# Option 1: Using the isaaclab.sh executable
# note: this works for both the bundled python and the virtual environment
./isaaclab.sh -p source/standalone/tutorials/00_sim/create_empty.py
# Option 2: Using python in your virtual environment
python source/standalone/tutorials/00_sim/create_empty.py
.. tab:: Windows
.. code:: batch
:: Option 1: Using the isaaclab.bat executable
:: note: this works for both the bundled python and the virtual environment
isaaclab.bat -p source\standalone\tutorials\00_sim\create_empty.py
:: Option 2: Using python in your virtual environment
python source\standalone\tutorials\00_sim\create_empty.py
The above command should launch the simulator and display a window with a black
ground plane. You can exit the script by pressing ``Ctrl+C`` on your terminal.
On Windows machines, please terminate the process from Command Prompt using
``Ctrl+Break`` or ``Ctrl+fn+B``.
If you see this, then the installation was successful! |:tada:|
......@@ -141,8 +141,10 @@ format.
.. code:: bash
# install the dependencies
sudo apt install cmake build-essential
# install python module (for robomimic)
./isaaclab.sh -e robomimic
./isaaclab.sh -i robomimic
# split data
./isaaclab.sh -p source/standalone//workflows/robomimic/tools/split_train_val.py logs/robomimic/Isaac-Lift-Cube-Franka-IK-Rel-v0/hdf_dataset.hdf5 --ratio 0.2
......@@ -172,7 +174,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash
# install python module (for stable-baselines3)
./isaaclab.sh -e sb3
./isaaclab.sh -i sb3
# run script for training
# note: we enable cpu flag since SB3 doesn't optimize for GPU anyway
./isaaclab.sh -p source/standalone/workflows/sb3/train.py --task Isaac-Cartpole-v0 --headless --cpu
......@@ -185,7 +187,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash
# install python module (for skrl)
./isaaclab.sh -e skrl
./isaaclab.sh -i skrl
# run script for training
./isaaclab.sh -p source/standalone/workflows/skrl/train.py --task Isaac-Reach-Franka-v0 --headless
# run script for playing with 32 environments
......@@ -197,7 +199,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash
# install python module (for rl-games)
./isaaclab.sh -e rl_games
./isaaclab.sh -i rl_games
# run script for training
./isaaclab.sh -p source/standalone/workflows/rl_games/train.py --task Isaac-Ant-v0 --headless
# run script for playing with 32 environments
......@@ -209,7 +211,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash
# install python module (for rsl-rl)
./isaaclab.sh -e rsl_rl
./isaaclab.sh -i rsl_rl
# run script for training
./isaaclab.sh -p source/standalone/workflows/rsl_rl/train.py --task Isaac-Reach-Franka-v0 --headless
# run script for playing with 32 environments
......
......@@ -75,8 +75,8 @@ custom arguments and those from :class:`~app.AppLauncher`.
[INFO] Using python from: /isaac-sim/python.sh
[INFO][AppLauncher]: The argument 'width' will be used to configure the SimulationApp.
[INFO][AppLauncher]: The argument 'height' will be used to configure the SimulationApp.
usage: launch_app.py [-h] [--size SIZE] [--width WIDTH] [--height HEIGHT] [--headless] [--livestream {0,1,2,3}]
[--offscreen_render] [--verbose] [--experience EXPERIENCE]
usage: launch_app.py [-h] [--size SIZE] [--width WIDTH] [--height HEIGHT] [--headless] [--livestream {0,1,2}]
[--enable_cameras] [--verbose] [--experience EXPERIENCE]
Tutorial on running IsaacSim via the AppLauncher.
......@@ -88,9 +88,9 @@ custom arguments and those from :class:`~app.AppLauncher`.
app_launcher arguments:
--headless Force display off at all times.
--livestream {0,1,2,3}
--livestream {0,1,2}
Force enable livestreaming. Mapping corresponds to that for the "LIVESTREAM" environment variable.
--offscreen_render Enable offscreen rendering when running without a GUI.
--enable_cameras Enable cameras when running without a GUI.
--verbose Enable verbose terminal logging from the SimulationApp.
--experience EXPERIENCE
The experience file to load when launching the SimulationApp.
......@@ -123,7 +123,7 @@ In the case where these arguments are provided from the CLI, they will override
as we will demonstrate later in this tutorial.
These arguments can be used with any script that starts the simulation using :class:`~app.AppLauncher`,
with one exception, ``--offscreen_render``. This setting sets the rendering pipeline to use the
with one exception, ``--enable_cameras``. This setting sets the rendering pipeline to use the
offscreen renderer. However, this setting is only compatible with the :class:`omni.isaac.lab.sim.SimulationContext`.
It will not work with Isaac Sim's :class:`omni.isaac.core.simulation_context.SimulationContext` class.
For more information on this flag, please see the :class:`~app.AppLauncher` API documentation.
......
......@@ -46,7 +46,7 @@ A collection of these prims, with their attributes and relationships, is called
as a container for all prims in a scene. When we say we are designing a scene, we are actually designing a USD stage.
While working with direct USD APIs provides a lot of flexibility, it can be cumbersome to learn and use. To make it
easier to design scenes, Isaac Lab builds on top of the USD APIs to provide a configuration-drive interface to spawn prims
easier to design scenes, Isaac Lab builds on top of the USD APIs to provide a configuration-driven interface to spawn prims
into a scene. These are included in the :mod:`sim.spawners` module.
When spawning prims into the scene, each prim requires a configuration class instance that defines the prim's attributes
......
.. _tutorial-create-base-env:
Creating a Base Environment
===========================
Creating a Manager-Based Base Environment
=========================================
.. currentmodule:: omni.isaac.lab
Environments bring together different aspects of the simulation such as
the scene, observations and actions spaces, reset events etc. to create a
coherent interface for various applications. In Isaac Lab, environments are
implemented as :class:`envs.BaseEnv` and :class:`envs.RLTaskEnv` classes.
The two classes are very similar, but :class:`envs.RLTaskEnv` is useful for
coherent interface for various applications. In Isaac Lab, manager-based environments are
implemented as :class:`envs.ManagerBasedEnv` and :class:`envs.ManagerBasedRLEnv` classes.
The two classes are very similar, but :class:`envs.ManagerBasedRLEnv` is useful for
reinforcement learning tasks and contains rewards, terminations, curriculum
and command generation. The :class:`envs.BaseEnv` class is useful for
and command generation. The :class:`envs.ManagerBasedEnv` class is useful for
traditional robot control and doesn't contain rewards and terminations.
In this tutorial, we will look at the base class :class:`envs.BaseEnv` and its
corresponding configuration class :class:`envs.BaseEnvCfg`. We will use the
In this tutorial, we will look at the base class :class:`envs.ManagerBasedEnv` and its
corresponding configuration class :class:`envs.ManagerBasedEnvCfg` for the manager-based workflow.
We will use the
cartpole environment from earlier to illustrate the different components
in creating a new :class:`envs.BaseEnv` environment.
in creating a new :class:`envs.ManagerBasedEnv` environment.
The Code
......@@ -39,7 +40,7 @@ directory.
The Code Explained
~~~~~~~~~~~~~~~~~~
The base class :class:`envs.BaseEnv` wraps around many intricacies of the simulation interaction
The base class :class:`envs.ManagerBasedEnv` wraps around many intricacies of the simulation interaction
and provides a simple interface for the user to run the simulation and interact with it. It
is composed of the following components:
......@@ -51,7 +52,7 @@ is composed of the following components:
By configuring these components, the user can create different variations of the same environment
with minimal effort. In this tutorial, we will go through the different components of the
:class:`envs.BaseEnv` class and how to configure them to create a new environment.
:class:`envs.ManagerBasedEnv` class and how to configure them to create a new environment.
Designing the scene
-------------------
......@@ -126,7 +127,7 @@ takes in the :attr:`managers.EventTermCfg.func` that specifies the function or c
class that performs the event.
Additionally, it expects the **mode** of the event. The mode specifies when the event term should be applied.
It is possible to specify your own mode. For this, you'll need to adapt the :class:`~envs.BaseEnv` class.
It is possible to specify your own mode. For this, you'll need to adapt the :class:`~envs.ManagerBasedEnv` class.
However, out of the box, Isaac Lab provides three commonly used modes:
* ``"startup"`` - Event that takes place only once at environment startup.
......@@ -145,13 +146,13 @@ Tying it all together
---------------------
Having defined the scene and manager configurations, we can now define the environment configuration
through the :class:`envs.BaseEnvCfg` class. This class takes in the scene, action, observation and
through the :class:`envs.ManagerBasedEnvCfg` class. This class takes in the scene, action, observation and
event configurations.
In addition to these, it also takes in the :attr:`envs.BaseEnvCfg.sim` which defines the simulation
In addition to these, it also takes in the :attr:`envs.ManagerBasedEnvCfg.sim` which defines the simulation
parameters such as the timestep, gravity, etc. This is initialized to the default values, but can
be modified as needed. We recommend doing so by defining the :meth:`__post_init__` method in the
:class:`envs.BaseEnvCfg` class, which is called after the configuration is initialized.
:class:`envs.ManagerBasedEnvCfg` class, which is called after the configuration is initialized.
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
......@@ -162,12 +163,12 @@ Running the simulation
Lastly, we revisit the simulation execution loop. This is now much simpler since we have
abstracted away most of the details into the environment configuration. We only need to
call the :meth:`envs.BaseEnv.reset` method to reset the environment and :meth:`envs.BaseEnv.step`
call the :meth:`envs.ManagerBasedEnv.reset` method to reset the environment and :meth:`envs.ManagerBasedEnv.step`
method to step the environment. Both these functions return the observation and an info dictionary
which may contain additional information provided by the environment. These can be used by an
agent for decision-making.
The :class:`envs.BaseEnv` class does not have any notion of terminations since that concept is
The :class:`envs.ManagerBasedEnv` class does not have any notion of terminations since that concept is
specific for episodic tasks. Thus, the user is responsible for defining the termination condition
for the environment. In this tutorial, we reset the simulation at regular intervals.
......@@ -213,5 +214,5 @@ directory. For completeness, they can be run using the following commands:
./isaaclab.sh -p source/standalone/tutorials/03_envs/create_quadruped_base_env.py --num_envs 32
In the following tutorial, we will look at the :class:`envs.RLTaskEnv` class and how to use it
In the following tutorial, we will look at the :class:`envs.ManagerBasedRLEnv` class and how to use it
to create a Markovian Decision Process (MDP).
This diff is collapsed.
.. _tutorial-create-rl-env:
Creating an RL Environment
==========================
Creating a Manager-Based RL Environment
=======================================
.. currentmodule:: omni.isaac.lab
Having learnt how to create a base environment in :ref:`tutorial-create-base-env`, we will now look at how to create a
Having learnt how to create a base environment in :ref:`tutorial-create-base-env`, we will now look at how to create a manager-based
task environment for reinforcement learning.
The base environment is designed as an sense-act environment where the agent can send commands to the environment
and receive observations from the environment. This minimal interface is sufficient for many applications such as
traditional motion planning and controls. However, many applications require a task-specification which often
serves as the learning objective for the agent. For instance, in a navigation task, the agent may be required to
reach a goal location. To this end, we use the :class:`envs.RLTaskEnv` class which extends the base environment
reach a goal location. To this end, we use the :class:`envs.ManagerBasedRLEnv` class which extends the base environment
to include a task specification.
Similar to other components in Isaac Lab, instead of directly modifying the base class :class:`RLTaskEnv`, we
encourage users to simply implement a configuration :class:`RLTaskEnvCfg` for their task environment.
Similar to other components in Isaac Lab, instead of directly modifying the base class :class:`envs.ManagerBasedRLEnv`, we
encourage users to simply implement a configuration :class:`envs.ManagerBasedRLEnvCfg` for their task environment.
This practice allows us to separate the task specification from the environment implementation, making it easier
to reuse components of the same environment for different tasks.
In this tutorial, we will configure the cartpole environment using the :class:`RLTaskEnvCfg` to create a task
In this tutorial, we will configure the cartpole environment using the :class:`envs.ManagerBasedRLEnvCfg` to create a manager-based task
for balancing the pole upright. We will learn how to specify the task using reward terms, termination criteria,
curriculum and commands.
......@@ -29,20 +29,20 @@ curriculum and commands.
The Code
~~~~~~~~
For this tutorial, we use the cartpole environment defined in ``omni.isaac.lab_tasks.classic.cartpole`` module.
For this tutorial, we use the cartpole environment defined in ``omni.isaac.lab_tasks.manager_based.classic.cartpole`` module.
.. dropdown:: Code for cartpole_env_cfg.py
:icon: code
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/classic/cartpole/cartpole_env_cfg.py
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
:language: python
:emphasize-lines: 63-68, 124-149, 152-162, 165-169, 187-192
:linenos:
The script for running the environment ``run_cartpole_rl_env.py`` is present in the
``source/standalone/tutorials/03_envs`` directory. The script is similar to the
``isaaclab/source/standalone/tutorials/03_envs`` directory. The script is similar to the
``cartpole_base_env.py`` script in the previous tutorial, except that it uses the
:class:`envs.RLTaskEnv` instead of the :class:`envs.BaseEnv`.
:class:`envs.ManagerBasedRLEnv` instead of the :class:`envs.ManagerBasedEnv`.
.. dropdown:: Code for run_cartpole_rl_env.py
:icon: code
......@@ -63,7 +63,7 @@ will focus only on the RL components of the environment.
In Isaac Lab, we provide various implementations of different terms in the :mod:`envs.mdp` module. We will use
some of these terms in this tutorial, but users are free to define their own terms as well. These
are usually placed in their task-specific sub-package
(for instance, in :mod:`omni.isaac.lab_tasks.classic.cartpole.mdp`).
(for instance, in :mod:`omni.isaac.lab_tasks.manager_based.classic.cartpole.mdp`).
Defining rewards
......@@ -83,7 +83,7 @@ For the cartpole task, we will use the following reward terms:
* **Cart Velocity Reward**: Encourage the agent to keep the cart velocity as small as possible.
* **Pole Velocity Reward**: Encourage the agent to keep the pole velocity as small as possible.
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/classic/cartpole/cartpole_env_cfg.py
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
:language: python
:pyobject: RewardsCfg
......@@ -106,7 +106,7 @@ The flag :attr:`managers.TerminationsCfg.time_out` specifies whether the term is
or terminated term. These are used to indicate the two types of terminations as described in `Gymnasium's documentation
<https://gymnasium.farama.org/tutorials/gymnasium_basics/handling_time_limits/>`_.
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/classic/cartpole/cartpole_env_cfg.py
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
:language: python
:pyobject: TerminationsCfg
......@@ -121,7 +121,7 @@ For this simple task, we do not use any commands. This is specified by using a c
:class:`envs.mdp.NullCommandCfg` configuration. However, you can see an example of command definitions in the
locomotion or manipulation tasks.
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/classic/cartpole/cartpole_env_cfg.py
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
:language: python
:pyobject: CommandsCfg
......@@ -136,18 +136,18 @@ In this tutorial we don't implement a curriculum for simplicity, but you can see
curriculum definition in the other locomotion or manipulation tasks.
We use a simple pass-through curriculum to define a curriculum manager that does not modify the environment.
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/classic/cartpole/cartpole_env_cfg.py
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
:language: python
:pyobject: CurriculumCfg
Tying it all together
---------------------
With all the above components defined, we can now create the :class:`RLTaskEnvCfg` configuration for the
cartpole environment. This is similar to the :class:`BaseEnvCfg` defined in :ref:`tutorial-create-base-env`,
With all the above components defined, we can now create the :class:`ManagerBasedRLEnvCfg` configuration for the
cartpole environment. This is similar to the :class:`ManagerBasedEnvCfg` defined in :ref:`tutorial-create-base-env`,
only with the added RL components explained in the above sections.
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/classic/cartpole/cartpole_env_cfg.py
.. literalinclude:: ../../../../source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/manager_based/classic/cartpole/cartpole_env_cfg.py
:language: python
:pyobject: CartpoleEnvCfg
......@@ -155,8 +155,8 @@ Running the simulation loop
---------------------------
Coming back to the ``run_cartpole_rl_env.py`` script, the simulation loop is similar to the previous tutorial.
The only difference is that we create an instance of :class:`envs.RLTaskEnv` instead of the
:class:`envs.BaseEnv`. Consequently, now the :meth:`envs.RLTaskEnv.step` method returns additional signals
The only difference is that we create an instance of :class:`envs.ManagerBasedRLEnv` instead of the
:class:`envs.ManagerBasedEnv`. Consequently, now the :meth:`envs.ManagerBasedRLEnv.step` method returns additional signals
such as the reward and termination status. The information dictionary also maintains logging of quantities
such as the reward contribution from individual terms, the termination status of each term, the episode length etc.
......@@ -185,10 +185,10 @@ where you started the simulation.
In this tutorial, we learnt how to create a task environment for reinforcement learning. We do this
by extending the base environment to include the rewards, terminations, commands and curriculum terms.
We also learnt how to use the :class:`envs.RLTaskEnv` class to run the environment and receive various
We also learnt how to use the :class:`envs.ManagerBasedRLEnv` class to run the environment and receive various
signals from it.
While it is possible to manually create an instance of :class:`envs.RLTaskEnv` class for a desired task,
While it is possible to manually create an instance of :class:`envs.ManagerBasedRLEnv` class for a desired task,
this is not scalable as it requires specialized scripts for each task. Thus, we exploit the
:meth:`gymnasium.make` function to create the environment with the gym interface. We will learn how to do this
in the next tutorial.
Designing an Environment
========================
The following tutorials introduce the concept of environments: :class:`~omni.isaac.lab.envs.BaseEnv`
and its derivative :class:`~omni.isaac.lab.envs.RLTaskEnv`. These environments bring-in together
The following tutorials introduce the concept of manager-based environments: :class:`~omni.isaac.lab.envs.ManagerBasedEnv`
and its derivative :class:`~omni.isaac.lab.envs.ManagerBasedRLEnv`, as well as the direct workflow base class
:class:`~omni.isaac.lab.envs.DirectRLEnv`. These environments bring-in together
different aspects of the framework to create a simulation environment for agent interaction.
.. toctree::
......@@ -11,5 +12,6 @@ different aspects of the framework to create a simulation environment for agent
create_base_env
create_rl_env
create_direct_rl_env
register_rl_env_gym
run_rl_training
......@@ -7,7 +7,7 @@ In the previous tutorials, we covered how to define an RL task environment, regi
it into the ``gym`` registry, and interact with it using a random agent. We now move
on to the next step: training an RL agent to solve the task.
Although the :class:`envs.RLTaskEnv` conforms to the :class:`gymnasium.Env` interface,
Although the :class:`envs.ManagerBasedRLEnv` conforms to the :class:`gymnasium.Env` interface,
it is not exactly a ``gym`` environment. The input and outputs of the environment are
not numpy arrays, but rather based on torch tensors with the first dimension being the
number of environment instances.
......@@ -15,8 +15,8 @@ number of environment instances.
Additionally, most RL libraries expect their own variation of an environment interface.
For example, `Stable-Baselines3`_ expects the environment to conform to its
`VecEnv API`_ which expects a list of numpy arrays instead of a single tensor. Similarly,
`RSL-RL`_ and `RL-Games`_ expect a different interface. Since there is no one-size-fits-all
solution, we do not base the :class:`envs.RLTaskEnv` on any particular learning library.
`RSL-RL`_, `RL-Games`_ and `SKRL`_ expect a different interface. Since there is no one-size-fits-all
solution, we do not base the :class:`envs.ManagerBasedRLEnv` on any particular learning library.
Instead, we implement wrappers to convert the environment into the expected interface.
These are specified in the :mod:`omni.isaac.lab_tasks.utils.wrappers` module.
......@@ -93,13 +93,13 @@ Headless execution with off-screen render
"""""""""""""""""""""""""""""""""""""""""
Since the above command does not render the simulation, it is not possible to visualize the agent's
behavior during training. To visualize the agent's behavior, we pass the ``--offscreen_render`` which
behavior during training. To visualize the agent's behavior, we pass the ``--enable_cameras`` which
enables off-screen rendering. Additionally, we pass the flag ``--video`` which records a video of the
agent's behavior during training.
.. code-block:: bash
./isaaclab.sh -p source/standalone/workflows/sb3/train.py --task Isaac-Cartpole-v0 --num_envs 64 --headless --offscreen_render --video
./isaaclab.sh -p source/standalone/workflows/sb3/train.py --task Isaac-Cartpole-v0 --num_envs 64 --headless --enable_cameras --video
The videos are saved to the ``logs/sb3/Isaac-Cartpole-v0/<run-dir>/videos`` directory. You can open these videos
using any video player.
......@@ -151,3 +151,4 @@ directory. You can also specify a specific checkpoint by passing the ``--checkpo
.. _`stable_baselines3.common.vec_env.VecNormalize`: https://stable-baselines3.readthedocs.io/en/master/guide/vec_envs.html#vecnormalize
.. _RL-Games: https://github.com/Denys88/rl_games
.. _RSL-RL: https://github.com/leggedrobotics/rsl_rl
.. _SKRL: https://skrl.readthedocs.io
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.16.5"
version = "0.17.11"
# Description
title = "Isaac Lab framework for Robot Learning"
......
......@@ -333,6 +333,8 @@ class RigidObject(AssetBase):
self._create_buffers()
# process configuration
self._process_cfg()
# update the rigid body data
self.update(0.0)
def _create_buffers(self):
"""Create buffers for storing data."""
......@@ -369,6 +371,9 @@ class RigidObject(AssetBase):
# -- used to compute body accelerations numerically
self._last_body_vel_w = torch.zeros(self.num_instances, self.num_bodies, 6, device=self.device)
# mass
self._data.default_mass = self.root_physx_view.get_masses().clone()
def _process_cfg(self):
"""Post processing of configuration parameters."""
# default state
......@@ -391,7 +396,8 @@ class RigidObject(AssetBase):
override the update function without having to worry about updating the common data.
"""
# -- body acceleration
self._data.body_acc_w[:] = (self._data.body_state_w[..., 7:] - self._last_body_vel_w) / dt
if dt > 0.0:
self._data.body_acc_w[:] = (self._data.body_state_w[..., 7:] - self._last_body_vel_w) / dt
self._last_body_vel_w[:] = self._data.body_state_w[..., 7:]
# -- root state in body frame
self._data.root_vel_b[:, 0:3] = math_utils.quat_rotate_inverse(
......
......@@ -57,6 +57,13 @@ class RigidObjectData:
This quantity is computed based on the rigid body state from the last step.
"""
##
# Default rigid body properties
##
default_mass: torch.Tensor = None
""" Default mass provided by simulation. Shape is (num_instances, num_bodies)."""
"""
Properties
"""
......
This diff is collapsed.
......@@ -11,5 +11,5 @@ toggling different debug visualization tools, and other user-defined functionali
"""
from .base_env_window import BaseEnvWindow
from .rl_task_env_window import RLTaskEnvWindow
from .manager_based_rl_env_window import ManagerBasedRLEnvWindow
from .viewport_camera_controller import ViewportCameraController
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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