ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

cluster_extraction - pcl::search not declared?

asked 2012-01-05 00:23:39 -0600

TobyLightheart gravatar image

updated 2012-02-27 13:27:13 -0600

kwc gravatar image

Hi Everyone,

I've tried selectively importing the code from the Point Cloud Library Cylinder Model Segmentation tutorial into the template provided in the ROS PCL tutorial.

Trying to run rosmake throws an error:

/ros_workspace/turtlebot_test/src/model_segmentation.cpp:49:8: error: ‘pcl::search’ has not been declared

The tutorials compile and work on my system individually in ROS and using the CMake method described on the PCL website respectively. I've tried adding headers and library links to the CMake file but to no avail.

Any help would be appreciated.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
2

answered 2012-01-05 03:59:43 -0600

karthik gravatar image

Hi,

If you want to use the latest pcl 1.4, download the perception_pcl_unstable package to your ros_workspace so that its looked on top of the perception_pcl path. So in that case the pcl 1.4 will be used in all your compilation. Use the following command to download the package onto the workspace.

svn co https://svn.pointclouds.org/ros/trunk/perception_pcl_unstable perception_pcl_unstable

This is what i did and it worked

Hope this helps,

Karthik

edit flag offensive delete link more

Comments

Putting perception_pcl_unstable into my ROS workspace folder has solved that compile error. The compiler still needed some help finding includes like 'Eigen/StdVector', which I ended up handling by adding 'include_directories(/usr/include/eigen3)' to CMakeLists.txt. Thanks for your suggestion!
TobyLightheart gravatar image TobyLightheart  ( 2012-01-05 18:56:14 -0600 )edit
You are welcome :)
karthik gravatar image karthik  ( 2012-01-05 20:06:12 -0600 )edit
Hey, May i know where you pasted the include_directories(/usr/include/eigen3) to solve the Eigen/StdVector issue.
karthik gravatar image karthik  ( 2012-01-09 05:21:10 -0600 )edit
It turns out what looks like a more general method to include Eigen is described here http://www.ros.org/wiki/eigen I had put that original include line just before the 'rosbuild_genmsg()' line in the CMakeLists.txt in my test package directory.
TobyLightheart gravatar image TobyLightheart  ( 2012-01-09 14:34:16 -0600 )edit
Hey, Thank you very much. It solved one of my issues here. http://answers.ros.org/question/3539/installation-of-tabletop_object-detector-package
karthik gravatar image karthik  ( 2012-01-11 08:27:15 -0600 )edit
1

answered 2012-01-05 00:43:55 -0600

DimitriProsser gravatar image

updated 2012-01-05 01:39:41 -0600

The first major thing that I would check would be to ensure that you've included all of the necessary header files in your source file.

 #include <pcl/ModelCoefficients.h>
 #include <pcl/io/pcd_io.h>
 #include <pcl/point_types.h>
 #include <pcl/features/normal_3d.h>
 #include <pcl/filters/extract_indices.h>
 #include <pcl/filters/passthrough.h>
 #include <pcl/sample_consensus/method_types.h>
 #include <pcl/sample_consensus/model_types.h>
 #include <pcl/segmentation/sac_segmentation.h>

Next would be to check your manifest.xml for all necessary dependencies:

<depend package="pcl" />
<depend package="pcl_ros" />

EDIT: After reading some documentation and playing with Eclipse code-completion, it seems as though KdTree is not under the search namespace.

Thus, change:

pcl::search::KdTree<PointT>::Ptr tree (new pcl::search::KdTree<PointT> ());

To:

pcl::KdTree<PointT>::Ptr tree (new pcl::KdTree<PointT> ());

And then you're all set.

edit flag offensive delete link more

Comments

Thanks for the fast reply. Unfortunately the problem doesn't seem to a lack of those headers or dependencies. I had added the dependencies and all of those headers except 'pcd_io.h' to the .cpp source file, but that last header didn't remove the compile error.
TobyLightheart gravatar image TobyLightheart  ( 2012-01-05 01:14:25 -0600 )edit
I'm afraid the change you suggested in the edit gives me a 'cannot allocate abstract type' compile error. It turns out that the most current release of PCL (1.4), available in the 'perception_pcl_unstable' stack, does have kdtree in a 'search' namespace, so I've used that. Thanks anyway!
TobyLightheart gravatar image TobyLightheart  ( 2012-01-05 18:36:12 -0600 )edit
0

answered 2012-01-05 02:37:19 -0600

TobyLightheart gravatar image

I may have spotted an issue; my installation of ros-electric seems to only come with pcl-1.1, while the newer classes and the pcl::search namespace only exist in more recent releases of pcl. (Is it generally the case that ros-electric only has pcl-1.1?)

I've downloaded and installed pcl 1.4 and copy and pasting the usr/include directory 'pcl-1.4' into the includes directory of the 'pcl' package in the 'perception_pcl' stack to replace the 'pcl-1.1' directory. Then adding '#include < pcl/search/kdtree.h >' allows the file to compile successfully.

Pasting pcl-1.4 files into the pcl package is pretty crude, and I haven't been able to test the code yet so other problems might have been introduced. Does anyone have a suggestion of a better method?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-01-05 00:23:39 -0600

Seen: 2,796 times

Last updated: Jan 05 '12