Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

How to prepare your system

Ugo Pattacini edited this page Mar 4, 2018 · 38 revisions

This guide walks you through the steps required to prepare our Ubuntu VM used for the VVV school.

Install dependencies

# Update the local database
$ sudo apt update

# Essentials
$ sudo apt install build-essential
$ sudo apt install git
$ sudo apt install cmake
$ sudo apt install cmake-curses-gui
$ sudo apt install libedit-dev

# YARP related dependencies
$ sudo sh -c 'echo "deb http://www.icub.org/ubuntu `lsb_release -cs` contrib/science" > /etc/apt/sources.list.d/icub.list'
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 57A5ACB6110576A6
$ sudo apt update
$ sudo apt install icub-common

# ROS installation steps
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
$ sudo apt update
$ sudo apt install ros-kinetic-desktop-full python-wstool
$ sudo rosdep init
$ rosdep update

# MoveIt! installation steps
$ sudo apt install ros-kinetic-moveit

# Caffe dependencies (cpu only installation)
# If you require CUDA, please install CUDA 8.0 & cuDNN beforehand
# OpenBLAS
$ sudo apt install libopenblas-dev
# boost
$ sudo apt install libboost-all-dev
# Google Protobuf Buffers C++
$ sudo apt install libprotobuf-dev protobuf-compiler
# Google Logging
$ sudo apt install libgoogle-glog-dev
# Google Flags
$ sudo apt install libgflags-dev
# LevelDB
$ sudo apt install libleveldb-dev
# HDF5
$ sudo apt install libhdf5-serial-dev
# LMDB
$ sudo apt install liblmdb-dev
# snappy
$ sudo apt install libsnappy-dev
# yaml python parser
$ sudo apt install python-yaml
# gnuplot for the deep learning lab
$ sudo apt install gnuplot
# access dict values as attributes
$ sudo apt install python-pip
$ pip install easydict

Note ros-desktop package should have installed also the Gazebo simulator. If this is not the case, please install also the following package

$ sudo apt install gazebo7 libgazebo7-dev

Install ROS packages for the TIAGo robot from sources

$ cd ~

# create folder catkin workspace
$ mkdir -p catkin_ws/src
$ cd catkin_ws/src

# set up the workspace with a configuration file listing all required packages
$ wstool init
$ wstool merge https://gist.githubusercontent.com/bmagyar/03d507e4adef2e2d92992029eba6815f/raw/fe6ce6454cc14f0e5db849923bb1273c206404a7/tiago-kinetic.rosinstall

# download all packages in the workspace configuration
$ wstool update
$ cd ..

# parse all packages for their dependencies and install them
$ rosdep install -y --from-paths src --ignore-src --rosdistro kinetic
# This command will say that some packages could not have rosdep keys resolved.
# It is not a real error, keep going with the next steps.

# if this doesn't go well, read below!
# build the packages
$ source /opt/ros/kinetic/setup.bash
$ catkin_make -j2

Verify the installation of TIAGo

$ cd ~/catkin_ws

# add the packages in this workspace to the ROS path
$ source devel/setup.bash

# launch a MoveIt demo with TIAGo equipped with the gripper (CTRL+C to terminate)
$ roslaunch tiago_moveit_config demo.launch robot:=steel

# launch the Gazebo version (CTRL+C to terminate)
$ roslaunch tiago_gazebo tiago_gazebo.launch robot:=steel

# in a new terminal run the following to see the list of topic names (CTRL+C to terminate)
$ cd ~/catkin_ws
$ source devel/setup.bash
$ rostopic list

In case rosdep gives dpkg-query errors, you can install the dependencies with the following command:

$ sudo apt install ros-kinetic-joint-state-controller ros-kinetic-controller-manager ros-kinetic-moveit-simple-controller-manager ros-kinetic-moveit-ros-move-group ros-kinetic-imu-sensor-controller  ros-kinetic-joy ros-kinetic-joy-teleop  ros-kinetic-twist-mux ros-kinetic-position-controllers ros-kinetic-moveit-ros-visualization  ros-kinetic-moveit-planners-ompl ros-kinetic-joint-trajectory-controller ros-kinetic-diff-drive-controller

Matlab/Simulink

Some lessons, tutorials and assignments may require to have Matlab and Simulink installed. If you do not have a valid licence, you can require a 30 days free trial directly at Mathwork. Be sure to have access (or to require access) to the following Matlab products:

  • MATLAB
  • Simulink

If you have the freedom to choose a version, please select R2017b.

Full installation instructions for Matlab can be found here. The following are a short extract, specialized for GNU/Linux of the full documentation.

Once you downloaded the correct installer, unzip it. Open the terminal and move to the extracted folder and then execute the install script with administrator permissions:

$ sudo ./install

Follow the on-screen instructions. You have to login with your MathWorks account

and when prompted select the correct license you requested (e.g. Trial Package in the following image)

Finalize the installation following the on-screen instructions and by adding the symlink in /usr/local/bin.

Setup environment variables

We assume that you have the following directories available in your home path:

  • ~/robot-code
  • ~/robot-install

You can then create the file ~/.bashrc-dev containing the following instructions:

echo "--- Loading YARP + iCub + Dev preferences ---"

# to enhance git experience in the console ;)
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[00;32m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '

# ccache export
export PATH=/usr/lib/ccache:${PATH}

export ROBOT_CODE=~/robot-code
export ROBOT_INSTALL=~/robot-install

export YARP_ROBOT_NAME="iCubGazeboV2_5"

# ros
source /opt/ros/kinetic/setup.bash

# caffe configuration
export Caffe_ROOT=${ROBOT_CODE}/caffe
export Caffe_DIR=${Caffe_ROOT}/build/install

# YARP + iCub exports
export YARP_DIR=${ROBOT_INSTALL}
export ICUB_DIR=${ROBOT_INSTALL}
export ICUBcontrib_DIR=${ROBOT_INSTALL}
export RTF_DIR=${ROBOT_INSTALL}

export YARP_COLORED_OUTPUT=1

# gazebo plugins and models
source /usr/share/gazebo/setup.sh
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:${ROBOT_INSTALL}/share/gazebo/models/:${ROBOT_INSTALL}/share/iCub/robots:${ROBOT_INSTALL}/share
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:${ROBOT_INSTALL}/share

# matlab
export PATH=$PATH:/usr/local/MATLAB/R2017b/bin
alias matlab='LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab'
export MATLABPATH=${ROBOT_INSTALL}/mex:${ROBOT_INSTALL}/share/WB-Toolbox:${ROBOT_INSTALL}/share/WB-Toolbox/images

export PATH=${PATH}:${ROBOT_INSTALL}/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ROBOT_INSTALL}/lib:${ROBOT_INSTALL}/lib/rtf:/opt/ros/kinetic/lib
export YARP_DATA_DIRS=${ROBOT_INSTALL}/share/yarp:${ROBOT_INSTALL}/share/iCub:${ROBOT_INSTALL}/share/ICUBcontrib

# Fix possible QT issue that might arise
export QT_X11_NO_MITSHM=1

echo "--- Loading done! ---"

Finally, do:

$ echo "source ~/.bashrc-dev" >> ~/.bashrc

And restart the bash.

Setup git configuration

$ git config --global user.name "firstname lastname"
$ git config --global user.email "valid email"
$ git config --global color.pager true
$ git config --global color.ui auto
$ git config --global push.default upstream

Get the code

$ cd $ROBOT_CODE
$ git clone https://github.com/robotology/robot-testing.git
$ git clone https://github.com/robotology/ycm.git
$ git clone https://github.com/robotology/yarp.git
$ git clone https://github.com/robotology/icub-main.git
$ git clone https://github.com/robotology/icub-contrib-common.git
$ git clone https://github.com/robotology/idyntree.git
$ git clone https://github.com/robotology/WB-Toolbox.git
$ git clone https://github.com/robotology/gazebo-yarp-plugins.git
$ git clone https://github.com/robotology-playground/icub-models.git
$ git clone https://github.com/robotology-playground/icub-gazebo-wholebody.git
$ git clone https://github.com/robotology/event-driven.git
$ git clone https://github.com/BVLC/caffe.git
$ cd caffe
$ git checkout b2982c7eef65a1b94db6f22fb8bb7caa986e6f29

Install the code

Install robot-testing

$ cd $ROBOT_CODE/robot-testing
$ git checkout devel
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL
$ make install

Install YCM

$ cd $ROBOT_CODE/ycm
$ git checkout devel
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL
$ make install

Install YARP

$ cd $ROBOT_CODE/yarp
$ git checkout devel
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL \
        -DYARP_COMPILE_RTF_ADDONS=ON \
        -DCREATE_GUIS=ON \
        -DCREATE_LIB_MATH=ON \
        -DCREATE_DEVICE_LIBRARY_MODULES=ON \
        -DENABLE_yarpmod_opencv_grabber=ON
$ make install

Setup Yarp autocompletion

$ sudo ln -s $ROBOT_CODE/yarp/scripts/yarp_completion /etc/bash_completion.d/yarp_completion

Install icub-main

$ cd $ROBOT_CODE/icub-main
$ git checkout devel
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL \
        -DENABLE_icubmod_cartesiancontrollerserver=ON \
        -DENABLE_icubmod_cartesiancontrollerclient=ON \
        -DENABLE_icubmod_gazecontrollerclient=ON
$ make install

Install icub-contrib-common

$ cd $ROBOT_CODE/icub-contrib-common
$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL
$ make install

Install Caffe

$ cd $ROBOT_CODE/caffe
$ mkdir build && cd build
# If one needs to compile Caffe without CUDA capabilities please use -DCPU_ONLY=ON
# otherwise remove it from the line below.
$ cmake .. \
        -DBLAS=Open \
        -DCPU_ONLY=ON
$ make all
$ make runtest
$ make install
$ cd ../
$ ./scripts/download_model_binary.py models/bvlc_reference_caffenet
$ ./data/ilsvrc12/get_ilsvrc_aux.sh

Install iDynTree

$ cd $ROBOT_CODE/idyntree
$ git checkout devel
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL \
        -DIDYNTREE_USES_KDL=OFF
$ make install

Install WB-Toolbox

$ cd $ROBOT_CODE/WB-Toolbox
$ git checkout WB3.0
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL \
        -DYCM_DIR=$ROBOT_INSTALL/share/YCM/cmake
$ make install

Install gazebo-yarp-plugins

$ cd $ROBOT_CODE/gazebo-yarp-plugins
$ git checkout devel
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL
$ make install

Install icub-models

$ cd $ROBOT_CODE/icub-models
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL
$ make install

Install icub-gazebo-wholebody

$ cd $ROBOT_CODE/icub-gazebo-wholebody
$ git checkout feature/useGeneratedModels
$ mkdir -p build && cd build
$ cmake .. \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL \
        -DROBOT_NAME="iCubGazeboV2_5"
$ make install

Install event-driven

$ cd $ROBOT_CODE/event-driven
$ mkdir build && cd build
$ cmake .. \
        -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL \
        -DBUILD_PROCESSING=ON \
        -DOpenCV_DIR=/usr/share/OpenCV
$ make install

Download datasets

$ cd $ROBOT_CODE
$ mkdir datasets && cd datasets
$ wget http://www.icub.org/download/software/datasetplayer-demo/testData_20120803_095402.zip
$ wget http://www.icub.org/download/software/datasetplayer-demo/dataDisparity.zip
$ wget -O vvv18-eventdriven-dataset.tar.gz https://ndownloader.figshare.com/files/10322340
$ wget -O iCW-vvv18.tar.gz https://ndownloader.figshare.com/files/10322337
$ unzip testData_20120803_095402.zip
$ unzip dataDisparity.zip
$ tar -xvzf vvv18-eventdriven-dataset.tar.gz
$ tar -xvzf iCW-vvv18.tar.gz