Ask Your Question
1

How to link ROS to pcl17

asked 2013-10-10 07:44:09 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Im running the ground_based_rgbd_people_detector from pcl17 and im looking to publish the distance to ROS. To do this i Included ros/ros.h to the .cpp code but when i try to compile it y get the following error:--undefined reference to `ros::init(int&, char**, std::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, unsigned int)'

Im using rosbuild, and im really stuck. Would really appreciate some help.

I Need to add the reference to ros or the ros ibrary in the CMakeList.txt but dont know how. Right now my CMakeList.txt is: set(SUBSYS_NAME people) set(SUBSYS_DESC "Point cloud people library") set(SUBSYS_DEPS common kdtree search features sample_consensus filters io visualization geometry segmentation octree)

if(NOT VTK_FOUND) set(DEFAULT FALSE) set(REASON "VTK was not found.") else(NOT VTK_FOUND) set(DEFAULT TRUE) set(REASON) set(VTK_USE_FILE ${VTK_USE_FILE} CACHE INTERNAL "VTK_USE_FILE") include (${VTK_USE_FILE}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) endif(NOT VTK_FOUND)

set(build TRUE) PCL_SUBSYS_OPTION(build ${SUBSYS_NAME} ${SUBSYS_DESC} ON) PCL_SUBSYS_DEPEND(build ${SUBSYS_NAME} DEPS ${SUBSYS_DEPS})

PCL_ADD_DOC(${SUBSYS_NAME})

if(build) set(incs include/pcl17/${SUBSYS_NAME}/ground_based_people_detection_app.h include/pcl17/${SUBSYS_NAME}/head_based_subcluster.h include/pcl17/${SUBSYS_NAME}/height_map_2d.h include/pcl17/${SUBSYS_NAME}/person_classifier.h include/pcl17/${SUBSYS_NAME}/person_cluster.h include/pcl17/${SUBSYS_NAME}/hog.h )

set(impl_incs
    include/pcl17/${SUBSYS_NAME}/impl/ground_based_people_detection_app.hpp
    include/pcl17/${SUBSYS_NAME}/impl/head_based_subcluster.hpp
    include/pcl17/${SUBSYS_NAME}/impl/height_map_2d.hpp
    include/pcl17/${SUBSYS_NAME}/impl/person_classifier.hpp
    include/pcl17/${SUBSYS_NAME}/impl/person_cluster.hpp
    include/pcl17/${SUBSYS_NAME}/impl/hog.hpp
    )

set(srcs
    )

set(LIB_NAME pcl_${SUBSYS_NAME})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
PCL_ADD_LIBRARY(${LIB_NAME} ${SUBSYS_NAME} ${srcs} ${incs} ${impl_incs})
PCL_MAKE_PKGCONFIG(${LIB_NAME} ${SUBSYS_NAME} "${SUBSYS_DESC}" "${SUBSYS_DEPS}" "" "" "" "")
# Install include files
PCL_ADD_INCLUDES(${SUBSYS_NAME} ${SUBSYS_NAME} ${incs})     
PCL_ADD_INCLUDES(${SUBSYS_NAME} ${SUBSYS_NAME}/impl ${impl_incs})

SET_TARGET_PROPERTIES(pcl_${SUBSYS_NAME} PROPERTIES LINKER_LANGUAGE CXX)    

PCL_ADD_EXECUTABLE(pcl_ground_based_rgbd_people_detector ${SUBSYS_NAME} apps/main_ground_based_people_detection.cpp)
target_link_libraries(pcl_ground_based_rgbd_people_detector pcl_people pcl_common pcl_kdtree pcl_search pcl_features pcl_sample_consensus pcl_filters pcl_io pcl_visualization pcl_segmentation)

endif(build)

How can i refenrece correctly to ROS

Cris

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-10 22:44:25 -0600

This is the wrong way. You should create a new ros package and use pcl17 in this package. Don't manipulate pcl17 directly.

edit flag offensive delete link more

Comments

@MichaelKorn thanks, could you explain a little how to accomplish this? to be able use the pcl17 code with ROS

ctguell gravatar imagectguell ( 2013-10-11 04:00:33 -0600 )edit

Just create a new ROS package and use pcl17 as dependency.

MichaelKorn gravatar imageMichaelKorn ( 2013-10-12 10:06:02 -0600 )edit

@MichaelKorn thanks. Now im in the verge of finally accomplishing the task but i have a small problem. When i run the program from the bin, from the package pcl17 direct form download, "rosrun pcl17 pcl_ground_based_rgbd_people_detector" it runs but with a problem. but if I run it from the pcl_trunk "/pcl17/build/pcl_trunk/build/bin$ ./pcl_ground_based_rgbd_people_detector" it runs perfectly. So when in include the pcl17 in my new package im getting the program that has the problem and not the one in trunk that works fine. Do you have any idea how to solve this? The error is the following. [pcl17::people::PersonClassifier::evaluate] SVM has not been set! once again thanks

ctguell gravatar imagectguell ( 2013-10-15 01:58:41 -0600 )edit
1

I'm not familiar with the PersonClassifier. You can find the error message in people/include/pcl/people/impl/person_classifier.hpp. So the question is why:SVM_weights_.size() == 0? This should be loaded from a file. In the main_ground_based_people_detection.cpp you can find a hard-coded RELATIV Path

MichaelKorn gravatar imageMichaelKorn ( 2013-10-15 02:47:38 -0600 )edit

@MichaelKorn thanks that was the problem, its solved now, really appreciate the help ;)

ctguell gravatar imagectguell ( 2013-10-15 03:25:00 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-10-10 07:44:09 -0600

Seen: 282 times

Last updated: Oct 10 '13