Skip to content

Commit 51d06cf

Browse files
Mayankm96nikitardn
andauthored
Updates RSL-RL to version 2.0 (#14)
* Adds files from internal * Updates version to 2.0 * Fix to split and pad for rnn policies (#15) * Small fix to adapt to new configs from orbit (#16) * Fixes dummy config * Adds onnx to deps * Adds contributors --------- Co-authored-by: Nikita Rudin <[email protected]>
1 parent 2ad79cf commit 51d06cf

37 files changed

+1812
-716
lines changed

.flake8

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[flake8]
2+
show-source=True
3+
statistics=True
4+
per-file-ignores=*/__init__.py:F401
5+
# E402: Module level import not at top of file
6+
# E501: Line too long
7+
# W503: Line break before binary operator
8+
# E203: Whitespace before ':' -> conflicts with black
9+
# D401: First line should be in imperative mood
10+
# R504: Unnecessary variable assignment before return statement.
11+
# R505: Unnecessary elif after return statement
12+
# SIM102: Use a single if-statement instead of nested if-statements
13+
# SIM117: Merge with statements for context managers that have same scope.
14+
ignore=E402,E501,W503,E203,D401,R504,R505,SIM102,SIM117
15+
max-line-length = 120
16+
max-complexity = 18
17+
exclude=_*,.vscode,.git,docs/**
18+
# docstrings
19+
docstring-convention=google
20+
# annotations
21+
suppress-none-returning=True
22+
allow-star-arg-any=True

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ __pycache__
99
.pytest_cache
1010

1111
# vs code
12-
.vscode
12+
.vscode

.pre-commit-config.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
repos:
2+
- repo: https://github.com/python/black
3+
rev: 23.10.1
4+
hooks:
5+
- id: black
6+
args: ["--line-length", "120", "--preview"]
7+
- repo: https://github.com/pycqa/flake8
8+
rev: 6.1.0
9+
hooks:
10+
- id: flake8
11+
additional_dependencies: [flake8-simplify, flake8-return]
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v4.5.0
14+
hooks:
15+
- id: trailing-whitespace
16+
- id: check-symlinks
17+
- id: destroyed-symlinks
18+
- id: check-yaml
19+
- id: check-merge-conflict
20+
- id: check-case-conflict
21+
- id: check-executables-have-shebangs
22+
- id: check-toml
23+
- id: end-of-file-fixer
24+
- id: check-shebang-scripts-are-executable
25+
- id: detect-private-key
26+
- id: debug-statements
27+
- repo: https://github.com/pycqa/isort
28+
rev: 5.12.0
29+
hooks:
30+
- id: isort
31+
name: isort (python)
32+
args: ["--profile", "black", "--filter-files"]
33+
- repo: https://github.com/asottile/pyupgrade
34+
rev: v3.15.0
35+
hooks:
36+
- id: pyupgrade
37+
args: ["--py37-plus"]
38+
- repo: https://github.com/codespell-project/codespell
39+
rev: v2.2.6
40+
hooks:
41+
- id: codespell
42+
additional_dependencies:
43+
- tomli
44+
# FIXME: Figure out why this is getting stuck under VPN.
45+
# - repo: https://github.com/RobertCraigie/pyright-python
46+
# rev: v1.1.315
47+
# hooks:
48+
# - id: pyright
49+
# Note: We disable this by default since not all code is compatible with it.
50+
# - repo: https://github.com/Lucas-C/pre-commit-hooks
51+
# rev: v1.5.1
52+
# hooks:
53+
# - id: insert-license
54+
# files: \.py$
55+
# args:
56+
# # - --remove-header # Remove existing license headers. Useful when updating license.
57+
# - --license-filepath
58+
# - .github/LICENSE_HEADER.txt

CONTRIBUTORS.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# RSL-RL Maintainers and Contributors
2+
3+
This is the official list of developers and contributors.
4+
5+
To see the full list of contributors, see the revision history in the source control.
6+
7+
Names should be added to this file as: individual names or organizations.
8+
9+
Email addresses are tracked elsewhere to avoid spam.
10+
11+
Please keep the lists sorted alphabetically.
12+
13+
## Maintainers
14+
15+
* Robotic Syetms Lab, ETH Zurich
16+
* NVIDIA Corporation
17+
18+
---
19+
20+
* David Hoeller
21+
* Nikita Rudin
22+
23+
## Contributors
24+
25+
* Eric Vollenweider
26+
* Fabian Jenelten
27+
* Lorenzo Terenzi
28+
* Marko Bjelonic
29+
* Matthijs van der Boon
30+
* Mayank Mittal
31+
* Zhang Chong

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2727
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2828
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

30-
See licenses/dependencies for license information of dependencies of this package.
30+
See licenses/dependencies for license information of dependencies of this package.

README.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,57 @@
11
# RSL RL
2+
23
Fast and simple implementation of RL algorithms, designed to run fully on GPU.
34
This code is an evolution of `rl-pytorch` provided with NVIDIA's Isaac GYM.
45

56
Only PPO is implemented for now. More algorithms will be added later.
67
Contributions are welcome.
78

9+
**Maintainer**: David Hoeller and Nikita Rudin <br/>
10+
**Affiliation**: Robotic Systems Lab, ETH Zurich & NVIDIA <br/>
11+
**Contact**: [email protected]
12+
813
## Setup
914

10-
```
15+
Following are the instructions to setup the repository for your workspace:
16+
17+
```bash
1118
git clone https://github.com/leggedrobotics/rsl_rl
1219
cd rsl_rl
1320
pip install -e .
1421
```
1522

16-
### Useful Links ###
17-
Example use case: https://github.com/leggedrobotics/legged_gym
18-
Project website: https://leggedrobotics.github.io/legged_gym/
19-
Paper: https://arxiv.org/abs/2109.11978
23+
The framework supports the following logging frameworks which can be configured through `logger`:
24+
25+
* Tensorboard: https://www.tensorflow.org/tensorboard/
26+
* Weights & Biases: https://wandb.ai/site
27+
* Neptune: https://docs.neptune.ai/
28+
29+
For a demo configuration of the PPO, please check: [dummy_config.yaml](config/dummy_config.yaml) file.
30+
2031

21-
**Maintainer**: Nikita Rudin
22-
**Affiliation**: Robotic Systems Lab, ETH Zurich & NVIDIA
23-
**Contact**: [email protected]
32+
## Contribution Guidelines
33+
34+
For documentation, we adopt the [Google Style Guide](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for docstrings. We use [Sphinx](https://www.sphinx-doc.org/en/master/) for generating the documentation. Please make sure that your code is well-documented and follows the guidelines.
35+
36+
We use the following tools for maintaining code quality:
37+
38+
- [pre-commit](https://pre-commit.com/): Runs a list of formatters and linters over the codebase.
39+
- [black](https://black.readthedocs.io/en/stable/): The uncompromising code formatter.
40+
- [flake8](https://flake8.pycqa.org/en/latest/): A wrapper around PyFlakes, pycodestyle, and McCabe complexity checker.
41+
42+
Please check [here](https://pre-commit.com/#install) for instructions to set these up. To run over the entire repository, please execute the following command in the terminal:
43+
44+
45+
```bash
46+
# for installation (only once)
47+
pre-commit install
48+
# for running
49+
pre-commit run --all-files
50+
```
2451

52+
### Useful Links
2553

54+
Environment repositories using the framework:
2655

56+
* `Legged-Gym` (built on top of NVIDIA Isaac Gym): https://leggedrobotics.github.io/legged_gym/
57+
* `Orbit` (built on top of NVIDIA Isaac Sim): https://isaac-orbit.github.io/

config/dummy_config.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
algorithm:
2+
class_name: PPO
3+
# training parameters
4+
# -- value function
5+
value_loss_coef: 1.0
6+
clip_param: 0.2
7+
use_clipped_value_loss: true
8+
# -- surrogate loss
9+
desired_kl: 0.01
10+
entropy_coef: 0.01
11+
gamma: 0.99
12+
lam: 0.95
13+
max_grad_norm: 1.0
14+
# -- training
15+
learning_rate: 0.001
16+
num_learning_epochs: 5
17+
num_mini_batches: 4 # mini batch size = num_envs * num_steps / num_mini_batches
18+
schedule: adaptive # adaptive, fixed
19+
policy:
20+
class_name: ActorCritic
21+
# for MLP i.e. `ActorCritic`
22+
activation: elu
23+
actor_hidden_dims: [128, 128, 128]
24+
critic_hidden_dims: [128, 128, 128]
25+
init_noise_std: 1.0
26+
# only needed for `ActorCriticRecurrent`
27+
# rnn_type: 'lstm'
28+
# rnn_hidden_size: 512
29+
# rnn_num_layers: 1
30+
runner:
31+
num_steps_per_env: 24 # number of steps per environment per iteration
32+
max_iterations: 1500 # number of policy updates
33+
empirical_normalization: false
34+
# -- logging parameters
35+
save_interval: 50 # check for potential saves every `save_interval` iterations
36+
experiment_name: walking_experiment
37+
run_name: ""
38+
# -- logging writer
39+
logger: tensorboard # tensorboard, neptune, wandb
40+
neptune_project: legged_gym
41+
wandb_project: legged_gym
42+
# -- load and resuming
43+
resume: false
44+
load_run: -1 # -1 means load latest run
45+
resume_path: null # updated from load_run and checkpoint
46+
checkpoint: -1 # -1 means load latest checkpoint
47+
runner_class_name: OnPolicyRunner
48+
seed: 1
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Łukasz Langa
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)