Robotics Library

Build RL on Ubuntu

CMake GUI
The Robotics Library uses CMake as a build system. It can generate project files for various platforms, e.g., Visual Studio solution files.

Prerequities

In order to compile RL and the dependencies on Windows, you need to install a compiler (e.g., the GNU Compiler Collection) and the cross-platform build system CMake ≥ 2.8.11. You can install them on Ubuntu with the following command.

sudo apt-get install build-essential cmake

Optionally, you can also install one or both of the available user interfaces for CMake.

sudo apt-get install cmake-curses-gui cmake-gui

A number of third-party libraries is required to build all components. It is recommended to get these dependencies from binary packages included in the Ubuntu distribution or from the project's PPA. The latter can be added to the system with the following commands.

sudo add-apt-repository ppa:roblib/ppa
sudo apt-get update

In order to install the third-party dependencies required by the individual components, run the following command in a terminal. Please make sure to install the correct version of SOLID (>=3.5.6 with -fno-strict-aliasing patch) from the PPA, as it is not included in any main repository. Also check for the version numbers of libboost-dev (>= 1.46), libeigen3-dev (>= 3.0), and libcgal-dev (>= 3.6.1).

sudo apt-get install libboost-dev libcgal-dev libcoin60-dev libdc1394-22-dev libeigen3-dev libqt4-dev libqt4-opengl-dev libode-dev libsimage-dev libsolid-dev libsoqt4-dev libxml2-dev

In order to generate the API documentation, you need to install the following software packages as well.

sudo apt-get install doxygen graphviz

For multi core compilation support (e.g., quad core), set these variables before running the other commands.

export MAKEFLAGS=-j4

Building the Robotics Library

Download the source code and additional examples and extract the archives. Open a terminal and change into the directory of the extracted source.

tar -xvzf librl-0.6.2-src.tar.gz
tar -xvzf librl-0.6.2-examples.tar.gz
cd rl-0.6.2

Create a build directory.

mkdir build
cd build

Build and install the library by executing the following commands.

cmake ..
make
sudo make install
sudo ldconfig

If CMake installs into platform-specific folders such as /usr/local/lib/x86_64-linux-gnu, libraries may not be automatically indexed (e.g., demos will fail to run because librlkin or librlsg are not found). You can add that directory to ldconfig following this Stackoverflow answer.

Additionally, the following commands can be used to build the API documentation on demand and to run tests included in the project.

make doc
ctest

If tests fail without reason, please send us a bug report including detailed results from the test cases, state your operating system, kernel, and chipset.

lsb_release -a
uname -a
gcc --version
ctest -V

Build Configuration

You can configure the build process by specifying a number of CMake options. Building of selected libraries, demos, or extra applications can be disabled in order to avoid certain dependencies if they are not required. The following table shows an overview of all RL specific parameters and their default values. These options can be directly appended to the cmake command. For a detailed overview of all options, you can run one of the available user interfaces of CMake, ccmake or cmake-gui.

.
Option Description Values
-D BUILD_DEMOS=ON Enable/disable building the demo applications. ON/OFF
-D BUILD_DOCUMENTATION=OFF Enable/disable building the API documentation. ON/OFF
-D BUILD_EXTRAS=ON Enable/disable building the extra applications. ON/OFF
-D BUILD_RL_HAL=ON Enable/disable building the RL::HAL library and its dependencies. ON/OFF
-D BUILD_RL_KIN=ON Enable/disable building the RL::KIN library and its dependencies. ON/OFF
-D BUILD_RL_MATH=ON Enable/disable building the RL::MATH library and its dependencies. ON/OFF
-D BUILD_RL_MDL=ON Enable/disable building the RL::MDL library and its dependencies. ON/OFF
-D BUILD_RL_PLAN=ON Enable/disable building the RL::PLAN library and its dependencies. ON/OFF
-D BUILD_RL_SG=ON Enable/disable building the RL::SG library and its dependencies. ON/OFF
-D BUILD_RL_UTIL=ON Enable/disable building the RL::UTIL library and its dependencies. ON/OFF
-D BUILD_RL_XML=ON Enable/disable building the RL::XML library and its dependencies. ON/OFF

Building the Dependencies

Robotics Library Components
The Robotics Library uses a number of external dependencies, some of which are optional. For definite and current information of the exact dependencies, please refer to the build files in the source code.

SOLID

For current Linux systems, SOLID is probably the only dependency you need to compile manually, as it is not included in any of the main repositories. It is an optional dependency for the scene graph component and can be used for collision detection and distance computation.

Download the SOLID source code and extract the archive. Open a terminal and change into the directory of the extracted source. Build and install the library by executing the following commands.

./configure
make
sudo make install

If you receive segfaults during runtime that refer to SOLID, you may have to patch it in the following way in order to use no-strict-aliasing.

--- solid-3.5.6.orig/configure.ac
+++ solid-3.5.6/configure.ac
@@ -48,8 +48,8 @@ if test "x$enable_debug" = "xyes"; then
    CXXFLAGS="-g"
 AC_MSG_RESULT(yes)
 else
-   CFLAGS="-O2 -fno-gcse -DNDEBUG"	
-   CXXFLAGS="-O2 -fno-gcse -DNDEBUG"
+   CFLAGS="-O2 -fno-gcse -fno-strict-aliasing -DNDEBUG"	
+   CXXFLAGS="-O2 -fno-gcse -fno-strict-aliasing -DNDEBUG"
 AC_MSG_RESULT(no)
 fi

gcc 4.7.2 on Ubuntu 12.10 may require the following additional patch for SOLID.

--- solid-3.5.6.orig/src/complex/DT_BBoxTree.h
+++ solid-3.5.6/src/complex/DT_BBoxTree.h
@@ -31,6 +31,20 @@
 #include "DT_CBox.h"
 
 
+inline DT_CBox computeCBox(const DT_Convex *p)
+{
+    return DT_CBox(p->bbox()); 
+}
+
+inline DT_CBox computeCBox(MT_Scalar margin, const MT_Transform& xform) 
+{
+    const MT_Matrix3x3& basis = xform.getBasis();
+    return DT_CBox(MT_Point3(MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0)), 
+                   MT_Vector3(basis[0].length() * margin, 
+                              basis[1].length() * margin, 
+                              basis[2].length() * margin));
+} 
+
 class DT_BBoxTree {
 public:
     enum NodeType { INTERNAL = 0, LEAF = 1 };
--- solid-3.5.6.orig/src/complex/DT_Complex.cpp
+++ solid-3.5.6/src/complex/DT_Complex.cpp
@@ -120,20 +120,6 @@ MT_BBox DT_Complex::bbox(const MT_Transf
     return MT_BBox(center - extent, center + extent);
 }
 
-inline DT_CBox computeCBox(const DT_Convex *p)
-{
-    return DT_CBox(p->bbox()); 
-}
-
-inline DT_CBox computeCBox(MT_Scalar margin, const MT_Transform& xform) 
-{
-    const MT_Matrix3x3& basis = xform.getBasis();
-    return DT_CBox(MT_Point3(MT_Scalar(0.0), MT_Scalar(0.0), MT_Scalar(0.0)), 
-                   MT_Vector3(basis[0].length() * margin, 
-                              basis[1].length() * margin, 
-                              basis[2].length() * margin));
-} 
-
 void DT_Complex::refit()
 {
     DT_RootData<const DT_Convex *> rd(m_nodes, m_leaves);