ICub machines configuration: Difference between revisions

From ISRWiki
Jump to navigation Jump to search
Line 169: Line 169:


== CUDA ==
== CUDA ==
=== Prerequisites ===


* install dependencies: <code>sudo apt-get install freeglut3-dev libdevil-dev libglew-dev</code>
* install dependencies: <code>sudo apt-get install freeglut3-dev libdevil-dev libglew-dev</code>
* download and install NVIDIA CUDA Toolkit from http://docs.nvidia.com/cuda; troubleshooting: http://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04
* check that <code>libcudart5.5</code> (and similar) are '''not''' installed on the system
* SiftGPU:
 
** download it from http://cs.unc.edu/~ccwu/siftgpu/
=== CUDA Toolkit, SDK and Examples ===
** unzip it - typically in your home directory, not in the NFS shared folder
 
** add <code>export SIFTGPU_DIR=~/SiftGPU</code> or similar to your iCub bashrc file
* download and install NVIDIA CUDA Toolkit from http://docs.nvidia.com/cuda (not from Ubuntu packages)
** compile it with <code>make</code>
* output of successful installation:
** if you obtain the error "/usr/local/cuda/bin/nvcc: Command not found", this can help: <code>sudo ln -s /usr/lib/nvidia-cuda-toolkit /usr/local/cuda</code>. See also http://askubuntu.com/questions/231503/nvcc-compiler-setup-ubuntu-12-04
 
** run the test programs SimpleSIFT, MultiThreadSIFT in a real console on the machine (not via ssh)
Driver:  Installed
Toolkit:  Installed in /usr/local/cuda-6.5
Samples:  Installed in /home/icub
 
Please make sure that
-  PATH includes /usr/local/cuda-6.5/bin
-  LD_LIBRARY_PATH includes /usr/local/cuda-6.5/lib64, or, add /usr/local/cuda-6.5/lib64 to /etc/ld.so.conf and run ldconfig as root
 
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-6.5/bin
To uninstall the NVIDIA Driver, run nvidia-uninstall
 
* troubleshooting: http://askubuntu.com/questions/451672/installing-and-testing-cuda-in-ubuntu-14-04
 
=== SiftGPU ===
 
* download it from http://cs.unc.edu/~ccwu/siftgpu/
* unzip it - typically in your home directory, not in the NFS shared folder
* add <code>export SIFTGPU_DIR=~/SiftGPU</code> or similar to your iCub bashrc file
* compile it with <code>make</code>
* if you obtain the error "/usr/local/cuda/bin/nvcc: Command not found", this can help: <code>sudo ln -s /usr/lib/nvidia-cuda-toolkit /usr/local/cuda</code>. See also http://askubuntu.com/questions/231503/nvcc-compiler-setup-ubuntu-12-04
* run the test programs SimpleSIFT, MultiThreadSIFT in a real console on the machine (not via ssh)


== IOL ==
== IOL ==

Revision as of 18:50, 11 February 2015

In this page we will list configurations that are commonplace to Linux machines used at Vislab to work with the iCub robot.

See VisLab machines configuration/Archive for obsolete information.

Operating system installation

Follow Ubuntu defaults and partitioning. For servers and critical machines, use LTS releases. Machines involved in demos must have a user named icub, to make the distributed setup possible (this is required by the graphical 'yarpmanager' program). Furthermore, to use the NFS network mount, this user has to have the uid 1000 and guid 1000.

In order to add a user:

  • either use the Ubuntu graphical frontends
  • or use a Terminal: sudo adduser icub followed by sudo usermod -aG admin icub to give it sudo privileges

Other operations

Network configuration

See also: VisLab network, ISR computing resources.

Manually configure your internet connection as detailed in one of the following subsections, depending if the machine is a desktop or a server one.

Optionally, you may also customize the /etc/hosts file; this would allow us to quickly access other machines, as in: ping icbubrain1. Alternatively, we can do nothing and just use ping icubbrain1.visnet (i.e., attach the .visnet part after a machine name, see VisLab network for details).

Desktop machines

With the graphical Network Manager (https://help.ubuntu.com/14.04/ubuntu-help/net-fixed-ip-address.html), configure the connection "Auto eth0" IPv4 as follows:

Address Netmask Gateway DNS Servers notes
10.10.1.x 255.255.255.0 10.10.1.254 10.0.0.1, 10.0.0.2 visnet (iCub machines)
10.0.x.y 255.255.0.0 10.0.0.254 10.0.0.1, 10.0.0.2 isrnet (rest of ISR)

Servers

Edit /etc/network/interfaces like this:

auto lo
iface lo inet loopback
  
auto eth0
iface eth0 inet static
address 10.x.y.z # put your IP here, see above table
netmask 255.255.x.y # see above table
network 10.10.1.0
broadcast 10.10.1.255
gateway 10.10.1.254
dns-nameservers 10.0.0.1 10.0.0.2

In some versions of Ubuntu, to configure DNS you also need to edit /etc/resolvconf/resolv.conf.d/head like this:

nameserver 10.0.0.1
nameserver 10.0.0.2

then run:

sudo resolvconf -u

Dependencies

sudo apt-get install build-essential libace-dev libgsl0-dev libncurses5-dev gfortran libtinyxml-dev
sudo apt-get install git-core subversion ssh gcc g++ make cmake-curses-gui
sudo apt-get install qttools5-dev qtdeclarative5-dev qtdeclarative5-controls-plugin qtmultimedia5-dev qtdeclarative5-qtmultimedia-plugin qtquick1-5-dev

iCub Simulator dependencies: SDL and ODE.

The GTK versions of graphical YARP programs will be discontinued in 2015 (replaced by Qt equivalents). If you still want to obtain the old programs during compilation, do:

sudo apt-get install libgtkmm-2.4-dev

Environment variables

  • Create a file called ~/.bashrc_iCub like this one. Usually you do not need all of the following variables and settings, just a subset.
# /usr/local/src/robot directory can be mounted from NFS, or created manually with permissions:  sudo chown icub.icub /usr/local/src/robot -R
export ROBOT_CODE=/usr/local/src/robot
export ICUBcontrib_DIR=$ROBOT_CODE/icub-contrib-common/build
export YARP_ROOT=$ROBOT_CODE/yarp
export YARP_DIR=$YARP_ROOT/build
export ICUB_ROOT=${ROBOT_CODE}/icub-main
export ICUB_DIR=${ICUB_ROOT}/build
export icub_firmware_shared_DIR=${ROBOT_CODE}/icub-firmware-shared/build
export YARP_DATA_DIRS=${YARP_DIR}/share/yarp:${ICUB_DIR}/share/iCub:${ICUBcontrib_DIR}/share/ICUBcontrib
export FIRMWARE_BIN=${ROBOT_CODE}/icub-firmware/build
export IPOPT_DIR=$ROBOT_CODE/Ipopt-3.11.9
export OpenCV_DIR=$ROBOT_CODE/opencv-2.4.9/build
#export OpenCV_DIR=$ROBOT_CODE/opencv-2.4.9/build-cuda # for opencv_gpu
# if your modules rely on icub-contrib-common (such as POETICON++), set the following:
export ICUBcontrib_DIR=$code/icub-contrib-common/build
export PATH=$PATH:$YARP_DIR/bin:$ICUB_DIR/bin:$ICUBcontrib_DIR/bin
export YARP_DATA_DIRS=$YARP_DIR/share/yarp:$ICUB_DIR/share/iCub:$ICUBcontrib_DIR/share/ICUBcontrib
# himrep, iol, stereo-vision, CUDA, SiftGPU, Lua
export SIFTGPU_DIR=~/SiftGPU    # note: SiftGPU installed outside NFS
export LIBSVMLIN_DIR=${ROBOT_CODE}/himrep/liblinear-1.91
### DO NOT REMOVE ';;;' ###
export LUA_PATH=";;;${ROBOT_CODE}/rFSM/?.lua;${ICUBcontrib_DIR}/share/ICUBcontrib/contexts/interactiveObjectsLearning/LUA/?.lua"
export LUA_CPATH=";;;$YARP_ROOT/bindings/build_lua/?.so"
export PATH=$PATH:$ICUB_DIR/bin:$YARP_DIR/bin:$ICUBcontrib_DIR/bin
export PATH=$PATH:/usr/local/cuda-6.5/bin
export PATH=$PATH:${ROBOT_CODE}/rFSM/tools:${ICUBcontrib_DIR}/share/ICUBcontrib/contexts/interactiveObjectsLearning/LUA
export PATH=$PATH:${YARP_ROOT}/bindings/build-lua
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.5/lib64
export YARP_ROBOT_NAME=iCubLisboa01
# To enable tab completion on yarp port names
if [ -f $YARP_ROOT/scripts/yarp_completion ]; then
  source $YARP_ROOT/scripts/yarp_completion
fi
  • Then, before the following line of /etc/bash.bashrc
[ -z "$PS1" ] && return

add this:

# per-user environment variables (non-interactive and interactive mode)
source $HOME/.bashrc_iCub

The reason why we use the above custom file (as opposed to the standard ~/.bashrc) is that we want to enforce the variables both during interactive and non-interactive sessions, such as commands launched via yarprun from another machine.

Additional software

OpenCV

Ubuntu packages

 sudo apt-get install libcv-dev libhighgui-dev libcvaux-dev libopencv-gpu-dev

This is the easiest way to install OpenCV, however some machines may require a custom manual compilation instead (see below).

Manual compilation

  • on most machines: download OpenCV 2.4.3 or higher, create a build directory, CMake, set WITH_CUDA=OFF, compile, set OpenCV_DIR to the path of OpenCV-x.y.z/build, for example:
export OpenCV_DIR=$code/OpenCV-2.4.3/build
  • on CUDA machines, in order to compile CUDA-enabled modules: create a build-cuda directory, CMake, set WITH_CUDA=ON, compile, set OpenCV_DIR to the path of OpenCV-x.y.z/build-cuda

YARP and iCub

If you work with the robot, use the volume shares exported from the NFS server.

In other cases:

Follow the instructions on the iCub software article. When compiling, do not use sudo make install but simply make (we have configured the PATH variable to find the latest compiled binaries, and we do not want two copies of the same thing on the system).

  • yarp CMake configuration
CMAKE_BUILD_TYPE Release
CREATE_GUIS
CREATE_LIB_MATH
// to enable 640x480@30Hz images with Bayer encoding
// install libraw1394-dev libdc1394-22-dev then enable
CREATE_OPTIONAL_CARRIERS
ENABLE_yarpcar_bayer_carrier
  • icub-main CMake configuration
CMAKE_BUILD_TYPE Release
// on servers, do http://wiki.icub.org/wiki/Installing_IPOPT then enable
ENABLE_icubmod_cartesiancontrollerclient ON
ENABLE_icubmod_cartesiancontrollerserver ON
ENABLE_icubmod_gazecontrollerclient ON
  • final configuration
  1. yarp namespace /icub
  2. in order to find the yarpserver running on iCub laptop, write 10.10.1.53 10000 into the file specified by yarp conf
  • special machines such as pc104 need different flags

CUDA

Prerequisites

  • install dependencies: sudo apt-get install freeglut3-dev libdevil-dev libglew-dev
  • check that libcudart5.5 (and similar) are not installed on the system

CUDA Toolkit, SDK and Examples

  • download and install NVIDIA CUDA Toolkit from http://docs.nvidia.com/cuda (not from Ubuntu packages)
  • output of successful installation:

Driver: Installed Toolkit: Installed in /usr/local/cuda-6.5 Samples: Installed in /home/icub

Please make sure that

-   PATH includes /usr/local/cuda-6.5/bin
-   LD_LIBRARY_PATH includes /usr/local/cuda-6.5/lib64, or, add /usr/local/cuda-6.5/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-6.5/bin To uninstall the NVIDIA Driver, run nvidia-uninstall

SiftGPU

  • download it from http://cs.unc.edu/~ccwu/siftgpu/
  • unzip it - typically in your home directory, not in the NFS shared folder
  • add export SIFTGPU_DIR=~/SiftGPU or similar to your iCub bashrc file
  • compile it with make
  • if you obtain the error "/usr/local/cuda/bin/nvcc: Command not found", this can help: sudo ln -s /usr/lib/nvidia-cuda-toolkit /usr/local/cuda. See also http://askubuntu.com/questions/231503/nvcc-compiler-setup-ubuntu-12-04
  • run the test programs SimpleSIFT, MultiThreadSIFT in a real console on the machine (not via ssh)

IOL

  • sudo apt-get install lua5.1 liblua5.1-dev
  • clone rFSM

See also https://github.com/robotology/iol

stereo-vision

Clone https://github.com/robotology/stereo-vision, in CMake set USE_SIFT_GPU=ON

See also