Unverified Commit 3149af00 authored by Mayank Mittal's avatar Mayank Mittal Committed by GitHub

Renames Gym Envs related extensions to Tasks (#228)

# Description

Since there is a lot of confusion and debate around what is a scene vs.
environment vs. task, this MR makes it explicit that Gym/RL-related
definitions are always called "tasks". Thus, the corresponding
extensions are renamed from `orbit_envs` to `orbit_tasks`.

Fixes #143

## Type of change

- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- This change requires a documentation update

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
parent 137f836d
...@@ -20,8 +20,8 @@ import sys ...@@ -20,8 +20,8 @@ import sys
sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit")) sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit"))
sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit/omni/isaac/orbit")) sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit/omni/isaac/orbit"))
sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit_envs")) sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit_tasks"))
sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs")) sys.path.insert(0, os.path.abspath("../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks"))
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
......
...@@ -25,13 +25,13 @@ omni.isaac.orbit extension ...@@ -25,13 +25,13 @@ omni.isaac.orbit extension
orbit.utils.mdp orbit.utils.mdp
orbit.compat orbit.compat
omni.isaac.orbit_envs extension omni.isaac.orbit_tasks extension
------------------------------- --------------------------------
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
orbit_envs.isaac_env orbit_tasks.isaac_env
orbit_envs.utils orbit_tasks.utils
orbit_envs.utils.data_collector orbit_tasks.utils.data_collector
orbit_envs.utils.wrappers orbit_tasks.utils.wrappers
omni.isaac.orbit_envs.isaac_env omni.isaac.orbit_tasks.isaac_env
=============================== ================================
We use OpenAI Gym registry to register the environment and their default configuration file. We use OpenAI Gym registry to register the environment and their default configuration file.
The default configuration file is passed to the argument "kwargs" in the Gym specification registry. The default configuration file is passed to the argument "kwargs" in the Gym specification registry.
...@@ -18,8 +18,8 @@ class. This is done using the function :meth:`load_default_env_cfg` in the sub-m ...@@ -18,8 +18,8 @@ class. This is done using the function :meth:`load_default_env_cfg` in the sub-m
.. code-block:: python .. code-block:: python
import gym import gym
import omni.isaac.orbit_envs import omni.isaac.orbit_tasks
from omni.isaac.orbit_envs.utils.parse_cfg import load_default_env_cfg from omni.isaac.orbit_tasks.utils.parse_cfg import load_default_env_cfg
task_name = "Isaac-Cartpole-v0" task_name = "Isaac-Cartpole-v0"
cfg = load_default_env_cfg(task_name) cfg = load_default_env_cfg(task_name)
...@@ -27,7 +27,7 @@ class. This is done using the function :meth:`load_default_env_cfg` in the sub-m ...@@ -27,7 +27,7 @@ class. This is done using the function :meth:`load_default_env_cfg` in the sub-m
All environments must inherit from :class:`IsaacEnv` class which is defined in the sub-module All environments must inherit from :class:`IsaacEnv` class which is defined in the sub-module
:mod:`omni.isaac.orbit_envs.isaac_env`. :mod:`omni.isaac.orbit_tasks.isaac_env`.
The main methods that needs to be implemented by an inherited environment class: The main methods that needs to be implemented by an inherited environment class:
* :meth:`_design_scene`: Design the template environment for cloning. * :meth:`_design_scene`: Design the template environment for cloning.
...@@ -47,7 +47,7 @@ The action and observation space correspond to single environment (and not vecto ...@@ -47,7 +47,7 @@ The action and observation space correspond to single environment (and not vecto
Base Environment Base Environment
---------------- ----------------
.. automodule:: omni.isaac.orbit_envs.isaac_env .. automodule:: omni.isaac.orbit_tasks.isaac_env
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
...@@ -57,7 +57,7 @@ Base Environment ...@@ -57,7 +57,7 @@ Base Environment
Base Configuration Base Configuration
--------------------- ---------------------
.. automodule:: omni.isaac.orbit_envs.isaac_env_cfg .. automodule:: omni.isaac.orbit_tasks.isaac_env_cfg
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
omni.isaac.orbit_envs.utils.data_collector omni.isaac.orbit_tasks.utils.data_collector
========================================== ==========================================
All post-processed robomimic compatible datasets share the same data structure. A single dataset is a All post-processed robomimic compatible datasets share the same data structure. A single dataset is a
...@@ -16,7 +16,7 @@ The following sample shows how to use the ``robomimic`` data collector: ...@@ -16,7 +16,7 @@ The following sample shows how to use the ``robomimic`` data collector:
import os import os
import torch import torch
from omni.isaac.orbit_envs.utils.data_collector import RobomimicDataCollector from omni.isaac.orbit_tasks.utils.data_collector import RobomimicDataCollector
# name of the environment (needed by robomimic) # name of the environment (needed by robomimic)
task_name = "Isaac-Franka-Lift-v0" task_name = "Isaac-Franka-Lift-v0"
...@@ -73,7 +73,7 @@ The following sample shows how to use the ``robomimic`` data collector: ...@@ -73,7 +73,7 @@ The following sample shows how to use the ``robomimic`` data collector:
collector_interface.close() collector_interface.close()
.. automodule:: omni.isaac.orbit_envs.utils.data_collector .. automodule:: omni.isaac.orbit_tasks.utils.data_collector
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
omni.isaac.orbit_envs.utils omni.isaac.orbit_tasks.utils
=============================== ===============================
.. automodule:: omni.isaac.orbit_envs.utils .. automodule:: omni.isaac.orbit_tasks.utils
:members: :members:
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
omni.isaac.orbit_envs.utils.wrappers omni.isaac.orbit_tasks.utils.wrappers
==================================== ====================================
Wrappers allow you to modify the behavior of an environment without modifying the environment itself. Wrappers allow you to modify the behavior of an environment without modifying the environment itself.
...@@ -14,7 +14,7 @@ environment instance to the wrapper constructor. For instance, to wrap an enviro ...@@ -14,7 +14,7 @@ environment instance to the wrapper constructor. For instance, to wrap an enviro
.. code-block:: python .. code-block:: python
from omni.isaac.orbit_envs.utils.wrappers.sb3 import Sb3VecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.sb3 import Sb3VecEnvWrapper
env = Sb3VecEnvWrapper(env) env = Sb3VecEnvWrapper(env)
...@@ -28,27 +28,27 @@ environment instance to the wrapper constructor. For instance, to wrap an enviro ...@@ -28,27 +28,27 @@ environment instance to the wrapper constructor. For instance, to wrap an enviro
RL-Games Wrapper RL-Games Wrapper
---------------- ----------------
.. automodule:: omni.isaac.orbit_envs.utils.wrappers.rl_games .. automodule:: omni.isaac.orbit_tasks.utils.wrappers.rl_games
:members: :members:
:show-inheritance: :show-inheritance:
RSL-RL Wrapper RSL-RL Wrapper
-------------- --------------
.. automodule:: omni.isaac.orbit_envs.utils.wrappers.rsl_rl .. automodule:: omni.isaac.orbit_tasks.utils.wrappers.rsl_rl
:members: :members:
:show-inheritance: :show-inheritance:
SKRL Wrapper SKRL Wrapper
------------ ------------
.. automodule:: omni.isaac.orbit_envs.utils.wrappers.skrl .. automodule:: omni.isaac.orbit_tasks.utils.wrappers.skrl
:members: :members:
:show-inheritance: :show-inheritance:
Stable-Baselines3 Wrapper Stable-Baselines3 Wrapper
------------------------- -------------------------
.. automodule:: omni.isaac.orbit_envs.utils.wrappers.sb3 .. automodule:: omni.isaac.orbit_tasks.utils.wrappers.sb3
:members: :members:
:show-inheritance: :show-inheritance:
...@@ -15,19 +15,19 @@ Extension containing the core framework of Orbit. ...@@ -15,19 +15,19 @@ Extension containing the core framework of Orbit.
:start-line: 3 :start-line: 3
omni.isaac.orbit_envs omni.isaac.orbit_tasks
--------------------- ----------------------
Extension containing the environments built using Orbit. Extension containing the environments built using Orbit.
.. include:: ../../../source/extensions/omni.isaac.orbit_envs/docs/CHANGELOG.rst .. include:: ../../../source/extensions/omni.isaac.orbit_tasks/docs/CHANGELOG.rst
:start-line: 3 :start-line: 3
omni.isaac.contrib_envs omni.isaac.contrib_tasks
----------------------- ------------------------
Extension for environments contributed by the community. Extension for environments contributed by the community.
.. include:: ../../../source/extensions/omni.isaac.contrib_envs/docs/CHANGELOG.rst .. include:: ../../../source/extensions/omni.isaac.contrib_tasks/docs/CHANGELOG.rst
:start-line: 3 :start-line: 3
...@@ -68,7 +68,7 @@ argument to the :class:`SimulationContext` class. For example, to increase the s ...@@ -68,7 +68,7 @@ argument to the :class:`SimulationContext` class. For example, to increase the s
sim = SimulationContext(sim_params={"gpu_found_lost_pairs_capacity": 4096}) sim = SimulationContext(sim_params={"gpu_found_lost_pairs_capacity": 4096})
These settings are also directly exposed through the :class:`PhysxCfg` class in the ``omni.isaac.orbit_envs`` These settings are also directly exposed through the :class:`PhysxCfg` class in the ``omni.isaac.orbit_tasks``
extension, which can be used to configure the simulation engine. Please see the documentation for extension, which can be used to configure the simulation engine. Please see the documentation for
:class:`PhysxCfg` for more details. :class:`PhysxCfg` for more details.
......
...@@ -90,8 +90,8 @@ The ``orbit`` repository is structured as follows: ...@@ -90,8 +90,8 @@ The ``orbit`` repository is structured as follows:
├── source ├── source
│   ├── extensions │   ├── extensions
│   │   ├── omni.isaac.orbit │   │   ├── omni.isaac.orbit
│   │   └── omni.isaac.orbit_envs │   │   └── omni.isaac.orbit_tasks
│   │   └── omni.isaac.contrib_envs │   │   └── omni.isaac.contrib_tasks
│   ├── standalone │   ├── standalone
│   │   ├── demo │   │   ├── demo
│   │   ├── environments │   │   ├── environments
...@@ -227,7 +227,7 @@ The ``source/standalone`` directory contains various standalone applications des ...@@ -227,7 +227,7 @@ The ``source/standalone`` directory contains various standalone applications des
provided by ``orbit``. These applications are written in python and are structured as follows: provided by ``orbit``. These applications are written in python and are structured as follows:
* **demo**: Contains various demo applications that showcase the core framework ``omni.isaac.orbit``. * **demo**: Contains various demo applications that showcase the core framework ``omni.isaac.orbit``.
* **environments**: Contains applications for running environments defined in ``omni.isaac.orbit_envs`` with different agents. * **environments**: Contains applications for running environments defined in ``omni.isaac.orbit_tasks`` with different agents.
These include a random policy, zero-action policy, teleoperation or scripted state machines. These include a random policy, zero-action policy, teleoperation or scripted state machines.
* **workflows**: Contains applications for using environments with various learning-based frameworks. These include different * **workflows**: Contains applications for using environments with various learning-based frameworks. These include different
reinforcement learning or imitation learning libraries. reinforcement learning or imitation learning libraries.
...@@ -44,7 +44,7 @@ Environments ...@@ -44,7 +44,7 @@ Environments
------------ ------------
With Orbit, we also provide a suite of benchmark environments included With Orbit, we also provide a suite of benchmark environments included
in the ``omni.isaac.orbit_envs`` extension. We use the OpenAI Gym registry in the ``omni.isaac.orbit_tasks`` extension. We use the OpenAI Gym registry
to register these environments. For each environment, we provide a default to register these environments. For each environment, we provide a default
configuration file that defines the scene, observations, rewards and action spaces. configuration file that defines the scene, observations, rewards and action spaces.
...@@ -141,7 +141,7 @@ format. ...@@ -141,7 +141,7 @@ format.
.. code:: bash .. code:: bash
# install python module (for robomimic) # install python module (for robomimic)
./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_envs[robomimic]' ./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_tasks[robomimic]'
# split data # split data
./orbit.sh -p source/standalone//workflows/robomimic/tools/split_train_val.py logs/robomimic/Isaac-Lift-Franka-v0/hdf_dataset.hdf5 --ratio 0.2 ./orbit.sh -p source/standalone//workflows/robomimic/tools/split_train_val.py logs/robomimic/Isaac-Lift-Franka-v0/hdf_dataset.hdf5 --ratio 0.2
...@@ -171,7 +171,7 @@ from the environments into the respective libraries function argument and return ...@@ -171,7 +171,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash .. code:: bash
# install python module (for stable-baselines3) # install python module (for stable-baselines3)
./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_envs[sb3]' ./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_tasks[sb3]'
# run script for training # run script for training
# note: we enable cpu flag since SB3 doesn't optimize for GPU anyway # note: we enable cpu flag since SB3 doesn't optimize for GPU anyway
./orbit.sh -p source/standalone/workflows/sb3/train.py --task Isaac-Cartpole-v0 --headless --cpu ./orbit.sh -p source/standalone/workflows/sb3/train.py --task Isaac-Cartpole-v0 --headless --cpu
...@@ -184,7 +184,7 @@ from the environments into the respective libraries function argument and return ...@@ -184,7 +184,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash .. code:: bash
# install python module (for skrl) # install python module (for skrl)
./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_envs[skrl]' ./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_tasks[skrl]'
# run script for training # run script for training
./orbit.sh -p source/standalone/workflows/skrl/train.py --task Isaac-Reach-Franka-v0 --headless ./orbit.sh -p source/standalone/workflows/skrl/train.py --task Isaac-Reach-Franka-v0 --headless
# run script for playing with 32 environments # run script for playing with 32 environments
...@@ -196,7 +196,7 @@ from the environments into the respective libraries function argument and return ...@@ -196,7 +196,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash .. code:: bash
# install python module (for rl-games) # install python module (for rl-games)
./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_envs[rl_games]' ./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_tasks[rl_games]'
# run script for training # run script for training
./orbit.sh -p source/standalone/workflows/rl_games/train.py --task Isaac-Ant-v0 --headless ./orbit.sh -p source/standalone/workflows/rl_games/train.py --task Isaac-Ant-v0 --headless
# run script for playing with 32 environments # run script for playing with 32 environments
...@@ -208,7 +208,7 @@ from the environments into the respective libraries function argument and return ...@@ -208,7 +208,7 @@ from the environments into the respective libraries function argument and return
.. code:: bash .. code:: bash
# install python module (for rsl-rl) # install python module (for rsl-rl)
./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_envs[rsl_rl]' ./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_tasks[rsl_rl]'
# run script for training # run script for training
./orbit.sh -p source/standalone/workflows/rsl_rl/train.py --task Isaac-Reach-Franka-v0 --headless ./orbit.sh -p source/standalone/workflows/rsl_rl/train.py --task Isaac-Reach-Franka-v0 --headless
# run script for playing with 32 environments # run script for playing with 32 environments
......
Running an RL environment Running an RL environment
========================= =========================
In this tutorial, we will learn how to run existing learning environments provided in the ``omni.isaac.orbit_envs`` In this tutorial, we will learn how to run existing learning environments provided in the ``omni.isaac.orbit_tasks``
extension. All the environments included in Orbit follow the ``gym.Env`` interface, which means that they can be used extension. All the environments included in Orbit follow the ``gym.Env`` interface, which means that they can be used
with any reinforcement learning framework that supports OpenAI Gym. However, since the environments are implemented with any reinforcement learning framework that supports OpenAI Gym. However, since the environments are implemented
in a vectorized fashion, they can only be used with frameworks that support vectorized environments. in a vectorized fashion, they can only be used with frameworks that support vectorized environments.
...@@ -9,7 +9,7 @@ in a vectorized fashion, they can only be used with frameworks that support vect ...@@ -9,7 +9,7 @@ in a vectorized fashion, they can only be used with frameworks that support vect
Many common frameworks come with their own desired definitions of a vectorized environment and require the returned data Many common frameworks come with their own desired definitions of a vectorized environment and require the returned data
to follow their supported data types and data structures. For example, ``stable-baselines3`` uses ``numpy`` arrays, while to follow their supported data types and data structures. For example, ``stable-baselines3`` uses ``numpy`` arrays, while
``rsl-rl``, ``rl-games``, or ``skrl`` use ``torch.Tensor``. We provide wrappers for these different frameworks, which can be found ``rsl-rl``, ``rl-games``, or ``skrl`` use ``torch.Tensor``. We provide wrappers for these different frameworks, which can be found
in the ``omni.isaac.orbit_envs.utils.wrappers`` module. in the ``omni.isaac.orbit_tasks.utils.wrappers`` module.
The Code The Code
...@@ -31,24 +31,24 @@ Using gym registry for environments ...@@ -31,24 +31,24 @@ Using gym registry for environments
All environments are registered using the ``gym`` registry, which means that you can create an instance of All environments are registered using the ``gym`` registry, which means that you can create an instance of
an environment by calling ``gym.make``. The environments are registered in the ``__init__.py`` file of the an environment by calling ``gym.make``. The environments are registered in the ``__init__.py`` file of the
``omni.isaac.orbit_envs`` extension with the following syntax: ``omni.isaac.orbit_tasks`` extension with the following syntax:
.. code-block:: python .. code-block:: python
# Cartpole environment # Cartpole environment
gym.register( gym.register(
id="Isaac-Cartpole-v0", id="Isaac-Cartpole-v0",
entry_point="omni.isaac.orbit_envs.classic.cartpole:CartpoleEnv", entry_point="omni.isaac.orbit_tasks.classic.cartpole:CartpoleEnv",
kwargs={"cfg_entry_point": "omni.isaac.orbit_envs.classic.cartpole:cartpole_cfg.yaml"}, kwargs={"cfg_entry_point": "omni.isaac.orbit_tasks.classic.cartpole:cartpole_cfg.yaml"},
) )
The ``cfg_entry_point`` argument is used to load the default configuration for the environment. The default The ``cfg_entry_point`` argument is used to load the default configuration for the environment. The default
configuration is loaded using the :meth:`omni.isaac.orbit_envs.utils.parse_cfg.load_default_env_cfg` function. configuration is loaded using the :meth:`omni.isaac.orbit_tasks.utils.parse_cfg.load_default_env_cfg` function.
The configuration entry point can correspond to both a YAML file or a python configuration The configuration entry point can correspond to both a YAML file or a python configuration
class. The default configuration can be overridden by passing a custom configuration instance to the ``gym.make`` class. The default configuration can be overridden by passing a custom configuration instance to the ``gym.make``
function as shown later in the tutorial. function as shown later in the tutorial.
To inform the ``gym`` registry with all the environments provided by the ``omni.isaac.orbit_envs`` extension, To inform the ``gym`` registry with all the environments provided by the ``omni.isaac.orbit_tasks`` extension,
we must import the module at the start of the script. we must import the module at the start of the script.
.. literalinclude:: ../../../source/standalone/environments/zero_agent.py .. literalinclude:: ../../../source/standalone/environments/zero_agent.py
...@@ -59,7 +59,7 @@ we must import the module at the start of the script. ...@@ -59,7 +59,7 @@ we must import the module at the start of the script.
.. note:: .. note::
As a convention, we name all the environments in ``omni.isaac.orbit_envs`` extension with the prefix ``Isaac-``. As a convention, we name all the environments in ``omni.isaac.orbit_tasks`` extension with the prefix ``Isaac-``.
For more complicated environments, we follow the pattern: ``Isaac-<TaskName>-<RobotName>-v<N>``, For more complicated environments, we follow the pattern: ``Isaac-<TaskName>-<RobotName>-v<N>``,
where `N` is used to specify different observations or action spaces within the same task definition. For example, where `N` is used to specify different observations or action spaces within the same task definition. For example,
for legged locomotion with ANYmal C, the environment is called ``Isaac-Velocity-Anymal-C-v0``. for legged locomotion with ANYmal C, the environment is called ``Isaac-Velocity-Anymal-C-v0``.
......
...@@ -4,8 +4,8 @@ Creating an environment ...@@ -4,8 +4,8 @@ Creating an environment
In Orbit, we provide a set of environments that are ready to use. However, you may want to create your own In Orbit, we provide a set of environments that are ready to use. However, you may want to create your own
environment for your application. This tutorial will show you how to create a new environment from scratch. environment for your application. This tutorial will show you how to create a new environment from scratch.
As a practice, we maintain all the environments that are *officially* provided in the ``omni.isaac.orbit_envs`` As a practice, we maintain all the environments that are *officially* provided in the ``omni.isaac.orbit_tasks``
extension. It is recommended to add your environment to the extension ``omni.isaac.contrib_envs``. This way, you can extension. It is recommended to add your environment to the extension ``omni.isaac.contrib_tasks``. This way, you can
easily update your environment when the API changes and you can also contribute your environment to the community. easily update your environment when the API changes and you can also contribute your environment to the community.
In this tutorial, we will look at the base class :py:class:`IsaacEnv` and discuss the different methods that you In this tutorial, we will look at the base class :py:class:`IsaacEnv` and discuss the different methods that you
...@@ -60,7 +60,7 @@ The base class :py:class:`IsaacEnv` is defined in the file ``isaac_env.py``: ...@@ -60,7 +60,7 @@ The base class :py:class:`IsaacEnv` is defined in the file ``isaac_env.py``:
.. dropdown:: :fa:`eye,mr-1` Code for `isaac_env.py` .. dropdown:: :fa:`eye,mr-1` Code for `isaac_env.py`
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/isaac_env.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/isaac_env.py
:language: python :language: python
:linenos: :linenos:
...@@ -91,7 +91,7 @@ under the prim path ``/World/defaultGroundPlane`` and optionally, markers for de ...@@ -91,7 +91,7 @@ under the prim path ``/World/defaultGroundPlane`` and optionally, markers for de
.. dropdown:: :fa:`eye,mr-1` Code for `_design_scene` method in `lift_env.py` .. dropdown:: :fa:`eye,mr-1` Code for `_design_scene` method in `lift_env.py`
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/manipulation/lift/lift_env.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/manipulation/lift/lift_env.py
:language: python :language: python
:lines: 75-110 :lines: 75-110
:linenos: :linenos:
...@@ -114,7 +114,7 @@ various buffers corresponding to episode counter, episode reward, history, senso ...@@ -114,7 +114,7 @@ various buffers corresponding to episode counter, episode reward, history, senso
.. dropdown:: :fa:`eye,mr-1` Code for `_reset_idx` method in `lift_env.py` .. dropdown:: :fa:`eye,mr-1` Code for `_reset_idx` method in `lift_env.py`
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/manipulation/lift/lift_env.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/manipulation/lift/lift_env.py
:language: python :language: python
:lines: 112-137 :lines: 112-137
:linenos: :linenos:
...@@ -126,7 +126,7 @@ instances are displaced correctly in the simulation stage (i.e. account for the ...@@ -126,7 +126,7 @@ instances are displaced correctly in the simulation stage (i.e. account for the
An example of this is shown in the :py:meth:`_randomize_object_initial_pose` method for the Lift environment: An example of this is shown in the :py:meth:`_randomize_object_initial_pose` method for the Lift environment:
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/manipulation/lift/lift_env.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/manipulation/lift/lift_env.py
:language: python :language: python
:lines: 298-326 :lines: 298-326
:lineno-start: 298 :lineno-start: 298
...@@ -171,7 +171,7 @@ the simulator at a specified , updates the buffers and sensors, and computes the ...@@ -171,7 +171,7 @@ the simulator at a specified , updates the buffers and sensors, and computes the
.. dropdown:: :fa:`eye,mr-1` Code for `_step_impl` method in `lift_env.py` .. dropdown:: :fa:`eye,mr-1` Code for `_step_impl` method in `lift_env.py`
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/manipulation/lift/lift_env.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/manipulation/lift/lift_env.py
:language: python :language: python
:lines: 139-189 :lines: 139-189
:emphasize-lines: 21-29,42-47 :emphasize-lines: 21-29,42-47
...@@ -197,7 +197,7 @@ found in the `MDP managers <../api/orbit.utils.mdp.html>`_ section. ...@@ -197,7 +197,7 @@ found in the `MDP managers <../api/orbit.utils.mdp.html>`_ section.
.. dropdown:: :fa:`eye,mr-1` Code for `_get_observations` method in `lift_env.py` .. dropdown:: :fa:`eye,mr-1` Code for `_get_observations` method in `lift_env.py`
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/manipulation/lift/lift_env.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/manipulation/lift/lift_env.py
:language: python :language: python
:lines: 191-193 :lines: 191-193
:linenos: :linenos:
...@@ -209,7 +209,7 @@ Registering the environment ...@@ -209,7 +209,7 @@ Registering the environment
Before you can run your environment, you need to register your environment with the OpenAI Gym interface. Before you can run your environment, you need to register your environment with the OpenAI Gym interface.
To register an environment, call the :py:meth:`gym.register` method in the :py:mod:`__init__.py` file of your environment package To register an environment, call the :py:meth:`gym.register` method in the :py:mod:`__init__.py` file of your environment package
(for instance, in ``omni.isaac.contrib_envs.__init__.py``). This has the following components: (for instance, in ``omni.isaac.contrib_tasks.__init__.py``). This has the following components:
* **Name of the environment:** This should ideally be in the format :py:const:`Isaac-\<EnvironmentName\>-\<Robot\>-\<Version\>`. * **Name of the environment:** This should ideally be in the format :py:const:`Isaac-\<EnvironmentName\>-\<Robot\>-\<Version\>`.
However, this is not a strict requirement and you can use any name you want. However, this is not a strict requirement and you can use any name you want.
...@@ -217,11 +217,11 @@ To register an environment, call the :py:meth:`gym.register` method in the :py:m ...@@ -217,11 +217,11 @@ To register an environment, call the :py:meth:`gym.register` method in the :py:m
* **Config entry point:** This is the import path of the environment configuration file. This is used to instantiate the environment configuration. * **Config entry point:** This is the import path of the environment configuration file. This is used to instantiate the environment configuration.
The configuration file can be either a YAML file or a Python dataclass The configuration file can be either a YAML file or a Python dataclass
As examples of this in the ``omni.isaac.orbit_envs`` package, we have the following: As examples of this in the ``omni.isaac.orbit_tasks`` package, we have the following:
.. dropdown:: :fa:`eye,mr-1` Registering an environment with a YAML configuration file .. dropdown:: :fa:`eye,mr-1` Registering an environment with a YAML configuration file
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/__init__.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/__init__.py
:language: python :language: python
:lines: 52-56 :lines: 52-56
:linenos: :linenos:
...@@ -229,7 +229,7 @@ As examples of this in the ``omni.isaac.orbit_envs`` package, we have the follow ...@@ -229,7 +229,7 @@ As examples of this in the ``omni.isaac.orbit_envs`` package, we have the follow
.. dropdown:: :fa:`eye,mr-1` Registering an environment with a Python dataclass configuration file .. dropdown:: :fa:`eye,mr-1` Registering an environment with a Python dataclass configuration file
.. literalinclude:: ../../../source/extensions/omni.isaac.orbit_envs/omni/isaac/orbit_envs/__init__.py .. literalinclude:: ../../../source/extensions/omni.isaac.orbit_tasks/omni/isaac/orbit_tasks/__init__.py
:language: python :language: python
:lines: 84-88 :lines: 84-88
:linenos: :linenos:
...@@ -239,8 +239,8 @@ As examples of this in the ``omni.isaac.orbit_envs`` package, we have the follow ...@@ -239,8 +239,8 @@ As examples of this in the ``omni.isaac.orbit_envs`` package, we have the follow
The Code Execution The Code Execution
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
Now that we have gone through the code, let's run the environment. All environments registered in the ``omni.isaac.orbit_envs`` Now that we have gone through the code, let's run the environment. All environments registered in the ``omni.isaac.orbit_tasks``
and ``omni.isaac.contrib_envs`` packages are automatically available in the included standalone environments and workflows scripts. and ``omni.isaac.contrib_tasks`` packages are automatically available in the included standalone environments and workflows scripts.
As an example, to run the Lift environment, you can use the following command. As an example, to run the Lift environment, you can use the following command.
......
...@@ -6,7 +6,7 @@ This can be used to apply functions to modify observations or rewards, record vi ...@@ -6,7 +6,7 @@ This can be used to apply functions to modify observations or rewards, record vi
A detailed description of the API is available in the `gym.Wrapper <https://gymnasium.farama.org/api/wrappers/>`_ class. A detailed description of the API is available in the `gym.Wrapper <https://gymnasium.farama.org/api/wrappers/>`_ class.
At present, all environments inheriting from the :class:`omni.isaac.orbit_envs.isaac_env.IsaacEnv` class At present, all environments inheriting from the :class:`omni.isaac.orbit_tasks.isaac_env.IsaacEnv` class
are compatible with ``gym.Wrapper``, since the base class implements the ``gym.Env`` interface. are compatible with ``gym.Wrapper``, since the base class implements the ``gym.Env`` interface.
In order to wrap an environment, you need to first initialize the base environment. After that, you can 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.
...@@ -28,8 +28,8 @@ For example, here is how you would wrap an environment to enforce that reset is ...@@ -28,8 +28,8 @@ For example, here is how you would wrap an environment to enforce that reset is
import gym import gym
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import load_default_env_cfg from omni.isaac.orbit_tasks.utils import load_default_env_cfg
# create base environment # create base environment
cfg = load_default_env_cfg("Isaac-Reach-Franka-v0") cfg = load_default_env_cfg("Isaac-Reach-Franka-v0")
...@@ -138,7 +138,7 @@ As an example of how to use the :class:`IsaacEnv` with Stable-Baselines3: ...@@ -138,7 +138,7 @@ As an example of how to use the :class:`IsaacEnv` with Stable-Baselines3:
.. code:: python .. code:: python
from omni.isaac.orbit_envs.utils.wrappers.sb3 import Sb3VecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.sb3 import Sb3VecEnvWrapper
# create isaac-env instance # create isaac-env instance
env = gym.make(task_name, cfg=env_cfg, render=headless) env = gym.make(task_name, cfg=env_cfg, render=headless)
...@@ -156,5 +156,5 @@ As an example of how to use the :class:`IsaacEnv` with Stable-Baselines3: ...@@ -156,5 +156,5 @@ As an example of how to use the :class:`IsaacEnv` with Stable-Baselines3:
To add support for a new learning framework, you need to implement a wrapper class that To add support for a new learning framework, you need to implement a wrapper class that
converts the :class:`IsaacEnv` to the learning framework's environment definition. This converts the :class:`IsaacEnv` to the learning framework's environment definition. This
wrapper class should typically inherit from the ``gym.Wrapper`` class. We include a wrapper class should typically inherit from the ``gym.Wrapper`` class. We include a
set of these wrappers in the :mod:`omni.isaac.orbit_envs.utils.wrappers` module. You can set of these wrappers in the :mod:`omni.isaac.orbit_tasks.utils.wrappers` module. You can
use these wrappers as a reference to implement your own wrapper for a new learning framework. use these wrappers as a reference to implement your own wrapper for a new learning framework.
...@@ -236,7 +236,7 @@ while [[ $# -gt 0 ]]; do ...@@ -236,7 +236,7 @@ while [[ $# -gt 0 ]]; do
echo "[INFO] Installing extra requirements such as learning frameworks..." echo "[INFO] Installing extra requirements such as learning frameworks..."
python_exe=$(extract_python_exe) python_exe=$(extract_python_exe)
# install the rl-frameworks specified # install the rl-frameworks specified
${python_exe} -m pip install -e ${ORBIT_PATH}/source/extensions/omni.isaac.orbit_envs[all] ${python_exe} -m pip install -e ${ORBIT_PATH}/source/extensions/omni.isaac.orbit_tasks[all]
shift # past argument shift # past argument
;; ;;
-c|--conda) -c|--conda)
......
...@@ -51,8 +51,8 @@ known_third_party = [ ...@@ -51,8 +51,8 @@ known_third_party = [
known_first_party = "omni.isaac.orbit" known_first_party = "omni.isaac.orbit"
known_assets_firstparty = "omni.isaac.assets" known_assets_firstparty = "omni.isaac.assets"
known_extra_firstparty = [ known_extra_firstparty = [
"omni.isaac.contrib_envs", "omni.isaac.contrib_tasks",
"omni.isaac.orbit_envs" "omni.isaac.orbit_tasks"
] ]
# Imports from the local folder # Imports from the local folder
known_local_folder = "config" known_local_folder = "config"
......
...@@ -13,10 +13,10 @@ keywords = ["robotics", "rl", "il", "learning"] ...@@ -13,10 +13,10 @@ keywords = ["robotics", "rl", "il", "learning"]
[dependencies] [dependencies]
"omni.isaac.orbit" = {} "omni.isaac.orbit" = {}
"omni.isaac.orbit_envs" = {} "omni.isaac.orbit_tasks" = {}
"omni.isaac.core" = {} "omni.isaac.core" = {}
"omni.isaac.gym" = {} "omni.isaac.gym" = {}
"omni.replicator.isaac" = {} "omni.replicator.isaac" = {}
[[python.module]] [[python.module]]
name = "omni.isaac.contrib_envs" name = "omni.isaac.contrib_tasks"
# Orbit: Contributed Environment # Orbit: Contributed Environment
This extension serves as a platform to host contributed environments from the robotics and machine learning This extension serves as a platform to host contributed environments from the robotics and machine learning
community. The extension follows the same style as the `omni.isaac.orbit_envs` extension. community. The extension follows the same style as the `omni.isaac.orbit_tasks` extension.
The environments should follow the `gym.Env` API from OpenAI Gym version `0.21.0`. They need to be registered using The environments should follow the `gym.Env` API from OpenAI Gym version `0.21.0`. They need to be registered using
the Gym registry. the Gym registry.
...@@ -15,12 +15,12 @@ The environments can be configured using either Python classes (wrapped using `c ...@@ -15,12 +15,12 @@ The environments can be configured using either Python classes (wrapped using `c
YAML files. The template structure of the environment is always put at the same level as the environment file YAML files. The template structure of the environment is always put at the same level as the environment file
itself. However, its various instances should be included in directories within the environment directory itself. itself. However, its various instances should be included in directories within the environment directory itself.
The environments should then be registered in the `omni/isaac/contrib_envs/__init__.py`: The environments should then be registered in the `omni/isaac/contrib_tasks/__init__.py`:
```python ```python
gym.register( gym.register(
id="Isaac-Contrib-<my-awesome-env>-v0", id="Isaac-Contrib-<my-awesome-env>-v0",
entry_point="omni.isaac.contrib_envs.<your-env-package>:<your-env-class>", entry_point="omni.isaac.contrib_tasks.<your-env-package>:<your-env-class>",
kwargs={"cfg_entry_point": "omni.isaac.contrib_envs.<your-env-package-cfg>:<your-env-class-cfg>"}, kwargs={"cfg_entry_point": "omni.isaac.contrib_tasks.<your-env-package-cfg>:<your-env-class-cfg>"},
) )
``` ```
...@@ -19,8 +19,8 @@ Note: ...@@ -19,8 +19,8 @@ Note:
Usage: Usage:
>>> import gym >>> import gym
>>> import omni.isaac.contrib_envs >>> import omni.isaac.contrib_tasks
>>> from omni.isaac.orbit_envs.utils.parse_cfg import load_default_env_cfg >>> from omni.isaac.orbit_tasks.utils.parse_cfg import load_default_env_cfg
>>> >>>
>>> task_name = "Isaac-Contrib-<my-registered-env-name>-v0" >>> task_name = "Isaac-Contrib-<my-registered-env-name>-v0"
>>> cfg = load_default_env_cfg(task_name) >>> cfg = load_default_env_cfg(task_name)
...@@ -34,14 +34,11 @@ import os ...@@ -34,14 +34,11 @@ import os
import toml import toml
# Conveniences to other module directories via relative paths # Conveniences to other module directories via relative paths
ORBIT_CONTRIB_ENVS_EXT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../")) ORBIT_CONTRIB_TASKS_EXT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../"))
"""Path to the extension source directory.""" """Path to the extension source directory."""
ORBIT_CONTRIB_ENVS_DATA_DIR = os.path.join(ORBIT_CONTRIB_ENVS_EXT_DIR, "data") ORBIT_CONTRIB_TASKS_METADATA = toml.load(os.path.join(ORBIT_CONTRIB_TASKS_EXT_DIR, "config", "extension.toml"))
"""Path to the extension data directory."""
ORBIT_CONTRIB_ENVS_METADATA = toml.load(os.path.join(ORBIT_CONTRIB_ENVS_EXT_DIR, "config", "extension.toml"))
"""Extension metadata dictionary parsed from the extension.toml file.""" """Extension metadata dictionary parsed from the extension.toml file."""
# Configure the module-level variables # Configure the module-level variables
__version__ = ORBIT_CONTRIB_ENVS_METADATA["package"]["version"] __version__ = ORBIT_CONTRIB_TASKS_METADATA["package"]["version"]
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
"""Installation script for the 'omni.isaac.contrib_envs' python package.""" """Installation script for the 'omni.isaac.contrib_tasks' python package."""
from __future__ import annotations from __future__ import annotations
...@@ -19,7 +19,7 @@ EXTENSION_TOML_DATA = toml.load(os.path.join(EXTENSION_PATH, "config", "extensio ...@@ -19,7 +19,7 @@ EXTENSION_TOML_DATA = toml.load(os.path.join(EXTENSION_PATH, "config", "extensio
# Installation operation # Installation operation
setup( setup(
name="omni-isaac-contrib_envs", name="omni-isaac-contrib_tasks",
author="Community", author="Community",
url=EXTENSION_TOML_DATA["package"]["repository"], url=EXTENSION_TOML_DATA["package"]["repository"],
version=EXTENSION_TOML_DATA["package"]["version"], version=EXTENSION_TOML_DATA["package"]["version"],
...@@ -27,7 +27,7 @@ setup( ...@@ -27,7 +27,7 @@ setup(
keywords=EXTENSION_TOML_DATA["package"]["keywords"], keywords=EXTENSION_TOML_DATA["package"]["keywords"],
include_package_data=True, include_package_data=True,
python_requires=">=3.7", python_requires=">=3.7",
packages=["omni.isaac.contrib_envs"], packages=["omni.isaac.contrib_tasks"],
classifiers=["Natural Language :: English", "Programming Language :: Python :: 3.7"], classifiers=["Natural Language :: English", "Programming Language :: Python :: 3.7"],
zip_safe=False, zip_safe=False,
) )
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.9.31" version = "0.9.32"
# Description # Description
title = "ORBIT framework for Robot Learning" title = "ORBIT framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.9.32 (2023-11-02)
~~~~~~~~~~~~~~~~~~~
Changed
^^^^^^^
* Renamed the :class:`omni.isaac.orbit.envs.RLEnv` class to :class:`omni.isaac.orbit.envs.RLTaskEnv` to
avoid confusions in terminologies between environments and tasks.
0.9.31 (2023-11-02) 0.9.31 (2023-11-02)
~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
from .base_env import BaseEnv from .base_env import BaseEnv
from .base_env_cfg import BaseEnvCfg, ViewerCfg from .base_env_cfg import BaseEnvCfg, ViewerCfg
from .rl_env import RLEnv, VecEnvObs, VecEnvStepReturn from .rl_task_env import RLTaskEnv, VecEnvObs, VecEnvStepReturn
from .rl_env_cfg import RLEnvCfg from .rl_task_env_cfg import RLTaskEnvCfg
__all__ = [ __all__ = [
# base # base
...@@ -14,8 +14,8 @@ __all__ = [ ...@@ -14,8 +14,8 @@ __all__ = [
"BaseEnvCfg", "BaseEnvCfg",
"ViewerCfg", "ViewerCfg",
# rl # rl
"RLEnv", "RLTaskEnv",
"RLEnvCfg", "RLTaskEnvCfg",
# env type variables # env type variables
"VecEnvObs", "VecEnvObs",
"VecEnvStepReturn", "VecEnvStepReturn",
......
...@@ -15,7 +15,7 @@ from omni.isaac.orbit.assets.articulation import Articulation ...@@ -15,7 +15,7 @@ from omni.isaac.orbit.assets.articulation import Articulation
from omni.isaac.orbit.managers.action_manager import ActionTerm from omni.isaac.orbit.managers.action_manager import ActionTerm
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.rl_env import BaseEnv from omni.isaac.orbit.envs import BaseEnv
from . import actions_cfg from . import actions_cfg
......
...@@ -15,7 +15,7 @@ from omni.isaac.orbit.assets.articulation import Articulation ...@@ -15,7 +15,7 @@ from omni.isaac.orbit.assets.articulation import Articulation
from omni.isaac.orbit.managers.action_manager import ActionTerm from omni.isaac.orbit.managers.action_manager import ActionTerm
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.rl_env import BaseEnv from omni.isaac.orbit.envs import BaseEnv
from . import actions_cfg from . import actions_cfg
......
...@@ -19,11 +19,11 @@ from omni.isaac.orbit.managers import SceneEntityCfg ...@@ -19,11 +19,11 @@ from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.terrains import TerrainImporter from omni.isaac.orbit.terrains import TerrainImporter
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.rl_env import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
def terrain_levels_vel( def terrain_levels_vel(
env: RLEnv, env_ids: Sequence[int], asset_cfg: SceneEntityCfg = SceneEntityCfg("robot") env: RLTaskEnv, env_ids: Sequence[int], asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor: ) -> torch.Tensor:
"""Curriculum based on the distance the robot walked when commanded to move at a desired velocity. """Curriculum based on the distance the robot walked when commanded to move at a desired velocity.
...@@ -53,7 +53,7 @@ def terrain_levels_vel( ...@@ -53,7 +53,7 @@ def terrain_levels_vel(
return torch.mean(terrain.terrain_levels.float()) return torch.mean(terrain.terrain_levels.float())
def modify_reward_weight(env: RLEnv, env_ids: Sequence[int], term_name: str, weight: float, num_steps: int): def modify_reward_weight(env: RLTaskEnv, env_ids: Sequence[int], term_name: str, weight: float, num_steps: int):
"""Curriculum that modifies a reward weight a given number of steps. """Curriculum that modifies a reward weight a given number of steps.
Args: Args:
......
...@@ -19,7 +19,7 @@ from omni.isaac.orbit.managers import SceneEntityCfg ...@@ -19,7 +19,7 @@ from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.sensors import RayCaster from omni.isaac.orbit.sensors import RayCaster
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.base_env import BaseEnv from omni.isaac.orbit.envs import BaseEnv
""" """
Root state. Root state.
......
...@@ -22,7 +22,7 @@ from omni.isaac.orbit.managers import SceneEntityCfg ...@@ -22,7 +22,7 @@ from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.utils.math import quat_from_euler_xyz, sample_uniform from omni.isaac.orbit.utils.math import quat_from_euler_xyz, sample_uniform
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.base_env import BaseEnv from omni.isaac.orbit.envs import BaseEnv
def randomize_rigid_body_material( def randomize_rigid_body_material(
......
...@@ -19,14 +19,14 @@ from omni.isaac.orbit.managers import SceneEntityCfg ...@@ -19,14 +19,14 @@ from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.sensors import ContactSensor from omni.isaac.orbit.sensors import ContactSensor
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.rl_env import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
""" """
General. General.
""" """
def termination_penalty(env: RLEnv) -> torch.Tensor: def termination_penalty(env: RLTaskEnv) -> torch.Tensor:
"""Penalize terminated episodes that don't correspond to episodic timeouts.""" """Penalize terminated episodes that don't correspond to episodic timeouts."""
return env.reset_buf * (~env.termination_manager.time_outs) return env.reset_buf * (~env.termination_manager.time_outs)
...@@ -36,21 +36,21 @@ Root penalties. ...@@ -36,21 +36,21 @@ Root penalties.
""" """
def lin_vel_z_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def lin_vel_z_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize z-axis base linear velocity using L2-kernel.""" """Penalize z-axis base linear velocity using L2-kernel."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: RigidObject = env.scene[asset_cfg.name] asset: RigidObject = env.scene[asset_cfg.name]
return torch.square(asset.data.root_lin_vel_b[:, 2]) return torch.square(asset.data.root_lin_vel_b[:, 2])
def ang_vel_xy_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def ang_vel_xy_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize xy-axis base angular velocity using L2-kernel.""" """Penalize xy-axis base angular velocity using L2-kernel."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: RigidObject = env.scene[asset_cfg.name] asset: RigidObject = env.scene[asset_cfg.name]
return torch.sum(torch.square(asset.data.root_ang_vel_b[:, :2]), dim=1) return torch.sum(torch.square(asset.data.root_ang_vel_b[:, :2]), dim=1)
def flat_orientation_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def flat_orientation_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize non-flat base orientation using L2-kernel. """Penalize non-flat base orientation using L2-kernel.
This is computed by penalizing the xy-components of the projected gravity vector. This is computed by penalizing the xy-components of the projected gravity vector.
...@@ -61,7 +61,7 @@ def flat_orientation_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg(" ...@@ -61,7 +61,7 @@ def flat_orientation_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("
def base_height_l2( def base_height_l2(
env: RLEnv, target_height: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot") env: RLTaskEnv, target_height: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor: ) -> torch.Tensor:
"""Penalize asset height from its target using L2-kernel. """Penalize asset height from its target using L2-kernel.
...@@ -74,7 +74,7 @@ def base_height_l2( ...@@ -74,7 +74,7 @@ def base_height_l2(
return torch.square(asset.data.root_pos_w[:, 2] - target_height) return torch.square(asset.data.root_pos_w[:, 2] - target_height)
def body_lin_acc_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def body_lin_acc_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize the linear acceleration of bodies using L2-kernel.""" """Penalize the linear acceleration of bodies using L2-kernel."""
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
return torch.sum(torch.norm(asset.data.body_lin_acc_w[:, asset_cfg.body_ids, :], dim=-1), dim=1) return torch.sum(torch.norm(asset.data.body_lin_acc_w[:, asset_cfg.body_ids, :], dim=-1), dim=1)
...@@ -85,28 +85,28 @@ Joint penalties. ...@@ -85,28 +85,28 @@ Joint penalties.
""" """
def joint_torques_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_torques_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize torques applied on the articulation using L2-kernel.""" """Penalize torques applied on the articulation using L2-kernel."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
return torch.sum(torch.square(asset.data.applied_torque), dim=1) return torch.sum(torch.square(asset.data.applied_torque), dim=1)
def joint_vel_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_vel_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize joint velocities on the articulation.""" """Penalize joint velocities on the articulation."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
return torch.sum(torch.square(asset.data.joint_vel), dim=1) return torch.sum(torch.square(asset.data.joint_vel), dim=1)
def joint_acc_l2(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_acc_l2(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize joint accelerations on the articulation using L2-kernel.""" """Penalize joint accelerations on the articulation using L2-kernel."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
return torch.sum(torch.square(asset.data.joint_acc), dim=1) return torch.sum(torch.square(asset.data.joint_acc), dim=1)
def joint_pos_limits(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_pos_limits(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize joint positions if they cross the soft limits. """Penalize joint positions if they cross the soft limits.
This is computed as a sum of the absolute value of the difference between the joint position and the soft limits. This is computed as a sum of the absolute value of the difference between the joint position and the soft limits.
...@@ -120,7 +120,7 @@ def joint_pos_limits(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("rob ...@@ -120,7 +120,7 @@ def joint_pos_limits(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("rob
def joint_vel_limits( def joint_vel_limits(
env: RLEnv, soft_ratio: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot") env: RLTaskEnv, soft_ratio: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor: ) -> torch.Tensor:
"""Penalize joint velocities if they cross the soft limits. """Penalize joint velocities if they cross the soft limits.
...@@ -143,7 +143,7 @@ Action penalties. ...@@ -143,7 +143,7 @@ Action penalties.
""" """
def applied_torque_limits(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def applied_torque_limits(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Penalize applied torques if they cross the limits. """Penalize applied torques if they cross the limits.
This is computed as a sum of the absolute value of the difference between the applied torques and the limits. This is computed as a sum of the absolute value of the difference between the applied torques and the limits.
...@@ -160,7 +160,7 @@ def applied_torque_limits(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg ...@@ -160,7 +160,7 @@ def applied_torque_limits(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg
return torch.sum(out_of_limits, dim=1) return torch.sum(out_of_limits, dim=1)
def action_rate_l2(env: RLEnv) -> torch.Tensor: def action_rate_l2(env: RLTaskEnv) -> torch.Tensor:
"""Penalize the rate of change of the actions using L2-kernel.""" """Penalize the rate of change of the actions using L2-kernel."""
return torch.sum(torch.square(env.action_manager.action - env.action_manager.prev_action), dim=1) return torch.sum(torch.square(env.action_manager.action - env.action_manager.prev_action), dim=1)
...@@ -170,7 +170,7 @@ Contact sensor. ...@@ -170,7 +170,7 @@ Contact sensor.
""" """
def undesired_contacts(env: RLEnv, threshold: float, sensor_cfg: SceneEntityCfg) -> torch.Tensor: def undesired_contacts(env: RLTaskEnv, threshold: float, sensor_cfg: SceneEntityCfg) -> torch.Tensor:
"""Penalize undesired contacts as the number of violations that are above a threshold.""" """Penalize undesired contacts as the number of violations that are above a threshold."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
contact_sensor: ContactSensor = env.scene.sensors[sensor_cfg.name] contact_sensor: ContactSensor = env.scene.sensors[sensor_cfg.name]
...@@ -181,7 +181,7 @@ def undesired_contacts(env: RLEnv, threshold: float, sensor_cfg: SceneEntityCfg) ...@@ -181,7 +181,7 @@ def undesired_contacts(env: RLEnv, threshold: float, sensor_cfg: SceneEntityCfg)
return torch.sum(is_contact, dim=1) return torch.sum(is_contact, dim=1)
def contact_forces(env: RLEnv, threshold: float, sensor_cfg: SceneEntityCfg) -> torch.Tensor: def contact_forces(env: RLTaskEnv, threshold: float, sensor_cfg: SceneEntityCfg) -> torch.Tensor:
"""Penalize contact forces as the amount of violations of the net contact force.""" """Penalize contact forces as the amount of violations of the net contact force."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
contact_sensor: ContactSensor = env.scene.sensors[sensor_cfg.name] contact_sensor: ContactSensor = env.scene.sensors[sensor_cfg.name]
...@@ -197,7 +197,9 @@ Velocity-tracking rewards. ...@@ -197,7 +197,9 @@ Velocity-tracking rewards.
""" """
def track_lin_vel_xy_exp(env: RLEnv, std: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def track_lin_vel_xy_exp(
env: RLTaskEnv, std: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor:
"""Reward tracking of linear velocity commands (xy axes) using exponential kernel.""" """Reward tracking of linear velocity commands (xy axes) using exponential kernel."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: RigidObject = env.scene[asset_cfg.name] asset: RigidObject = env.scene[asset_cfg.name]
...@@ -208,7 +210,9 @@ def track_lin_vel_xy_exp(env: RLEnv, std: float, asset_cfg: SceneEntityCfg = Sce ...@@ -208,7 +210,9 @@ def track_lin_vel_xy_exp(env: RLEnv, std: float, asset_cfg: SceneEntityCfg = Sce
return torch.exp(-lin_vel_error / std**2) return torch.exp(-lin_vel_error / std**2)
def track_ang_vel_z_exp(env: RLEnv, std: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def track_ang_vel_z_exp(
env: RLTaskEnv, std: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor:
"""Reward tracking of angular velocity commands (yaw) using exponential kernel.""" """Reward tracking of angular velocity commands (yaw) using exponential kernel."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: RigidObject = env.scene[asset_cfg.name] asset: RigidObject = env.scene[asset_cfg.name]
......
...@@ -19,19 +19,19 @@ from omni.isaac.orbit.managers import SceneEntityCfg ...@@ -19,19 +19,19 @@ from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.sensors import ContactSensor from omni.isaac.orbit.sensors import ContactSensor
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs.rl_env import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
""" """
MDP terminations. MDP terminations.
""" """
def time_out(env: RLEnv) -> torch.Tensor: def time_out(env: RLTaskEnv) -> torch.Tensor:
"""Terminate the episode when the episode length exceeds the maximum episode length.""" """Terminate the episode when the episode length exceeds the maximum episode length."""
return env.episode_length_buf >= env.max_episode_length return env.episode_length_buf >= env.max_episode_length
def command_resample(env: RLEnv, num_resamples: int = 1) -> torch.Tensor: def command_resample(env: RLTaskEnv, num_resamples: int = 1) -> torch.Tensor:
"""Terminate the episode based on the total number of times commands have been re-sampled. """Terminate the episode based on the total number of times commands have been re-sampled.
This makes the maximum episode length fluid in nature as it depends on how the commands are This makes the maximum episode length fluid in nature as it depends on how the commands are
...@@ -48,7 +48,7 @@ Root terminations. ...@@ -48,7 +48,7 @@ Root terminations.
def bad_orientation( def bad_orientation(
env: RLEnv, limit_angle: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot") env: RLTaskEnv, limit_angle: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor: ) -> torch.Tensor:
"""Terminate when the asset's orientation is too far from the desired orientation limits. """Terminate when the asset's orientation is too far from the desired orientation limits.
...@@ -59,7 +59,9 @@ def bad_orientation( ...@@ -59,7 +59,9 @@ def bad_orientation(
return torch.acos(-asset.data.projected_gravity_b[:, 2]).abs() > limit_angle return torch.acos(-asset.data.projected_gravity_b[:, 2]).abs() > limit_angle
def base_height(env: RLEnv, minimum_height: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def base_height(
env: RLTaskEnv, minimum_height: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor:
"""Terminate when the asset's height is below the minimum height. """Terminate when the asset's height is below the minimum height.
Note: Note:
...@@ -75,7 +77,7 @@ Joint terminations. ...@@ -75,7 +77,7 @@ Joint terminations.
""" """
def joint_pos_limit(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_pos_limit(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Terminate when the asset's joint positions are outside of the soft joint limits.""" """Terminate when the asset's joint positions are outside of the soft joint limits."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
...@@ -85,7 +87,9 @@ def joint_pos_limit(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robo ...@@ -85,7 +87,9 @@ def joint_pos_limit(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robo
return torch.logical_or(out_of_upper_limits, out_of_lower_limits) return torch.logical_or(out_of_upper_limits, out_of_lower_limits)
def joint_velocity_limit(env: RLEnv, max_velocity, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_velocity_limit(
env: RLTaskEnv, max_velocity, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")
) -> torch.Tensor:
"""Terminate when the asset's joint velocities are outside of the soft joint limits.""" """Terminate when the asset's joint velocities are outside of the soft joint limits."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
...@@ -93,7 +97,7 @@ def joint_velocity_limit(env: RLEnv, max_velocity, asset_cfg: SceneEntityCfg = S ...@@ -93,7 +97,7 @@ def joint_velocity_limit(env: RLEnv, max_velocity, asset_cfg: SceneEntityCfg = S
return torch.any(torch.abs(asset.data.joint_vel) > max_velocity, dim=1) return torch.any(torch.abs(asset.data.joint_vel) > max_velocity, dim=1)
def joint_torque_limit(env: RLEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor: def joint_torque_limit(env: RLTaskEnv, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot")) -> torch.Tensor:
"""Terminate when torque applied on the asset's joints are are outside of the soft joint limits.""" """Terminate when torque applied on the asset's joints are are outside of the soft joint limits."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
asset: Articulation = env.scene[asset_cfg.name] asset: Articulation = env.scene[asset_cfg.name]
...@@ -108,7 +112,7 @@ Contact sensor. ...@@ -108,7 +112,7 @@ Contact sensor.
""" """
def illegal_contact(env: RLEnv, threshold: float, sensor_cfg: SceneEntityCfg) -> torch.Tensor: def illegal_contact(env: RLTaskEnv, threshold: float, sensor_cfg: SceneEntityCfg) -> torch.Tensor:
"""Terminate when the contact force on the sensor exceeds the force threshold.""" """Terminate when the contact force on the sensor exceeds the force threshold."""
# extract the used quantities (to enable type-hinting) # extract the used quantities (to enable type-hinting)
contact_sensor: ContactSensor = env.scene.sensors[sensor_cfg.name] contact_sensor: ContactSensor = env.scene.sensors[sensor_cfg.name]
......
...@@ -15,7 +15,7 @@ from omni.isaac.orbit.command_generators import CommandGeneratorBase ...@@ -15,7 +15,7 @@ from omni.isaac.orbit.command_generators import CommandGeneratorBase
from omni.isaac.orbit.managers import CurriculumManager, RewardManager, TerminationManager from omni.isaac.orbit.managers import CurriculumManager, RewardManager, TerminationManager
from .base_env import BaseEnv from .base_env import BaseEnv
from .rl_env_cfg import RLEnvCfg from .rl_task_env_cfg import RLTaskEnvCfg
VecEnvObs = Dict[str, Union[torch.Tensor, Dict[str, torch.Tensor]]] VecEnvObs = Dict[str, Union[torch.Tensor, Dict[str, torch.Tensor]]]
"""Observation returned by the environment. """Observation returned by the environment.
...@@ -32,7 +32,7 @@ observation term in the group, or a single tensor obtained from concatenating al ...@@ -32,7 +32,7 @@ observation term in the group, or a single tensor obtained from concatenating al
Note: Note:
By default, most learning frameworks deal with default and privileged observations in different ways. By default, most learning frameworks deal with default and privileged observations in different ways.
This handling must be taken care of by the wrapper around the :class:`RLEnv` instance. This handling must be taken care of by the wrapper around the :class:`RLTaskEnv` instance.
For included frameworks (RSL-RL, RL-Games, skrl), the observations must have the key "policy". In case, For included frameworks (RSL-RL, RL-Games, skrl), the observations must have the key "policy". In case,
the key "critic" is also present, then the critic observations are taken from the "critic" group. the key "critic" is also present, then the critic observations are taken from the "critic" group.
...@@ -48,7 +48,7 @@ It contains the observation, reward, termination signal and additional informati ...@@ -48,7 +48,7 @@ It contains the observation, reward, termination signal and additional informati
""" """
class RLEnv(BaseEnv, gym.Env): class RLTaskEnv(BaseEnv, gym.Env):
"""The superclass for reinforcement learning-based environments. """The superclass for reinforcement learning-based environments.
This class inherits from :class:`BaseEnv` and implements the core functionality for This class inherits from :class:`BaseEnv` and implements the core functionality for
...@@ -75,10 +75,10 @@ class RLEnv(BaseEnv, gym.Env): ...@@ -75,10 +75,10 @@ class RLEnv(BaseEnv, gym.Env):
metadata: ClassVar[dict[str, Any]] = {"render.modes": ["human", "rgb_array"]} metadata: ClassVar[dict[str, Any]] = {"render.modes": ["human", "rgb_array"]}
"""Metadata for the environment.""" """Metadata for the environment."""
cfg: RLEnvCfg cfg: RLTaskEnvCfg
"""Configuration for the environment.""" """Configuration for the environment."""
def __init__(self, cfg: RLEnvCfg, **kwargs): def __init__(self, cfg: RLTaskEnvCfg, **kwargs):
# initialize the base class to setup the scene. # initialize the base class to setup the scene.
super().__init__(cfg=cfg) super().__init__(cfg=cfg)
......
...@@ -11,15 +11,15 @@ from omni.isaac.orbit.command_generators import CommandGeneratorBaseCfg ...@@ -11,15 +11,15 @@ from omni.isaac.orbit.command_generators import CommandGeneratorBaseCfg
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from .base_env_cfg import BaseEnvCfg from .base_env_cfg import BaseEnvCfg
from .ui import RLEnvWindow from .ui import RLTaskEnvWindow
@configclass @configclass
class RLEnvCfg(BaseEnvCfg): class RLTaskEnvCfg(BaseEnvCfg):
"""Configuration for a reinforcement learning environment.""" """Configuration for a reinforcement learning environment."""
# ui settings # ui settings
ui_window_class_type: type | None = RLEnvWindow ui_window_class_type: type | None = RLTaskEnvWindow
# general settings # general settings
episode_length_s: float = MISSING episode_length_s: float = MISSING
......
...@@ -19,6 +19,6 @@ enable_extension("omni.isaac.ui") ...@@ -19,6 +19,6 @@ enable_extension("omni.isaac.ui")
# import all UI elements here # import all UI elements here
from .base_env_window import BaseEnvWindow from .base_env_window import BaseEnvWindow
from .rl_env_window import RLEnvWindow from .rl_task_env_window import RLTaskEnvWindow
__all__ = ["BaseEnvWindow", "RLEnvWindow"] __all__ = ["BaseEnvWindow", "RLTaskEnvWindow"]
...@@ -10,17 +10,17 @@ from typing import TYPE_CHECKING ...@@ -10,17 +10,17 @@ from typing import TYPE_CHECKING
from .base_env_window import BaseEnvWindow from .base_env_window import BaseEnvWindow
if TYPE_CHECKING: if TYPE_CHECKING:
from ..rl_env import RLEnv from ..rl_task_env import RLTaskEnv
class RLEnvWindow(BaseEnvWindow): class RLTaskEnvWindow(BaseEnvWindow):
"""Window manager for the RL environment. """Window manager for the RL environment.
On top of the basic environment window, this class adds controls for the RL environment. On top of the basic environment window, this class adds controls for the RL environment.
This includes visualization of the command manager. This includes visualization of the command manager.
""" """
def __init__(self, env: RLEnv, window_name: str = "Orbit"): def __init__(self, env: RLTaskEnv, window_name: str = "Orbit"):
"""Initialize the window. """Initialize the window.
Args: Args:
......
...@@ -15,7 +15,7 @@ from .manager_base import ManagerBase ...@@ -15,7 +15,7 @@ from .manager_base import ManagerBase
from .manager_cfg import CurriculumTermCfg from .manager_cfg import CurriculumTermCfg
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
class CurriculumManager(ManagerBase): class CurriculumManager(ManagerBase):
...@@ -29,10 +29,10 @@ class CurriculumManager(ManagerBase): ...@@ -29,10 +29,10 @@ class CurriculumManager(ManagerBase):
parameters. Each curriculum term should instantiate the :class:`CurriculumTermCfg` class. parameters. Each curriculum term should instantiate the :class:`CurriculumTermCfg` class.
""" """
_env: RLEnv _env: RLTaskEnv
"""The environment instance.""" """The environment instance."""
def __init__(self, cfg: object, env: RLEnv): def __init__(self, cfg: object, env: RLTaskEnv):
"""Initialize the manager. """Initialize the manager.
Args: Args:
......
...@@ -17,7 +17,7 @@ from .manager_base import ManagerBase ...@@ -17,7 +17,7 @@ from .manager_base import ManagerBase
from .manager_cfg import RandomizationTermCfg from .manager_cfg import RandomizationTermCfg
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
class RandomizationManager(ManagerBase): class RandomizationManager(ManagerBase):
...@@ -49,10 +49,10 @@ class RandomizationManager(ManagerBase): ...@@ -49,10 +49,10 @@ class RandomizationManager(ManagerBase):
""" """
_env: RLEnv _env: RLTaskEnv
"""The environment instance.""" """The environment instance."""
def __init__(self, cfg: object, env: RLEnv): def __init__(self, cfg: object, env: RLTaskEnv):
"""Initialize the randomization manager. """Initialize the randomization manager.
Args: Args:
......
...@@ -15,7 +15,7 @@ from .manager_base import ManagerBase ...@@ -15,7 +15,7 @@ from .manager_base import ManagerBase
from .manager_cfg import RewardTermCfg from .manager_cfg import RewardTermCfg
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
class RewardManager(ManagerBase): class RewardManager(ManagerBase):
...@@ -36,10 +36,10 @@ class RewardManager(ManagerBase): ...@@ -36,10 +36,10 @@ class RewardManager(ManagerBase):
""" """
_env: RLEnv _env: RLTaskEnv
"""The environment instance.""" """The environment instance."""
def __init__(self, cfg: object, env: RLEnv): def __init__(self, cfg: object, env: RLTaskEnv):
"""Initialize the reward manager. """Initialize the reward manager.
Args: Args:
......
...@@ -15,7 +15,7 @@ from .manager_base import ManagerBase ...@@ -15,7 +15,7 @@ from .manager_base import ManagerBase
from .manager_cfg import TerminationTermCfg from .manager_cfg import TerminationTermCfg
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
class TerminationManager(ManagerBase): class TerminationManager(ManagerBase):
...@@ -30,10 +30,10 @@ class TerminationManager(ManagerBase): ...@@ -30,10 +30,10 @@ class TerminationManager(ManagerBase):
parameters. Each termination term should instantiate the :class:`TerminationTermCfg` class. parameters. Each termination term should instantiate the :class:`TerminationTermCfg` class.
""" """
_env: RLEnv _env: RLTaskEnv
"""The environment instance.""" """The environment instance."""
def __init__(self, cfg: object, env: RLEnv): def __init__(self, cfg: object, env: RLTaskEnv):
"""Initializes the termination manager. """Initializes the termination manager.
Args: Args:
......
...@@ -18,4 +18,4 @@ keywords = ["robotics", "rl", "il", "learning"] ...@@ -18,4 +18,4 @@ keywords = ["robotics", "rl", "il", "learning"]
"omni.replicator.isaac" = {} "omni.replicator.isaac" = {}
[[python.module]] [[python.module]]
name = "omni.isaac.orbit_envs" name = "omni.isaac.orbit_tasks"
...@@ -9,6 +9,12 @@ Changed ...@@ -9,6 +9,12 @@ Changed
* Changed the way agent configs are handled for environments and learning agents. Switched from yaml to configclasses. * Changed the way agent configs are handled for environments and learning agents. Switched from yaml to configclasses.
Fixed
^^^^^
* Fixed the way package import automation is handled in the :mod:`omni.isaac.orbit_tasks` module. Earlier it was
not skipping the blacklisted packages properly.
0.4.3 (2023-09-25) 0.4.3 (2023-09-25)
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
......
...@@ -14,7 +14,7 @@ itself. However, its various instances are included in directories within the en ...@@ -14,7 +14,7 @@ itself. However, its various instances are included in directories within the en
This looks like as follows: This looks like as follows:
```tree ```tree
omni/isaac/orbit_envs/locomotion/ omni/isaac/orbit_tasks/locomotion/
├── __init__.py ├── __init__.py
└── velocity └── velocity
├── a1 ├── a1
...@@ -26,19 +26,19 @@ omni/isaac/orbit_envs/locomotion/ ...@@ -26,19 +26,19 @@ omni/isaac/orbit_envs/locomotion/
└── velocity_env.py └── velocity_env.py
``` ```
The environments are then registered in the `omni/isaac/orbit_envs/__init__.py`: The environments are then registered in the `omni/isaac/orbit_tasks/__init__.py`:
```python ```python
gym.register( gym.register(
id="Isaac-Velocity-Anymal-C-v0", id="Isaac-Velocity-Anymal-C-v0",
entry_point="omni.isaac.orbit_envs.locomotion.velocity:LocomotionEnv", entry_point="omni.isaac.orbit_tasks.locomotion.velocity:LocomotionEnv",
kwargs={"cfg_entry_point": "omni.isaac.orbit_envs.locomotion.velocity.anymal_c.flat_terrain_cfg:FlatTerrainCfg"}, kwargs={"cfg_entry_point": "omni.isaac.orbit_tasks.locomotion.velocity.anymal_c.flat_terrain_cfg:FlatTerrainCfg"},
) )
gym.register( gym.register(
id="Isaac-Velocity-A1-v0", id="Isaac-Velocity-A1-v0",
entry_point="omni.isaac.orbit_envs.locomotion.velocity:LocomotionEnv", entry_point="omni.isaac.orbit_tasks.locomotion.velocity:LocomotionEnv",
kwargs={"cfg_entry_point": "omni.isaac.orbit_envs.locomotion.velocity.a1.flat_terrain_cfg:FlatTerrainCfg"}, kwargs={"cfg_entry_point": "omni.isaac.orbit_tasks.locomotion.velocity.a1.flat_terrain_cfg:FlatTerrainCfg"},
) )
``` ```
......
...@@ -19,8 +19,8 @@ Note: ...@@ -19,8 +19,8 @@ Note:
Usage: Usage:
>>> import gym >>> import gym
>>> import omni.isaac.orbit_envs >>> import omni.isaac.orbit_tasks
>>> from omni.isaac.orbit_envs.utils.parse_cfg import load_default_env_cfg >>> from omni.isaac.orbit_tasks.utils.parse_cfg import load_default_env_cfg
>>> >>>
>>> task_name = "Isaac-Cartpole-v0" >>> task_name = "Isaac-Cartpole-v0"
>>> cfg = load_default_env_cfg(task_name) >>> cfg = load_default_env_cfg(task_name)
...@@ -29,64 +29,26 @@ Usage: ...@@ -29,64 +29,26 @@ Usage:
from __future__ import annotations from __future__ import annotations
import importlib
import os import os
import pkgutil
import toml import toml
# Conveniences to other module directories via relative paths # Conveniences to other module directories via relative paths
ORBIT_ENVS_EXT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../")) ORBIT_TASKS_EXT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../"))
"""Path to the extension source directory.""" """Path to the extension source directory."""
ORBIT_ENVS_DATA_DIR = os.path.join(ORBIT_ENVS_EXT_DIR, "data") ORBIT_TASKS_METADATA = toml.load(os.path.join(ORBIT_TASKS_EXT_DIR, "config", "extension.toml"))
"""Path to the extension data directory."""
ORBIT_ENVS_METADATA = toml.load(os.path.join(ORBIT_ENVS_EXT_DIR, "config", "extension.toml"))
"""Extension metadata dictionary parsed from the extension.toml file.""" """Extension metadata dictionary parsed from the extension.toml file."""
# Configure the module-level variables # Configure the module-level variables
__version__ = ORBIT_ENVS_METADATA["package"]["version"] __version__ = ORBIT_TASKS_METADATA["package"]["version"]
## ##
# Register Gym environments. # Register Gym environments.
## ##
from .utils import import_packages
def _import_all(package_name: str, blacklist_pkgs: list[str] = None):
"""Import all sub-packages in a package recursively.
It is easier to use this function to import all sub-packages in a package recursively
than to manually import each sub-package.
It replaces the need of the following code:
.. code-block:: python
import .locomotion.velocity
import .manipulation.reach
import .manipulation.lift
Args:
package_name: The package name.
blacklist_pkgs: The list of blacklisted packages to skip. Defaults to None,
which means no packages are blacklisted.
"""
# Default blacklist
if blacklist_pkgs is None:
blacklist_pkgs = []
# Import the package
package = importlib.import_module(package_name)
# Import all Python files
for file_name, module_name, is_pkg in pkgutil.walk_packages(package.__path__, package.__name__ + "."):
# check blacklisted
if any([pkg_name in module_name for pkg_name in blacklist_pkgs]):
continue
if is_pkg:
importlib.import_module(module_name)
_import_all(module_name, blacklist_pkgs)
# The blacklist is used to prevent importing configs from sub-packages # The blacklist is used to prevent importing configs from sub-packages
_BLACKLIST_PKGS = ["locomotion.velocity.config.anymal_d", "classic", "manipulation", "utils"] _BLACKLIST_PKGS = ["locomotion.velocity.config.anymal_d", "classic", "manipulation", "utils"]
# Import all configs in this package # Import all configs in this package
_import_all(__name__, _BLACKLIST_PKGS) import_packages(__name__, _BLACKLIST_PKGS)
...@@ -17,7 +17,7 @@ from . import agents ...@@ -17,7 +17,7 @@ from . import agents
gym.register( gym.register(
id="Isaac-Ant-v0", id="Isaac-Ant-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": f"{__name__}:ant_env_cfg.yaml", "env_cfg_entry_point": f"{__name__}:ant_env_cfg.yaml",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml", "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
......
...@@ -16,8 +16,8 @@ from omni.isaac.core.articulations import ArticulationView ...@@ -16,8 +16,8 @@ from omni.isaac.core.articulations import ArticulationView
import omni.isaac.orbit.compat.utils.kit as kit_utils import omni.isaac.orbit.compat.utils.kit as kit_utils
from omni.isaac.orbit_envs.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs from omni.isaac.orbit_tasks.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs
from omni.isaac.orbit_envs.isaac_env_cfg import EnvCfg, IsaacEnvCfg from omni.isaac.orbit_tasks.isaac_env_cfg import EnvCfg, IsaacEnvCfg
class AntEnv(IsaacEnv): class AntEnv(IsaacEnv):
......
...@@ -17,7 +17,7 @@ from . import agents ...@@ -17,7 +17,7 @@ from . import agents
gym.register( gym.register(
id="Isaac-Cartpole-v0", id="Isaac-Cartpole-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": f"{__name__}:ant_env_cfg.yaml", "env_cfg_entry_point": f"{__name__}:ant_env_cfg.yaml",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml", "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -15,8 +15,8 @@ from omni.isaac.core.articulations import ArticulationView ...@@ -15,8 +15,8 @@ from omni.isaac.core.articulations import ArticulationView
import omni.isaac.orbit.compat.utils.kit as kit_utils import omni.isaac.orbit.compat.utils.kit as kit_utils
from omni.isaac.orbit_envs.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs from omni.isaac.orbit_tasks.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs
from omni.isaac.orbit_envs.isaac_env_cfg import EnvCfg, IsaacEnvCfg from omni.isaac.orbit_tasks.isaac_env_cfg import EnvCfg, IsaacEnvCfg
class CartpoleEnv(IsaacEnv): class CartpoleEnv(IsaacEnv):
......
...@@ -17,7 +17,7 @@ from . import agents ...@@ -17,7 +17,7 @@ from . import agents
gym.register( gym.register(
id="Isaac-Humanoid-v0", id="Isaac-Humanoid-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": f"{__name__}:ant_env_cfg.yaml", "env_cfg_entry_point": f"{__name__}:ant_env_cfg.yaml",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml", "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
......
...@@ -16,8 +16,8 @@ from omni.isaac.core.articulations import ArticulationView ...@@ -16,8 +16,8 @@ from omni.isaac.core.articulations import ArticulationView
import omni.isaac.orbit.compat.utils.kit as kit_utils import omni.isaac.orbit.compat.utils.kit as kit_utils
from omni.isaac.orbit_envs.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs from omni.isaac.orbit_tasks.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs
from omni.isaac.orbit_envs.isaac_env_cfg import EnvCfg, IsaacEnvCfg from omni.isaac.orbit_tasks.isaac_env_cfg import EnvCfg, IsaacEnvCfg
class HumanoidEnv(IsaacEnv): class HumanoidEnv(IsaacEnv):
......
...@@ -13,7 +13,7 @@ from . import agents, flat_env_cfg, rough_env_cfg ...@@ -13,7 +13,7 @@ from . import agents, flat_env_cfg, rough_env_cfg
gym.register( gym.register(
id="Isaac-Velocity-Flat-Anymal-B-v0", id="Isaac-Velocity-Flat-Anymal-B-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.AnymalBFlatEnvCfg, "env_cfg_entry_point": flat_env_cfg.AnymalBFlatEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBFlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBFlatPPORunnerCfg,
...@@ -22,7 +22,7 @@ gym.register( ...@@ -22,7 +22,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Flat-Anymal-B-Play-v0", id="Isaac-Velocity-Flat-Anymal-B-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.AnymalBFlatEnvCfg_PLAY, "env_cfg_entry_point": flat_env_cfg.AnymalBFlatEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBFlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBFlatPPORunnerCfg,
...@@ -31,7 +31,7 @@ gym.register( ...@@ -31,7 +31,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Anymal-B-v0", id="Isaac-Velocity-Rough-Anymal-B-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.AnymalBRoughEnvCfg, "env_cfg_entry_point": rough_env_cfg.AnymalBRoughEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBRoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBRoughPPORunnerCfg,
...@@ -40,7 +40,7 @@ gym.register( ...@@ -40,7 +40,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Anymal-B-Play-v0", id="Isaac-Velocity-Rough-Anymal-B-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.AnymalBRoughEnvCfg_PLAY, "env_cfg_entry_point": rough_env_cfg.AnymalBRoughEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBRoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalBRoughPPORunnerCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -13,17 +13,17 @@ from . import agents, flat_env_cfg, rough_env_cfg ...@@ -13,17 +13,17 @@ from . import agents, flat_env_cfg, rough_env_cfg
gym.register( gym.register(
id="Isaac-Velocity-Flat-Anymal-C-v0", id="Isaac-Velocity-Flat-Anymal-C-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.AnymalCFlatEnvCfg, "env_cfg_entry_point": flat_env_cfg.AnymalCFlatEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCFlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCFlatPPORunnerCfg,
"skrl_cfg_entry_point": "omni.isaac.orbit_envs.locomotion.velocity.anymal_c.agents:skrl_cfg.yaml", "skrl_cfg_entry_point": "omni.isaac.orbit_tasks.locomotion.velocity.anymal_c.agents:skrl_cfg.yaml",
}, },
) )
gym.register( gym.register(
id="Isaac-Velocity-Flat-Anymal-C-Play-v0", id="Isaac-Velocity-Flat-Anymal-C-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.AnymalCFlatEnvCfg_PLAY, "env_cfg_entry_point": flat_env_cfg.AnymalCFlatEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCFlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCFlatPPORunnerCfg,
...@@ -32,7 +32,7 @@ gym.register( ...@@ -32,7 +32,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Anymal-C-v0", id="Isaac-Velocity-Rough-Anymal-C-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.AnymalCRoughEnvCfg, "env_cfg_entry_point": rough_env_cfg.AnymalCRoughEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCRoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCRoughPPORunnerCfg,
...@@ -41,7 +41,7 @@ gym.register( ...@@ -41,7 +41,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Anymal-C-Play-v0", id="Isaac-Velocity-Rough-Anymal-C-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.AnymalCRoughEnvCfg_PLAY, "env_cfg_entry_point": rough_env_cfg.AnymalCRoughEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCRoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalCRoughPPORunnerCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -13,7 +13,7 @@ from . import agents, flat_env_cfg, rough_env_cfg ...@@ -13,7 +13,7 @@ from . import agents, flat_env_cfg, rough_env_cfg
gym.register( gym.register(
id="Isaac-Velocity-Flat-Anymal-D-v0", id="Isaac-Velocity-Flat-Anymal-D-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.AnymalDFlatEnvCfg, "env_cfg_entry_point": flat_env_cfg.AnymalDFlatEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDFlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDFlatPPORunnerCfg,
...@@ -22,7 +22,7 @@ gym.register( ...@@ -22,7 +22,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Flat-Anymal-D-Play-v0", id="Isaac-Velocity-Flat-Anymal-D-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.AnymalDFlatEnvCfg_PLAY, "env_cfg_entry_point": flat_env_cfg.AnymalDFlatEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDFlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDFlatPPORunnerCfg,
...@@ -31,7 +31,7 @@ gym.register( ...@@ -31,7 +31,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Anymal-D-v0", id="Isaac-Velocity-Rough-Anymal-D-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.AnymalDRoughEnvCfg, "env_cfg_entry_point": rough_env_cfg.AnymalDRoughEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDRoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDRoughPPORunnerCfg,
...@@ -40,7 +40,7 @@ gym.register( ...@@ -40,7 +40,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Anymal-D-Play-v0", id="Isaac-Velocity-Rough-Anymal-D-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.AnymalDRoughEnvCfg_PLAY, "env_cfg_entry_point": rough_env_cfg.AnymalDRoughEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDRoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.AnymalDRoughPPORunnerCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -13,7 +13,7 @@ from . import agents, flat_env_cfg, rough_env_cfg ...@@ -13,7 +13,7 @@ from . import agents, flat_env_cfg, rough_env_cfg
gym.register( gym.register(
id="Isaac-Velocity-Flat-Unitree-A1-v0", id="Isaac-Velocity-Flat-Unitree-A1-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.UnitreeA1FlatEnvCfg, "env_cfg_entry_point": flat_env_cfg.UnitreeA1FlatEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1FlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1FlatPPORunnerCfg,
...@@ -22,7 +22,7 @@ gym.register( ...@@ -22,7 +22,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Flat-Unitree-A1-Play-v0", id="Isaac-Velocity-Flat-Unitree-A1-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": flat_env_cfg.UnitreeA1FlatEnvCfg_PLAY, "env_cfg_entry_point": flat_env_cfg.UnitreeA1FlatEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1FlatPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1FlatPPORunnerCfg,
...@@ -31,7 +31,7 @@ gym.register( ...@@ -31,7 +31,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Unitree-A1-v0", id="Isaac-Velocity-Rough-Unitree-A1-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.UnitreeA1RoughEnvCfg, "env_cfg_entry_point": rough_env_cfg.UnitreeA1RoughEnvCfg,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1RoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1RoughPPORunnerCfg,
...@@ -40,7 +40,7 @@ gym.register( ...@@ -40,7 +40,7 @@ gym.register(
gym.register( gym.register(
id="Isaac-Velocity-Rough-Unitree-A1-Play-v0", id="Isaac-Velocity-Rough-Unitree-A1-Play-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": rough_env_cfg.UnitreeA1RoughEnvCfg_PLAY, "env_cfg_entry_point": rough_env_cfg.UnitreeA1RoughEnvCfg_PLAY,
"rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1RoughPPORunnerCfg, "rsl_rl_cfg_entry_point": agents.rsl_rl_cfg.UnitreeA1RoughPPORunnerCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit_envs.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg from omni.isaac.orbit_tasks.locomotion.velocity.velocity_env_cfg import LocomotionVelocityRoughEnvCfg
## ##
# Pre-defined configs # Pre-defined configs
......
...@@ -12,10 +12,10 @@ from omni.isaac.orbit.managers import SceneEntityCfg ...@@ -12,10 +12,10 @@ from omni.isaac.orbit.managers import SceneEntityCfg
from omni.isaac.orbit.sensors import ContactSensor from omni.isaac.orbit.sensors import ContactSensor
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
def feet_air_time(env: RLEnv, sensor_cfg: SceneEntityCfg, threshold: float) -> torch.Tensor: def feet_air_time(env: RLTaskEnv, sensor_cfg: SceneEntityCfg, threshold: float) -> torch.Tensor:
"""Reward long steps taken by the feet using L2-kernel. """Reward long steps taken by the feet using L2-kernel.
This function rewards the agent for taking steps that are longer than a threshold. This helps ensure This function rewards the agent for taking steps that are longer than a threshold. This helps ensure
......
...@@ -11,7 +11,7 @@ from dataclasses import MISSING ...@@ -11,7 +11,7 @@ from dataclasses import MISSING
import omni.isaac.orbit.sim as sim_utils import omni.isaac.orbit.sim as sim_utils
from omni.isaac.orbit.assets import ArticulationCfg, AssetBaseCfg from omni.isaac.orbit.assets import ArticulationCfg, AssetBaseCfg
from omni.isaac.orbit.command_generators import UniformVelocityCommandGeneratorCfg from omni.isaac.orbit.command_generators import UniformVelocityCommandGeneratorCfg
from omni.isaac.orbit.envs import RLEnvCfg from omni.isaac.orbit.envs import RLTaskEnvCfg
from omni.isaac.orbit.managers import CurriculumTermCfg as CurrTerm from omni.isaac.orbit.managers import CurriculumTermCfg as CurrTerm
from omni.isaac.orbit.managers import ObservationGroupCfg as ObsGroup from omni.isaac.orbit.managers import ObservationGroupCfg as ObsGroup
from omni.isaac.orbit.managers import ObservationTermCfg as ObsTerm from omni.isaac.orbit.managers import ObservationTermCfg as ObsTerm
...@@ -25,7 +25,7 @@ from omni.isaac.orbit.terrains import TerrainImporterCfg ...@@ -25,7 +25,7 @@ from omni.isaac.orbit.terrains import TerrainImporterCfg
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit.utils.noise import AdditiveUniformNoiseCfg as Unoise from omni.isaac.orbit.utils.noise import AdditiveUniformNoiseCfg as Unoise
import omni.isaac.orbit_envs.locomotion.velocity.mdp as mdp import omni.isaac.orbit_tasks.locomotion.velocity.mdp as mdp
## ##
# Pre-defined configs # Pre-defined configs
...@@ -243,7 +243,7 @@ class CurriculumCfg: ...@@ -243,7 +243,7 @@ class CurriculumCfg:
@configclass @configclass
class LocomotionVelocityRoughEnvCfg(RLEnvCfg): class LocomotionVelocityRoughEnvCfg(RLTaskEnvCfg):
"""Configuration for the locomotion velocity-tracking environment.""" """Configuration for the locomotion velocity-tracking environment."""
# Scene settings # Scene settings
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# TODO: be moved once CabinetEnv exists # TODO: be moved once CabinetEnv exists
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -17,7 +17,7 @@ from . import agents ...@@ -17,7 +17,7 @@ from . import agents
gym.register( gym.register(
id="Isaac-Lift-Franka-v0", id="Isaac-Lift-Franka-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": f"{__name__}.lift_env_cfg:LiftEnvCfg", "env_cfg_entry_point": f"{__name__}.lift_env_cfg:LiftEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml", "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -12,7 +12,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulatorCfg ...@@ -12,7 +12,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulatorCfg
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit.utils.assets import ISAAC_NUCLEUS_DIR from omni.isaac.orbit.utils.assets import ISAAC_NUCLEUS_DIR
from omni.isaac.orbit_envs.isaac_env_cfg import EnvCfg, IsaacEnvCfg, PhysxCfg, SimCfg, ViewerCfg from omni.isaac.orbit_tasks.isaac_env_cfg import EnvCfg, IsaacEnvCfg, PhysxCfg, SimCfg, ViewerCfg
## ##
# Scene settings # Scene settings
......
...@@ -20,7 +20,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulator ...@@ -20,7 +20,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulator
from omni.isaac.orbit.utils.dict import class_to_dict from omni.isaac.orbit.utils.dict import class_to_dict
from omni.isaac.orbit.utils.math import quat_inv, quat_mul, random_orientation, sample_uniform, scale_transform from omni.isaac.orbit.utils.math import quat_inv, quat_mul, random_orientation, sample_uniform, scale_transform
from omni.isaac.orbit_envs.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs from omni.isaac.orbit_tasks.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs
from .lift_cfg import LiftEnvCfg, RandomizationCfg from .lift_cfg import LiftEnvCfg, RandomizationCfg
......
...@@ -15,7 +15,7 @@ from . import agents ...@@ -15,7 +15,7 @@ from . import agents
gym.register( gym.register(
id="Isaac-Reach-Franka-v0", id="Isaac-Reach-Franka-v0",
entry_point="omni.isaac.orbit.envs.rl_env:RLEnv", entry_point="omni.isaac.orbit.envs:RLTaskEnv",
kwargs={ kwargs={
"env_cfg_entry_point": f"{__name__}.reach_env_cfg:ReachEnvCfg", "env_cfg_entry_point": f"{__name__}.reach_env_cfg:ReachEnvCfg",
"rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml", "rl_games_cfg_entry_point": f"{agents.__name__}:rl_games_ppo_cfg.yaml",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlPpoActorCriticCfg, RslRlPpoActorCriticCfg,
RslRlPpoAlgorithmCfg, RslRlPpoAlgorithmCfg,
......
...@@ -11,7 +11,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulatorCfg ...@@ -11,7 +11,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulatorCfg
from omni.isaac.orbit.utils import configclass from omni.isaac.orbit.utils import configclass
from omni.isaac.orbit.utils.assets import ISAAC_NUCLEUS_DIR from omni.isaac.orbit.utils.assets import ISAAC_NUCLEUS_DIR
from omni.isaac.orbit_envs.isaac_env_cfg import EnvCfg, IsaacEnvCfg, SimCfg, ViewerCfg from omni.isaac.orbit_tasks.isaac_env_cfg import EnvCfg, IsaacEnvCfg, SimCfg, ViewerCfg
## ##
# Scene settings # Scene settings
......
...@@ -19,7 +19,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulator ...@@ -19,7 +19,7 @@ from omni.isaac.orbit.robots.single_arm import SingleArmManipulator
from omni.isaac.orbit.utils.dict import class_to_dict from omni.isaac.orbit.utils.dict import class_to_dict
from omni.isaac.orbit.utils.math import random_orientation, sample_uniform, scale_transform from omni.isaac.orbit.utils.math import random_orientation, sample_uniform, scale_transform
from omni.isaac.orbit_envs.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs from omni.isaac.orbit_tasks.isaac_env import IsaacEnv, VecEnvIndices, VecEnvObs
from .reach_cfg import RandomizationCfg, ReachEnvCfg from .reach_cfg import RandomizationCfg, ReachEnvCfg
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"""Utilities and wrappers for environments.""" """Utilities and wrappers for environments."""
from .importer import import_packages
from .parse_cfg import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg from .parse_cfg import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg
__all__ = ["load_cfg_from_registry", "parse_env_cfg", "get_checkpoint_path"] __all__ = ["load_cfg_from_registry", "parse_env_cfg", "get_checkpoint_path", "import_packages"]
# Copyright (c) 2022-2023, The ORBIT Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
"""Utilities for importing all configs in a package recursively."""
from __future__ import annotations
import importlib
import pkgutil
import sys
__all__ = ["import_packages"]
def import_packages(package_name: str, blacklist_pkgs: list[str] = None):
"""Import all sub-packages in a package recursively.
It is easier to use this function to import all sub-packages in a package recursively
than to manually import each sub-package.
It replaces the need of the following code snippet on the top of each package's ``__init__.py`` file:
.. code-block:: python
import .locomotion.velocity
import .manipulation.reach
import .manipulation.lift
Args:
package_name: The package name.
blacklist_pkgs: The list of blacklisted packages to skip. Defaults to None,
which means no packages are blacklisted.
"""
# Default blacklist
if blacklist_pkgs is None:
blacklist_pkgs = []
# Import the package itself
package = importlib.import_module(package_name)
# Import all Python files
for _ in _walk_packages(package.__path__, package.__name__ + ".", blacklist_pkgs=blacklist_pkgs):
pass
def _walk_packages(
path: str | None = None,
prefix: str = "",
onerror: callable | None = None,
blacklist_pkgs: list[str] | None = None,
):
"""Yields ModuleInfo for all modules recursively on path, or, if path is None, all accessible modules.
Note:
This function is a modified version of the original ``pkgutil.walk_packages`` function. It adds
the `blacklist_pkgs` argument to skip blacklisted packages. Please refer to the original
``pkgutil.walk_packages`` function for more details.
"""
if blacklist_pkgs is None:
blacklist_pkgs = []
def seen(p, m={}):
if p in m:
return True
m[p] = True # noqa: R503
for info in pkgutil.iter_modules(path, prefix):
# check blacklisted
if any([black_pkg_name in info.name for black_pkg_name in blacklist_pkgs]):
continue
# yield the module info
yield info
if info.ispkg:
try:
__import__(info.name)
except ImportError:
if onerror is not None:
onerror(info.name)
except Exception:
if onerror is not None:
onerror(info.name)
else:
raise
else:
path = getattr(sys.modules[info.name], "__path__", None) or []
# don't traverse path items we've seen before
path = [p for p in path if not seen(p)]
yield from _walk_packages(path, info.name + ".", onerror, blacklist_pkgs)
...@@ -37,7 +37,7 @@ def load_cfg_from_registry(task_name: str, entry_point_key: str) -> dict | Any: ...@@ -37,7 +37,7 @@ def load_cfg_from_registry(task_name: str, entry_point_key: str) -> dict | Any:
Usage: Usage:
.. code-block:: python .. code-block:: python
from omni.isaac.orbit_envs.utils.parse_cfg import load_cfg_from_registry from omni.isaac.orbit_tasks.utils.parse_cfg import load_cfg_from_registry
cfg = load_cfg_from_registry("My-Awesome-Task-v0", "env_entry_point_cfg") cfg = load_cfg_from_registry("My-Awesome-Task-v0", "env_entry_point_cfg")
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
"""Wrapper to configure an :class:`RLEnv` instance to RL-Games vectorized environment. """Wrapper to configure an :class:`RLTaskEnv` instance to RL-Games vectorized environment.
The following example shows how to wrap an environment for RL-Games and register the environment construction The following example shows how to wrap an environment for RL-Games and register the environment construction
for RL-Games :class:`Runner` class: for RL-Games :class:`Runner` class:
...@@ -12,7 +12,7 @@ for RL-Games :class:`Runner` class: ...@@ -12,7 +12,7 @@ for RL-Games :class:`Runner` class:
from rl_games.common import env_configurations, vecenv from rl_games.common import env_configurations, vecenv
from omni.isaac.orbit_envs.utils.wrappers.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper
# configuration parameters # configuration parameters
rl_device = "cuda:0" rl_device = "cuda:0"
...@@ -39,7 +39,7 @@ import torch ...@@ -39,7 +39,7 @@ import torch
from rl_games.common import env_configurations from rl_games.common import env_configurations
from rl_games.common.vecenv import IVecEnv from rl_games.common.vecenv import IVecEnv
from omni.isaac.orbit.envs import RLEnv, VecEnvObs from omni.isaac.orbit.envs import RLTaskEnv, VecEnvObs
__all__ = ["RlGamesVecEnvWrapper", "RlGamesGpuEnv"] __all__ = ["RlGamesVecEnvWrapper", "RlGamesGpuEnv"]
...@@ -74,7 +74,7 @@ class RlGamesVecEnvWrapper(gym.Wrapper): ...@@ -74,7 +74,7 @@ class RlGamesVecEnvWrapper(gym.Wrapper):
https://github.com/NVIDIA-Omniverse/IsaacGymEnvs https://github.com/NVIDIA-Omniverse/IsaacGymEnvs
""" """
def __init__(self, env: RLEnv, rl_device: str, clip_obs: float, clip_actions: float): def __init__(self, env: RLTaskEnv, rl_device: str, clip_obs: float, clip_actions: float):
"""Initializes the wrapper instance. """Initializes the wrapper instance.
Args: Args:
...@@ -84,11 +84,11 @@ class RlGamesVecEnvWrapper(gym.Wrapper): ...@@ -84,11 +84,11 @@ class RlGamesVecEnvWrapper(gym.Wrapper):
clip_actions: The clipping value for actions. clip_actions: The clipping value for actions.
Raises: Raises:
ValueError: The environment is not inherited from :class:`RLEnv`. ValueError: The environment is not inherited from :class:`RLTaskEnv`.
""" """
# check that input is valid # check that input is valid
if not isinstance(env.unwrapped, RLEnv): if not isinstance(env.unwrapped, RLTaskEnv):
raise ValueError(f"The environment must be inherited from RLEnv. Environment type: {type(env)}") raise ValueError(f"The environment must be inherited from RLTaskEnv. Environment type: {type(env)}")
# initialize gym wrapper # initialize gym wrapper
gym.Wrapper.__init__(self, env) gym.Wrapper.__init__(self, env)
# initialize rl-games vec-env # initialize rl-games vec-env
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
"""Wrapper to configure an :class:`RLEnv` instance to RSL-RL vectorized environment. """Wrapper to configure an :class:`RLTaskEnv` instance to RSL-RL vectorized environment.
The following example shows how to wrap an environment for RSL-RL: The following example shows how to wrap an environment for RSL-RL:
.. code-block:: python .. code-block:: python
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import RslRlVecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import RslRlVecEnvWrapper
env = RslRlVecEnvWrapper(env) env = RslRlVecEnvWrapper(env)
...@@ -21,7 +21,7 @@ import gym ...@@ -21,7 +21,7 @@ import gym
import gym.spaces import gym.spaces
import torch import torch
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
class RslRlVecEnvWrapper(gym.Wrapper): class RslRlVecEnvWrapper(gym.Wrapper):
...@@ -38,22 +38,22 @@ class RslRlVecEnvWrapper(gym.Wrapper): ...@@ -38,22 +38,22 @@ class RslRlVecEnvWrapper(gym.Wrapper):
https://github.com/leggedrobotics/rsl_rl/blob/master/rsl_rl/env/vec_env.py https://github.com/leggedrobotics/rsl_rl/blob/master/rsl_rl/env/vec_env.py
""" """
def __init__(self, env: RLEnv): def __init__(self, env: RLTaskEnv):
"""Initializes the wrapper. """Initializes the wrapper.
Args: Args:
env: The environment to wrap around. env: The environment to wrap around.
Raises: Raises:
ValueError: When the environment is not an instance of :class:`RLEnv`. ValueError: When the environment is not an instance of :class:`RLTaskEnv`.
""" """
# check that input is valid # check that input is valid
if not isinstance(env.unwrapped, RLEnv): if not isinstance(env.unwrapped, RLTaskEnv):
raise ValueError(f"The environment must be inherited from RLEnv. Environment type: {type(env)}") raise ValueError(f"The environment must be inherited from RLTaskEnv. Environment type: {type(env)}")
# initialize the wrapper # initialize the wrapper
gym.Wrapper.__init__(self, env) gym.Wrapper.__init__(self, env)
# store information required by wrapper # store information required by wrapper
orbit_env: RLEnv = self.env.unwrapped orbit_env: RLTaskEnv = self.env.unwrapped
self.num_envs = orbit_env.num_envs self.num_envs = orbit_env.num_envs
self.num_actions = orbit_env.action_manager.total_action_dim self.num_actions = orbit_env.action_manager.total_action_dim
self.num_obs = orbit_env.observation_manager.group_obs_dim["policy"][0] self.num_obs = orbit_env.observation_manager.group_obs_dim["policy"][0]
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
"""Wrapper to configure an :class:`RLEnv` instance to Stable-Baselines3 vectorized environment. """Wrapper to configure an :class:`RLTaskEnv` instance to Stable-Baselines3 vectorized environment.
The following example shows how to wrap an environment for Stable-Baselines3: The following example shows how to wrap an environment for Stable-Baselines3:
.. code-block:: python .. code-block:: python
from omni.isaac.orbit_envs.utils.wrappers.sb3 import Sb3VecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.sb3 import Sb3VecEnvWrapper
env = Sb3VecEnvWrapper(env) env = Sb3VecEnvWrapper(env)
...@@ -24,7 +24,7 @@ from typing import Any ...@@ -24,7 +24,7 @@ from typing import Any
from stable_baselines3.common.vec_env.base_vec_env import VecEnv, VecEnvObs, VecEnvStepReturn from stable_baselines3.common.vec_env.base_vec_env import VecEnv, VecEnvObs, VecEnvStepReturn
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
__all__ = ["process_sb3_cfg", "Sb3VecEnvWrapper"] __all__ = ["process_sb3_cfg", "Sb3VecEnvWrapper"]
...@@ -72,7 +72,7 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv): ...@@ -72,7 +72,7 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv):
still considered a single environment instance, Stable Baselines tries to wrap still considered a single environment instance, Stable Baselines tries to wrap
around it using the :class:`DummyVecEnv`. This is only done if the environment around it using the :class:`DummyVecEnv`. This is only done if the environment
is not inheriting from their :class:`VecEnv`. Thus, this class thinly wraps is not inheriting from their :class:`VecEnv`. Thus, this class thinly wraps
over the environment from :class:`RLEnv`. over the environment from :class:`RLTaskEnv`.
We also add monitoring functionality that computes the un-discounted episode We also add monitoring functionality that computes the un-discounted episode
return and length. This information is added to the info dicts under key `episode`. return and length. This information is added to the info dicts under key `episode`.
...@@ -97,18 +97,18 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv): ...@@ -97,18 +97,18 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv):
https://stable-baselines3.readthedocs.io/en/master/common/monitor.html https://stable-baselines3.readthedocs.io/en/master/common/monitor.html
""" """
def __init__(self, env: RLEnv): def __init__(self, env: RLTaskEnv):
"""Initialize the wrapper. """Initialize the wrapper.
Args: Args:
env: The environment to wrap around. env: The environment to wrap around.
Raises: Raises:
ValueError: When the environment is not an instance of :class:`RLEnv`. ValueError: When the environment is not an instance of :class:`RLTaskEnv`.
""" """
# check that input is valid # check that input is valid
if not isinstance(env.unwrapped, RLEnv): if not isinstance(env.unwrapped, RLTaskEnv):
raise ValueError(f"The environment must be inherited from RLEnv. Environment type: {type(env)}") raise ValueError(f"The environment must be inherited from RLTaskEnv. Environment type: {type(env)}")
# initialize the wrapper # initialize the wrapper
gym.Wrapper.__init__(self, env) gym.Wrapper.__init__(self, env)
# initialize vec-env # initialize vec-env
...@@ -152,7 +152,7 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv): ...@@ -152,7 +152,7 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv):
reset_ids = (dones > 0).nonzero(as_tuple=False) reset_ids = (dones > 0).nonzero(as_tuple=False)
# convert data types to numpy depending on backend # convert data types to numpy depending on backend
# Note: RLEnv uses torch backend (by default). # Note: RLTaskEnv uses torch backend (by default).
obs = self._process_obs(obs_dict) obs = self._process_obs(obs_dict)
rew = rew.cpu().numpy() rew = rew.cpu().numpy()
dones = dones.cpu().numpy() dones = dones.cpu().numpy()
...@@ -198,7 +198,7 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv): ...@@ -198,7 +198,7 @@ class Sb3VecEnvWrapper(gym.Wrapper, VecEnv):
"""Convert observations into NumPy data type.""" """Convert observations into NumPy data type."""
# Sb3 doesn't support asymmetric observation spaces, so we only use "policy" # Sb3 doesn't support asymmetric observation spaces, so we only use "policy"
obs = obs_dict["policy"] obs = obs_dict["policy"]
# Note: RLEnv uses torch backend (by default). # Note: RLTaskEnv uses torch backend (by default).
if self.env.sim.backend == "torch": if self.env.sim.backend == "torch":
if isinstance(obs, dict): if isinstance(obs, dict):
for key, value in obs.items(): for key, value in obs.items():
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
"""Wrapper to configure an :class:`RLEnv` instance to skrl environment. """Wrapper to configure an :class:`RLTaskEnv` instance to skrl environment.
The following example shows how to wrap an environment for skrl: The following example shows how to wrap an environment for skrl:
.. code-block:: python .. code-block:: python
from omni.isaac.orbit_envs.utils.wrappers.skrl import SkrlVecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.skrl import SkrlVecEnvWrapper
env = SkrlVecEnvWrapper(env) env = SkrlVecEnvWrapper(env)
...@@ -37,7 +37,7 @@ from skrl.trainers.torch import Trainer ...@@ -37,7 +37,7 @@ from skrl.trainers.torch import Trainer
from skrl.trainers.torch.sequential import SEQUENTIAL_TRAINER_DEFAULT_CONFIG from skrl.trainers.torch.sequential import SEQUENTIAL_TRAINER_DEFAULT_CONFIG
from skrl.utils.model_instantiators import Shape # noqa: F401 from skrl.utils.model_instantiators import Shape # noqa: F401
from omni.isaac.orbit.envs import RLEnv from omni.isaac.orbit.envs import RLTaskEnv
__all__ = ["SkrlVecEnvWrapper", "SkrlSequentialLogTrainer"] __all__ = ["SkrlVecEnvWrapper", "SkrlSequentialLogTrainer"]
...@@ -92,10 +92,10 @@ Vectorized environment wrapper. ...@@ -92,10 +92,10 @@ Vectorized environment wrapper.
""" """
def SkrlVecEnvWrapper(env: RLEnv): def SkrlVecEnvWrapper(env: RLTaskEnv):
"""Wraps around Isaac Orbit environment for skrl. """Wraps around Isaac Orbit environment for skrl.
This function wraps around the Isaac Orbit environment. Since the :class:`RLEnv` environment This function wraps around the Isaac Orbit environment. Since the :class:`RLTaskEnv` environment
wrapping functionality is defined within the skrl library itself, this implementation wrapping functionality is defined within the skrl library itself, this implementation
is maintained for compatibility with the structure of the extension that contains it. is maintained for compatibility with the structure of the extension that contains it.
Internally it calls the :func:`wrap_env` from the skrl library API. Internally it calls the :func:`wrap_env` from the skrl library API.
...@@ -104,14 +104,14 @@ def SkrlVecEnvWrapper(env: RLEnv): ...@@ -104,14 +104,14 @@ def SkrlVecEnvWrapper(env: RLEnv):
env: The environment to wrap around. env: The environment to wrap around.
Raises: Raises:
ValueError: When the environment is not an instance of :class:`RLEnv`. ValueError: When the environment is not an instance of :class:`RLTaskEnv`.
Reference: Reference:
https://skrl.readthedocs.io/en/latest/modules/skrl.envs.wrapping.html https://skrl.readthedocs.io/en/latest/modules/skrl.envs.wrapping.html
""" """
# check that input is valid # check that input is valid
if not isinstance(env.unwrapped, RLEnv): if not isinstance(env.unwrapped, RLTaskEnv):
raise ValueError(f"The environment must be inherited from RLEnv. Environment type: {type(env)}") raise ValueError(f"The environment must be inherited from RLTaskEnv. Environment type: {type(env)}")
# wrap and return the environment # wrap and return the environment
return wrap_env(env, wrapper="isaac-orbit") return wrap_env(env, wrapper="isaac-orbit")
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: BSD-3-Clause
"""Installation script for the 'omni.isaac.orbit_envs' python package.""" """Installation script for the 'omni.isaac.orbit_tasks' python package."""
import itertools import itertools
import os import os
...@@ -42,7 +42,7 @@ EXTRAS_REQUIRE["all"] = list(itertools.chain.from_iterable(EXTRAS_REQUIRE.values ...@@ -42,7 +42,7 @@ EXTRAS_REQUIRE["all"] = list(itertools.chain.from_iterable(EXTRAS_REQUIRE.values
# Installation operation # Installation operation
setup( setup(
name="omni-isaac-orbit_envs", name="omni-isaac-orbit_tasks",
author="NVIDIA, ETH Zurich, and University of Toronto", author="NVIDIA, ETH Zurich, and University of Toronto",
maintainer="Mayank Mittal", maintainer="Mayank Mittal",
maintainer_email="mittalma@ethz.ch", maintainer_email="mittalma@ethz.ch",
...@@ -54,7 +54,7 @@ setup( ...@@ -54,7 +54,7 @@ setup(
python_requires=">=3.7", python_requires=">=3.7",
install_requires=INSTALL_REQUIRES, install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
packages=["omni.isaac.orbit_envs"], packages=["omni.isaac.orbit_tasks"],
classifiers=["Natural Language :: English", "Programming Language :: Python :: 3.7"], classifiers=["Natural Language :: English", "Programming Language :: Python :: 3.7"],
zip_safe=False, zip_safe=False,
) )
...@@ -9,7 +9,7 @@ import os ...@@ -9,7 +9,7 @@ import os
import torch import torch
import unittest import unittest
from omni.isaac.orbit_envs.utils.data_collector import RobomimicDataCollector from omni.isaac.orbit_tasks.utils.data_collector import RobomimicDataCollector
class TestRobomimicDataCollector(unittest.TestCase): class TestRobomimicDataCollector(unittest.TestCase):
......
...@@ -27,8 +27,8 @@ import unittest ...@@ -27,8 +27,8 @@ import unittest
import omni.usd import omni.usd
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils.parse_cfg import parse_env_cfg from omni.isaac.orbit_tasks.utils.parse_cfg import parse_env_cfg
class TestEnvironments(unittest.TestCase): class TestEnvironments(unittest.TestCase):
......
...@@ -24,9 +24,9 @@ import os ...@@ -24,9 +24,9 @@ import os
import torch import torch
import unittest import unittest
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import parse_env_cfg from omni.isaac.orbit_tasks.utils import parse_env_cfg
class TestRecordVideoWrapper(unittest.TestCase): class TestRecordVideoWrapper(unittest.TestCase):
......
...@@ -9,7 +9,7 @@ Script to print all the available environments in ORBIT. ...@@ -9,7 +9,7 @@ Script to print all the available environments in ORBIT.
The script iterates over all registered environments and stores the details in a table. The script iterates over all registered environments and stores the details in a table.
It prints the name of the environment, the entry point and the config file. It prints the name of the environment, the entry point and the config file.
All the environments are registered in the `omni.isaac.orbit_envs` extension. They start All the environments are registered in the `omni.isaac.orbit_tasks` extension. They start
with `Isaac` in their name. with `Isaac` in their name.
""" """
...@@ -30,12 +30,12 @@ simulation_app = app_launcher.app ...@@ -30,12 +30,12 @@ simulation_app = app_launcher.app
import gym import gym
from prettytable import PrettyTable from prettytable import PrettyTable
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
def main(): def main():
"""Print all environments registered in `omni.isaac.orbit_envs` extension.""" """Print all environments registered in `omni.isaac.orbit_tasks` extension."""
# print all the available environments # print all the available environments
table = PrettyTable(["S. No.", "Task Name", "Entry Point", "Config"]) table = PrettyTable(["S. No.", "Task Name", "Entry Point", "Config"])
table.title = "Available Environments in ORBIT" table.title = "Available Environments in ORBIT"
......
...@@ -37,9 +37,9 @@ import traceback ...@@ -37,9 +37,9 @@ import traceback
import carb import carb
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import parse_env_cfg from omni.isaac.orbit_tasks.utils import parse_env_cfg
def main(): def main():
......
...@@ -47,8 +47,8 @@ import warp as wp ...@@ -47,8 +47,8 @@ import warp as wp
from omni.isaac.orbit.utils.timer import Timer from omni.isaac.orbit.utils.timer import Timer
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils.parse_cfg import parse_env_cfg from omni.isaac.orbit_tasks.utils.parse_cfg import parse_env_cfg
# initialize warp # initialize warp
wp.init() wp.init()
......
...@@ -41,9 +41,9 @@ import carb ...@@ -41,9 +41,9 @@ import carb
from omni.isaac.orbit.devices import Se3Gamepad, Se3Keyboard, Se3SpaceMouse from omni.isaac.orbit.devices import Se3Gamepad, Se3Keyboard, Se3SpaceMouse
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import parse_env_cfg from omni.isaac.orbit_tasks.utils import parse_env_cfg
def pre_process_actions(delta_pose: torch.Tensor, gripper_command: bool) -> torch.Tensor: def pre_process_actions(delta_pose: torch.Tensor, gripper_command: bool) -> torch.Tensor:
......
...@@ -36,9 +36,9 @@ import traceback ...@@ -36,9 +36,9 @@ import traceback
import carb import carb
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import parse_env_cfg from omni.isaac.orbit_tasks.utils import parse_env_cfg
def main(): def main():
......
...@@ -48,10 +48,10 @@ from rl_games.common import env_configurations, vecenv ...@@ -48,10 +48,10 @@ from rl_games.common import env_configurations, vecenv
from rl_games.common.player import BasePlayer from rl_games.common.player import BasePlayer
from rl_games.torch_runner import Runner from rl_games.torch_runner import Runner
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg from omni.isaac.orbit_tasks.utils import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper
def main(): def main():
......
...@@ -55,10 +55,10 @@ from rl_games.torch_runner import Runner ...@@ -55,10 +55,10 @@ from rl_games.torch_runner import Runner
from omni.isaac.orbit.utils.dict import print_dict from omni.isaac.orbit.utils.dict import print_dict
from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import load_cfg_from_registry, parse_env_cfg from omni.isaac.orbit_tasks.utils import load_cfg_from_registry, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.rl_games import RlGamesGpuEnv, RlGamesVecEnvWrapper
def main(): def main():
......
...@@ -45,10 +45,10 @@ import carb ...@@ -45,10 +45,10 @@ import carb
from omni.isaac.orbit.devices import Se3Keyboard, Se3SpaceMouse from omni.isaac.orbit.devices import Se3Keyboard, Se3SpaceMouse
from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils.data_collector import RobomimicDataCollector from omni.isaac.orbit_tasks.utils.data_collector import RobomimicDataCollector
from omni.isaac.orbit_envs.utils.parse_cfg import parse_env_cfg from omni.isaac.orbit_tasks.utils.parse_cfg import parse_env_cfg
def pre_process_actions(delta_pose: torch.Tensor, gripper_command: bool) -> torch.Tensor: def pre_process_actions(delta_pose: torch.Tensor, gripper_command: bool) -> torch.Tensor:
......
...@@ -40,9 +40,9 @@ import robomimic # noqa: F401 ...@@ -40,9 +40,9 @@ import robomimic # noqa: F401
import robomimic.utils.file_utils as FileUtils import robomimic.utils.file_utils as FileUtils
import robomimic.utils.torch_utils as TorchUtils import robomimic.utils.torch_utils as TorchUtils
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import parse_env_cfg from omni.isaac.orbit_tasks.utils import parse_env_cfg
def main(): def main():
......
...@@ -9,7 +9,7 @@ import argparse ...@@ -9,7 +9,7 @@ import argparse
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
if TYPE_CHECKING: if TYPE_CHECKING:
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import RslRlOnPolicyRunnerCfg from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import RslRlOnPolicyRunnerCfg
def add_rsl_rl_args(parser: argparse.ArgumentParser): def add_rsl_rl_args(parser: argparse.ArgumentParser):
...@@ -38,7 +38,7 @@ def parse_rsl_rl_cfg(task_name: str, args_cli: argparse.Namespace) -> RslRlOnPol ...@@ -38,7 +38,7 @@ def parse_rsl_rl_cfg(task_name: str, args_cli: argparse.Namespace) -> RslRlOnPol
Returns: Returns:
The parsed configuration for RSL-RL agent based on inputs. The parsed configuration for RSL-RL agent based on inputs.
""" """
from omni.isaac.orbit_envs.utils.parse_cfg import load_cfg_from_registry from omni.isaac.orbit_tasks.utils.parse_cfg import load_cfg_from_registry
# load the default configuration # load the default configuration
rslrl_cfg: RslRlOnPolicyRunnerCfg = load_cfg_from_registry(task_name, "rsl_rl_cfg_entry_point") rslrl_cfg: RslRlOnPolicyRunnerCfg = load_cfg_from_registry(task_name, "rsl_rl_cfg_entry_point")
......
...@@ -44,10 +44,10 @@ import traceback ...@@ -44,10 +44,10 @@ import traceback
import carb import carb
from rsl_rl.runners import OnPolicyRunner from rsl_rl.runners import OnPolicyRunner
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import get_checkpoint_path, parse_env_cfg from omni.isaac.orbit_tasks.utils import get_checkpoint_path, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import ( from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import (
RslRlOnPolicyRunnerCfg, RslRlOnPolicyRunnerCfg,
RslRlVecEnvWrapper, RslRlVecEnvWrapper,
export_policy_as_onnx, export_policy_as_onnx,
......
...@@ -56,14 +56,14 @@ from datetime import datetime ...@@ -56,14 +56,14 @@ from datetime import datetime
import carb import carb
from rsl_rl.runners import OnPolicyRunner from rsl_rl.runners import OnPolicyRunner
from omni.isaac.orbit.envs.rl_env_cfg import RLEnvCfg from omni.isaac.orbit.envs import RLTaskEnvCfg
from omni.isaac.orbit.utils.dict import print_dict from omni.isaac.orbit.utils.dict import print_dict
from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import get_checkpoint_path, parse_env_cfg from omni.isaac.orbit_tasks.utils import get_checkpoint_path, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.rsl_rl import RslRlOnPolicyRunnerCfg, RslRlVecEnvWrapper from omni.isaac.orbit_tasks.utils.wrappers.rsl_rl import RslRlOnPolicyRunnerCfg, RslRlVecEnvWrapper
torch.backends.cuda.matmul.allow_tf32 = True torch.backends.cuda.matmul.allow_tf32 = True
torch.backends.cudnn.allow_tf32 = True torch.backends.cudnn.allow_tf32 = True
...@@ -74,7 +74,7 @@ torch.backends.cudnn.benchmark = False ...@@ -74,7 +74,7 @@ torch.backends.cudnn.benchmark = False
def main(): def main():
"""Train with RSL-RL agent.""" """Train with RSL-RL agent."""
# parse configuration # parse configuration
env_cfg: RLEnvCfg = parse_env_cfg(args_cli.task, use_gpu=not args_cli.cpu, num_envs=args_cli.num_envs) env_cfg: RLTaskEnvCfg = parse_env_cfg(args_cli.task, use_gpu=not args_cli.cpu, num_envs=args_cli.num_envs)
agent_cfg: RslRlOnPolicyRunnerCfg = cli_args.parse_rsl_rl_cfg(args_cli.task, args_cli) agent_cfg: RslRlOnPolicyRunnerCfg = cli_args.parse_rsl_rl_cfg(args_cli.task, args_cli)
# specify directory for logging experiments # specify directory for logging experiments
......
...@@ -41,10 +41,10 @@ import carb ...@@ -41,10 +41,10 @@ import carb
from stable_baselines3 import PPO from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import VecNormalize from stable_baselines3.common.vec_env import VecNormalize
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils.parse_cfg import load_cfg_from_registry, parse_env_cfg from omni.isaac.orbit_tasks.utils.parse_cfg import load_cfg_from_registry, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.sb3 import Sb3VecEnvWrapper, process_sb3_cfg from omni.isaac.orbit_tasks.utils.wrappers.sb3 import Sb3VecEnvWrapper, process_sb3_cfg
def main(): def main():
......
...@@ -57,10 +57,10 @@ from stable_baselines3.common.vec_env import VecNormalize ...@@ -57,10 +57,10 @@ from stable_baselines3.common.vec_env import VecNormalize
from omni.isaac.orbit.utils.dict import print_dict from omni.isaac.orbit.utils.dict import print_dict
from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import load_cfg_from_registry, parse_env_cfg from omni.isaac.orbit_tasks.utils import load_cfg_from_registry, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.sb3 import Sb3VecEnvWrapper, process_sb3_cfg from omni.isaac.orbit_tasks.utils.wrappers.sb3 import Sb3VecEnvWrapper, process_sb3_cfg
def main(): def main():
......
...@@ -46,10 +46,10 @@ import carb ...@@ -46,10 +46,10 @@ import carb
from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG from skrl.agents.torch.ppo import PPO, PPO_DEFAULT_CONFIG
from skrl.utils.model_instantiators import deterministic_model, gaussian_model, shared_model from skrl.utils.model_instantiators import deterministic_model, gaussian_model, shared_model
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg from omni.isaac.orbit_tasks.utils import get_checkpoint_path, load_cfg_from_registry, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.skrl import SkrlVecEnvWrapper, process_skrl_cfg from omni.isaac.orbit_tasks.utils.wrappers.skrl import SkrlVecEnvWrapper, process_skrl_cfg
def main(): def main():
......
...@@ -61,10 +61,10 @@ from skrl.utils.model_instantiators import deterministic_model, gaussian_model, ...@@ -61,10 +61,10 @@ from skrl.utils.model_instantiators import deterministic_model, gaussian_model,
from omni.isaac.orbit.utils.dict import print_dict from omni.isaac.orbit.utils.dict import print_dict
from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml from omni.isaac.orbit.utils.io import dump_pickle, dump_yaml
import omni.isaac.contrib_envs # noqa: F401 import omni.isaac.contrib_tasks # noqa: F401
import omni.isaac.orbit_envs # noqa: F401 import omni.isaac.orbit_tasks # noqa: F401
from omni.isaac.orbit_envs.utils import load_cfg_from_registry, parse_env_cfg from omni.isaac.orbit_tasks.utils import load_cfg_from_registry, parse_env_cfg
from omni.isaac.orbit_envs.utils.wrappers.skrl import SkrlSequentialLogTrainer, SkrlVecEnvWrapper, process_skrl_cfg from omni.isaac.orbit_tasks.utils.wrappers.skrl import SkrlSequentialLogTrainer, SkrlVecEnvWrapper, process_skrl_cfg
def main(): def main():
......
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