[ros-users] Problems with normal estimation (segmentation fault)

Florian Seidel seidel.florian at googlemail.com
Wed Jun 8 11:37:32 UTC 2011


Hey there,

I have a problem with normal estimation and hope that someone can help
me figuring this out.
I have two installations of ros on two different Ubuntu machines. 
The code in question runs without problems on one installation.
On the other using the same pcd files the code quits with a segmentation
fault. 

This is the code:

        typename PointCloud<PT>::Ptr cloud(new PointCloud<PT> ());
        sensor_msgs::PointCloud2 cloud_blob;
        
        if (reader.read(p.string(), cloud_blob) != -1) {
        pcl::fromROSMsg(cloud_blob, *cloud);
        } else {
        throw PCDLoaderException(
        string("Can't load cloud from file: ") + p.filename());
        }
        
        typename KdTreeFLANN<PT>::Ptr kdTree =
        make_shared<KdTreeFLANN<PT> > ();
        
        kdTree->setInputCloud(cloud);
        
        pcl::IndicesConstPtr indices = createIndices(cloud->size());
        
        NormalEstimation<PT,pcl::Normal> normalEstimator;
        normalEstimator.setInputCloud(cloud);
        
        
        normalEstimator.setSearchMethod(kdTree);
        normalEstimator.setIndices(indices);
        normalEstimator.setKSearch(10);
        normalEstimator.compute(*normals);

I use the pcl version which ships with diamondback but also tried
pcl_unstable from the repo (cloned it 2 days ago). 

This is a stack trace of the segmentation fault. 

        pcl::KdTreeFLANN<pcl::PointXYZ>::nearestKSearch() at
        kdtree_flann.hpp:80 0x7ffff0cf7e10 
        pcl::KdTreeFLANN<pcl::PointXYZ>::nearestKSearch() at
        kdtree_flann.h:183 0x507753 
        boost::_mfi::mf4<int, pcl::KdTree<pcl::PointXYZ>, int, int,
        std::vector<int, std::allocator<int> >&, std::vector<float,
        std::allocator<float>
        >&>::call<boost::shared_ptr<pcl::KdTree<pcl::PointXYZ> >, int,
        int, std::vector<int, std::allocator<int> >, std::vector<float,
        std::allocator<float> > >() at mem_fn_template.hpp:485 0x505af5 
        boost::_mfi::mf4<int, pcl::KdTree<pcl::PointXYZ>, int, int,
        std::vector<int, std::allocator<int> >&, std::vector<float,
        std::allocator<float> >&>::operator() at mem_fn_template.hpp:499
        0x5050d2 
        boost::_bi::list5<boost::reference_wrapper<boost::shared_ptr<pcl::KdTree<pcl::PointXYZ> > >, boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> >::operator() at bind.hpp:508 0x503b79 
        boost::_bi::bind_t<int, boost::_mfi::mf4<int,
        pcl::KdTree<pcl::PointXYZ>, int, int, std::vector<int,
        std::allocator<int> >&, std::vector<float, std::allocator<float>
        >&>,
        boost::_bi::list5<boost::reference_wrapper<boost::shared_ptr<pcl::KdTree<pcl::PointXYZ> > >, boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >::operator() at bind_template.hpp:145 0x501a39 
        boost::detail::function::function_obj_invoker4<boost::_bi::bind_t<int, boost::_mfi::mf4<int, pcl::KdTree<pcl::PointXYZ>, int, int, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&>, boost::_bi::list5<boost::reference_wrapper<boost::shared_ptr<pcl::KdTree<pcl::PointXYZ> > >, boost::arg<1>, boost::arg<2>, boost::arg<3>, boost::arg<4> > >, int, int, double, std::vector<int, std::allocator<int> >&, std::vector<float, std::allocator<float> >&>::invoke() at function_template.hpp:132 0x4fefd7 
        boost::function4<int, int, double, std::vector<int,
        std::allocator<int> >&, std::vector<float, std::allocator<float>
        >&>::operator() at function_template.hpp:1.013 0x7ffff1eb6bb8 
        pcl::Feature<pcl::PointXYZ, pcl::Normal>::searchForNeighbors()
        at feature.h:355 0x7ffff1f0aca2 
        pcl::NormalEstimationOMP<pcl::PointXYZ,
        pcl::Normal>::computeFeature() at normal_3d_omp.hpp:58
        0x7ffff1f0aca2 

I wanted to run the unittest files which come with pcl_unstable but
couldn't find them. So maybe as a first step someone could tell me where
they are located. ( I executed "make test" in pcl_unstable/pcl/ )

Cheers,

Flo





More information about the ros-users mailing list