Commit ffd9a163 authored by Mayank Mittal's avatar Mayank Mittal Committed by Mayank Mittal

Reorganization of the tutorials in the docs (#292)

This MR makes the following changes:

* Re-organizes the docs to have somewhat a better story
* Renames all the scripts to start with "VERB_ACTION.py" -- Previous
namings like articulation.py was causing file-search conflicts

- This change requires a documentation update

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [x] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
parent 1387e410
......@@ -56,3 +56,9 @@ repos:
- --license-filepath
- .github/LICENSE_HEADER.txt
- --use-current-year
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
......@@ -71,6 +71,10 @@ source_suffix = {
".md": "markdown",
}
# make sure we don't have any unknown references
# TODO: Enable this by default once we have fixed all the warnings
# nitpicky = True
# put type hints inside the signature instead of the description (easier to maintain)
autodoc_typehints = "signature"
# autodoc_typehints_format = "fully-qualified"
......
......@@ -3,7 +3,7 @@ Overview
**Orbit** 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
`NVIDIA Isaac Sim`_ to leverage the latest simulation capabilities for photo-realistic scenes, and fast
and efficient simulation. The core objectives of the framework are:
- **Modularity**: Easily customize and add new environments, robots, and sensors.
......@@ -26,8 +26,6 @@ For more information about the framework, please refer to the `paper <https://ar
source/setup/installation
source/setup/developer
source/setup/docker
source/setup/cluster
source/setup/sample
.. toctree::
......@@ -40,36 +38,15 @@ For more information about the framework, please refer to the `paper <https://ar
.. toctree::
:maxdepth: 1
:caption: How-to Guides
:caption: Resources
:titlesonly:
source/how_to_guides/index
.. toctree::
:maxdepth: 1
:caption: Tutorials (Core)
source/tutorials/00_sim/empty
source/tutorials/00_sim/prims
source/tutorials/00_sim/applauncher
source/tutorials/00_sim/docker
source/tutorials/01_assets/articulation
source/tutorials/01_assets/rigid_object
source/tutorials/02_scene/scene
source/tutorials/index
source/how-to/index
source/deployment/index
.. toctree::
:hidden:
:maxdepth: 1
:caption: Tutorials (Environments)
source/tutorials/03_envs/base_env
source/tutorials/03_envs/rl_env
source/tutorials/03_envs/gym_registry
source/tutorials/03_envs/rl_training
.. toctree::
:maxdepth: 2
:caption: Source API
source/api/index
......
BSD 3-Clause License
Copyright (c) 2016-2022 HangZhou YuShu TECHNOLOGY CO.,LTD. ("Unitree Robotics")
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* 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.
* 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.
Copyright (c) 2018 Anthony Sottile
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.
Cluster Setup
.. _deployment-cluster:
Cluster Guide
=============
Clusters are a great way to speed up training and evaluation of learning algorithms.
......
Docker Guide
============
.. _deployment-docker:
Docker is a tool that allows for the creation of containers, which are isolated environments that can
be used to run applications. They are useful for ensuring that an application can run on any machine
that has Docker installed, regardless of the host machine's operating system or installed libraries.
We include a Dockerfile and docker-compose.yaml file that can be used to build a Docker image that
contains Orbit and all of its dependencies. This image can then be used to run Orbit in a container.
The Dockerfile is based on the Isaac Sim image provided by NVIDIA, which includes the Omniverse
application launcher and the Isaac Sim application. The Dockerfile installs Orbit and its dependencies
on top of this image.
Docker Guide
============
.. caution::
......
Container Deployment
====================
Docker is a tool that allows for the creation of containers, which are isolated environments that can
be used to run applications. They are useful for ensuring that an application can run on any machine
that has Docker installed, regardless of the host machine's operating system or installed libraries.
We include a Dockerfile and docker-compose.yaml file that can be used to build a Docker image that
contains Orbit and all of its dependencies. This image can then be used to run Orbit in a container.
The Dockerfile is based on the Isaac Sim image provided by NVIDIA, which includes the Omniverse
application launcher and the Isaac Sim application. The Dockerfile installs Orbit and its dependencies
on top of this image.
The following guides provide instructions for building the Docker image and running Orbit in a
container.
.. toctree::
:maxdepth: 1
docker
cluster
run_docker_example
Using Orbit with Docker
=======================
Running an example with Docker
==============================
In this tutorial, we will learn how to use the Orbit Docker container for development. For a detailed
description of the Docker setup, including installation and obtaining access to an Isaac Sim
image, please reference the :doc:`Docker Setup page </source/setup/docker>`. For a description
of Docker in general, please refer to `their official documentation <https://docs.docker.com/get-started/overview/>`_.
From the root of the ``orbit`` repository, the ``docker`` directory contains all the Docker relevant files. These include the three files
(**Dockerfile**, **docker-compose.yaml**, **.env**) which are used by Docker, and an additional script that we use to interface with them,
**container.sh**.
From the root of the ``orbit`` repository, the ``docker`` directory contains all the Docker relevant files. These include the three files (**Dockerfile**, **docker-compose.yaml**, **.env**)
which are used by Docker, and an additional script that we use to interface with them, **container.sh**. In this tutorial, we will learn
how to use the latter to build an image, run an experiment, and extract the outputs.
In this tutorial, we will learn how to use the Orbit Docker container for development. For a detailed description of the Docker setup,
including installation and obtaining access to an Isaac Sim image, please reference the :ref:`deployment-docker`. For a description
of Docker in general, please refer to `their official documentation <https://docs.docker.com/get-started/overview/>`_.
Building the Container
......@@ -24,7 +23,8 @@ To build the Orbit container from the root of the Orbit repository, we will run
The terminal will first pull the base IsaacSim image, build the Orbit image's additional layers on top of it, and run the Orbit container.
This should take several minutes upon the first build but will be shorter in subsequent runs as Docker's caching prevents repeated work.
If we run the command ``docker container ls`` on the terminal, the output will list the containers that are running on the system. If everything has been set up correctly, a container with the ``NAME`` **orbit** should appear, similar to below:
If we run the command ``docker container ls`` on the terminal, the output will list the containers that are running on the system. If
everything has been set up correctly, a container with the ``NAME`` **orbit** should appear, similar to below:
.. code-block:: console
......@@ -33,7 +33,7 @@ If we run the command ``docker container ls`` on the terminal, the output will l
483d1d5e2def orbit "bash" 30 seconds ago Up 30 seconds orbit
Now that the container is up and running, we can enter it from our terminal.
Once the container is up and running, we can enter it from our terminal.
.. code-block:: console
......@@ -43,7 +43,7 @@ Now that the container is up and running, we can enter it from our terminal.
On entering the Orbit container, we are in the terminal as the superuser, ``root``. This environment contains a copy of the
Orbit repository, but also has access to the directories and libraries of Isaac Sim. We can run experiments from this environment
using a few convenient aliases that have been put into the ``root`` **.bashrc**. For instance, we have made the **orbit.sh** script
usable from anywhere by typing ``orbit``.
usable from anywhere by typing its alias ``orbit``.
Additionally in the container, we have `bind mounted`_ the ``orbit/source`` directory from the
host machine. This means that if we modify files under this directory from an editor on the host machine, the changes are
......@@ -55,11 +55,12 @@ from the Orbit Docker container.
The Code
~~~~~~~~
The tutorial corresponds to the ``docker.py`` script in the ``orbit/source/standalone/tutorials/00_sim`` directory.
The tutorial corresponds to the ``log_time.py`` script in the ``orbit/source/standalone/tutorials/00_sim`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for ``docker.py``
.. dropdown:: Code for log_time.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/docker.py
.. literalinclude:: ../../../source/standalone/tutorials/00_sim/log_time.py
:language: python
:emphasize-lines: 46-55, 72-79
:linenos:
......@@ -69,10 +70,10 @@ The Code Explained
~~~~~~~~~~~~~~~~~~
The Orbit Docker container has several `volumes`_ to facilitate persistent storage between the host computer and the
container. Once such `volume`_ is the ``/workspace/orbit/logs`` directory.
The ``docker.py`` script designates this directory as the location to which a ``log.txt`` should be written:
container. One such volume is the ``/workspace/orbit/logs`` directory.
The ``log_time.py`` script designates this directory as the location to which a ``log.txt`` should be written:
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/docker.py
.. literalinclude:: ../../../source/standalone/tutorials/00_sim/log_time.py
:language: python
:start-at: # Specify that the logs must be in logs/docker_tutorial
:end-at: print(f"[INFO] Logging experiment to directory: {log_dir_path}")
......@@ -82,7 +83,7 @@ As the comments note, :func:`os.path.abspath()` will prepend ``/workspace/orbit`
the Docker container all python execution is done through ``/workspace/orbit/orbit.sh``.
The output will be a file, ``log.txt``, with the ``sim_time`` written on a newline at every simulation step:
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/docker.py
.. literalinclude:: ../../../source/standalone/tutorials/00_sim/log_time.py
:language: python
:start-at: # Prepare to count sim_time
:end-at: sim_time += sim_dt
......@@ -95,7 +96,7 @@ We will execute the script to produce a log, adding a ``--headless`` flag to our
.. code-block:: bash
orbit -p source/standalone/tutorials/00_sim/docker.py --headless
orbit -p source/standalone/tutorials/00_sim/log_time.py --headless
Now ``log.txt`` will have been produced at ``/workspace/orbit/logs/docker_tutorial``. If we exit the container
......@@ -107,8 +108,9 @@ the following command to retrieve our logs from the Docker container and put the
./container.sh copy
We will see a terminal readout reporting the artifacts we have retrieved from the container. If we navigate to ``/orbit/docker/artifacts/logs/docker_tutorial``,
we will see a copy of the ``log.txt`` file which was produced by the script above.
We will see a terminal readout reporting the artifacts we have retrieved from the container. If we navigate to
``/orbit/docker/artifacts/logs/docker_tutorial``, we will see a copy of the ``log.txt`` file which was produced
by the script above.
Each of the directories under ``artifacts`` corresponds to Docker `volumes`_ mapped to directories
within the container and the ``container.sh copy`` command copies them from those `volumes`_ to these directories.
......@@ -129,12 +131,11 @@ the build process when we next run ``./container.sh start``, we may enter the fo
docker image rm orbit
A subsequent run of `docker image ls` will show that the image tagged **orbit** is now gone. We can repeat the process for the
A subsequent run of ``docker image ls``` will show that the image tagged **orbit** is now gone. We can repeat the process for the
underlying NVIDIA container if we wish to free up more space. If a more powerful method of freeing resources from Docker is desired,
please consult the documentation for the `docker prune`_ commands.
.. _volumes: https://docs.docker.com/storage/volumes/
.. _volume: https://docs.docker.com/storage/volumes/
.. _bind mounted: https://docs.docker.com/storage/bind-mounts/
.. _docker prune: https://docs.docker.com/config/pruning/
......@@ -50,7 +50,7 @@ joint torque commands, i.e. at every time-step,
\tau = \tau_{des}
Thus, this control mode is achievable by setting the command type for the actuator group, via
the :class:`ActuatorControlCfg` class, to `"t_abs"`.
the :class:`ActuatorControlCfg` class, to ``"t_abs"``.
Velocity control
......@@ -68,7 +68,7 @@ current and desired joint velocities. Based on input actions, the joint torques
where :math:`k_d` are the gains parsed from configuration.
This control mode is achievable by setting the command type for the actuator group, via
the :class:`ActuatorControlCfg` class, to `"v_abs"` or `"v_rel"`.
the :class:`ActuatorControlCfg` class, to ``"v_abs"`` or ``"v_rel"``.
.. attention::
......@@ -92,7 +92,7 @@ are zero). Based on the input actions, the joint torque commands are computed as
where :math:`k_p` and :math:`k_d` are the gains parsed from configuration.
In its simplest above form, the control mode is achievable by setting the command type for the actuator group,
via the :class:`ActuatorControlCfg` class, to `"p_abs"` or `"p_rel"`.
via the :class:`ActuatorControlCfg` class, to ``"p_abs"`` or ``"p_rel"``.
However, a more complete formulation which considers the dynamics of the articulation would be:
......
Creating Markers in Orbit
=========================
In this tutorial, we will explore how to create different types of markers in `Orbit` using a Python script.
In this tutorial, we will explore how to create different types of markers using a Python script.
The script demonstrates the creation of markers with various shapes and visual properties.
Please ensure you have gone through the previous tutorials, especially creating an empty scene for a foundational understanding.
......@@ -13,7 +13,7 @@ The Code
The tutorial corresponds to the ``markers.py`` script in the ``orbit/source/standalone/demos`` directory.
Let's take a look at the Python script:
.. literalinclude:: ../../../../source/standalone/demos/markers.py
.. literalinclude:: ../../../source/standalone/demos/markers.py
:language: python
:linenos:
......@@ -23,11 +23,11 @@ The Code Explained
Creating and spawning markers
-----------------------------
The :function:`spawn_markers` function creates different types of markers with specified configurations.
The :meth:`spawn_markers` function creates different types of markers with specified configurations.
For example, we include frames, arrows, cubes, spheres, cylinders, cones, and meshes.
The function returns a :obj:`VisualizationMarkers` object.
.. literalinclude:: ../../../../source/standalone/demos/markers.py
.. literalinclude:: ../../../source/standalone/demos/markers.py
:language: python
:lines: 37-84
:linenos:
......@@ -36,11 +36,11 @@ The function returns a :obj:`VisualizationMarkers` object.
Main simulation logic
---------------------
The `main` function sets up the simulation context, camera view, and spawns lights into the stage.
The ``main`` function sets up the simulation context, camera view, and spawns lights into the stage.
It then creates instances of the markers and places them in a grid pattern.
The markers are rotated around the z-axis during the simulation for visualization purposes.
.. literalinclude:: ../../../../source/standalone/demos/markers.py
.. literalinclude:: ../../../source/standalone/demos/markers.py
:language: python
:lines: 86-111
:linenos:
......
How-to Guides
=============
This section includes guides that help you use Orbit. These are intended for users who
have already worked through the tutorials and are looking for more information on how to
use Orbit. If you are new to Orbit, we recommend you start with the tutorials.
.. note::
This section is a work in progress. If you have a question that is not answered here,
please open an issue on our `GitHub page <https://github.com/NVIDIA-Omniverse/Orbit>`_.
.. toctree::
:maxdepth: 1
:numbered:
write_articulation_cfg
draw_markers
wrap_rl_env
......@@ -10,7 +10,7 @@ A detailed description of the API is available in the :class:`gymnasium.Wrapper`
At present, all RL environments inheriting from the :class:`omni.isaac.orbit.envs.RLTaskEnv` 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.
wrap it with as many wrappers as you want by calling ``env = wrapper(env, *args, **kwargs)`` repeatedly.
For example, here is how you would wrap an environment to enforce that reset is called before step or render:
......@@ -71,11 +71,12 @@ The camera's pose and image resolution can be configured through the
:class:`omni.isaac.orbit.envs.ViewerCfg` class.
.. dropdown:: :fa:`eye,mr-1` Default parameters of the :class:`ViewerCfg` class:
.. dropdown:: Default parameters of the ViewerCfg class:
:icon: code
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/envs/base_env_cfg.py
:language: python
:pyobject: ViewerCfg
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/envs/base_env_cfg.py
:language: python
:pyobject: ViewerCfg
After adjusting the parameters, you can record videos by wrapping the environment with the
......
......@@ -30,30 +30,21 @@ the :class:`ArticulationCfg` that defines the cartpole.
The Code
~~~~~~~~
The tutorial corresponds to the ``cartpole.py`` script in the
``orbit/source/standalone/tutorials/01_assets`` directory.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
:language: python
:linenos:
The Code Explained
~~~~~~~~~~~~~~~~~~
Creating the Cartpole Articulation
-----------------------------------
In Orbit, we define an :class:`Articulation` by constructing its
configuration :class:`ArticulationCfg`. In the following sections we will break
down each part of the configuration.
.. dropdown:: :fa:`eye,mr-1` Code for USD import configuration
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
.. dropdown:: Code for USD import configuration
:icon: code
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
:language: python
:linenos:
The Code Explained
~~~~~~~~~~~~~~~~~~
Importing Cartpole's USD
^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -63,9 +54,10 @@ The next chunk of code handles the USD import of the Cartpole:
* Defining the rigid body properties of the Cartpole
* Defining properties of the root of the Cartpole
.. dropdown:: :fa:`eye,mr-1` Code for USD import configuration
.. dropdown:: Code for USD import configuration
:icon: code
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
:language: python
:start-after: # USD file configuration
:end-before: # Initial state definition
......@@ -85,7 +77,7 @@ case ``cartpole.usd`` is included in the Nucleus server.
.. TODO: Document Nucleus server somewhere or link it if docs exist
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
:language: python
:start-after: # Location of USD file
:end-before: # Rigid body properties
......@@ -104,7 +96,7 @@ environment. The settings we want to modify in this example are:
.. TODO: Either go into more detail here, or add tutorial on rigid body properties
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
:language: python
:start-after: # Rigid body properties
:end-before: # Articulation root properties
......@@ -119,7 +111,7 @@ example, we will spawn the Cartpole at the origin of the XY plane at a Z height
of 2.0 meters. The cart's joints will default to 0.0 as defined by the ``joint_pos``
parameter.
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
:language: python
:start-after: # Initial state definition
:end-before: # Actuators definition
......@@ -131,73 +123,7 @@ The cartpole articulation has two actuators, one corresponding to each joint
``cart_to_pole`` and ``slider_to_cart``. for more details on actuators, see
:ref:`feature-actuators`.
.. literalinclude:: ../../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit/omni/isaac/orbit/assets/config/cartpole.py
:language: python
:start-after: # Actuators definition
:end-before: # End cartpole articulation configuration
Putting it all together
-----------------------
Finally, let's handle the main portion of the the script where the scene is
created, the robot is spawned and the simulation loop lives.
:meth:`design_scene` adds a ground plane and a light to the scene.
Scene Setup
-----------
In this section, the :class:``SimulationContext`` is initialized,
the camera view is set, the ground plane and lights are spawned:
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
:language: python
:start-after: def main():
:end-before: # spawn cartpole articulation
Spawning the Cartpole
^^^^^^^^^^^^^^^^^^^^^
The last step to finalize the scene is to spawn the :class:`Articulation`.
We configure the prim path that the Cartpole will be spawned to within the USD
stage. Because we only have 1 robot in this toy example ``/World/Robot`` is
suitable:
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
:language: python
:start-after: # spawn cartpole articulation
:end-before: # Play the simulator
When using other pre-defined :class:`ArticulationCfg` (e.g. Anymal, Franka,
etc.), you can use :class:`replace` as in this example to update parameters
without having to update the source code.
Finally, the simulator is reset (as this is necessary to initialize PhysX handles)
and we are ready to run the simulation loop.
Running the simulation loop
---------------------------
This part should be familiar from the previous tutorials, where we run the
simulation loop and update the joint data for the cartpole to it's defaults.
We set the ``cart_to_pole`` joint to ``pi / 8`` here to ensure that the pole
is not perfectly vertical at the start of the simulation which would result
in a static simulation.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
:language: python
:start-after: # Simulation loop
:end-before: # End simulation loop
The Code Execution
~~~~~~~~~~~~~~~~~~
Now that we have gone through the code, let's run the script and see the
result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/01_assets/articulation.py
This should open a stage with a single cartpole. The simulation should be
playing with the pole swinging freely.
How to Guides
=============
This document provides an overview of the How-To-Guides available in the Orbit Software documentation. Each guide focuses on a specific aspect of the software and provides step-by-step instructions to help you get started.
.. _sim-control-objects:
Custom Articulations
--------------------
The `assets` section includes guides that help you develop your own Articulations as opposed to using those included in Orbit.
.. toctree::
:maxdepth: 1
Creating your own Articulation: Cartpole <01_assets/cartpole>
Sensors
-------
The `sensors` section focuses on guides related to perception and sensing capabilities in the Orbit Software.
These guides will help you understand how to use sensors, such as cameras and depth sensors, to perceive the environment and extract useful information for your applications.
.. toctree::
:maxdepth: 1
Cameras <02_sensors/camera>
Ray-Casters <02_sensors/ray_caster>
Ray-Caster Camera <02_sensors/ray_caster_camera>
Frame Transformer <02_sensors/frame_transformer>
Sensors on Articulated Robots <02_sensors/sensors_on_robot>
Markers
-------
The `markers` section focuses on how to add different visualization markers in the Orbit Software.
.. toctree::
:maxdepth: 1
Markers <03_markers/markers>
Control
-------
The `control` section focuses on how to implement controllers within Orbit.
.. toctree::
:maxdepth: 1
Markers <04_controllers/ik_controller>
Please refer to the individual guides in each section for detailed instructions and examples.
Gym
---
.. toctree::
:maxdepth: 1
Gym Wrappers <05_gym/wrappers>
......@@ -116,7 +116,7 @@ following command in the terminal:
.. code:: bash
./orbit.sh --format # or `./orbit.sh -f`
./orbit.sh --format # or "./orbit.sh -f"
Contributing Documentation
--------------------------
......@@ -143,7 +143,7 @@ builds the documentation using the ``docs/Makefile``:
.. code:: bash
./orbit.sh --docs # or `./orbit.sh -d`
./orbit.sh --docs # or "./orbit.sh -d"
The documentation is generated in the ``docs/_build`` directory. To view the documentation, open
the ``index.html`` file in the ``html`` directory. This can be done by running the following command
......
......@@ -55,10 +55,11 @@ been deprecated in favor of the new ``UsdLuxLightAPI`` API. In the new API the a
are prefixed with ``inputs:``. For example, the ``intensity`` attribute is now available as
``inputs:intensity``.
The following example shows how to create a `SphereLight` using the old API and
The following example shows how to create a sphere light using the old API and
the new API.
.. dropdown:: :fa:`eye,mr-1` Code for Isaac Sim 2022.2.1 and below
.. dropdown:: Code for Isaac Sim 2022.2.1 and below
:icon: code
.. code-block:: python
......@@ -71,7 +72,8 @@ the new API.
attributes={"radius": 2.5, "intensity": 600.0, "color": (0.75, 0.75, 0.75)},
)
.. dropdown:: :fa:`eye,mr-1` Code for Isaac Sim 2023.1.0 and above
.. dropdown:: Code for Isaac Sim 2023.1.0 and above
:icon: code
.. code-block:: python
......
......@@ -96,8 +96,9 @@ The ``orbit`` repository is structured as follows:
│   │   └── omni.isaac.orbit_tasks
│   │   └── omni.isaac.contrib_tasks
│   ├── standalone
│   │   ├── demo
│   │   ├── demos
│   │   ├── environments
│   │   ├── tutorials
│   │   └── workflows
│   └── tools
└── VERSION
......
......@@ -88,7 +88,7 @@ On a new terminal (**Ctrl+Alt+T**), run the following:
.. code:: bash
# note: you can pass the argument `--help` to see all arguments possible.
# note: you can pass the argument "--help" to see all arguments possible.
${ISAACSIM_PATH}/isaac-sim.sh
- Check that the simulator runs from a standalone python script:
......@@ -183,7 +183,7 @@ running the following on your terminal:
.. code:: bash
# note: execute the command from where the `orbit.sh` executable exists
# note: execute the command from where the "orbit.sh" executable exists
# option1: for bash users
echo -e "alias orbit=$(pwd)/orbit.sh" >> ${HOME}/.bashrc
# option2: for zshell users
......@@ -216,16 +216,16 @@ use the following command:
.. code:: bash
# Option 1: Default name for conda environment is 'orbit'
./orbit.sh --conda # or `./orbit.sh -c`
./orbit.sh --conda # or "./orbit.sh -c"
# Option 2: Custom name for conda environment
./orbit.sh --conda my_env # or `./orbit.sh -c my_env`
./orbit.sh --conda my_env # or "./orbit.sh -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 orbit # or `conda activate my_env`
conda activate orbit # or "conda activate my_env"
Once you are in the virtual environment, you do not need to use ``./orbit.sh -p``
to run python scripts. You can use the default python executable in your environment
......@@ -250,7 +250,7 @@ To build all the extensions, run the following commands:
.. code:: bash
./orbit.sh --install # or `./orbit.sh -i`
./orbit.sh --install # or "./orbit.sh -i"
- For installing all other dependencies (such as learning
frameworks), execute:
......@@ -258,10 +258,10 @@ To build all the extensions, run the following commands:
.. code:: bash
# Option 1: Install all dependencies
./orbit.sh --extra # or `./orbit.sh -e`
./orbit.sh --extra # or "./orbit.sh -e"
# Option 2: Install only a subset of dependencies
# note: valid options are 'rl_games', 'rsl_rl', 'sb3', 'robomimic', 'all'
./orbit.sh --extra rsl_rl # or `./orbit.sh -e rsl_rl
./orbit.sh --extra rsl_rl # or "./orbit.sh -e rsl_r"
Verifying the installation
......
Running existing scripts
========================
API Demos
---------
Showroom
--------
The main core interface extension in Orbit ``omni.isaac.orbit`` provides
the main modules for actuators, objects, robots and sensors. We provide
a list of demo scripts. These showcase how to use the provided interfaces
within a code in a minimal way.
A few quick demo scripts to run and checkout:
- Spawn different quadrupeds, visualize feet markers, and make
robots stand using position commands:
a list of demo scripts and tutorials. These showcase how to use the provided
interfaces within a code in a minimal way.
.. code:: bash
./orbit.sh -p source/standalone/demo/play_quadrupeds.py
A few quick showroom scripts to run and checkout:
- Spawn multiple Franka arms and apply random joint position commands:
- Spawn different quadrupeds and make robots stand using position commands:
.. code:: bash
./orbit.sh -p source/standalone/demo/play_arms.py --robot franka_panda
./orbit.sh -p source/standalone/demos/quadrupeds.py
- Spawn multiple robots and control them using inverse kinematics
controller:
- Spawn different arms and apply random joint position commands:
.. code:: bash
./orbit.sh -p source/standalone/demo/play_ik_control.py --robot franka_panda --num_envs 128
./orbit.sh -p source/standalone/demos/arms.py
- Spawn a camera and visualize the obtained pointcloud:
- Spawn multiple markers that are useful for visualizations:
.. code:: bash
# CPU
./orbit.sh -p source/standalone/demo/play_camera.py
# GPU
./orbit.sh -p source/standalone/demo/play_camera.py --gpu
./orbit.sh -p source/standalone/demos/markers.py
Environments
------------
Workflows
---------
With Orbit, we also provide a suite of benchmark environments included
in the ``omni.isaac.orbit_tasks`` extension. We use the OpenAI Gym registry
......
......@@ -14,11 +14,12 @@ an initial understanding of working with the simulator.
The Code
~~~~~~~~
The tutorial corresponds to the ``empty.py`` script in the ``orbit/source/standalone/tutorials/00_sim`` directory.
The tutorial corresponds to the ``create_empty.py`` script in the ``orbit/source/standalone/tutorials/00_sim`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for ``empty.py``
.. dropdown:: Code for create_empty.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/empty.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/create_empty.py
:language: python
:emphasize-lines: 18-30,34-38,44-48,51,56-58,71
:linenos:
......@@ -44,7 +45,7 @@ For this tutorial, we mainly look at adding the command-line options to a user-d
to it. These include launching the app headless, configuring different Livestream options,
and enabling off-screen rendering.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/empty.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/create_empty.py
:language: python
:lines: 18-30
:linenos:
......@@ -59,7 +60,7 @@ Isaac Sim and other libraries. Here we import two modules:
* `carb`_: A library that provides various microservices and diagnostics utilities in Omniverse.
* :mod:`omni.isaac.orbit.sim`: A sub-package in Orbit for all the core simulator-related operations.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/empty.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/create_empty.py
:language: python
:lines: 36-38
:linenos:
......@@ -76,13 +77,13 @@ simulation.
In Orbit, the :class:`sim.SimulationContext` class inherits from Isaac Sim's
:class:`omni.isaac.core.simulation_context.SimulationContext` to allow configuring the simulation
through Python's `dataclass` object and handle certain intricacies of the simulation stepping.
through Python's ``dataclass`` object and handle certain intricacies of the simulation stepping.
For this tutorial, we set the physics and rendering time step to 0.01 seconds. This is done
by passing these quantities to the :class:`sim.SimulationCfg`, which is then used to create an
instance of the simulation context.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/empty.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/create_empty.py
:language: python
:lines: 44-48
:linenos:
......@@ -117,7 +118,7 @@ while the simulation app is running. The method :meth:`sim.SimulationContext.ste
which dictates whether the step includes updating the rendering-related events or not. By default, this flag is
set to True.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/empty.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/create_empty.py
:language: python
:lines: 56-58
:linenos:
......@@ -130,7 +131,7 @@ Lastly, the simulation application is stopped and its window is closed by callin
:meth:`omni.isaac.kit.SimulationApp.close` method. We do this operation under a try-catch
statement to close the app gracefully in case an error happens.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/empty.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/create_empty.py
:language: python
:lines: 70-71
:linenos:
......@@ -144,7 +145,7 @@ Now that we have gone through the code, let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/00_sim/empty.py
./orbit.sh -p source/standalone/tutorials/00_sim/create_empty.py
The simulation should be playing, and the stage should be rendering. To stop the simulation,
......@@ -156,7 +157,7 @@ following:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/00_sim/empty.py --headless
./orbit.sh -p source/standalone/tutorials/00_sim/create_empty.py --headless
Now that we have a basic understanding of how to run a simulation, let's move on to the
......
......@@ -14,13 +14,13 @@ demonstrates how to spawn a ground plane, lights, primitive shapes, and meshes f
The Code
~~~~~~~~
The tutorial corresponds to the ``prims.py`` script in the ``orbit/source/standalone/tutorials/00_sim`` directory.
The tutorial corresponds to the ``spawn_prims.py`` script in the ``orbit/source/standalone/tutorials/00_sim`` directory.
Let's take a look at the Python script:
.. dropdown:: Code for prims.py
.. dropdown:: Code for spawn_prims.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:emphasize-lines: 43-82, 95
:linenos:
......@@ -85,7 +85,7 @@ Spawning a ground plane
The :class:`sim.spawners.GroundPlaneCfg` configures a grid-like ground plane with modifiable properties such as its
appearance and size.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:lines: 45-47
:linenos:
......@@ -99,7 +99,7 @@ It is possible to spawn `different light prims`_ into the stage. These include d
lights, and cylinder lights. In this tutorial, we spawn a distant light which is a light that is infinitely far away
from the scene and shines in a single direction.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:lines: 49-54
:linenos:
......@@ -113,7 +113,7 @@ Before spawning primitive shapes, we introduce the concept of a transform prim o
contains only transformation properties. It is used to group other prims under it and to transform them as a group.
Here we make an Xform prim to group all the primitive shapes under it.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:lines: 56-57
:linenos:
......@@ -125,7 +125,7 @@ physics properties, and material properties of the cone. By default, the physics
The first two cones we spawn ``Cone1`` and ``Cone2`` are visual elements and do not have physics enabled.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:lines: 58-65
:linenos:
......@@ -135,7 +135,7 @@ For the third cone ``ConeRigid``, we add rigid body physics to it by setting the
class. Through these attributes, we can specify the mass, friction, and restitution of the cone. If unspecified, they
default to the default values set by USD Physics.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:lines: 67-78
:linenos:
......@@ -149,14 +149,14 @@ Lastly, it is possible to spawn prims from other file formats such as other USD,
we spawn a USD file of a table into the scene. The table is a mesh prim and has a material prim associated with it.
All of this information is stored in its USD file.
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/prims.py
.. literalinclude:: ../../../../source/standalone/tutorials/00_sim/spawn_prims.py
:language: python
:lines: 80-82
:linenos:
:lineno-start: 80
The table above is added as a reference to the scene. In layman terms, this means that the table is not actually added
to the scene, but a `pointer` to the table asset is added. This allows us to modify the table asset and have the changes
to the scene, but a ``pointer`` to the table asset is added. This allows us to modify the table asset and have the changes
reflected in the scene in a non-destructive manner. For example, we can change the material of the table without
actually modifying the underlying file for the table asset directly. Only the changes are stored in the USD stage.
......@@ -168,7 +168,7 @@ Similar to the tutorial before, to run the script, execute the following command
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/00_sim/prims.py
./orbit.sh -p source/standalone/tutorials/00_sim/spawn_prims.py
Once the simulation starts, you should see a window with a ground plane, a light, some cones, and a table.
The green cone, which has rigid body physics enabled, should fall and collide with the table and the ground
......
......@@ -16,13 +16,13 @@ robot.
The Code
~~~~~~~~
The tutorial corresponds to the ``articulation.py`` script in the ``orbit/source/standalone/tutorials/01_assets``
The tutorial corresponds to the ``run_articulation.py`` script in the ``orbit/source/standalone/tutorials/01_assets``
directory.
.. dropdown:: Code for articulation.py
.. dropdown:: Code for run_articulation.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_articulation.py
:language: python
:emphasize-lines: 58-69, 92-103, 103-105, 111, 125-127, 133
:linenos:
......@@ -48,7 +48,7 @@ create this configuration object is provided in the :ref:`how-to-create-articula
As seen in the previous tutorial, we can spawn the articulation into the scene in a similar fashion by creating
an instance of the :class:`assets.Articulation` class by passing the configuration object to its constructor.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_articulation.py
:language: python
:lines: 58-69
:linenos:
......@@ -72,7 +72,7 @@ To reset the articulation, we first set the root state by calling the :meth:`Art
method. Similarly, we set the joint states by calling the :meth:`Articulation.write_joint_state_to_sim` method.
Finally, we call the :meth:`Articulation.reset` method to reset any internal buffers and caches.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_articulation.py
:language: python
:lines: 92-103
:linenos:
......@@ -96,7 +96,7 @@ At every step, we randomly sample joint efforts and set them to the articulation
:meth:`Articulation.write_data_to_sim` method to write the data to the PhysX buffer. Finally, we step
the simulation.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/articulation.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_articulation.py
:language: python
:lines: 108-112
:linenos:
......@@ -123,7 +123,7 @@ To run the code and see the results, let's run the script from the terminal:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/01_assets/articulation.py
./orbit.sh -p source/standalone/tutorials/01_assets/run_articulation.py
This command should open a stage with a ground plane, lights, and two cart-poles that are moving around randomly.
......
......@@ -13,12 +13,12 @@ with a rigid object. For this, we will use the :class:`assets.RigidObject` class
The Code
~~~~~~~~
The tutorial corresponds to the ``rigid_object.py`` script in the ``orbit/source/standalone/tutorials/01_assets`` directory.
The tutorial corresponds to the ``run_rigid_object.py`` script in the ``orbit/source/standalone/tutorials/01_assets`` directory.
.. dropdown:: Code for rigid_object.py
.. dropdown:: Code for run_rigid_object.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/rigid_object.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_rigid_object.py
:language: python
:emphasize-lines: 59-78, 80-82, 102-112, 115-118, 122-123, 136-138, 143-144
:linenos:
......@@ -61,7 +61,7 @@ each of the ``/World/Origin{i}`` locations. For instance, if ``/World/Origin1``
present in the scene, the rigid object prims are spawned at the locations ``/World/Origin1/Cone`` and
``/World/Origin2/Cone`` respectively.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/rigid_object.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_rigid_object.py
:language: python
:lines: 59-78
:linenos:
......@@ -71,7 +71,7 @@ Since we want to interact with the rigid object, we pass this entity back to the
is then used to interact with the rigid object in the simulation loop. In later tutorials, we will see a more
convenient way to handle multiple scene entities using the :class:`scene.InteractiveScene` class.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/rigid_object.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_rigid_object.py
:language: python
:lines: 80-82
:linenos:
......@@ -101,7 +101,7 @@ attribute, which we left as identity in this tutorial. We then randomize the tra
set the desired state of the rigid object prim using the :meth:`assets.RigidObject.write_root_state_to_sim` method.
As the name suggests, this method writes the root state of the rigid object prim into the simulation buffer.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/rigid_object.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_rigid_object.py
:language: python
:lines: 102-112
:linenos:
......@@ -114,7 +114,7 @@ Before stepping the simulation, we perform the :meth:`assets.RigidObject.write_d
writes other data, such as external forces, into the simulation buffer. In this tutorial, we do not apply any
external forces to the rigid object, so this method is not necessary. However, it is included for completeness.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/rigid_object.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_rigid_object.py
:language: python
:lines: 115-116
:linenos:
......@@ -126,7 +126,7 @@ Updating the state
After stepping the simulation, we update the internal buffers of the rigid object prims to reflect their new state
inside the :class:`assets.RigidObject.data` attribute. This is done using the :meth:`assets.RigidObject.update` method.
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/rigid_object.py
.. literalinclude:: ../../../../source/standalone/tutorials/01_assets/run_rigid_object.py
:language: python
:lines: 122-123
:linenos:
......@@ -140,7 +140,7 @@ Now that we have gone through the code, let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/01_assets/rigid_object.py
./orbit.sh -p source/standalone/tutorials/01_assets/run_rigid_object.py
This should open a stage with a ground plane, lights, and several green cones. The cones must be dropping from
......
......@@ -33,13 +33,13 @@ become more useful in the future as more assets and sensors are added to the sce
The Code
~~~~~~~~
This tutorial corresponds to the ``scene_creation.py`` script within
``orbit/source/standalone/tutorials/03_scene``.
This tutorial corresponds to the ``create_scene.py`` script within
``orbit/source/standalone/tutorials/02_scene``.
.. dropdown:: Code for scene_creation.py
.. dropdown:: Code for create_scene.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/03_scene/scene_creation.py
.. literalinclude:: ../../../../source/standalone/tutorials/02_scene/create_scene.py
:language: python
:emphasize-lines: 51-64, 69-71, 92-93, 100-101, 106-107, 117-119
:linenos:
......@@ -62,7 +62,7 @@ to create the scene.
For the cartpole example, we specify the same scene as in the previous tutorial, but list
them now in the configuration class :class:`CartpoleSceneCfg` instead of manually spawning them.
.. literalinclude:: ../../../../source/standalone/tutorials/03_scene/scene_creation.py
.. literalinclude:: ../../../../source/standalone/tutorials/02_scene/create_scene.py
:language: python
:lines: 51-64
:linenos:
......@@ -109,7 +109,7 @@ object to its constructor. While creating the configuration instance of ``Cartpo
we specify how many environment copies we want to create using the ``num_envs`` argument.
This will be used to clone the scene for each environment.
.. literalinclude:: ../../../../source/standalone/tutorials/03_scene/scene_creation.py
.. literalinclude:: ../../../../source/standalone/tutorials/02_scene/create_scene.py
:language: python
:lines: 117-119
:linenos:
......@@ -124,7 +124,7 @@ scene elements can be accessed from the :class:`InteractiveScene` object using t
entity. The key is specified through the configuration class for each entity. For example,
the cartpole is specified using the key ``"cartpole"`` in the configuration class.
.. literalinclude:: ../../../../source/standalone/tutorials/03_scene/scene_creation.py
.. literalinclude:: ../../../../source/standalone/tutorials/02_scene/create_scene.py
:language: python
:lines: 69-71
:linenos:
......@@ -133,12 +133,6 @@ the cartpole is specified using the key ``"cartpole"`` in the configuration clas
Running the simulation loop
---------------------------
.. literalinclude:: ../../../../source/standalone/tutorials/03_scene/scene_creation.py
:language: python
:emphasize-lines: 15-16, 18, 28
:start-after: # Simulation loop
:end-before: # End simulation loop
The rest of the script looks similar to previous scripts that interfaced with :class:`assets.Articulation`,
with a few small differences in the methods called:
......@@ -158,7 +152,7 @@ the ``--num_envs`` argument to the script.
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/03_scene/scene_creation.py --num_envs 32
./orbit.sh -p source/standalone/tutorials/02_scene/create_scene.py --num_envs 32
This should open a stage with 32 cartpoles swinging around randomly. You can use the
mouse to rotate the camera and the arrow keys to move around the scene.
......
......@@ -24,13 +24,13 @@ in creating a new :class:`envs.BaseEnv` environment.
The Code
~~~~~~~~
The tutorial corresponds to the ``cartpole_base_env`` script in the ``orbit/source/standalone/tutorials/04_envs``
The tutorial corresponds to the ``create_cartpole_base_env`` script in the ``orbit/source/standalone/tutorials/03_envs``
directory.
.. dropdown:: Code for cartpole_base_env.py
.. dropdown:: Code for create_cartpole_base_env.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_base_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
:emphasize-lines: 51-55, 58-75, 78-111, 114-133, 138-142, 147, 151, 156-157, 163-164
:linenos:
......@@ -76,7 +76,7 @@ different control schemes for different aspects of the environment.
In the cartpole environment, we want to control the force applied to the cart to balance the pole.
Thus, we will create an action term that controls the force applied to the cart.
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_base_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
:pyobject: ActionsCfg
:linenos:
......@@ -108,7 +108,7 @@ callable class that computes the observation for that term. It includes other pa
defining the noise model, clipping, scaling, etc. However, we leave these parameters to their
default values for this tutorial.
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_base_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
:pyobject: ObservationsCfg
:linenos:
......@@ -138,7 +138,7 @@ For this example, we randomize the pole's mass on startup. This is done only onc
is expensive and we don't want to do it on every reset. We also randomize the initial joint state of
the cartpole and the pole at every reset.
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_base_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
:pyobject: RandomizationCfg
:linenos:
......@@ -156,7 +156,7 @@ parameters such as the timestep, gravity, etc. This is initialized to the defaul
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.
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_base_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
:pyobject: CartpoleEnvCfg
:linenos:
......@@ -176,7 +176,7 @@ The :class:`envs.BaseEnv` class does not have any notion of terminations since t
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.
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_base_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/create_cartpole_base_env.py
:language: python
:pyobject: main
:linenos:
......@@ -196,7 +196,7 @@ To run the base environment made in this tutorial, you can use the following com
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/04_envs/cartpole_base_env.py --num_envs 32
./orbit.sh -p source/standalone/tutorials/03_envs/create_cartpole_base_env.py --num_envs 32
This should open a stage with a ground plane, light source, and cartpoles. The simulation should be
......@@ -208,16 +208,16 @@ To stop the simulation, you can either close the window, or press ``Ctrl+C`` in
started the simulation.
In this tutorial, we learned about the different managers that help define a base environment. We
include more examples of defining the base environment in the ``orbit/source/standalone/tutorials/04_envs``
include more examples of defining the base environment in the ``orbit/source/standalone/tutorials/03_envs``
directory. For completion, they can be run using the following commands:
.. code-block:: bash
# Floating cube environment with custom action term for PD control
./orbit.sh -p source/standalone/tutorials/04_envs/cube_base_env.py --num_envs 32
./orbit.sh -p source/standalone/tutorials/03_envs/create_cube_base_env.py --num_envs 32
# Quadrupedal locomotion environment with a policy that interacts with the environment
./orbit.sh -p source/standalone/tutorials/04_envs/quadruped_base_env.py --num_envs 32
./orbit.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
......
......@@ -39,15 +39,15 @@ For this tutorial, we use the cartpole environment defined in ``omni.isaac.orbit
:emphasize-lines: 63-68, 124-149, 152-162, 165-169, 187-192
:linenos:
The script for running the environment ``cartpole_rl_env.py`` is present in the
``orbit/source/standalone/tutorials/04_envs`` directory. The script is similar to the
The script for running the environment ``run_cartpole_rl_env.py`` is present in the
``orbit/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`.
.. dropdown:: Code for cartpole_rl_env.py
.. dropdown:: Code for run_cartpole_rl_env.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_rl_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/run_cartpole_rl_env.py
:language: python
:emphasize-lines: 46-50, 64-65
:linenos:
......@@ -164,13 +164,13 @@ only with the added RL components explained in the above sections.
Running the simulation loop
---------------------------
Coming back to the ``cartpole_rl_env.py`` script, the simulation loop is similar to the previous tutorial.
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
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.
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_rl_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/run_cartpole_rl_env.py
:language: python
:pyobject: main
:linenos:
......@@ -180,11 +180,11 @@ such as the reward contribution from individual terms, the termination status of
The Code Execution
~~~~~~~~~~~~~~~~~~
Similar to the previous tutorial, we can run the environment by executing the ``cartpole_rl_env.py`` script.
Similar to the previous tutorial, we can run the environment by executing the ``run_cartpole_rl_env.py`` script.
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/04_envs/cartpole_rl_env.py --num_envs 32
./orbit.sh -p source/standalone/tutorials/03_envs/run_cartpole_rl_env.py --num_envs 32
This should open a similar simulation as in the previous tutorial. However, this time, the environment
......
......@@ -10,7 +10,7 @@ class.
.. dropdown:: Environment creation in the previous tutorial
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/04_envs/cartpole_rl_env.py
.. literalinclude:: ../../../../source/standalone/tutorials/03_envs/run_cartpole_rl_env.py
:language: python
:lines: 39-50
......
Spawn Sensors on a Robot in Orbit
=================================
Adding Sensors on a Robot
=========================
This tutorial demonstrates how to simulate various sensors onboard the quadruped robot ANYmal-C (ANYbotics) using the ORBIT framework. The included sensors are:
......@@ -12,11 +12,13 @@ Please review their how-to guides before proceeding with this guide.
The Code
~~~~~~~~
The tutorial corresponds to the ``sensors_on_robot.py`` script in the ``orbit/source/standalone/tutorials/02_sensors`` directory.
The tutorial corresponds to the ``add_sensors_on_robot.py`` script in the
``orbit/source/standalone/tutorials/04_sensors`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for `sensors_on_robot.py`
.. dropdown:: Code for add_sensors_on_robot.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/sensors_on_robot.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
:language: python
:emphasize-lines: 72-90, 116-123, 125-139, 150-151
:linenos:
......@@ -26,8 +28,8 @@ The Code Explained
~~~~~~~~~~~~~~~~~~
The script designs a scene with a ground plane, lights, and two instances of the ANYmal-C robot.
This guide will not explain the individual sensors; please refer to their corresponding how-to guides for more details (see :ref:`Height-Scanner How-to-Guide <_how_to_ray_caster_label>` and :ref:`Camera How-to-Guide <_how_to_camera_label>`).
Furthermore, how to spawn such an articualted robot in the scene is explained in the :ref:`Articulation How-to-Guide <_how_to_articulation_label>`.
This guide will not explain the individual sensors; please refer to their corresponding how-to guides for more details (see :ref:`Height-Scanner How-to-Guide <how_to_ray_caster_label>` and :ref:`Camera How-to-Guide <how_to_camera_label>`).
Furthermore, how to spawn such an articulated robot in the scene is explained in the :ref:`Articulation How-to-Guide <how_to_articulation_label>`.
In the following, we will detail the ``add_sensor`` function, which is responsible for adding the sensors on the robot.
The ``run_simulator`` function updates the sensors and provides some information on them.
......@@ -42,7 +44,7 @@ The resulting configurations and initialization calls are shown below.
Camera sensor:
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/sensors_on_robot.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
:language: python
:lines: 88-102
:linenos:
......@@ -50,7 +52,7 @@ Camera sensor:
Height scanner sensor:
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/sensors_on_robot.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
:language: python
:lines: 103-114
:linenos:
......@@ -58,7 +60,7 @@ Height scanner sensor:
Contact sensor:
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/sensors_on_robot.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
:language: python
:lines: 115-120
:linenos:
......@@ -66,7 +68,7 @@ Contact sensor:
Please note that the buffers, physics handles for the camera and robot, and other aspects are initialized when the simulation is played. Thus, we must call ``sim.reset()``.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/sensors_on_robot.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
:language: python
:lines: 181-182
:linenos:
......@@ -78,7 +80,7 @@ Running the simulation loop
For every simulation step, the sensors are updated and we print some information.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/sensors_on_robot.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
:language: python
:lines: 150-168
:linenos:
......@@ -92,7 +94,7 @@ Now that we have gone through the code let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/02_sensors/sensors_on_robot.py
./orbit.sh -p source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
This command should open a stage with a ground plane, lights, and two quadrupedal robots.
......
.. _how_to_frame_transformer_label:
Using the Frame Transformer Sensor in Orbit
===========================================
Using the Frame Transformer
===========================
This tutorial demonstrates using the :class:`FrameTransformer` sensor in the ORBIT framework.
The :class:`FrameTransformer` sensor is used to report the transformation of one or more frames (target frames) with respect to another frame (source frame)
......@@ -10,11 +11,13 @@ The :class:`FrameTransformer` sensor is used to report the transformation of one
The Code
~~~~~~~~
The tutorial corresponds to the ``frame_transformer.py`` script in the ``orbit/source/standalone/tutorials/02_sensors`` directory.
The tutorial corresponds to the ``run_frame_transformer.py`` script in the
``orbit/source/standalone/tutorials/04_sensors`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for `frame_transformer.py`
.. dropdown:: Code for run_frame_transformer.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/frame_transformer.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_frame_transformer.py
:language: python
:emphasize-lines: 72-90, 116-123, 125-139, 150-151
:linenos:
......@@ -38,7 +41,7 @@ The source frame is the frame with respect to which the translations are reporte
We can specify a list of frames for the target frames and include regex patterns to match multiple frames.
In some cases, the target frame is not an individual prim; its relation to a "parent" prim can be defined over an offset.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/frame_transformer.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_frame_transformer.py
:language: python
:lines: 72-90
:linenos:
......@@ -46,7 +49,7 @@ In some cases, the target frame is not an individual prim; its relation to a "pa
Please note that the buffers, physics handles for the robot, and other aspects are initialized when the simulation is played. Thus, we must call ``sim.reset()``.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/frame_transformer.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_frame_transformer.py
:language: python
:lines: 150-151
:linenos:
......@@ -58,7 +61,7 @@ Running the simulation loop
After each step call, we must update the frame transformer sensor to get the latest transforms.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/frame_transformer.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_frame_transformer.py
:language: python
:lines: 116-123
:linenos:
......@@ -66,7 +69,7 @@ After each step call, we must update the frame transformer sensor to get the lat
To visualize the transforms, we visualize a different frame in a regular interval based on the transform reported by the sensor.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/frame_transformer.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_frame_transformer.py
:language: python
:lines: 125-139
:linenos:
......@@ -80,7 +83,7 @@ Now that we have gone through the code let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/02_sensors/frame_transformer.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_frame_transformer.py
This should open a stage with a ground plane, lights, and a quadrupedal robot. Consistently, one frame should be visualized.
......
.. _how_to_ray_caster_label:
Using the Ray-Caster Sensor in Orbit
====================================
Using the Ray-Caster
====================
This tutorial demonstrates using the :class:`RayCaster` sensor from the Orbit framework.
Here, we present its usability as a height-scanner, but it can also be used as LiDAR or for any other purpose achieved by ray-casting.
......@@ -10,11 +11,13 @@ Here, we present its usability as a height-scanner, but it can also be used as L
The Code
~~~~~~~~
The tutorial corresponds to the ``ray_caster.py`` script in the ``orbit/source/standalone/tutorials/02_sensors`` directory.
The tutorial corresponds to the ``run_ray_caster.py`` script in the
``orbit/source/standalone/tutorials/04_sensors`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for `ray_caster.py`
.. dropdown:: Code for run_ray_caster.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster.py
:language: python
:emphasize-lines: 84-94, 100-117, 137-138, 118-123
:linenos:
......@@ -33,7 +36,7 @@ Adding the ray-caster sensor
As usual, the ray-caster is defined over its config class, :class:`RayCasterCfg`.
Unlike the Camera sensor, the ray-caster operates as a virtual sensor and does not require instantiation within the scene. Instead, it is solely attached to a prim, employed to specify its location, along with a potential offset. This attachment allows the ray-caster to cast a predetermined pattern of rays against a mesh.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster.py
:language: python
:lines: 84-94
:linenos:
......@@ -41,7 +44,7 @@ Unlike the Camera sensor, the ray-caster operates as a virtual sensor and does n
Please note that the buffers, physics handles for the RigidObject, and other aspects are initialized when the simulation is played. Thus, we must call ``sim.reset()``.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster.py
:language: python
:lines: 137-138
:linenos:
......@@ -57,7 +60,7 @@ Running the simulation loop
In this tutorial, we step the simulation and reset the position of the spheres to initial random positions. For a detailed explanation of the simulation loop, please refer to the :ref:`RigidObject How-to-Guide <_how_to_rigid_objects_label>`.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster.py
:language: python
:lines: 100-117
:linenos:
......@@ -65,7 +68,7 @@ In this tutorial, we step the simulation and reset the position of the spheres t
For the ray-caster sensor, we execute the ray-casting operation. Here, we also time this operation to give an impression of how much time such operations require.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster.py
:language: python
:lines: 118-123
:linenos:
......@@ -78,7 +81,7 @@ Now that we have gone through the code let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/02_sensors/ray_caster.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_ray_caster.py
This command should open a stage with a ground plane, lights, and some spheres first falling and then rolling on rough terrain with a raycaster pattern next to them.
......
Using the Ray-Caster Camera Sensor in Orbit
===========================================
Using the Ray-Caster Camera
===========================
This tutorial demonstrates using the :class:`RayCasterCamera` sensor as a depth camera from the Orbit framework.
We already saw how to use the USD camera sensor (see :ref:`Camera How-to-Guide <_how_to_camera_label>`) and the ray-caster sensor when used as a height scanner (see :ref:`Height Scanner How-to-Guide <_how_to_ray_caster_label>`).
We already saw how to use the USD camera sensor (see :ref:`Camera How-to-Guide <how_to_camera_label>`) and the ray-caster sensor when used as a height scanner (see :ref:`Height Scanner How-to-Guide <how_to_ray_caster_label>`).
As the current implementation of the ray-caster is faster and more memory efficient than the USD camera sensor, it is a good alternative when only geometric information is required.
The interfaces for both cameras are identical, including the data buffers they use. However, the initialization configuration differs slightly as no spawn configuration is required for the ray-caster camera.
The Code
~~~~~~~~
The tutorial corresponds to the ``ray_caster_camera.py`` script in the ``orbit/source/standalone/tutorials/02_sensors`` directory.
The tutorial corresponds to the ``run_ray_caster_camera.py`` script in the
``orbit/source/standalone/tutorials/04_sensors`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for `ray_caster_camera.py`
.. dropdown:: Code for run_ray_caster_camera.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
:language: python
:emphasize-lines: 68-88,94-106,111-145,156-157
:linenos:
......@@ -33,7 +35,7 @@ Like the ray-casting-based height scanner and unlike the USD camera, the ray-cas
For the ray-caster camera, we specify the pinhole camera pattern. The pattern config includes the camera intrinsics and the image dimension, which will define the direction of the rays.
Other parameters are defined in the general config, as they are independent of the pattern. These include data types, offset, or the mesh to be ray-casted against.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
:language: python
:lines: 68-88
:linenos:
......@@ -41,7 +43,7 @@ Other parameters are defined in the general config, as they are independent of t
Please note that the buffers and other aspects are initialized when the simulation is played. Thus, we must call ``sim.reset()``.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/ray_caster_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
:language: python
:lines: 156-157
:linenos:
......@@ -57,7 +59,7 @@ Running the simulation loop
In this tutorial, we step the simulation and efficiently render and save the camera images. To save the images, we use the Replicator BasicWriter (more information `here <www.docs.omniverse.nvidia.com/isaacsim/latest/replicator_tutorials/tutorial_replicator_recorder.html?highlight=basic%20writer#writer-parameters>`_).
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
:language: python
:lines: 94-96
:linenos:
......@@ -65,13 +67,13 @@ In this tutorial, we step the simulation and efficiently render and save the cam
The camera's position and orientation can be set within the config by defining the offset relative to the parent frame. Alternatively, we can set the position and orientation of the camera directly in the scene. In this example, we provide two options for the latter: either by providing the camera center and a target point (:meth:`RayCasterCamera:set_world_poses_from_view`) or by providing the camera center and a rotation quaternion (:meth:`RayCasterCamera:set_world_poses_from_view`). To allow for maximum flexibility, the provided quaternions can be provided in three conventions:
* `"opengl"` - forward axis: -Z - up axis +Y - OpenGL (Usd.Camera) convention
* `"ros"` - forward axis: +Z - up axis -Y - ROS convention
* `"world"` - forward axis: +X - up axis +Z - World Frame convention
* ``"opengl"`` - forward axis: -Z - up axis +Y - OpenGL (Usd.Camera) convention
* ``"ros"`` - forward axis: +Z - up axis -Y - ROS convention
* ``"world"`` - forward axis: +X - up axis +Z - World Frame convention
This behavior is the same as for the USD camera.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
:language: python
:lines: 98-106
:linenos:
......@@ -79,7 +81,7 @@ This behavior is the same as for the USD camera.
While stepping the simulator, we update the camera and write the images to the defined folder. Therefore, we first convert them to numpy arrays before packing them in a dictionary, which the BasicWriter can handle.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
:language: python
:lines: 111-145
:linenos:
......@@ -93,7 +95,7 @@ Now that we have gone through the code let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/02_sensors/ray_caster_camera.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
This call should open a stage with a ground plane, lights, and a visualization of the points where the rays hit the mesh.
......
.. _how_to_camera_label:
Using the Camera Sensor in Orbit
=================================
Using the Camera Sensor
=======================
This tutorial demonstrates using the :class:`Camera` from the Orbit framework. The camera sensor is created and interfaced through the Omniverse Replicator API.
......@@ -9,11 +10,13 @@ This tutorial demonstrates using the :class:`Camera` from the Orbit framework. T
The Code
~~~~~~~~
The tutorial corresponds to the ``usd_camera.py`` script in the ``orbit/source/standalone/tutorials/02_sensors`` directory.
The tutorial corresponds to the ``run_usd_camera.py`` script in the
``orbit/source/standalone/tutorials/04_sensors`` directory.
.. dropdown:: :fa:`eye,mr-1` Code for `usd_camera.py`
.. dropdown:: Code for run_usd_camera.py
:icon: code
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:emphasize-lines: 102-112,113-114,121-123,125-133,135-139,140-141,155-179,181-215
:linenos:
......@@ -31,7 +34,7 @@ Adding the camera sensor
As Orbit is a config-driven framework, the camera is defined over its config class, :class:`CameraCfg`. Whereas parameters that do not depend on the used camera type are direct arguments of this class, all camera type-related arguments are defined in the spawn config. With the camera type, we refer to either PinholeCamera or FisheyeCamera. The type-independent parameters are, e.g., the data types to capture (e.g., "rgb," "distance_to_image_plane," "normals," "motion_vectors," "semantic_segmentation"), the width and height of the image and its offset. The spawn configurations defined parameters such as the aperture or the focus distance. These are given together with all other spawn-related configs under :class:`PinholeCameraCfg` and :class:`FisheyeCameraCfg`.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 102-112
:linenos:
......@@ -39,7 +42,7 @@ As Orbit is a config-driven framework, the camera is defined over its config cla
While in previous how-to guides, we had to manually call the function to spawn the object into the scene, sensors already include this functionality when initialized. Consequently, we only have to pass the ``camera_cfg`` to the :class:`Camera` class.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 113-114
:linenos:
......@@ -47,7 +50,7 @@ While in previous how-to guides, we had to manually call the function to spawn t
Please note that the Replicator Render Products, camera buffers and other aspects are initialized when the simulation is played. Thus, we must call ``sim.play()`` before rendering camera images.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 140-141
:linenos:
......@@ -59,7 +62,7 @@ Running the simulation loop
In this tutorial, we step the simulation and efficiently render and save the camera images. To save the images, we use the Replicator BasicWriter (more information `here <www.docs.omniverse.nvidia.com/isaacsim/latest/replicator_tutorials/tutorial_replicator_recorder.html?highlight=basic%20writer#writer-parameters>`_).
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 121-123
:linenos:
......@@ -67,11 +70,11 @@ In this tutorial, we step the simulation and efficiently render and save the cam
The camera's position and orientation can be set within the config by defining the offset relative to the parent frame. Alternatively, we can set the position and orientation of the camera directly in the scene. In this example, we provide two options for the latter: either by providing the camera center and a target point (:meth:`Camera:set_world_poses_from_view`) or by providing the camera center and a rotation quaternion (:meth:`Camera:set_world_poses_from_view`). To allow for maximum flexibility, the provided quaternions can be provided in three conventions:
* `"opengl"` - forward axis: -Z - up axis +Y - OpenGL (Usd.Camera) convention
* `"ros"` - forward axis: +Z - up axis -Y - ROS convention
* `"world"` - forward axis: +X - up axis +Z - World Frame convention
* ``"opengl"`` - forward axis: -Z - up axis +Y - OpenGL (Usd.Camera) convention
* ``"ros"`` - forward axis: +Z - up axis -Y - ROS convention
* ``"world"`` - forward axis: +X - up axis +Z - World Frame convention
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 125-133
:linenos:
......@@ -79,7 +82,7 @@ The camera's position and orientation can be set within the config by defining t
While stepping the simulator, we write the images to the defined folder. Therefore, we first convert them to numpy arrays before packing them in a dictionary, which the BasicWriter can handle.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 155-179
:linenos:
......@@ -87,7 +90,7 @@ While stepping the simulator, we write the images to the defined folder. Therefo
In addition, we provide the functionality to project the depth image into 3D space. This reprojection is done by using the camera intrinsics and the depth image. The resulting point cloud is visualized using the ``_debug_draw`` extension of Isaac Sim.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 181-215
:linenos:
......@@ -97,7 +100,7 @@ In addition, we provide the functionality to project the depth image into 3D spa
For all replicator buffers to be filled with the latest data, we may need to render the simulation multiple times.
.. literalinclude:: ../../../../source/standalone/tutorials/02_sensors/usd_camera.py
.. literalinclude:: ../../../../source/standalone/tutorials/04_sensors/run_usd_camera.py
:language: python
:lines: 135-139
:linenos:
......@@ -110,7 +113,7 @@ Now that we have gone through the code, let's run the script and see the result:
.. code-block:: bash
./orbit.sh -p source/standalone/tutorials/02_sensors/usd_camera.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_usd_camera.py
This should open a stage with a ground plane, lights, and some slowly falling down objects.
......
Tutorials
=========
Welcome to the Orbit tutorials! These tutorials provide a step-by-step guide to help you understand
and use various features of the framework. We recommend that you go through the tutorials in the
order they are listed here.
All the tutorials are written as Python scripts. You can find the source code for each tutorial in
the ``source/standalone/tutorials`` directory of the Orbit repository.
.. note::
We would love to extend the tutorials to cover more topics and use cases, so please let us know if
you have any suggestions.
Setting up a Simple Simulation
------------------------------
These tutorials show you how to launch the simulation with different settings and spawn objects in the
simulated scene. They cover the following APIs: :class:`~omni.isaac.orbit.app.AppLauncher`,
:class:`~omni.isaac.orbit.sim.SimulationContext`, and :class:`~omni.isaac.orbit.sim.spawners`.
.. toctree::
:maxdepth: 1
:titlesonly:
00_sim/launch_app
00_sim/create_empty
00_sim/spawn_prims
Interacting with Assets
-----------------------
Having spawned objects in the scene, these tutorials show you how to create physics handles for these
objects and interact with them. These revolve around the :class:`~omni.isaac.orbit.assets.AssetBase`
class and its derivatives such as :class:`~omni.isaac.orbit.assets.RigidObject` and
:class:`~omni.isaac.orbit.assets.Articulation`.
.. toctree::
:maxdepth: 1
:titlesonly:
01_assets/run_rigid_object
01_assets/run_articulation
Creating a Scene
----------------
With the basic concepts of the framework covered, the tutorials move to a more intuitive scene
interface that uses the :class:`~omni.isaac.orbit.scene.InteractiveScene` class. This class
provides a higher level abstraction for creating scenes easily.
.. toctree::
:maxdepth: 1
:titlesonly:
02_scene/create_scene
Designing an Environment
------------------------
The following tutorials introduce the concept of environments: :class:`~omni.isaac.orbit.envs.BaseEnv`
and its derivative :class:`~omni.isaac.orbit.envs.RLTaskEnv`. These environments bring-in together
different aspects of the framework to create a simulation environment for agent interaction.
.. toctree::
:maxdepth: 1
:titlesonly:
03_envs/create_base_env
03_envs/create_rl_env
03_envs/register_rl_env_gym
03_envs/run_rl_training
Integrating Sensors
-------------------
The following tutorials show you how to integrate sensors into the simulation environment. These
tutorials introduce the :class:`~omni.isaac.orbit.sensors.SensorBase` class and its derivatives
such as :class:`~omni.isaac.orbit.sensors.FrameTransformer` and :class:`~omni.isaac.orbit.sensors.RayCaster`.
.. toctree::
:maxdepth: 1
:titlesonly:
04_sensors/add_sensors_on_robot
04_sensors/run_frame_transformer
04_sensors/run_ray_caster
04_sensors/run_ray_caster_camera
04_sensors/run_usd_camera
Using Motion Generators
-----------------------
While the robots in the simulation environment can be controlled at the joint-level, the following
tutorials show you how to use motion generators to control the robots at the task-level.
.. toctree::
:maxdepth: 1
:titlesonly:
05_controllers/ik_controller
......@@ -288,8 +288,8 @@ Changed
Fixed
^^^^^
* Changed the reference of private `_body_view` variable inside the :class:`RigidObject` class
to the public `body_view` property. For a rigid object, the private variable is not defined.
* Changed the reference of private ``_body_view`` variable inside the :class:`RigidObject` class
to the public ``body_view`` property. For a rigid object, the private variable is not defined.
0.9.38 (2023-11-07)
......@@ -546,14 +546,14 @@ Added
class for all asset converters.
* Added :class:`omni.issac.orbit.sim.converters.mesh_converter.MeshConverter` to handle loading and conversion
of mesh files (OBJ, STL and FBX) into USD format.
* Added script `convert_mesh.py` to ``source/tools`` to allow users to convert a mesh to USD via command line arguments.
* Added script ``convert_mesh.py`` to ``source/tools`` to allow users to convert a mesh to USD via command line arguments.
Changed
^^^^^^^
* Renamed the submodule :mod:`omni.isaac.orbit.sim.loaders` to :mod:`omni.isaac.orbit.sim.converters` to be more
general with the functionality of the module.
* Updated `check_instanceable.py` script to convert relative paths to absolute paths.
* Updated ``check_instanceable.py`` script to convert relative paths to absolute paths.
0.9.17 (2023-10-22)
......@@ -660,14 +660,14 @@ Added
Added
^^^^^
* Added `livestream` and `ros` CLI args to :class:`omni.isaac.orbit.app.AppLauncher` class.
* Added ``--livestream`` and ``--ros`` CLI args to :class:`omni.isaac.orbit.app.AppLauncher` class.
* Added a static function :meth:`omni.isaac.orbit.app.AppLauncher.add_app_launcher_args`, which
appends the arguments needed for :class:`omni.isaac.orbit.app.AppLauncher` to the argument parser.
Changed
^^^^^^^
* Within :class:`omni.isaac.orbit.app.AppLauncher`, removed `REMOTE_DEPLOYMENT` env-var processing
* Within :class:`omni.isaac.orbit.app.AppLauncher`, removed ``REMOTE_DEPLOYMENT`` env-var processing
in the favor of ``HEADLESS`` and ``LIVESTREAM`` env-vars. These have clearer uses and better parity
with the CLI args.
......
......@@ -8,7 +8,7 @@
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/00_sim/empty.py
./orbit.sh -p source/standalone/tutorials/00_sim/create_empty.py
"""
......
......@@ -9,7 +9,7 @@ This script demonstrates how to run IsaacSim via the AppLauncher
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/00_sim/applauncher.py
./orbit.sh -p source/standalone/tutorials/00_sim/launch_app.py
"""
......@@ -44,7 +44,6 @@ simulation_app = app_launcher.app
import traceback
import carb
import omni.isaac.core.utils.prims as prim_utils
import omni.isaac.orbit.sim as sim_utils
......@@ -62,15 +61,13 @@ def design_scene():
)
cfg_light_distant.func("/World/lightDistant", cfg_light_distant, translation=(1, 0, 10))
# create a new xform prim for all objects to be spawned under
prim_utils.create_prim("/World/Objects", "Xform")
# spawn a cuboid
cfg_cuboid = sim_utils.CuboidCfg(
size=[args_cli.size] * 3,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 1.0, 1.0)),
)
# Spawn cuboid, altering translation on the z-axis to scale to its size
cfg_cuboid.func("/World/Objects/Cuboid1", cfg_cuboid, translation=(0.0, 0.0, args_cli.size / 2))
cfg_cuboid.func("/World/Object", cfg_cuboid, translation=(0.0, 0.0, args_cli.size / 2))
def main():
......
......@@ -4,13 +4,13 @@
# SPDX-License-Identifier: BSD-3-Clause
"""
This script demonstrates how to generate outputs in the Orbit Docker such that
they are easily retrievable.
This script demonstrates how to generate log outputs while the simulation plays.
It accompanies the tutorial on docker usage.
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/00_sim/docker.py
./orbit.sh -p source/standalone/tutorials/00_sim/log_time.py
"""
......@@ -23,7 +23,7 @@ import os
from omni.isaac.orbit.app import AppLauncher
# create argparser
parser = argparse.ArgumentParser(description="Tutorial on using Orbit with Docker")
parser = argparse.ArgumentParser(description="Tutorial on creating logs from within the docker container.")
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# parse the arguments
......
......@@ -8,7 +8,7 @@
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/00_sim/objects.py
./orbit.sh -p source/standalone/tutorials/00_sim/spawn_prims.py
"""
......
......@@ -8,7 +8,7 @@
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/01_assets/articulation.py
./orbit.sh -p source/standalone/tutorials/01_assets/run_articulation.py
"""
......@@ -22,7 +22,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="This script demonstrates how to spawn and interact with an articulation.")
parser = argparse.ArgumentParser(description="Tutorial on spawning and interacting with an articulation.")
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# parse the arguments
......
......@@ -4,12 +4,12 @@
# SPDX-License-Identifier: BSD-3-Clause
"""
This script demonstrates how to import and use the YCB objects in Orbit
This script demonstrates how to create a rigid object and interact with it.
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/01_assets/rigid_objects.py
./orbit.sh -p source/standalone/tutorials/01_assets/run_rigid_object.py
"""
......@@ -23,7 +23,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="Load YCB objects in Orbit and randomize their poses.")
parser = argparse.ArgumentParser(description="Tutorial on spawning and interacting with a rigid object.")
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# parse the arguments
......
......@@ -3,12 +3,12 @@
#
# SPDX-License-Identifier: BSD-3-Clause
"""This script demonstrates how to use the interactive scene interface to quickly setup a scene with multiple prims.
"""This script demonstrates how to use the interactive scene interface to setup a scene with multiple prims.
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/03_scene/scene_creation.py --num_envs 32
./orbit.sh -p source/standalone/tutorials/03_scene/create_scene.py --num_envs 32
"""
......@@ -22,7 +22,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="This script demonstrates how to use the scene interface.")
parser = argparse.ArgumentParser(description="Tutorial on using the interactive scene interface.")
parser.add_argument("--num_envs", type=int, default=2, help="Number of environments to spawn.")
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
......
......@@ -18,7 +18,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="This script demonstrates a simple cartpole environment.")
parser = argparse.ArgumentParser(description="Tutorial on creating a cartpole base environment.")
parser.add_argument("--num_envs", type=int, default=16, help="Number of environments to spawn.")
# append AppLauncher cli args
......
......@@ -27,7 +27,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="This script demonstrates base environment with a floating cube.")
parser = argparse.ArgumentParser(description="Tutorial on creating a floating cube environment.")
parser.add_argument("--num_envs", type=int, default=64, help="Number of environments to spawn.")
# append AppLauncher cli args
......
......@@ -27,7 +27,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="This script demonstrates a quadrupedal locomotion environment.")
parser = argparse.ArgumentParser(description="Tutorial on creating a quadruped base environment.")
parser.add_argument("--num_envs", type=int, default=64, help="Number of environments to spawn.")
# append AppLauncher cli args
......
......@@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause
"""
This script demonstrates how to call the RL environment for the cartpole balancing task.
This script demonstrates how to run the RL environment for the cartpole balancing task.
"""
from __future__ import annotations
......@@ -17,7 +17,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(description="This script demonstrates the RL environment for cartpole balancing.")
parser = argparse.ArgumentParser(description="Tutorial on running the cartpole RL environment.")
parser.add_argument("--num_envs", type=int, default=16, help="Number of environments to spawn.")
# append AppLauncher cli args
......
......@@ -4,18 +4,18 @@
# SPDX-License-Identifier: BSD-3-Clause
"""
This script demonstrates how to simulate sensors onboard the quadruped robot ANYmal-C (ANYbotics).
This script demonstrates how to add and simulate on-board sensors for a robot.
We include the following sensors:
We add the following sensors on the quadruped robot, ANYmal-C (ANYbotics):
* USD-Camera
* Height Scanner
* Contact Sensor
* USD-Camera: This is a camera sensor that is attached to the robot's base.
* Height Scanner: This is a height scanner sensor that is attached to the robot's base.
* Contact Sensor: This is a contact sensor that is attached to the robot's feet.
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/02_sensors/sensors_on_robot.py
./orbit.sh -p source/standalone/tutorials/04_sensors/add_sensors_on_robot.py
"""
......@@ -29,9 +29,7 @@ import argparse
from omni.isaac.orbit.app import AppLauncher
# add argparse arguments
parser = argparse.ArgumentParser(
description="This script demonstrates how to simulate a legged robot with onboard sensors."
)
parser = argparse.ArgumentParser(description="Tutorial on adding sensors on a robot.")
# append AppLauncher cli args
AppLauncher.add_app_launcher_args(parser)
# parse the arguments
......
......@@ -9,7 +9,7 @@ This script demonstrates the FrameTransformer sensor by visualizing the frames t
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/tutorials/02_sensors/frame_transformer.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_frame_transformer.py
"""
......
......@@ -4,12 +4,12 @@
# SPDX-License-Identifier: BSD-3-Clause
"""
This script demonstartes how to use the ray-caster sensor.
This script demonstrates how to use the ray-caster sensor.
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/how_to_guides/02_sensors/ray_caster.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_ray_caster.py
"""
......
......@@ -11,7 +11,7 @@ The camera sensor is based on using Warp kernels which do ray-casting against st
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/how_to_guides/02_sensors/ray_caster_camera.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_ray_caster_camera.py
"""
......
......@@ -12,7 +12,7 @@ the simulator or OpenGL convention for the camera, we use the robotics or ROS co
.. code-block:: bash
# Usage
./orbit.sh -p source/standalone/how_to_guides/02_sensors/usd_camera.py
./orbit.sh -p source/standalone/tutorials/04_sensors/run_usd_camera.py
"""
......
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