UPMC iCub project/XDE-simulator-dev

From Wiki for iCub and Friends
Revision as of 18:23, 10 December 2013 by Arwen (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If you want to develop robot controllers in XDE, you may need to prepare your machine by installing two further components: XDE-core, which is a set of development files of XDE used for developers, and ORC. XDE-core is, as XDE, not open-source.

Once you have XDE-core and ORC, you can install the modules developed in ISIR for developing controllers in XDE. In this case the code can be downloaded on github.



We hereby assume you have Ubuntu 12.04.


  • System dependencies

The basics for XDE-core sudo apt-get install libeigen3-dev g++ python-dev cmake git These are necessary for XDE-ISIR modules sudo apt-get install swig python-matplotlib

  • XDE-core

To retrieve the last developers packages, ask Sovannara Hak.

  • XDE-ISIRController (C++ version)

To retrieve the latest ISIR Controller for XDE based on C++ ask Joseph Salini.

  • XDE-ISIR modules

You will need to retrieve some modules from the github repository https://github.com/xde-isir Create a folder, for example xde-isir, where you can put all he modules. Each will be compiled separately.

  cd /home/icub/software/src/xde-isir
  git clone https://github.com/XDE-ISIR/XDE-Observers.git
  git clone https://github.com/XDE-ISIR/XDE-DocPythonAPI.git
  git clone https://github.com/XDE-ISIR/demo-spacemouse.git
  git clone https://github.com/XDE-ISIR/XDE-ZMPy.git
  git clone https://github.com/XDE-ISIR/RTEKukaFRIClient.git
  git clone https://github.com/XDE-ISIR/orocos_toolchain_xde.git
  git clone https://github.com/XDE-ISIR/XDE-Resources.git
  git clone https://github.com/XDE-ISIR/XDE-ISIRController.git 
  git clone https://github.com/XDE-ISIR/XDE-RobotLoader.git
  git clone https://github.com/XDE-ISIR/XDE-WorldManager.git
  git clone https://github.com/XDE-ISIR/XDE-Spacemouse.git
  git clone https://github.com/XDE-ISIR/XDE-ISIR.git
  git clone https://github.com/XDE-ISIR/XDE-SwigISIRController.git
  git clone https://github.com/XDE-ISIR/XDE-DocExamples.git

Note that XDE-ISIRController in this case has the same name of the one downloaded in the previous step, but it is different. The previous is in C++ and makes the controller available in C++ to XDE, whereas the one you get from git is the python version, that calls the C++ version to accelerate some parts of the simulation.



  • XDE-Core

Go in the folder where you have put xde-core, for example

  cd /home/icub/software/src/xde-core

and install the package:

  dpkg -i xdecore_3.99.5.0_amd64.deb

Check that LGSM library is included, this

  pkg-config --cflags eigen3

should return

  -I/usr/include/eigen3 -I/usr/include/eigen3/unsupported

If this is not the case, then you need to copy or modify the file eigen3.pc in your $PKG_CONFIG_PATH. Install the developer package:

   sudo dpkg -i --force-all  xdecore-dev_3.99.5.0_amd64.deb

Now you have to create a file xdecore.pc and put it your $PKG_CONFIG_PATH. In my case, $PKG_CONFIG_PATH=/home/icub/software/lib/pkgconfig.

   touch xdecore.pc

Copy-paste this into the file: prefix=/usr libdir=${prefix}/lib includedir=${prefix}/include/xdecore

Name: xdecore Description: XDE core library Version: Requires: eigen3 Libs: -L${libdir} -lXDECore Cflags: -I${includedir}

  • XDE-ISIRController (C++ version)

Go into the folder where you put XDE-ISIRController, for example

  cd /home/icub/software/src/XDE-ISIRController

Create the usual build folder, enter it and compile through cmake:

  mkdir build
  cd build
  ccmake ..
  make install

This will install libXDE-ISIRModel-gnulinux.so (in my case, it is located in: /home/icub/software/lib/libXDE-ISIRModel-gnulinux.so).

  • XDE-ISIR modules

Now these modules have to be compiled one by one, and in some cases in a different way.

  • XDE-WorldManager
  cd xde-isir/XDE-WorldManager
  python setup.py develop

You may want to build also its documentation

  runxde.sh setup.py build_doc

which builds the html doc in xde-isir/XDE-WorldManager/build/sphinx/html

  • XDE-RobotLoader
  cd xde-isir/XDE-RobotLoader
  python setup.py develop
  • XDE-Resources
  cd xde-isir/XDE-Resources
  mkdir build

Before doing the standard ccmake/make chain, you must check the content of the cmake file CMakeLists.txt, in particular check the execute_process command, and verify that it is installing into dist-packages. If not, change the code as below.

 "import sys, os; print os.sep.join(['lib', 'python' + sys.version[:3], 'dist-packages'])"

This avoid a known issue with ipython, it is going to be fixed - so probably you won't have this issue. Then you can finally do the ccmake/make thing: please do not change the install location in this case! I tried installing it in my usual /home/icub/software location, it doesn't work. So stick to the usual installation path.

  cd build
  sudo make install

You may need to check that XDE-Resources can be correctly found by python. So, in a terminal, type:

  import xde_resources

If it works, installation is ok. If it doesn't check which python packages for xde you have installed so far

  import xde_ +TAB

If you only see

  xde_robot_loader  xde_world_manager

It means you encountered a little bug, or you probably configured ccmake to install in a different location than the default one. In this case you need to redo the ccmake step, and make and make install in the default location. To verify, the install log should tell you something like:

  -- Installing: /usr/local/share/xde-resources/urdf/icub_simple.dae
  -- Installing: /usr/local/share/xde-resources/urdf/icub_simple_collision.dae
  -- Installing: /usr/local/lib/python2.7/dist-packages/xde_resources/core.py
  -- Installing: /usr/local/lib/python2.7/dist-packages/xde_resources/__init__.py

Note that the python files go to dist-packages.

  • XDE-ZMPy
  cd xde-isir/XDE-ZMPy
  python setup.py build
  python setup.py install --user

The script will install things locally, in my case it is in /home/icub/.local/lib/python2.7/site-packages/xde_zmpy Note: since 12-2013 this module has been integrated in the new XDE-ISIRcontroller, so it is not used anymore

  • XDE-ISIRController
  cd xde-isir/XDE-ISIRController
  python setup.py develop

Note that to install this module, you must have installed before the C++ version (few steps before), otherwise you will get the error

  XDE-ISIRController not found by pkg-config
  • XDE-DocExamples

Some documentation can be built by:

  cd xde-isir/XDE-DocExamples
  make html

which will create a browsable html documentation in build/html. In source/examples you can find some examples with scripts.

  • XDE-SwigISIRController
  cd XDE-SwigISIRController
  python setup.py build
  python setup.py install --user

The script will install things locally, in my case it is in /home/icub/.local/lib/python2.7/site-packages/swig_isir_controller



The general way to run scripts in XDE is

  runxde.sh my_script.py

If you installed XDE correctly, you should be able to have runxde.sh in the PATH (so you can use the autocompletion in your terminal).

iCub squatting in XDE

Some scripts for using the ISIR controllers with XDE and some robots (KUKA LWR, iCub) are provided in the examples of XDE-ISIRController (the python version)

  cd xde-isir/XDE-ISIRController/examples

As a first test, try running

  runxde.sh 01_full_joint_control.py 

Or you can try iCub for simple things:

  cd xde-isir/XDE-ISIRController/examples/icub_control
  runxde.sh 02_squatting.py