Skip to content

Commit

Permalink
Adds an initial StableBaselines3 RL environment as an example
Browse files Browse the repository at this point in the history
A lot of things are not working. Particularly when `ResetAll` is called,
the EnableVelocityChecks does not trigger the phyics system to populate
the velocity components. This is a blocker for the current example.

Signed-off-by: Arjo Chakravarty <[email protected]>
  • Loading branch information
arjo129 committed Nov 7, 2024
1 parent 76adc26 commit 83b30c2
Show file tree
Hide file tree
Showing 3 changed files with 525 additions and 0 deletions.
37 changes: 37 additions & 0 deletions examples/scripts/reinforcement_learning/simple_cart_pole/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Example for Reinforcement Learning (RL) With Gazebo

This demo world shows you an example of how you can use SDFormat, Ray-RLLIB and Gazebo to perform RL with python.
We start with a very simple cart-pole world. This world is defined in our sdf file `cart_pole.sdf`. It is analogous to
the

## Create a VENV

First create a virtual environment using python,
```
python3 -m venv venv
```
Lets activate it and install rayrllib and pytorch.
```
. venv/bin/activate
```

Lets install our dependencies
```
pip install "ray[rllib]" torch
```

In the same terminal you should add your gazebo python install directory to the `PYTHONPATH`
If you built gazebo from source in the current working directory this would be:
```
export PYTHONPATH=$PYTHONPATH:install/lib/python
```

You will also need to set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION to python due to version
mis-matches.
```
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
```

## Exploring the environment

You can see the environment by using `gz sim cart_pole.sdf`.
Loading

0 comments on commit 83b30c2

Please sign in to comment.