Using Eclipse and Orocos

.. work in progress ..

This page describes how you can configure Eclipse in order to write Orocos applications.

Important

First of all, download and install the latest Eclipse version from http://www.eclipse.org/downloads with the 'CDT' plugin (C/C++ Development Toolkit).

Don't continue if you have an Eclipse version older than Helios (3.6).

Getting Started

Eclipse is a great tool, but some Linux systems are not well prepared to use it. Follow these instructions carefully to get the most out of it.

Is Java setup correctly (Linux)?

This is a major issue. Do not use 'gij'/'kaffe'/... java implementation on Linux. You must use the Sun HotSpot(TM) OR a recent OpenJDK Runtime Environment implementation. You can check this by doing:

 java -version
 java version "1.6.0_10"
 Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
 Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
OR
java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu3)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

Note that you should not see any text saying 'gij' or 'kaffe',... Ubuntu/Debian users can install Sun java by doing:

  sudo aptitude install sun-java6-jre
  sudo update-alternatives --config java
 ... select '/usr/lib/jvm/java-6-sun/jre/bin/java'

In case of instability, or misbehaving windows/buttons. Try to use the Sun (= Oracle now) version. But also google for the export GDK_NATIVE_WINDOWS=1 solution in case you use Eclipse before Helios and a 2009 or newer Linux distro.

Extra stuff for your happiness

After you installed Eclipse and Java, you need to configure additionally:
  • Download and unzip the Rinzo XML editor plug-in version 0.6.0 or later and put only the ar.com.tadp.xml.rinzo.core jar file in eclipse/dropins. This plug-in allows you to have syntax highlighting when editing XML files. Add the .cpf extension to your project's 'File Associations' and let it point to the Rinzo editor. NOTE: Eclipse has an own XML Editor plugin that you can install instead.
  • Add the Eclipse CORBA Plugin in case you need to edit IDL files. The update site is http://eclipsecorba.sourceforge.net/update
  • Add the CMake Editor Plugin in case you need to edit cmake files. The update site is http://cmakeed.sourceforge.net/updates/
  • Add the .ops and .osd Orocos scripting file extensions to the 'File Associations' and let them open in the C++ editor, this adds some basic highlighting and indentation features.
  • Add include paths of your project to /usr/include or /usr/local/include or /usr/local/orocos/include such that the Eclipse Indexer can find the Orocos C++ headers and offer coding assistance. (In case you are developing the RTT itself, add orocos-rtt/src, orocos-rtt/build/src and orocos-rtt/src/os to your include paths, assuming you created a build directory 'build'.)
  • Make sure that hovering feature is on in such that you can see if the Indexer understands your C++ code.

If you're changing Orocos code, also download and enable the Eclipse indentation file attached to this post and Import it in the 'Coding Style' tab of your project Preferences.

Eclipse and Git

Peter Soetens has a git repository on http://www.github.com/psoetens . You can check it out using Eclipse with the Egit/jgit plugin. Instructions can be found on this github page. Egit runs on all Java platforms (no dependency on Linux git). In order to install Egit, add
 http://download.eclipse.org/egit/updates
to your update sites of Eclipse (Help -> Software updates...)

If you have an existing clone (checked out with plain old git), you can 'import' it by first importing the git repository directory as a project and then right click the project -> Team -> Share Project Follow the dialogs. There's some confusion with what to type in the location box. In older versions, you'd need to type

 file:///path/to/repository
Note the three ///

Eclipse and SVN

The official Orocos repository is on http://svn.mech.kuleuven.be/repos/orocos (WebSVN link: http://svn.mech.kuleuven.be/websvn/orocos ) You can use Subclipse (http://subclipse.tigris.org) and add
 http://subclipse.tigris.org/update_1.4.x
to your updates sites of Eclipse (Help -> Software updates...)

If you have an existing checkout, you can 'import' it by first importing the checkout directory as a project and then right click the project -> Team -> Share Project

AttachmentSize
orocos-coding-style.xml15.51 KB

Setting up Ubuntu 10.10, Eclipse and Orocos

Ubuntu or Debian Packages

You can find Ubuntu packages of the Orocos Toolchain in the ROS package repositories. Look for the package ros-<releasename>-orocos-toolchain-ros, which installs the orocos_toolchain_ros version.

There are also build instructions for building some of these packages manually here: How to build Debian packages

The rest of this page mixes installing Java and building Orocos toolchain sources. In case you used the Debian/Ubuntu packages above, only do the Java setup.

Setup

  • Replace Java.
  • Install the GNU Toolchain
  • Get Eclipse CDT
  • Install other Orocos dependencies

Java

I am starting with Ubuntu 10.10. First thing to do is to get rid of the OpenJDK version of Java and install the Oracle (Sun) version of Java using the Synaptic Package Manager.

Do the following in Synaptic at the same time:

  • Search for openjdk- and mark for removal or complete removal.
  • Search for sun-java- and select sun-java6-jdk. Make sure the following are selected too (some might be selected already):

 * sun-java6-bin
 * sun-java6-jre
 * sun-java6-plugin
 * sun-java6-source
  • Apply the changes and exit Synaptic.

GNU Toolchain and C++ Development

Install the following:

  • build-essential
  • automake
  • bison
  • libboost-all-dev
  • cmake

Other Orocos Dependencies

  • libxerces-c-dev
  • doxygen
  • dia-gnome
  • inkscape
  • docbook-xsl

omniiOrb

Using Synaptic get all the omniOrb packages that are not marked as transitional or dbg and have the same version number. (Hint: do a search of omniorb then sort by version) Include the lib* packages too.

Build Orocos

I do not like the bootstrap/autoproj procedure of building Orocos. I prefer using the the standard build instructions found in the RTT Installation Guide

Errata in RTT Installation Guide:

  • you have to cd to orocos-toolchain-2.2.1/rtt/ and then mkdir build;cd build and continue with the instructions.

Make sure to enable CORBA by using this cmake command:

cmake .. -DOROCOS_TARGET=gnulinux -DENABLE_CORBA=ON -DCORBA_IMPLEMENTATION=OMNIORB

OCL

Install:

  • libnetcdf-dev
  • netcdf-bin
  • libncurses5-dev
  • libncursesw5-dev
  • libreadline-dev
  • libedit-dev
  • lua5.1
  • lua5.1-0-dev

cd log4cpp;mkdir build;../configure;make;make install

Now: cd ocl;mkdir build;cmake ..;make;make install

Running Eclipse

JDK BUG for JDK 6.0_18 and above FIX on 64bit systems

Put this in your eclipse.ini file under -vmargs: -XX:-UseCompressedOops

Get Eclipse IDE for C/C++ Developers,. Unzip it somewhere and then do:

cd eclipse
./eclipse

Creating an Eclipse Project from an Orocos package

You can use Orocos packages in Eclipse easily. The easiest way is when you're using the ROS build system, since that allows you to generate an Eclipse project, with all the correct settings. If you don't use ROS, you can import it too, but you'll have to add the paths to headers etc manually.

ROS users

cd ~/ros
rosrun ocl orocreate-pkg orocosworld
cd orocosworld
make eclipse-project

Then go to Eclipse -> File -> Import -> Existing Project into Workspace and then follow the wizard.

When the project is loaded, give it some time to index all header files. All include paths and build settings in Eclipse will be set up for you.

non-ROS users

You must have sourced env.sh !

cd ~/src
orocreate-pkg orocosworld
cd orocosworld
make

Then go to Eclipse -> File > New > Makefile Project with Existing Code and complete the wizard page.

The next step you need to do is to add the include paths to RTT and/or OCL and any other dependency in the C++ configuration options of your project preferences.