Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an initial StableBaselines3 RL environment as an example #2667

Draft
wants to merge 4 commits into
base: arjo/feat/server_reset_public_api
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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 stable-baselines3[extra]
```
For visuallization to work you will also need to:
```
pip uninstall opencv-python
pip install opencv-python-headless
```
This is because `opencv-python` brings in Qt5 by default.

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
Loading