koide3 / fast_gicp

A collection of GICP-based fast point cloud registration algorithms
BSD 3-Clause "New" or "Revised" License
1.23k stars 316 forks source link

how to take fast_gicp in my own code? #129

Open Nothand0212 opened 1 year ago

Nothand0212 commented 1 year ago

the example can run perfectly, but when I take fast_gicp in my own code, I receive signal SIGSEGV, Segmentation fault.

0x00007ffff6f05a5a in pcl::search::KdTree<pcl::PointXYZI, pcl::KdTreeFLANN<pcl::PointXYZI, flann::L2_Simple<float> > >::setPointRepresentation(boost::shared_ptr<pcl::PointRepresentation<pcl::PointXYZI> const> const&) () from /lib/x86_64-linux-gnu/libpcl_search.so.1.10
(gdb) bt

  #0  0x00007ffff6f05a5a in pcl::search::KdTree<pcl::PointXYZI, pcl::KdTreeFLANN<pcl::PointXYZI, flann::L2_Simple<float> > >::setPointRepresentation(boost::shared_ptr<pcl::PointRepresentation<pcl::PointXYZI> const> const&) ()
   from /lib/x86_64-linux-gnu/libpcl_search.so.1.10
#1  0x00005555555b6360 in pcl::Registration<pcl::PointXYZI, pcl::PointXYZI, float>::align(pcl::PointCloud<pcl::PointXYZI>&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&) ()
#2  0x00005555555e3d47 in mapLocalization::initializeSystem() ()

this is my code, the pcl_icp can run.

    // pcl::IterativeClosestPoint<PointType, PointType> icp;
    // icp.setInputSource( sourceCloud );
    // icp.setInputTarget( targetCloud );
    // icp.setRANSACIterations( 0 );
    // icp.setMaxCorrespondenceDistance( 25 );
    // icp.setMaximumIterations( 100 );
    // icp.setTransformationEpsilon( 1e-6 );
    // icp.setEuclideanFitnessEpsilon( 1e-6 );
    // icp.align( *aligned_cloud_icp, initialGuess );
    // correctedLidarFrame = icp.getFinalTransformation();

    fast_gicp::FastVGICP<pcl::PointXYZI, pcl::PointXYZI> icp;
    icp.setResolution( 1.0 );
    icp.setNumThreads( 4 );
    icp.setInputSource( sourceCloud );
    icp.setInputTarget( targetCloud );
    icp.align( *aligned_cloud_icp, initialGuess );
    correctedLidarFrame = icp.getFinalTransformation();

hope some help,thanks!

ZepherusFF commented 1 year ago

Hi ! Did you manage to figure out the issue ?

Nothand0212 commented 1 year ago

Hi ! Did you manage to figure out the issue ?

Sorry, I cannot find out what cause this problem.

themightyoarfish commented 11 months ago

Try recent PCL if you can build from source and/or add add_definitions(${PCL_DEFINITIONS}) to both fast_gicp and your dependent project.