Robotics StackExchange | Archived questions

FLANN & PCL segmentation fault with KdTree in Euclidean Cluster Extraction

I am trying to perform euclidean cluster extraction under Ubuntu 12.04/11.10 (getting this error on both versions) and ROS Fuerte. The code for the clustering is below:

pcl::search::KdTree<pcl::PointXYZ>::Ptr tree ( new pcl::search::KdTree<pcl::PointXYZ>() );
tree->setInputCloud( input_point_cloud.makeShared() );
std::vector<pcl::PointIndices> *cluster_indices ( new std::vector<pcl::PointIndices>() );
std::vector<pcl::PointCloud<pcl::PointXYZ> > output_object_candidates; 

pcl::EuclideanClusterExtraction<pcl::PointXYZ> ec;
ec.setClusterTolerance( 0.01 ); // 2cm
ec.setMinClusterSize( 10 );
ec.setMaxClusterSize( 25000 );
ec.setSearchMethod( tree );
ec.setInputCloud( input_point_cloud.makeShared() );
ec.extract( *cluster_indices );

this leads to the following segmentation fault (with GDB 'bt' output):

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff36b11f4 in flann::KDTreeSingleIndex<flann::L2_Simple<float>   >::buildIndex() () from /opt/ros/fuerte/lib/libpcl_kdtree.so.1.5
(gdb) bt
#0  0x00007ffff36b11f4 in flann::KDTreeSingleIndex<flann::L2_Simple<float> >::buildIndex() () from /opt/ros/fuerte/lib/libpcl_kdtree.so.1.5
#1  0x00007ffff36a2938 in pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&,   boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&) () from  /opt/ros/fuerte/lib/libpcl_kdtree.so.1.5
#2  0x00007ffff70b718f in pcl::search::KdTree<pcl::PointXYZ>::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, boost::shared_ptr<std::vector<int, std::allocator<int> > const> const&) () from /opt/ros/fuerte/lib/libpcl_filters.so.1.5
#3  0x00007ffff63ee337 in object_candidate_extraction::extract_object_candidates (this=0x7fffffffdc10, input_point_cloud=..., object_candidates=...)
at /home/badrobit/ros_workspace/RoboCupAtWork/raw_object_perception/raw_safe_object_transportation/common/src/object_candidate_extraction.cpp:27
#4  0x0000000000450b9b in safe_object_transportation_node::get_point_cloud_data (this=0x7fffffffdb40, input_point_cloud=...)
at /home/badrobit/ros_workspace/RoboCupAtWork/raw_object_perception/raw_safe_object_transportation/ros/nodes/safe_object_transportation.cpp:54
#5  0x00000000004678d3 in boost::_mfi::mf1<void, safe_object_transportation_node, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>::operator() (
this=0x7fffe4000ca8, p=0x7fffffffdb40, a1=...) at /usr/include/boost/bind/mem_fn_template.hpp:165
#6  0x0000000000465665 in boost::_bi::list2<boost::_bi::value<safe_object_transportation_node*>, boost::arg<1> >::operator()<boost::_mfi::mf1<void, safe_object_transportation_node, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>, boost::_bi::list1<boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&> > (
this=0x7fffe4000cb8, f=..., a=...) at /usr/include/boost/bind/bind.hpp:313
#7  0x0000000000462d4e in boost::_bi::bind_t<void, boost::_mfi::mf1<void, safe_object_transportation_node, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<safe_object_transportation_node*>, boost::arg<1> > >::operator()<boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> > (
this=0x7fffe4000ca8, a1=...) at /usr/include/boost/bind/bind_template.hpp:47
#8  0x0000000000460797 in boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf1<void, safe_object_transportation_node, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>, boost::_bi::list2<boost::_bi::value<safe_object_transportation_node*>, boost::arg<1> > >, void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>::invoke (function_obj_ptr=..., a0=...) at /usr/include/boost/function/function_template.hpp:153
#9  0x00000000004659fb in boost::function1<void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&>::operator() (this=0x7fffe4000ca0, a0=...)
at /usr/include/boost/function/function_template.hpp:1013
#10 0x0000000000462efd in boost::detail::function::void_function_obj_invoker1<boost::function<void (boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&)>, void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> >::invoke(boost::detail::function::function_buffer&, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const>) (function_obj_ptr=..., a0=...) at /usr/include/boost/function/function_template.hpp:153
#11 0x000000000046cfd4 in boost::function1<void, boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> >::operator() (this=0x7fffe4000c58, a0=...)
at /usr/include/boost/function/function_template.hpp:1013
#12 0x000000000046ca5a in ros::SubscriptionCallbackHelperT<boost::shared_ptr<sensor_msgs::PointCloud2_<std::allocator<void> > const> const&, void>::call (this=0x7fffe4000c50, params=...)
at /opt/ros/fuerte/include/ros/subscription_callback_helper.h:180
#13 0x00007ffff7b880f7 in ros::SubscriptionQueue::call() () from /opt/ros/fuerte/lib/libroscpp.so
#14 0x00007ffff7b39f09 in ros::CallbackQueue::callOneCB(ros::CallbackQueue::TLS*) () from /opt/ros/fuerte/lib/libroscpp.so
#15 0x00007ffff7b3b9ab in ros::CallbackQueue::callAvailable(ros::WallDuration) () from /opt/ros/fuerte/lib/libroscpp.so
#16 0x00007ffff7b8b948 in ros::SingleThreadedSpinner::spin(ros::CallbackQueue*) () from /opt/ros/fuerte/lib/libroscpp.so
#17 0x00007ffff7b7063b in ros::spin() () from /opt/ros/fuerte/lib/libroscpp.so
#18 0x000000000044e359 in main (argc=1, argv=0x7fffffffdd28)
at /home/badrobit/ros_workspace/RoboCupAtWork/raw_object_perception/raw_safe_object_transportation/ros/nodes/safe_object_transportation.cpp:187

I have been trying to figure this error out for a while now to no avail. I am not sure if going to an experimental branch of PCL will solve this or not. I have followed the PCL tutorial as closely as possible as well as looking through their FAQ and wasn't really able to find any answers. Any help would be greatly appreciated.

Asked by BadRobot on 2013-01-21 07:29:05 UTC

Comments

have you figure out the error?

Asked by ZsurzsaLaszlo on 2013-05-27 03:16:12 UTC

I am sorry I have not.

Asked by BadRobot on 2013-06-21 21:43:05 UTC

Have you figured how to get Euclidean cluster extraction working in ros ecosystem?

Asked by pnambiar on 2014-08-18 09:12:39 UTC

I suggest asking on the pcl mailing list.

Asked by tfoote on 2014-09-09 00:32:20 UTC

Answers

Try adding the header files

#include < / ..../perception_pcl/pcl/build/pcl_trunk/kdtree/include/pcl/kdtree/kdtree_flann.h>

#include < /.../perception_pcl/pcl/build/pcl_trunk/kdtree/include/pcl/kdtree/impl/kdtree_flann.hpp>

Asked by sai on 2014-04-15 16:26:54 UTC

Comments