UPMC iCub project/XDE-simulator

From Wiki for iCub and Friends
Jump to: navigation, search


iCub-XDE is a dynamic simulator of iCub based on XDE. XDE is a simulator developed by CEA-list, adopted by ISIR to mainly simulate iCub and Kuka LWR.

More information about installation, testing etc can be found in ISIR's wiki (restricted access).

Preparation

Linux

We hereby assume you have Ubuntu 12.04.

Dependencies:

  • System dependencies

  sudo apt-get install ipython-qtconsole python-numpy \
  python-pyside libogre-dev libois-dev ogre-samples \
  ogre-samples-data ogre-tools libtbb-dev

  • XDE dependencies from CEA repository

You need to get some specific dependencies from the CEA repository. Add their key first:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6E50A1A3
sudo add-apt-repository ppa:xde/dependencies
sudo apt-get update

you can now install the XDE dependencies

sudo apt-get install -y -q \
  log4cpp-dev libeigen3-lgsm-dev libopencollada-dev liborocos-ocl-corba-gnulinux2.5 \
  liborocos-ocl-corba-gnulinux2.5-dev liborocos-ocl-corba2.5-dev \
  liborocos-ocl-gnulinux2.5 liborocos-ocl-gnulinux2.5-dev \
  liborocos-ocl2.5-dev liborocos-rtt-common2.5-dev \
  liborocos-rtt-common2.5-dev liborocos-rtt-corba-common2.5-dev \
  liborocos-rtt-corba-common2.5-dev liborocos-rtt-corba-gnulinux2.5 \
  liborocos-rtt-corba-gnulinux2.5-dev liborocos-rtt-gnulinux2.5 \
  liborocos-rtt-gnulinux2.5-dev libprotobuf-dev libprotobuf-java \
  libprotobuf-lite7 libprotobuf7 libprotoc-dev libprotoc7 opencollada-tools \
  protobuf-compiler python-protobuf

Installation

Linux

XDE will be given to you in the form of a zip file containing the binaries, some examples and scripts. Extract from the zip file the version for your machine, for example:

  XDE-FW-amd64-precise-devel-XXX.7z

where of course XXX is a code for your built. Extract it in XDE_ROOT, verify that /xde contains the folders /bin and /share and call it $XDE_PATH, for example:

  $XDE_PATH=/home/icub/software/src/xde-precise/xde

Set the PATH in your bashrc file.

To test that the installation is successful, you should try running an example script, for example the one in XDE_ROOT/xde-examples/example/pendulum. To do so, go in XDE_ROOT, create the following script file runxde.sh runxde.sh:

#! /bin/sh
# path must be set with the path the XDE binaries. This folder contains three directories, bin, share and lib.
path=$XDE_PATH
export TEST_BUILD_PATH=`pwd`/build
if [ -z "$path" ]; then echo ERROR : path is not set at all, unable to fin xde binaries; exit 1; fi
bin=$path/bin lib=$path/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib:$lib/types export XDE_LIBRARY_PATH=$lib export XDE_PYTHON_PATH=$lib export RTT_COMPONENT_PATH=$lib/ocl # do not look in /usr/lib/orocos/gnulinux/ocl/ it will override vector_string by strings
if [ -z "$1" ] ; then $bin/XDE $path/void_xde.py else $bin/XDE $1 -ORBInitRef NameService=corbaloc:iiop:localhost:2809/NameService $2 fi

Add this file to your PATH and change its mode as executable.

  cd $XDE_ROOT
  touch runxde.sh
  chmod a+x runxde.sh

In alternative, you can make a copy of the script into a convenient location that you know belongs to your PATH, for example /home/icub/software/bin. To check if the installation is working, first open a terminal and type (anywhere) runxde + TAB. If doing "tab" the terminal shows you runxde.sh, it means that it is correctly installed inside the PATH. To verify that the runxde.sh script you use is the correct one, you can do:

  icub@eva:~/software/src/xde-isir$ which runxde.sh 
  /home/icub/software/bin/runxde.sh

You can now try to launch it alone, to see the interactive xde terminal, or with one of the examples provided with the installation.

Now try launching a python example:

  runxde.sh xde-examples/example/pendulum/main.py  

If you see two new windows, one containing a simulated pendulum (you will see the x-y-z frames moving) then XDE is probably working!

If you want to try the interactive shell, you need to write a "void script" first, that allows you to run xde without arguments.

  cd $XDE_ROOT/xde
  touch void_xde.py

Now copy-paste the following lines into void_xde.py:

#!/usr/bin/env python
import loader import deploy deploy.loadTypekitsAndPlugins()
import lgsm
# a special version of IPython import xdefw.interactive shell = xdefw.interactive.shell_console() shell()

Usage

Linux

The general way to run scripts is

  runxde.sh my_script.py