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 · 11 revisions

Introduction

Official installation instructions can be found in our manual.

However, for attending VVV school we do support only Linux systems, hence we warmly suggest you follow the installation guide below (e.g. for a Ubuntu distribution), which is in turn the way we prepared our Virtual Machine.

Install dependencies

# Essentials
$ sudo apt-get install build-essential
$ sudo apt-get install git
$ sudo apt-get install cmake
$ sudo apt-get install cmake-curses-gui
$ sudo apt-get 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-get update
$ sudo apt-get 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-get update
$ sudo apt-get install ros-kinetic-desktop-full
$ sudo rosdep init
$ rosdep update

# ROS for NAO installation steps
$ sudo apt-get install ros-kinetic-nao-robot
$ sudo apt-get install ros-kinetic-nao-meshes
$ sudo apt-get install ros-kinetic-naoqi-dcm-driver
$ sudo apt-get install ros-kinetic-naoqi-bridge

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

# Caffe dependencies (cpu only installation). If you require CUDA, please install CUDA 8.0 & cuDNN beforehand.
# OpenBLAS
$ sudo apt-get install libopenblas-dev
# boost
$ sudo apt-get install libboost-all-dev
# Google Protobuf Buffers C++
$ sudo apt-get install libprotobuf-dev protobuf-compiler
# Google Logging
$ sudo apt-get install libgoogle-glog-dev
# Google Flags
$ sudo apt-get install libgflags-dev
# LevelDB
$ sudo apt-get install libleveldb-dev
# HDF5
$ sudo apt-get install libhdf5-serial-dev
# LMDB
$ sudo apt-get install liblmdb-dev
# snappy:
$ sudo apt-get install libsnappy-dev

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-get install gazebo7 libgazebo7-dev

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 R2016b.

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

Image of MathWorks login in installer

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

Image of MathWorks login in installer

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:

# 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\]\$ '

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

# ros
source /opt/ros/kinetic/setup.bash
export ROS_MASTER_URI=http://localhost:11311
# instead, if you need to communicate with an external machine, use:
# export ROS_MASTER_URI=http://[NAME_OF_MACHINE_RUNNING_ROSCORE_HERE]:11311"
# and add in /etc/hosts name and ip of all the machines in the ros network

# caffe configuration
export Caffe_ROOT=${ROBOT_CODE}/caffe

# liblinear
export LIBSVMLIN_DIR=${ROBOT_CODE}/himrep/liblinear-1.91

# gazebo plugins and models
source /usr/share/gazebo/setup.sh
export GAZEBO_PLUGIN_PATH=${ROBOT_CODE}/codyco-superbuild/build/install/lib
export GAZEBO_MODEL_PATH=${ROBOT_CODE}/codyco-superbuild/build/install/share/gazebo/models
export GAZEBO_RESOURCE_PATH=${GAZEBO_RESOURCE_PATH}:${ROBOT_CODE}/codyco-superbuild/build/install/share/gazebo/worlds

# matlab
export MATLABPATH=${ROBOT_CODE}/codyco-superbuild/build/install/mex:${ROBOT_CODE}/codyco-superbuild/build/install/share/WB-Toolbox:${ROBOT_CODE}/codyco-superbuild/build/install/share/WB-Toolbox/images:${ROBOT_INSTALL}/simmodels

export PATH=${PATH}:${ROBOT_INSTALL}/bin:${ROBOT_CODE}/codyco-superbuild/build/install/bin
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ROBOT_INSTALL}/lib:/opt/ros/kinetic/lib
export YARP_DATA_DIRS=${ROBOT_INSTALL}/share/yarp:${ROBOT_INSTALL}/share/iCub:${ROBOT_INSTALL}/share/ICUBcontrib:${ROBOT_CODE}/codyco-superbuild/build/install/share/codyco

Finally, do:

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

And restart the bash.

Setup git configuration

In order to install the codyco-superbuild software you must have git configured on your machine. If you have already performed the following steps, you can jump to the next section.

$ 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/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/robot-testing.git
$ git clone https://github.com/robotology/codyco-superbuild.git
$ git clone https://github.com/robotology-playground/event-driven.git
$ git clone https://github.com/BVLC/caffe.git
$ cd caffe
$ git checkout b2982c7eef65a1b94db6f22fb8bb7caa986e6f29
$ cd ../
$ git clone https://github.com/robotology/himrep.git

Setup Yarp autocompletion

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

Install the code

Install Yarp

$ cd $ROBOT_CODE/yarp
$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL -DCREATE_GUIS=ON -DCREATE_LIB_MATH=ON ../
$ make install

Install icub-main

$ cd $ROBOT_CODE/icub-main
$ 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 robot-testing

$ cd $ROBOT_CODE/robot-testing
$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$ROBOT_INSTALL -DENABLE_MIDDLEWARE_PLUGINS=ON ../
$ 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 codyco-superbuild

$ cd $ROBOT_CODE/codyco-superbuild
$ mkdir build && cd build
$ cmake -DCODYCO_USES_GAZEBO:BOOL=ON ../
$ make

Install event-driven

$ cd $ROBOT_CODE/event-driven
$ mkdir build && cd build
$ cmake -DV_10BITCODEC:BOOL=ON -DOpenCV_DIR=/usr/share/OpenCV ../
$ make install

Install himrep

$ cd $ROBOT_CODE/himrep
$ cd liblinear-1.91
$ cmake ./
$ make
$ cd ../
$ mkdir build && cd build
$ cmake ../
$ make install

# import and setup configuration file
$ yarp-config context --import himrep imagenet_val_cutfc6.prototxt

# Edit the imported file ~/.local/share/yarp/contexts/himrep/imagenet_val_cutfc6.prototxt
# to modify the absolute path to the mean image and make it point to ${Caffe_ROOT}/data/ilsvrc12/imagenet_mean.binaryproto 
# replacing ${Caffe_ROOT} with its actual value

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 http://www.icub.org/download/software/datasetplayer-demo/event_datasets.zip
$ wget https://data.mendeley.com/datasets/g7vvyk6gds/1/files/ffe5bac4-1ded-4bfd-a595-ef5393e69304/iCW.tar.gz
$ unzip testData_20120803_095402.zip
$ unzip dataDisparity.zip
$ unzip event_datasets.zip
$ tar -zxvf iCW.tar.gz