OpenRAVE Documentation

Working With the Source Code

These guidelines are for OpenRAVE Developers using Linux.


In order to compile debug, just do:

make DEBUG=d

This will create a builddebug folder independent of the original build folder.

Can setup colorgcc and ccache for easier development by executing the following setupgcc.bash script inside the ~/.bashrc file:

# install ccache and colorgcc if they are not installed
if [ -z "`which ccache`" ]; then
  echo Installing ColorGCC ...
  sudo apt-get install ccache

# Color GCC
if [ -z "`which colorgcc`" ]; then
  echo Installing ColorGCC ...
  sudo apt-get install colorgcc
if [ ! -z "`which colorgcc`" ]; then
  export CC="colorgcc"
  alias gcc='colorgcc'
  for C in `grep /usr/bin /etc/colorgcc/colorgccrc | sed -e 's/# //' -e 's/:.*//'`; do
    if [ ! -e /usr/local/bin/${C} ]; then
      echo "Installing colorgcc wrapper in $HOME/bin for ${C}... "
      sudo ln -s /usr/bin/colorgcc /usr/local/bin/${C}

# generate .colorgcc by inserting ccache with .*: /usr/bin/.*  (Ryohei Ueda)
looks_like_path() {
    local arg=$1
    local result=`echo "$arg" | grep -c /`
    if [ "$result" != "0" ]; then
        echo true
        return 0
        echo false
        return 1

# clear you .colorgccrc
if [ -e $HOME/.colorgccrc ]; then
    echo "clearing $HOME/.colorgccrc"
    echo > $HOME/.colorgccrc

while read line
    if [ "`echo $line | grep -c -e '^[a-zA-Z0-9].*:'`" != "0" ]; then
        local second_arg="`echo $line | cut -f2 -d:`"
        if [ "`looks_like_path $second_arg`" = "true" ]; then
            echo `echo $line | sed "s/: /: ccache /g"` >> $HOME/.colorgccrc
            echo $line >> $HOME/.colorgccrc
        echo $line >> $HOME/.colorgccrc
done < /etc/colorgcc/colorgccrc

### Color Make
#if [ -z "`which colormake`" ]; then
#  echo Installing ColorMake ...
#  sudo apt-get install colormake
#if [ ! -z "`which colormake`" ]; then
#  alias make='colormake'
#  if [ ! -e /usr/local/bin/make ]; then
#    sudo ln -s /usr/bin/colormake /usr/local/bin/make
#  fi

Note that this will create symlinks to the compilers inside /usr/local/bin.

Indenting C++ Files

OpenRAVE C++ code should automatically be run with uncrustify before being committed. Currently OpenRAVE requires uncrustify version >=0.57. First put .uncrustify.cfg in your $HOME directory.

Run a C++ file before committing to OpenRAVE:

uncrustify --no-backup myfile.cpp

Automatic Indention shows how to automate calling uncrustify when saving the C++ file in Emacs.


To get auto-completion for the OpenRAVE C++ API using Collection of Emacs Development Environment Tools (CEDEC), make sure to put the following Lisp code in your .emacs file:

(defun openrave-package-path ()
      (call-process "openrave-config" nil t nil "--cflags-only-I")
      (goto-char (point-min))
      (re-search-forward "^-I\\(.*\\)[ \\|$]")
      (match-string 1))))

(setq openrave-base-dir (openrave-package-path))
(semantic-add-system-include openrave-base-dir 'c++-mode)
(semantic-add-system-include openrave-base-dir 'c-mode)
(add-to-list 'auto-mode-alist (cons openrave-base-dir 'c++-mode))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat openrave-base-dir "/openrave/config.h"))

Automatic Indention

It is possible to setup emacs to automatically call uncrustify when saving a file by downloading the emacs-uncrustify pakcage, setting its path in the emacs load path, and putting the following in your .emacs file:

(require 'uncrustify)
(setq uncrustify-uncrustify-on-save t)
(setq uncrustify-args "-l CPP")


Using the bm.el library for getting bookmarks. If using bookmarks with uncrustify, have to add the following code to your .emacs file:

(add-hook 'uncrustify-init-hooks 'bm-buffer-save)
(add-hook 'uncrustify-finish-hooks 'bm-buffer-restore)


Having problems with OpenRAVE?