- Notifications
You must be signed in to change notification settings - Fork60
PyRoboLearn: a Python framework for Robot Learning
License
robotlearn/pyrobolearn
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository contains the code for thePyRoboLearn (PRL) framework: a Python framework for Robot Learning.This framework revolves mainly around 7 axes: simulators, worlds, robots, interfaces, learning tasks (= environment and policy), learning models, and learning algorithms.
Warning: The development of this framework is ongoing, and thus some substantial changes might occur. Sorry for the inconvenience.
The framework has been tested with Python 2.7, 3.5 and 3.6, on Ubuntu 16.04 and 18.04. The installation on other OS isexperimental.
There are two ways to install the framework:
- using a virtual environment and pip
- using a Docker
1. First download thepip
Python package manager and create a virtual environment for Python as described in the following link:https://packaging.python.org/guides/installing-using-pip-and-virtualenv/On Ubuntu, you can installpip
andvirtualenv
by typing in the terminal:
- In Python 2.7:
sudo apt install python-pipsudo pip install virtualenv
- In Python 3.5:
sudo apt install python3-pipsudo pip install virtualenv
You can then create the virtual environment by typing:
virtualenv -p /usr/bin/python<version><virtualenv_name># activate the virtual environmentsource<virtualenv_name>/bin/activate
where<version>
is the python version you want to use (select between2.7
or3.5
), and<virtualenv_name>
is a name of your choice for the virtual environment. For instance, it can bepy2.7
orpy3.5
.
To deactivate the virtual environment, just type:
deactivate
- clone this repository and install the requirements by executing the
setup.py
In Python 2.7:
git clone https://github.com/robotlearn/pyrobolearncd pyrobolearnpip install numpy cythonpip install http://github.com/cornellius-gp/gpytorch/archive/alpha.zip# this is for Python 2.7pip install -e.# this will install pyrobolearn as well as the required packages (so no need for: pip install -r requirements.txt)
In Python 3.5:
git clone https://github.com/robotlearn/pyrobolearncd pyrobolearnpip install numpy cythonpip install gpytorch# this is for Python 3.5pip install -e.# this will install pyrobolearn as well as the required packages (so no need for: pip install -r requirements.txt)
Depending on your computer configuration and the python version you use, you might need to install also the following packages throughapt-get
:
sudo apt install python-tk# if python 2.7sudo apt install python3-tk# if python 3.5
At the moment the docker is a self contained Ubuntu image with all the libraries installed. When launched we have access to a Python3.6 interpreter and we can import pyrobolearn directly.In the future, ROS may be splitted in another container and linked to this one.
- Install Docker and nvidia-docker
sudo apt-get updatesudo apt install apt-transport-https ca-certificates curl software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg| sudo apt-key add -sudo add-apt-repository"deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable # you should replace bionic by your versionsudo apt updatesudo apt install docker-cesudo systemctl status docker # check that docker is active
- Build the image
docker build -t pyrobolearn.
- Launch
You can now start the python interpreter with every library already installed
docker run -p 11311:11311 -v$PWD/dev:/pyrobolearn/dev/:rw -ti pyrobolearn python3
To open an interactive terminal in the docker image use:
docker run -p 11311:11311 -v$PWD/dev:/pyrobolearn/dev/:rw -ti pyrobolearn /bin/bash
4. nvidia-dockerif the GPU is not recognized in the interpreter, you can install nvidia-docker
curl -sL https://nvidia.github.io/nvidia-docker/gpgkey| sudo apt-key add -distribution=$(. /etc/os-release;echo$ID$VERSION_ID)curl -sL https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list| sudo tee /etc/apt/sources.list.d/nvidia-docker.listsudo apt-get updatesudo apt-get install nvidia-docker2sudo pkill -SIGHUP dockerd
And use:
nvidia-docker run -p 11311:11311 -v$PWD/dev:/pyrobolearn/dev/:rw -ti pyrobolearn
Note that some interfaces (like game controllers, depth camera, etc) might not be available on other OS, however themain robotic framework should work.
- Windows: You will have to install first PyBullet and NLopt beforehand.
For nlopt, install firstconda
, then type:
conda install -c conda-forge nlopt
If Pybullet doesn't install on Windows (using visual studio), you might have to copyrc.exe
andrc.dll
from
C:\Program Files (x86)\Windows Kits\10\bin\<xx.x.xxxx.x>\x64
to
C:\Program Files (x86)\Windows Kits\10\bin\x86
And add the last folder to the Windows environment path (Go toSystem Properties
>Advanced
>Environment Variables
>Path
>Edit
).
Finally, remove the nlopt package from therequirements.txt
. The rest of the installation should be straightforward.
2. Mac OSX: We managed to install the PyRoboLearn framework on MacOSX (Mojave) by following the procedures explained in the section"Virtualenv & Pip". You can replace thesudo apt install
bybrew install
(after installingHomebrew).
Check theREADME.rst
file in theexamples
folder.
PyRoboLearn is currently released under theGNU GPLv3 license.
For how to cite this repository, please refer to theCITATION.rst
file.
If you use a specific learning model, algorithm, robot, controller, and so on, please cite the corresponding paper. The reference(s) can usually be found in the class documentation (at the end), and sometimes in the README file in the corresponding folder.
Currently, we mainly use the PyBullet simulator.
- PyBullet, a Python module for physics simulation for games, robotics and machine learning, Erwin Coumans andYunfei Bai, 2016-2019
- References for each robot, model, and others can be found in the corresponding class documentation
- Locomotion controllers were provided by Songyan Xin
- We thanks Daniele Bonatto for providing the Docker file, and test the installation on Windows.