[Documentation] [TitleIndex] [WordIndex

Using pcl 1.7 standalone with ros fuerte

This page explains how to use pcl 1.7 standalone installation with ros fuerte.

This could be interesting if people do not want to compile the pcl from source. If not, the pcl17 (http://wiki.ros.org/pcl17) package should do the trick.

I have tested this in Ubuntu 12.04. There is a test ros package that compiles against pcl 1.7 standalone at https://github.com/miguelriem/test_tf_exceptions/tree/master/test_pcl_standalone

The Problem

The problem after installing pcl 1.7 standalone, is that you have the pcl 1.7 libraries at /usr/lib and the pcl1.5 libraries in /opt/ros/fuerte/lib

A package that might use both link directories -L/opt/ros/fuerte/lib and -L/usr/lib, which confuses cmake. Actually, normally, cmake will link against pcl-1.5, which is not what we want.

A similar problem occurs with the pcl1.5/1.7 headers.

Installing pcl 1.7 standalone

sudo apt-get install libpcl-1.7-all-dev

Finding pcl-1.7 with cmake

Add to the CMakeLists.txt

#Find PCL 1.7
find_package(PCL 1.7 REQUIRED)
include_directories(BEFORE ${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
if (NOT PCL_FOUND)
    MESSAGE(FATAL_ERROR "PCL not found.\n")
endif (NOT PCL_FOUND)

Linking against pcl-1.7

To link against pcl 1.7, we must make sure:

* a) The -I/usr/include/pcl-1.7 flag comes before the -I/opt/ros/fuerte/include/pcl-1.5

This is solved by the instruction:

include_directories(BEFORE ${PCL_INCLUDE_DIRS})

* b) That the -L/usr/lib comes before -L/opt/ros/fuerte/lib

This is solved by editing the properties of your compilation targets:

rosbuild_add_executable(MY_TARGET src/my_target.cpp)
SET_TARGET_PROPERTIES(MY_TARGET PROPERTIES LINK_FLAGS -L${PCL_LIBRARY_DIRS})

2024-12-07 14:58