diff --git a/.gitignore b/.gitignore index 894a44c..c7e5a28 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,11 @@ venv.bak/ # mypy .mypy_cache/ + +# others +*.pyc +*.swp +.ipynb_checkpoints/ +.idea/ +0_VRDemoSettings.txt +tests/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..16f18b8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019, Brian Delhaisse (brian.delhaisse@iit.it) + +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. diff --git a/README.md b/README.md index 09d48b2..6d57772 100644 --- a/README.md +++ b/README.md @@ -1 +1,9 @@ -# pyrobolearn \ No newline at end of file +# PyRoboLearn + +This repository contains the code for the *PyRoboLearn* (PRL) framework: a Python framework for Robot Learning. +This framework revolves mainly around 7 axes: simulators, worlds, robots, interfaces, learning tasks (= environment ++ policy), learning models, and learning algorithms. + +## Requirements + +The framework has been tested with Python 2.7 and Ubuntu 16.04. \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..dc8ba17 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,64 @@ +# To only install dependencies, type: +# $ pip install -r requirements.txt + +numpy>=1.13.3 +numba>=0.42.0 +numpy-quaternion>=2019.1.13.15.7.3 +autograd>=1.2 +matplotlib>=2.0.2 +sympy>=1.3 +scipy>=0.19.1 +control>=0.8.1 +opencv-python>=4.0.0.21 + +# multiprocessing +pathos>=0.2.3 + +# backend +torch>=1.0.0 +torchvision>=0.2.1 + +# simulators +pybullet>=2.4.1 +gym>=0.10.9 +# git+git://github.com/benelot/pybullet-gym + +# interfaces +inputs>=0.5 +gTTS>=2.0.3 +openni>=2.2.0.post6 +pyaudio>=0.2.8 + +# models and algos +sklearn>=0.0 +# gpytorch>=0.1.0rc4 +git+git://github.com/cornellius-gp/gpytorch/archive/alpha.zip +GPy>=1.9.6 +GPyOpt>=1.2.5 +hmmlearn>=0.2.1 +keras>=2.2.4 +neat-python>=0.92 +tensorflow>=1.3.0 +# tensorflow-gpu +cma>=2.6.0 +# ray>=0.6.3 [rllib] +# git+git://github.com/ikostrikov/pytorch-a2c-ppo-acktr + +# robots +urdf-parser-py>=0.0.3 + +# optim +cvxopt>=1.2.3 +cvxpy>=1.0.15 +quadprog>=0.1.6 +qpsolvers>=1.0.4 +nlopt>=2.4.2.post2 +# ipopt + +# control +slycot>=0.3.3 + +# worlds/utils +# gdal>=1.11.3 + +# need to install rbdl, ipopt, tf \ No newline at end of file diff --git a/scripts/install_all.sh b/scripts/install_all.sh new file mode 100755 index 0000000..9acd060 --- /dev/null +++ b/scripts/install_all.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Install everything: for each package, ask the user if he/she wishes to install it + +# check if user is root (i.e. running with sudo) +if [ `whoami` != root ]; then + echo "Please run this script with sudo" + exit +fi + +# check the first argument which must be the source directory +if [ -z $1 ] +then + echo "Specify the absolute location (or relative to home) where to install the various packages." + exit +fi + + +## Install packages + +# install ros-kinetic +read -p 'Do you wish to install the `ros-kinetic` package on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing ros-kinetic..." + $PWD/install_ros_kinetic.sh +else + echo "Not installing ros-kinetic" +fi + +# install rbdl +read -p 'Do you wish to install the `rbdl` package on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing rbdl..." + $PWD/install_rbdl.sh +else + echo "Not installing rbdl" +fi + +# install ipopt +read -p 'Do you wish to install the `ipopt` package on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing ipopt..." + $PWD/install_ipopt.sh +else + echo "Not installing ipopt" +fi + +# install openni2 & nite2 +read -p 'Do you wish to install the `openni2`, `libfreenect`, and `nite2` packages on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing openni2, libfreenect, and nite2..." + $PWD/install_openni2_nite2.sh $1 +else + echo "Not installing openni2, libfreenect, and nite2" +fi + +# install openpose +read -p 'Do you wish to install the `openpose` package on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing openpose..." + $PWD/install_openpose.sh $1 +else + echo "Not installing openpose" +fi \ No newline at end of file diff --git a/scripts/install_audio.sh b/scripts/install_audio.sh new file mode 100755 index 0000000..2acb46b --- /dev/null +++ b/scripts/install_audio.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Install audio packages for Ubuntu which is needed for pyaudio. + +sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 +sudo apt-get install ffmpeg libav-tools + +pip install pyaudio \ No newline at end of file diff --git a/scripts/install_gdal.sh b/scripts/install_gdal.sh new file mode 100755 index 0000000..c63748b --- /dev/null +++ b/scripts/install_gdal.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# This bash script install the gdal library and the official python wrapper + +sudo apt-get install libgdal-dev +export CPLUS_INCLUDE_PATH=/usr/include/gdal +export C_INCLUDE_PATH=/usr/include/gdal +#sudo pip install gdal +sudo apt-get install python-gdal \ No newline at end of file diff --git a/scripts/install_ipopt.sh b/scripts/install_ipopt.sh new file mode 100755 index 0000000..ba604ea --- /dev/null +++ b/scripts/install_ipopt.sh @@ -0,0 +1,88 @@ +#!/bin/sh +# File taken from CarND-MPC-Project from Udacity but modified to install python wrapper as well +# Source: https://github.com/udacity/CarND-MPC-Project +# +# To use this script: +# $ sudo ./install_openni2_nite2.sh +# +# You might need to source your .bashrc file at the end. +# +# IPopt installation on MacOSX: +# brew install ipopt --with-openblas + +# Define few variables +currentdir=$PWD + +# Pass the Ipopt source directory as the first argument +if [ -z $1 ] +then + echo "Specifiy the location of the Ipopt source directory in the first argument." + exit +fi +cd $1 + +# specify ipopt version +version=3.12.12 + +# install gfortran +sudo apt-get install gfortran + +# download ipopt +wget https://www.coin-or.org/download/source/Ipopt/Ipopt-${version}.zip +unzip Ipopt-${version}.zip +rm Ipopt-${version}.zip + +cd Ipopt-${version} + +prefix=/usr/local +srcdir=$PWD + +echo "Building Ipopt from ${srcdir}" +echo "Saving headers and libraries to ${prefix}" + +# BLAS +cd $srcdir/ThirdParty/Blas +./get.Blas +mkdir -p build && cd build +../configure --prefix=$prefix --disable-shared --with-pic +make +sudo make install + +# Lapack +cd $srcdir/ThirdParty/Lapack +./get.Lapack +mkdir -p build && cd build +../configure --prefix=$prefix --disable-shared --with-pic \ + --with-blas="$prefix/lib/libcoinblas.a -lgfortran" +make +sudo make install + +# ASL +cd $srcdir/ThirdParty/ASL +./get.ASL + +# MUMPS +cd $srcdir/ThirdParty/Mumps +./get.Mumps + +# build everything +cd $srcdir +./configure --prefix=$prefix coin_skip_warn_cxxflags=yes \ + --with-blas="$prefix/lib/libcoinblas.a -lgfortran" \ + --with-lapack=$prefix/lib/libcoinlapack.a +make +make test +sudo make -j1 install + +# write variables to export in the ~/.bashrc file, and source it +cd +echo "" >> .bashrc +echo "# Export environment variables for IPopt" >> .bashrc +echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib/" >> .bashrc +# source .bashrc + +# install python package +pip install ipopt + +# return to the original directory +cd $currentdir diff --git a/scripts/install_openni2_nite2.sh b/scripts/install_openni2_nite2.sh new file mode 100755 index 0000000..23e7848 --- /dev/null +++ b/scripts/install_openni2_nite2.sh @@ -0,0 +1,134 @@ +#!/bin/sh +# This bash script install the OpenNI2 and Nite2 packages (tested on Ubuntu 16.04) +# +# To use this script: +# $ sudo ./install_openni2_nite2.sh +# +# You might need to source your .bashrc file at the end. +# +# Github repo: +# - https://github.com/OpenNI/OpenNI +# - https://github.com/occipital/OpenNI2 +# - https://github.com/OpenKinect/libfreenect +# +# References: +# - https://roboticslab-uc3m.gitbook.io/installation-guides/install-openni-nite +# - https://stackoverflow.com/questions/32415089/install-openni2-and-nite2-on-linux +# - https://codeyarns.com/2015/08/04/how-to-install-and-use-openni2/ +# +# To test kinect (with libfreenect): +# $ freenect-glview +# To test asus/kinect (with openni, check in the Bin and Tools folders): +# $ NiViewer +# $ UserViewer + +# Define few variables +currentdir=$PWD + +# Check if user is root/running with sudo +if [ `whoami` != root ]; then + echo "Please run this script with sudo" + exit +fi + +# check the first argument which must be the source directory +if [ -z $1 ] +then + echo "Specify the absolute location (or relative to home) where to install the OpenNI2, libfreenect, and NiTE2 packages." + exit +fi + +# move to that directory +cd; cd $1 + +# install requirement packages +echo "Installing prerequired packages..." +sudo apt-get install git g++ cmake libxi-dev libxmu-dev libusb-1.0-0-dev pkg-config freeglut3-dev build-essential libudev-dev openjdk-8-jdk usbutils + +# driver for Asus Xtion Pro Live OpenNI driver (Ubuntu) +sudo apt-get install libopenni-sensor-primesense0 + +# install OpenNI2 +echo "Installing OpenNI2..." +cd; cd $1 +git clone https://github.com/occipital/OpenNI2.git # We used to have a fork off 6857677beee08e264fc5aeecb1adf647a7d616ab with working copy of Xtion Pro Live OpenNI2 driver. +cd OpenNI2 +make -j`nproc` +sudo ln -s $PWD/Bin/x64-Release/libOpenNI2.so /usr/local/lib/ # $PWD should be /yourPathTo/OpenNI2 +sudo ln -s $PWD/Bin/x64-Release/OpenNI2/ /usr/local/lib/ # $PWD should be /yourPathTo/OpenNI2 +sudo ln -s $PWD/Include /usr/local/include/OpenNI2 # $PWD should be /yourPathTo/OpenNI2 +sudo ldconfig +#sudo $PWD/Packaging/Linux/install.sh +sudo cp $PWD/Packaging/Linux/primesense-usb.rules /etc/udev/rules.d/557-primesense-usb.rules # install udev rules for usb devices +# Install prebuilt SDK from online (instead of git) +#wget https://s3.amazonaws.com/com.occipital.openni/OpenNI-Linux-x64-2.2.0.33.tar.bz2 +#tar -xjvf OpenNI-Linux-x64-2.2.0.33.tar.bz2 && rm OpenNI-Linux-x64-2.2.0.33.tar.bz2 +#cd OpenNI-Linux-x64-2.2 +#sudo ./install.sh # this installs 'primesense-usb.rules' in /etc/udev/rules.d/, and defines environment variables 'OPENNI2_*' +#cd; cd $1 +#cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so OpenNI-Linux-x64-2.2/Redist/OpenNI2/Drivers/ +#cp libfreenect/build/lib/OpenNI2-FreenectDriver/libFreenectDriver.so OpenNI-Linux-x64-2.2/Tools/OpenNI2/Drivers/ +#cd OpenNI-Linux-x64-2.2/Tools +#./NiViewer + +# Test the installation +#cd Bin/x64-Release/ +#./NiViewer + +# install libfreenect because it contains a driver to be used with OpenNI2 +echo "Installing libfreenect..." +cd; cd $1 +git clone https://github.com/OpenKinect/libfreenect +cd libfreenect && mkdir -p build +cd build +cmake .. -DBUILD_OPENNI2_DRIVER=ON +make -j`nproc` +sudo make install +sudo ldconfig +sudo ln -s /usr/local/lib/OpenNI2-FreenectDriver/libFreenectDriver.so /usr/local/lib/OpenNI2/Drivers +cd .. +sudo cp platform/linux/udev/51-kinect.rules /etc/udev/rules.d/ # don't need to run the app as root +cd wrappers/python/ +sudo python setup.py install + +# Test the installation +#freenect-glview + +# Set rules to avoid needing sudo when trying to read data from the sensors connected via USB port +sudo sh -c "echo 'KERNEL == \"ttyUSB0\", MODE = \"0777\"' > 80-persistent-local-usb.rules" + +# install NiTE2 +echo "Installing NiTE2..." +cd; cd $1 +wget https://sourceforge.net/projects/roboticslab/files/External/nite/NiTE-Linux-x64-2.2.tar.bz2 +tar xvf NiTE-Linux-x64-2.2.tar.bz2 && rm NiTE-Linux-x64-2.2.tar.bz2 +cd NiTE-Linux-x64-2.2/ +sudo ./install.sh # defines environment variables 'NITE2_*' +sudo ln -s $PWD/Redist/libNiTE2.so /usr/local/lib/ +sudo ln -s $PWD/Include /usr/local/include/NiTE-Linux-x64-2.2 +cd .. +sudo ldconfig +# Test the installation +#cd NiTE-Linux-x64-2.2/Samples/Bin +#./UserViewer + +# write variables to export in the ~/.bashrc file, and source it +cd +OUT_FILE=".bashrc" +echo "" >> $OUT_FILE +echo "# Export OPENNI and NITE environment variables" >> $OUT_FILE +echo "export OPENNI2_INCLUDE=$1/OpenNI2/Include" >> $OUT_FILE +if [ `uname -m` = "x86_64" ]; +then + #echo "export OPENNI2_REDIST64=$1/OpenNI-Linux-x64-2.2/Redist" >> $OUT_FILE + echo "export OPENNI2_REDIST64=$1/OpenNI2/Bin/x64-Release" >> $OUT_FILE + echo "export NITE2_REDIST64=$1/NiTE-Linux-x64-2.2/Redist" >> $OUT_FILE +else + #echo "export OPENNI2_REDIST=$1/OpenNI-Linux-x64-2.2/Redist" >> $OUT_FILE + echo "export OPENNI2_REDIST=$1/OpenNI2/Bin/x64-Release" >> $OUT_FILE + echo "export NITE2_REDIST=$1/NiTE-Linux-x64-2.2/Redist" >> $OUT_FILE +fi +# source .bashrc + +# return to the original directory +cd $currentdir diff --git a/scripts/install_openpose.sh b/scripts/install_openpose.sh new file mode 100755 index 0000000..25f6e96 --- /dev/null +++ b/scripts/install_openpose.sh @@ -0,0 +1,94 @@ +#!/bin/sh +# This bash script install the openpose and the official python wrapper +# +# Github repo: https://github.com/CMU-Perceptual-Computing-Lab/openpose +# Reference: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md +# FAQ (troubleshooting): https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/faq.md + + +# Define few variables +currentdir=$PWD + +# Check if user is root/running with sudo +if [ `whoami` != root ]; then + echo "Please run this script with sudo" + exit +fi + +# check the first argument which must be the source directory +if [ -z $1 ] +then + echo "Specify the absolute location (or relative to home) where to install the Openpose package." + exit +fi + +# move to that directory +cd; cd $1 + +# clone repository +git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose +cd openpose +git pull origin master + +# Prerequisites +sudo apt-get install cmake-qt-gui +sudo apt install cmake-curses-gui +read -p 'Do you wish to install the CUDA8 on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing CUDA8..." + sudo ./scripts/ubuntu/install_cuda.sh +else + echo "Not installing CUDA8" +fi +read -p 'Do you wish to install the cuDNN5.1 on this computer [yes/no]?: ' reply +if [ $reply = 'yes' ]; then + echo "Installing cuDNN5.1..." + sudo ./scripts/ubuntu/install_cudnn.sh +else + echo "Not installing cuDNN5.1" +fi +sudo ./scripts/ubuntu/install_deps.sh +sudo apt-get install libopencv-dev +sudo apt-get install nvidia-modprobe + +mkdir build && cd build +echo "Check https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation.md#openpose-configuration for more information on how to configure the openpose package" +#cmake-gui +# to build with python 2.7 +#export PYTHON_EXECUTABLE=/usr/bin/python2.7 +#export PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so +cmake -DBUILD_PYTHON=ON -DPYBIND11_PYTHON_VERSION=2.7 .. +make -j`nproc` +sudo make install +sudo cp python/openpose/pyopenpose.so /usr/local/lib/python2.7/dist-packages/ +cd .. +OPENPOSE_PATH_DIR=$PWD + +# go to home directory and export environment variables in the bashrc +cd +echo "\n\n# Export OPENPOSE environment variables" >> ".bashrc" +echo "export OPENPOSE_PATH=$OPENPOSE_PATH_DIR" >> ".bashrc" + +# Test installation (check github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/quick_start.md) +#cd OPENPOSE_PATH_DIR +#./build/examples/openpose/openpose.bin +# Python examples are in github.com/CMU-Perceptual-Computing-Lab/openpose/tree/master/examples/tutorial_api_python + +# return to original directory +cd currentdir + + +# Troubleshootings +# - If you obtain the following error "nvcc fatal : Unsupported gpu architecture 'compute_'", just modify the +# cmake/Cuda.cmake file, from the line "set(Caffe_known_gpu_archs "...")", remove the architectures that your +# computer does not possess. You can also specify the architecture in the cmake line with the option "CUDA_ARCH". +# - If you obtain an error with the python version, you have to specify the version you want to use to pybind11, by +# setting the option "-DPYBIND11_PYTHON_VERSION=2.7" +# - If you have the following error "Cuda check failed (30 vs. 0): unknown error" when launching a basic example +# in openpose as given in "https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/quick_start.md", +# then the error comes from your Nvidia GPU driver or your CUDA toolkit. Check the solutions given in the following +# link: https://github.com/NVIDIA/DIGITS/issues/1663 +# Before tempting any solutions, try to reboot your computer (this solution worked for me). Otherwise, this will +# probably require you to reinstall the Nvidia drivers / CUDA toolkit. +# - If you have an error with Qt such as: qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "", reinstall +# the package, or install qtcreator. diff --git a/scripts/install_rbdl.sh b/scripts/install_rbdl.sh new file mode 100755 index 0000000..914df19 --- /dev/null +++ b/scripts/install_rbdl.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# This bash script install the rbdl library and the official python wrapper +# +# repo + documentation: https://rbdl.bitbucket.io/ +# paper: https://pdfs.semanticscholar.org/f129/5068f646ea9379da72ba5183276ca73a038d.pdf + +# Define few variables +currentdir=$PWD + +# Check if user is root/running with sudo +if [ `whoami` != root ]; then + echo "Please run this script with sudo" + exit +fi + +# check the first argument which must be the source directory +if [ -z $1 ] +then + echo "Specify the absolute location (or relative to home) where to install the Openpose package." + exit +fi + +# move to that directory +cd; cd $1 + +# Install requirements +# update & upgrade # +sudo apt-get update +sudo apt-get upgrade + +#install cython +sudo apt-get -y install cython +# build-tools +sudo apt-get -y install build-essential +sudo apt-get -y install cmake +# eigen +sudo apt-get -y install libeigen3-dev + +# download and install rbdl +sudo rm -r rbdl +wget https://bitbucket.org/rbdl/rbdl/get/default.zip +unzip default.zip +rm default.zip +mv rbdl-rbdl-* rbdl +cd rbdl +mkdir build && cd build/ +cmake -D CMAKE_BUILD_TYPE=Release -D RBDL_BUILD_ADDON_URDFREADER=ON -D RBDL_BUILD_PYTHON_WRAPPER=ON ../ +# make error fix: cd addons/urdfreader +# open urdfreader.cc +# remove the line: #include "ros/ros.h" +make -j`nproc` +sudo make install + +## to use python wrapper, you need to install Cython and NumPy +cd python +sudo cp rbdl.so /usr/local/lib/python2.7/dist-packages +sudo cp rbdl.so /usr/local/lib/python2.7/site-packages + +# return to original directory +cd currentdir + + +## to wrap GetBodyId() function +# +# Inside crbdl.pxd, add: +# unsigned int GetBodyId(const char *body_name) +# inside cdef cppclass Model: +# +# Inside rbdl-wrapper.pyx, add: +# def GetBodyId (self, char* body_name): +# return self.thisptr.GetBodyId(body_name) +# inside cdef class Model: +# +# then do cmake, make, install again diff --git a/scripts/install_ros_kinetic.sh b/scripts/install_ros_kinetic.sh new file mode 100755 index 0000000..448fc27 --- /dev/null +++ b/scripts/install_ros_kinetic.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# update & upgrade # +sudo apt-get update +sudo apt-get upgrade + +# install ros indigo # +sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' +sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116 +sudo apt-get update +sudo apt-get -y install ros-kinetic-desktop-full +sudo rosdep init +rosdep update +echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc +source ~/.bashrc +sudo apt-get -y install python-rosinstall + +# install catkin # +sudo apt-get -y install ros-kinetic-catkin + + +# create ros workspace # +mkdir -p ~/catkin_ws/src +cd ~/catkin_ws/src +catkin_init_workspace +cd ~/catkin_ws/ +catkin_make +echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc + +# update gazebo to latest version # +#sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu trusty #main" > /etc/apt/sources.list.d/gazebo-latest.list' +#wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - +#sudo apt-get update +#sudo apt-get upgrade + +# install gazebo ros pkgs # +sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' +wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - +sudo apt-get -y install ros-kinetic-gazebo-ros-pkgs ros-kinetic-gazebo-ros-control + +# install ros control # +sudo apt-get -y install ros-kinetic-ros-control ros-kinetic-ros-controllers + +# additional setting # +#echo "export LC_NUMERIC=C" >> ~/.bashrc +#echo "killall -q roscore" >> ~/.bashrc +#echo "killall -q rosmaster" >> ~/.bashrc +#echo "killall -q gazebo" >> ~/.bashrc +#echo "killall -q gzserver" >> ~/.bashrc +#echo "killall -q gzclient" >> ~/.bashrc \ No newline at end of file diff --git a/scripts/install_sloccount.sh b/scripts/install_sloccount.sh new file mode 100755 index 0000000..99f6b5f --- /dev/null +++ b/scripts/install_sloccount.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# This bash installs the 'sloccount' command which counts source lines of code, and provides several statisticsabout this last one. +# Once installed, go to the pyrobolearn package and type: +# $ sloccount *.py */*.py + +# define variables +origindir=$PWD +scriptdir=`dirname $0` + +# install package +sudo apt install sloccount -y + +# compute statistics for pyrobolearn software +cd $scriptdir; cd .. +sloccount *.py */*.py + +# return to the original directory +cd $origindir diff --git a/scripts/install_trac_ik.sh b/scripts/install_trac_ik.sh new file mode 100755 index 0000000..cb840c7 --- /dev/null +++ b/scripts/install_trac_ik.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# This bash script install the trac_ik library and the official python wrapper +# +# wiki: http://wiki.ros.org/trac_ik +# repo: https://bitbucket.org/traclabs/trac_ik + +# install from Debian package +#sudo apt-get install ros-kinetic-trac-ik + +# Define few variables +currentdir=$PWD + +# Check if user is root/running with sudo +if [ `whoami` != root ]; then + echo "Please run this script with sudo" + exit +fi + +# check the first argument which must be the source directory +if [ -z $1 ] +then + echo "Specify the absolute location (or relative to home) where to install the Openpose package." + exit +fi + +# move to that directory +cd; cd $1 + +# install requirements +sudo apt-get install libccd-dev libccd2 libfcl-0.5-dev libfcl0.5 +sudo apt-get install libnlopt-dev libnlopt0 # nlopt +sudo apt-get -y install libeigen3-dev # eigen +sudo pip install nlopt + +# install trac_ik library from sources +git clone https://bitbucket.org/traclabs/trac_ik.git +cd trac_ik/trac_ik_lib/ +mkdir build && cd build +cmake -DPYTHON_VERSION=2.7 .. +make -j2 +source devel/setup.bash + +# install python +cd ../../trac_ik_python/ +mkdir build && cd build +cmake -DPYTHON_VERSION=2.7 .. +make -j2 +sudo make install diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..63610d5 --- /dev/null +++ b/setup.py @@ -0,0 +1,38 @@ +# Once in the pyrobolearn folder, type one of the following command: +# $ pip install -e . +# $ pip install --user -e . +# $ python setup.py install +# $ python setup.py install --home= + +from setuptools import setup, find_packages +from pip.req import parse_requirements + +# get description from readme file +with open('README.md', 'r') as f: + long_description = f.read() + +# get the required packages +install_requires = parse_requirements('requirements.txt', session=False) +reqs = [str(ir.req) for ir in install_requires] + +# setup +setup( + name='pyrobolearn', + version='0.1.0', + description='A Python framework for roboticists and machine learning practitioners', + long_description = long_description, + author='Brian Delhaisse', + author_email='briandelhaisse@gmail.com', + maintainer='Brian Delhaisse', + maintainer_email='Brian Delhaisse', + license='(c) Brian Delhaisse', + url='https://github.com/robotlearn/pyrobolearn', + platforms=['Linux Ubuntu'], + python_requires='2.7' + # packages=['', 'worlds', 'robots', 'tools', 'pso', 'envs', 'algos', 'optim', 'tasks', 'tools.vr', 'tools.vr.htc', 'tools.vr.oculus', + # 'tools.bci', 'tools.audio', 'tools.camera', 'tools.game_controllers', 'utils', 'utils.data_structures', + # 'models', 'robots', 'robots.ros', 'robots.ros.coman', 'robots.ros.walkman', 'filters', + # 'metrics', 'rl', 'mechanics', 'objectives', 'experiments', 'exploration'], + packages=find_packages(), #find_packages(exclude=('tests',)) + install_requires=reqs +)