Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
51a8694
Add environment wrapper for the skrl RL library
Toni-SM Jan 19, 2023
f3464af
Add training workflow for the skrl RL library
Toni-SM Jan 19, 2023
49400fa
Add training configuration .yaml files for the skrl RL library
Toni-SM Jan 19, 2023
afb6444
Add evaluation workflow for the skrl RL library
Toni-SM Jan 19, 2023
86852ec
Run pre-commit for all files
Toni-SM Jan 19, 2023
ed14985
Add skrl to RL extra dependencies
Toni-SM Jan 19, 2023
55f2402
Merge branch 'NVIDIA-Omniverse:main' into skrl-integration
Toni-SM Jan 19, 2023
f72ff95
Improve skrl wrapper dosctring
Toni-SM Jan 19, 2023
2f522e9
Merge branch 'NVIDIA-Omniverse:main' into skrl-integration
Toni-SM Jan 19, 2023
7b7d256
Add skrl RL library integration to docs
Toni-SM Jan 20, 2023
3142f22
Merge branch 'skrl-integration' of github.com:Toni-SM/Orbit into skrl…
Toni-SM Jan 20, 2023
27c554c
Add skrl RL library reference to Python code
Toni-SM Jan 20, 2023
916e599
Update the skrl RL library example steps in docs
Toni-SM Jan 21, 2023
110aa07
Allow creating shared models in skrl RL library workflow
Toni-SM Jan 22, 2023
311870a
Update skrl RL library task hyperparameters
Toni-SM Jan 22, 2023
7b28ef8
Increase MINOR version and update CHANGELOG
Toni-SM Jan 22, 2023
3fceaad
Merge branch 'NVIDIA-Omniverse:main' into skrl-integration
Toni-SM Jan 25, 2023
5a2bb3d
Add skrl LICENSE to docs dependencies
Toni-SM Jan 25, 2023
7a39851
Run evaluation steps without trainer
Toni-SM Jan 25, 2023
4f497a2
Configure training/evaluation mode
Toni-SM Jan 25, 2023
55cb5e1
Log custom environment data to Tensorboard
Toni-SM Jan 25, 2023
2ae2e96
Load last checkpoint during evaluation if not specified
Toni-SM Jan 25, 2023
3ecba46
Merge branch 'NVIDIA-Omniverse:main' into skrl-integration
Toni-SM Jan 25, 2023
e50fc53
Update training hyperparameters
Toni-SM Jan 25, 2023
ffbdb1e
Update CHANGELOG date
Toni-SM Jan 25, 2023
75d8c25
Move import statements to the beginning of the script
Toni-SM Jan 25, 2023
bc7d140
Simplify the training and evaluation scripts for the skrl RL library
Toni-SM Jan 25, 2023
64f0c97
Add customized trainer for logging episode information
Toni-SM Jan 25, 2023
c46dab9
Delete unused parameters from configuration files
Toni-SM Jan 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"omni.isaac.kit",
"omni.isaac.cloner",
"gym",
"skrl",
"stable_baselines3",
"rsl_rl",
"rl_games",
Expand Down
21 changes: 21 additions & 0 deletions docs/licenses/dependencies/skrl-license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Toni-SM

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions docs/source/api/orbit_envs.utils.wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ environment instance to the wrapper constructor. For instance, to wrap an enviro

.. _RL-Games: https://github.com/Denys88/rl_games
.. _RSL-RL: https://github.com/leggedrobotics/rsl_rl
.. _skrl: https://github.com/Toni-SM/skrl
.. _Stable-Baselines3: https://github.com/DLR-RM/stable-baselines3


Expand All @@ -38,6 +39,13 @@ RSL-RL Wrapper
:members:
:show-inheritance:

SKRL Wrapper
------------

.. automodule:: omni.isaac.orbit_envs.utils.wrappers.skrl
:members:
:show-inheritance:

Stable-Baselines3 Wrapper
-------------------------

Expand Down
13 changes: 12 additions & 1 deletion docs/source/setup/sample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ from the environments into the respective libraries function argument and return
# run script for playing with 32 environments
./orbit.sh -p source/standalone/workflows/sb3/play.py --task Isaac-Cartpole-v0 --num_envs 32 --checkpoint /PATH/TO/model.zip

- Training an agent with
`SKRL <https://skrl.readthedocs.io>`__ on ``Isaac-Reach-Franka-v0``:

.. code:: bash

# install python module (for skrl)
./orbit.sh -p -m pip install -e 'source/extensions/omni.isaac.orbit_envs[skrl]'
# run script for training
./orbit.sh -p source/standalone/workflows/skrl/train.py --task Isaac-Reach-Franka-v0 --headless
# run script for playing with 32 environments
./orbit.sh -p source/standalone/workflows/skrl/play.py --task Isaac-Reach-Franka-v0 --num_envs 32 --checkpoint /PATH/TO/model.pt

- Training an agent with
`RL-Games <https://github.com/Denys88/rl_games>`__ on ``Isaac-Ant-v0``:

Expand All @@ -188,7 +200,6 @@ from the environments into the respective libraries function argument and return
# run script for playing with 32 environments
./orbit.sh -p source/standalone/workflows/rsl_rl/play.py --task Isaac-Reach-Franka-v0 --num_envs 32 --checkpoint /PATH/TO/model.pth


All the scripts above log the training progress to `Tensorboard`_ in the ``logs`` directory in the root of
the repository. The logs directory follows the pattern ``logs/<library>/<task>/<date-time>``, where ``<library>``
is the name of the learning framework, ``<task>`` is the task name, and ``<date-time>`` is the timestamp at
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials/04_gym_env.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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
to follow their supported data types and data structures. For example, ``stable-baselines3`` uses ``numpy`` arrays, while
``rsl-rl`` or ``rl-games`` 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.


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.1.1"
version = "0.2.0"

# Description
title = "ORBIT Environments"
Expand Down
65 changes: 65 additions & 0 deletions source/extensions/omni.isaac.orbit_envs/data/skrl/ant_ppo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
seed: 42

# Models are instantiated using skrl's model instantiator utility
# https://skrl.readthedocs.io/en/develop/modules/skrl.utils.model_instantiators.html
models:
separate: False
policy: # see skrl.utils.model_instantiators.gaussian_model for parameter details
clip_actions: True
clip_log_std: True
min_log_std: -20.0
max_log_std: 2.0
input_shape: "Shape.STATES"
hiddens: [256, 128, 64]
hidden_activation: ["elu", "elu", "elu"]
output_shape: "Shape.ACTIONS"
output_activation: "tanh"
output_scale: 1.0
value: # see skrl.utils.model_instantiators.deterministic_model for parameter details
clip_actions: False
input_shape: "Shape.STATES"
hiddens: [256, 128, 64]
hidden_activation: ["elu", "elu", "elu"]
output_shape: "Shape.ONE"
output_activation: ""
output_scale: 1.0


# PPO agent configuration (field names are from PPO_DEFAULT_CONFIG)
# https://skrl.readthedocs.io/en/latest/modules/skrl.agents.ppo.html
agent:
rollouts: 16
learning_epochs: 8
mini_batches: 4
discount_factor: 0.99
lambda: 0.95
learning_rate: 3.e-4
learning_rate_scheduler: "KLAdaptiveRL"
learning_rate_scheduler_kwargs:
kl_threshold: 0.008
state_preprocessor: "RunningStandardScaler"
state_preprocessor_kwargs: null
value_preprocessor: "RunningStandardScaler"
value_preprocessor_kwargs: null
random_timesteps: 0
learning_starts: 0
grad_norm_clip: 1.0
ratio_clip: 0.2
value_clip: 0.2
clip_predicted_values: True
entropy_loss_scale: 0.0
value_loss_scale: 1.0
kl_threshold: 0
rewards_shaper_scale: 0.01
# logging and checkpoint
experiment:
directory: "ant"
experiment_name: ""
write_interval: 40
checkpoint_interval: 400


# Sequential trainer
# https://skrl.readthedocs.io/en/latest/modules/skrl.trainers.sequential.html
trainer:
timesteps: 8000
65 changes: 65 additions & 0 deletions source/extensions/omni.isaac.orbit_envs/data/skrl/anymal_ppo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
seed: 42

# Models are instantiated using skrl's model instantiator utility
# https://skrl.readthedocs.io/en/develop/modules/skrl.utils.model_instantiators.html
models:
separate: False
policy: # see skrl.utils.model_instantiators.gaussian_model for parameter details
clip_actions: False
clip_log_std: True
min_log_std: -20.0
max_log_std: 2.0
input_shape: "Shape.STATES"
hiddens: [128, 128, 128]
hidden_activation: ["elu", "elu", "elu"]
output_shape: "Shape.ACTIONS"
output_activation: "tanh"
output_scale: 1.0
value: # see skrl.utils.model_instantiators.deterministic_model for parameter details
clip_actions: False
input_shape: "Shape.STATES"
hiddens: [128, 128, 128]
hidden_activation: ["elu", "elu", "elu"]
output_shape: "Shape.ONE"
output_activation: ""
output_scale: 1.0


# PPO agent configuration (field names are from PPO_DEFAULT_CONFIG)
# https://skrl.readthedocs.io/en/latest/modules/skrl.agents.ppo.html
agent:
rollouts: 24
learning_epochs: 5
mini_batches: 4
discount_factor: 0.99
lambda: 0.95
learning_rate: 1.e-3
learning_rate_scheduler: "KLAdaptiveRL"
learning_rate_scheduler_kwargs:
kl_threshold: 0.01
state_preprocessor: "RunningStandardScaler"
state_preprocessor_kwargs: null
value_preprocessor: "RunningStandardScaler"
value_preprocessor_kwargs: null
random_timesteps: 0
learning_starts: 0
grad_norm_clip: 1.0
ratio_clip: 0.2
value_clip: 0.2
clip_predicted_values: True
entropy_loss_scale: 0.0
value_loss_scale: 1.0
kl_threshold: 0
rewards_shaper_scale: 1.0
# logging and checkpoint
experiment:
directory: "anymal"
experiment_name: ""
write_interval: 60
checkpoint_interval: 600


# Sequential trainer
# https://skrl.readthedocs.io/en/latest/modules/skrl.trainers.sequential.html
trainer:
timesteps: 12000
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
seed: 42

# Models are instantiated using skrl's model instantiator utility
# https://skrl.readthedocs.io/en/develop/modules/skrl.utils.model_instantiators.html
models:
separate: False
policy: # see skrl.utils.model_instantiators.gaussian_model for parameter details
clip_actions: True
clip_log_std: True
min_log_std: -20.0
max_log_std: 2.0
input_shape: "Shape.STATES"
hiddens: [32, 32]
hidden_activation: ["elu", "elu"]
output_shape: "Shape.ACTIONS"
output_activation: "tanh"
output_scale: 1.0
value: # see skrl.utils.model_instantiators.deterministic_model for parameter details
clip_actions: False
input_shape: "Shape.STATES"
hiddens: [32, 32]
hidden_activation: ["elu", "elu"]
output_shape: "Shape.ONE"
output_activation: ""
output_scale: 1.0


# PPO agent configuration (field names are from PPO_DEFAULT_CONFIG)
# https://skrl.readthedocs.io/en/latest/modules/skrl.agents.ppo.html
agent:
rollouts: 16
learning_epochs: 8
mini_batches: 1
discount_factor: 0.99
lambda: 0.95
learning_rate: 3.e-4
learning_rate_scheduler: "KLAdaptiveRL"
learning_rate_scheduler_kwargs:
kl_threshold: 0.008
state_preprocessor: "RunningStandardScaler"
state_preprocessor_kwargs: null
value_preprocessor: "RunningStandardScaler"
value_preprocessor_kwargs: null
random_timesteps: 0
learning_starts: 0
grad_norm_clip: 1.0
ratio_clip: 0.2
value_clip: 0.2
clip_predicted_values: True
entropy_loss_scale: 0.0
value_loss_scale: 2.0
kl_threshold: 0
rewards_shaper_scale: 1.0
# logging and checkpoint
experiment:
directory: "cartpole"
experiment_name: ""
write_interval: 16
checkpoint_interval: 80


# Sequential trainer
# https://skrl.readthedocs.io/en/latest/modules/skrl.trainers.sequential.html
trainer:
timesteps: 1600
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
seed: 42

# Models are instantiated using skrl's model instantiator utility
# https://skrl.readthedocs.io/en/develop/modules/skrl.utils.model_instantiators.html
models:
separate: False
policy: # see skrl.utils.model_instantiators.gaussian_model for parameter details
clip_actions: True
clip_log_std: True
min_log_std: -20.0
max_log_std: 2.0
input_shape: "Shape.STATES"
hiddens: [400, 200, 100]
hidden_activation: ["elu", "elu", "elu"]
output_shape: "Shape.ACTIONS"
output_activation: "tanh"
output_scale: 1.0
value: # see skrl.utils.model_instantiators.deterministic_model for parameter details
clip_actions: False
input_shape: "Shape.STATES"
hiddens: [400, 200, 100]
hidden_activation: ["elu", "elu", "elu"]
output_shape: "Shape.ONE"
output_activation: ""
output_scale: 1.0


# PPO agent configuration (field names are from PPO_DEFAULT_CONFIG)
# https://skrl.readthedocs.io/en/latest/modules/skrl.agents.ppo.html
agent:
rollouts: 32
learning_epochs: 8
mini_batches: 8
discount_factor: 0.99
lambda: 0.95
learning_rate: 3.e-4
learning_rate_scheduler: "KLAdaptiveRL"
learning_rate_scheduler_kwargs:
kl_threshold: 0.008
state_preprocessor: "RunningStandardScaler"
state_preprocessor_kwargs: null
value_preprocessor: "RunningStandardScaler"
value_preprocessor_kwargs: null
random_timesteps: 0
learning_starts: 0
grad_norm_clip: 1.0
ratio_clip: 0.2
value_clip: 0.2
clip_predicted_values: True
entropy_loss_scale: 0.0
value_loss_scale: 1.0
kl_threshold: 0
rewards_shaper_scale: 0.01
# logging and checkpoint
experiment:
directory: "humanoid"
experiment_name: ""
write_interval: 80
checkpoint_interval: 800


# Sequential trainer
# https://skrl.readthedocs.io/en/latest/modules/skrl.trainers.sequential.html
trainer:
timesteps: 16000
Loading