diff --git a/scripts/install_chrono.sh b/scripts/install_chrono.sh new file mode 100644 index 0000000..211a7ad --- /dev/null +++ b/scripts/install_chrono.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Install the Chrono simulator and its Python wrapper (pychrono) +# References: +# - install chrono: +# - https://github.com/projectchrono/chrono +# - http://api.projectchrono.org/development/tutorial_install_chrono.html +# - install pychrono: +# - http://api.projectchrono.org/development/module_python_installation.html + +# Define few variables +ORIGIN_DIR=$PWD + +# install chrono + +# Pass as the first argument the location where to install chrono and pychrono +if [[ -z $1 ]]; then + echo "Specify the location where to install the chrono and pychrono source directories as the first argument." + exit +fi +CHRONO_PATH=$1 +cd $CHRONO_PATH + +# install dependencies +sudo apt-get install libeigen3-dev cmake git +sudo apt install build-essential x11-common libxxf86vm-dev libglu1-mesa-dev freeglut3 xorg-dev +sudo apt install libirrlicht1.8 libirrlicht-dev libirrlicht-doc + +# install SWIG +git clone https://github.com/swig/swig.git +cd swig +sudo apt-get install automake +./autogen.sh +./configure +sudo apt-get install bison flex +make -j4 +sudo make install + +# install chrono and pychrono +cd $CHRONO_PATH +git clone https://github.com/projectchrono/chrono +cd chrono +mkdir build +cd build +cmake .. -DENABLE_MODULE_IRRLICHT=True -DENABLE_MODULE_PYTHON=True -DSWIG_EXECUTABLE=/usr/local/bin/swig +make -j4 +sudo make install +# the pychrono Python library is in chrono/build/bin + +# return to the original directory +cd $ORIGIN_DIR diff --git a/scripts/install_dart.sh b/scripts/install_dart.sh new file mode 100644 index 0000000..7cfd38e --- /dev/null +++ b/scripts/install_dart.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# Install the Dart simulator and its Python wrapper (dartpy) +# References +# - Install DART on Ubuntu: https://dartsim.github.io/install_dart_on_ubuntu.html +# - Install dartpy on Ubuntu: https://dartsim.github.io/install_dartpy_on_ubuntu.html + +# Define few variables +ORIGIN_DIR=$PWD + +# install dart + +# Pass as the first argument the location where to install DART +if [[ -z $1 ]]; then + echo "Specify the location where to install the DART source directory as the first argument." + exit +fi +cd $1 + +sudo apt-get remove libdart* + +# install dependencies +sudo apt-get install build-essential cmake pkg-config git +sudo apt-get install libeigen3-dev libassimp-dev libccd-dev libfcl-dev libboost-regex-dev libboost-system-dev +sudo apt-get install libnlopt-dev +sudo apt-get install coinor-libipopt-dev +sudo apt-get install libbullet-dev +sudo apt-get install libode-dev +sudo apt-get install liboctomap-dev +sudo apt-get install libflann-dev +sudo apt-get install libtinyxml2-dev liburdfdom-dev +sudo apt-get install libxi-dev libxmu-dev freeglut3-dev libopenscenegraph-dev +sudo apt-get install python3-pip + +# build and install DART and dartpy +git clone git://github.com/dartsim/dart.git +cd dart +git checkout tags/v6.9.0 +mkdir build +cd build +cmake .. -DDART_BUILD_DARTPY=ON -DCMAKE_INSTALL_PREFIX=/usr/ -DCMAKE_BUILD_TYPE=Release +make -j4 +make -j4 dartpy + +sudo make install + +# return to the original directory +cd $ORIGIN_DIR diff --git a/scripts/install_ipopt.sh b/scripts/install_ipopt.sh index ba604ea..a928820 100755 --- a/scripts/install_ipopt.sh +++ b/scripts/install_ipopt.sh @@ -16,7 +16,7 @@ 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." + echo "Specify the location of the Ipopt source directory in the first argument." exit fi cd $1 diff --git a/scripts/install_mujoco.sh b/scripts/install_mujoco.sh new file mode 100644 index 0000000..0287d21 --- /dev/null +++ b/scripts/install_mujoco.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# Install the MuJoCo simulator and the Python wrapper (mujoco_py) provided by OpenAI +# You have to provide the directory where to install the Mujoco and mujoco_py packages and which contains the mjkey.txt +# References: +# - install mujoco: https://www.roboti.us/index.html +# - install mujoco_py: https://github.com/openai/mujoco-py + +# Define few variables +ORIGIN_DIR=$PWD + +# install mujoco + +# Pass as the first argument the location where to install MuJoCo and mujoco_py +if [[ -z $1 ]]; then + echo "Specify the location where to install the MuJoCo and mujoco_py source directories as the first argument." + exit +fi +MUJOCO_PATH=$1 +cd $MUJOCO_PATH + +# check OS +if [[ "$OSTYPE" == "linux-gnu" ]]; then # LINUX + PACKAGE="mujoco200_linux" +elif [[ "$OSTYPE" == "darwin"* ]]; then # Mac OSX + PACKAGE="mujoco200_macos" +elif [[ "$OSTYPE" == "msys" ]]; then # Windows + PACKAGE="mujoco200_win64" +else + echo "This OS is not supported. Expecting a Linux, Mac OSX, or Windows system." + exit +fi + +# download package and unzip it +wget "https://www.roboti.us/download/${PACKAGE}.zip" +unzip "${PACKAGE}.zip" + +# install mujoco_py +sudo apt install libosmesa6-dev libgl1-mesa-glx libglfw3 + +export MUJOCO_PY_MJKEY_PATH="${MUJOCO_PATH}/mjkey.txt" +export MUJOCO_PY_MJPRO_PATH="${MUJOCO_PATH}/${PACKAGE}" +export MUJOCO_PY_MUJOCO_PATH="${MUJOCO_PATH}/${PACKAGE}" +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${MUJOCO_PATH}/${PACKAGE}/bin +export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so # :/usr/lib/x86_64-linux-gnu/libGL.so # for visualization + +# write variables to export in the ~/.bashrc file, and source it +cd +echo "" >> .bashrc +echo "# MuJoCo" >> .bashrc +echo "export MUJOCO_PY_MJKEY_PATH=${MUJOCO_PATH}/mjkey.txt" >> .bashrc +echo "export MUJOCO_PY_MJPRO_PATH=${MUJOCO_PATH}/${PACKAGE}" >> .bashrc +echo "export MUJOCO_PY_MUJOCO_PATH=${MUJOCO_PATH}/${PACKAGE}" >> .bashrc +echo "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${MUJOCO_PATH}/${PACKAGE}/bin" >> .bashrc +echo "export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so" >> .bashrc +# source .bashrc + +git clone https://github.com/openai/mujoco-py +cd mujoco-py +pip install -e . +# sudo python setup.py install + +# return to the original directory +cd $ORIGIN_DIR diff --git a/scripts/install_raisim.sh b/scripts/install_raisim.sh new file mode 100644 index 0000000..8e003f7 --- /dev/null +++ b/scripts/install_raisim.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# Install the raisim simulator (raisimLib and raisimOgre) and its Python wrapper (raisimpy) +# ./install_raisim [ []] +# References: +# - install raisimLib: https://github.com/leggedrobotics/raisimLib +# - install raisimOgre: https://github.com/leggedrobotics/raisimOgre +# - install raisimpy: https://github.com/robotlearn/raisimpy + +# Define few variables +ORIGIN_DIR=$PWD + +# define workspace, local build, and python version + +# Pass as the first argument the workspace location +if [[ -z $1 ]]; then + echo "Specify the WORKSPACE location where to clone/install the various RaiSim repositories." + exit +fi + +# Pass as the second argument the local build location +if [[ -z $2 ]]; then + echo "Specify the local build location where to install the exported cmake libraries." + exit +fi + +# Pass as the third argument the python version +if [[ -z $3 ]]; then + echo "Specify the python version." + exit +fi + +WORKSPACE=$1 +LOCAL_BUILD=$2 +PYTHON_VERSION=$3 + +##################### +# install raisimLib # +##################### + +# install raisimLib dependencies +sudo apt-get install libeigen-dev + +# install raisimLib +cd $WORKSPACE/raisimLib +mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$LOCAL_BUILD && make install + +###################### +# install raisimOgre # +###################### + +# install cmake > 3.10 +export cmake_version=3.14 +export cmake_build=5 +mkdir ~/temp +cd ~/temp +wget https://cmake.org/files/v$cmake_version/cmake-$cmake_version.$cmake_build.tar.gz +tar -xzvf cmake-$cmake_version.$cmake_build.tar.gz +cd cmake-$cmake_version.$cmake_build/ +./bootstrap +make -j4 +sudo make install + +# install g++ +sudo apt-get install -y software-properties-common +sudo add-apt-repository ppa:ubuntu-toolchain-r/test +sudo apt update +sudo apt install g++-8 gcc-8 -y + +# install raisimOgre dependencies +sudo apt-get install libgles2-mesa-dev libxt-dev libxaw7-dev libsdl2-dev libzzip-dev libfreeimage-dev libfreetype6-dev libpugixml-dev + +# build Ogre from source +cd $WORKSPACE +git clone https://github.com/leggedrobotics/ogre.git +cd ogre +git checkout raisimOgre +mkdir build +cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$LOCAL_BUILD -DOGRE_BUILD_COMPONENT_BITES=ON -OGRE_BUILD_COMPONENT_JAVA=OFF -DOGRE_BUILD_DEPENDENCIES=OFF -DOGRE_BUILD_SAMPLES=False +make install -j8 + +# install raisimOgre +cd $WORKSPACE +cd raisimOgre && mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=$LOCAL_BUILD -DCMAKE_INSTALL_PREFIX=$LOCAL_BUILD -DRAISIM_OGRE_EXAMPLES=True +make install -j8 + + +#################### +# Install raisimpy # +#################### + +# install pybind11 +cd $WORKSPACE +git clone https://github.com/pybind/pybind11 +mkdir build +cd build +if [[ -z $4 ]]; then # Check if path to python binary is provided + cmake .. +else + cmake -DPYTHON_EXECUTABLE=$4 .. +fi +make check -j 4 + +# install raisimpy +cd $WORKSPACE +git clone https://github.com/robotlearn/raisimpy +cd raisimpy +mkdir build && cd build +cmake -DPYBIND11_PYTHON_VERSION=$PYTHON_VERSION -DCMAKE_PREFIX_PATH=$LOCAL_BUILD -DCMAKE_INSTALL_PREFIX=$LOCAL_BUILD .. +make -j4 +make install +export PYTHONPATH=$PYTHONPATH:$LOCAL_BUILD/lib + +# write variables to export in the ~/.bashrc file, and source it +cd +echo "" >> .bashrc +echo "# RaiSim" >> .bashrc +echo "export PYTHONPATH=\$PYTHONPATH:${LOCAL_BUILD}/lib" >> .bashrc +# source .bashrc + +# return to the original directory +cd $ORIGIN_DIR diff --git a/scripts/install_sloccount.sh b/scripts/install_sloccount.sh index 99f6b5f..0f1339a 100755 --- a/scripts/install_sloccount.sh +++ b/scripts/install_sloccount.sh @@ -1,18 +1,25 @@ #!/bin/sh -# This bash installs the 'sloccount' command which counts source lines of code, and provides several statisticsabout this last one. +# This bash installs the 'sloccount' and 'cloc' commands which provide statistics such as the number of lines of code, +# and others of a certain software. # Once installed, go to the pyrobolearn package and type: -# $ sloccount *.py */*.py +# $ sloccount . +# or +# $ cloc . # define variables origindir=$PWD scriptdir=`dirname $0` -# install package +# install packages sudo apt install sloccount -y +sudo apt install cloc -y # compute statistics for pyrobolearn software cd $scriptdir; cd .. -sloccount *.py */*.py +echo "\n\nUsing Sloccount:" +sloccount . +echo "\n\nUsing clock:" +cloc . # return to the original directory cd $origindir diff --git a/scripts/install_vrep.sh b/scripts/install_vrep.sh new file mode 100644 index 0000000..abd2e07 --- /dev/null +++ b/scripts/install_vrep.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# Install the VREP simulator and the Python wrapper (PyRep) +# If you use a virtual environment for Python, activate this last one before launching this script +# References: +# - install VREP: http://www.coppeliarobotics.com/downloads.html +# - install PyRep: https://github.com/stepjam/PyRep + +# Define few variables +ORIGIN_DIR=$PWD + +# install VREP + +# Pass as the first argument the location where to install VREP and PyRep +if [[ -z $1 ]]; then + echo "Specify the location where to install the VREP and PyRep source directories as the first argument." + exit +fi +cd $1 + +# check OS +if [[ "$OSTYPE" == "linux-gnu" ]]; then + # LINUX + OS=`cat /etc/os-release | grep NAME= | head -1 | cut -c 7- | sed 's/.$//'` # e.g. Ubuntu + VERSION=`cat /etc/os-release | grep VERSION= | head -1 | cut -c 10- | cut -c -5` # e.g. 16.04 + + # Check Ubuntu version + if [[ $VERSION == "16.04" ]]; then + PACKAGE="V-REP_PRO_EDU_V3_6_2_Ubuntu16_04" + elif [[ $VERSION == "18.04" ]]; then + PACKAGE="V-REP_PRO_EDU_V3_6_2_Ubuntu18_04" + else + echo "This Linux distribution ${OS} ${VERSION} is not supported; Ubuntu 16.04 or 18.04 is required." + exit + fi + + # download package and unpack it + wget "http://www.coppeliarobotics.com/files/${PACKAGE}.tar.xz" + tar -xvf "${PACKAGE}.tar.xz" +elif [[ "$OSTYPE" == "darwin"* ]]; then + # Mac OSX + PACKAGE="V-REP_PRO_EDU_V3_6_2_Mac" + # download package and unpack it + wget "http://www.coppeliarobotics.com/files/${PACKAGE}.zip" + unzip "${PACKAGE}.zip" +#elif [[ "$OSTYPE" == "msys" ]]; then +# # Windows +# PACKAGE="V-REP_PRO_EDU_V3_6_2_Setup" +# wget "http://www.coppeliarobotics.com/files/$PACKAGE.exe" +else + echo "This OS is not supported. Expecting an Ubuntu or Mac OSX system." + exit +fi + +# export variables +export VREP_ROOT="${PWD}/${PACKAGE}" +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VREP_ROOT +export QT_QPA_PLATFORM_PLUGIN_PATH=$VREP_ROOT + +# write variables to export in the ~/.bashrc file, and source it +cd +echo "" >> .bashrc +echo "# VREP" >> .bashrc +echo "export VREP_ROOT=${PWD}/${PACKAGE}" >> .bashrc +echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$VREP_ROOT" >> .bashrc +echo "export QT_QPA_PLATFORM_PLUGIN_PATH=\$VREP_ROOT" >> .bashrc +# source .bashrc + +# install PyRep +cd $1 +git clone https://github.com/stepjam/PyRep.git +cd PyRep + +# install requirements and setup (if you don't have a virtual environment with Py3, you might need to replace +# pip by pip3, and python by python3. +pip install -r requirements.txt +python setup.py install --user + +# return to the original directory +cd $ORIGIN_DIR