koide3 / ndt_omp

Multi-threaded and SSE friendly NDT algorithm
BSD 2-Clause "Simplified" License
731 stars 321 forks source link

How use ndt_omp on my code? #64

Open Nothand0212 opened 1 year ago

Nothand0212 commented 1 year ago

After catkin_make, it can run the example.

rosrun ndt_omp align 251370668.pcd 251371071.pcd

But how to use ndt_omp on my code?

I add ndt_omp on my CMaktLists.txt

find_package(catkin REQUIRED COMPONENTS
  tf
  tf2
  tf2_ros
  roscpp
  rospy
  cv_bridge
  # pcl library
  pcl_conversions
  # msgs
  std_msgs
  sensor_msgs
  geometry_msgs
  nav_msgs
  message_generation
  visualization_msgs
  std_srvs
  ndt_omp
)

catkin_package(
  INCLUDE_DIRS include
  DEPENDS PCL GTSAM

  CATKIN_DEPENDS
  tf2
  tf2_ros
  roscpp
  std_msgs
  nav_msgs
  geometry_msgs
  sensor_msgs
  message_runtime
  message_generation
  visualization_msgs
  ndt_omp
)

and link to executable by

target_link_libraries(${PROJECT_NAME}_mapLocalization Boost::timer ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${OpenCV_LIBRARIES} ${OpenMP_CXX_FLAGS} gtsam yaml-cpp ${ROS_LIB})

It can catkin_make, But when I run my node, it received signal SIGSEGV, Segmentation fault. The GDB Info is below:

#0  __memcmp_avx2_movbe ()
    at ../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S:218
#1  0x00007ffff5dfd333 in __gnu_cxx::__normal_iterator<pcl::PCLPointField const*, std::vector<pcl::PCLPointField, std::allocator<pcl::PCLPointField> > > std::__find_if<__gnu_cxx::__normal_iterator<pcl::PCLPointField const*, std::vector<pcl::PCLPointField, std::allocator<pcl::PCLPointField> > >, __gnu_cxx::__ops::_Iter_pred<pcl::getFieldIndex<pcl::PointXYZI>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<pcl::PCLPointField, std::allocator<pcl::PCLPointField> > const&)::{lambda(auto:1 const&)#1}> >(__gnu_cxx::__normal_iterator<pcl::PCLPointField const*, std::vector<pcl::PCLPointField, std::allocator<pcl::PCLPointField> > >, __gnu_cxx::__normal_iterator<pcl::PCLPointField const*, std::vector<pcl::PCLPointField, std::allocator<pcl::PCLPointField> > >, __gnu_cxx::__ops::_Iter_pred<pcl::getFieldIndex<pcl::PointXYZI>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<pcl::PCLPointField, std::allocator<pcl::PCLPointField> > const&)::{lambda(auto:1 const&)#1}>, std::random_access_iterator_tag) ()
   from /lib/x86_64-linux-gnu/libpcl_filters.so.1.10
#2  0x00007ffff5f7a522 in void pcl::getMinMax3D<pcl::PointXYZI>(pcl::PointCloud<pcl::PointXYZI>::ConstPtr const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float, float, Eigen::Matrix<float, 4, 1, 0, 4, 1>&, Eigen::Matrix<float, 4, 1, 0, 4, 1>&, bool) ()
   from /lib/x86_64-linux-gnu/libpcl_filters.so.1.10
#3  0x00007ffff7522b70 in pclomp::VoxelGridCovariance<pcl::PointXYZI>::applyFilt--Type <RET> for more, q to quit, c to continue without paging--c
er(pcl::PointCloud<pcl::PointXYZI>&) () from /home/oem/Projects/lio_ws/devel/lib/libndt_omp.so
#4  0x00005555555c0f71 in pclomp::NormalDistributionsTransform<pcl::PointXYZI, pcl::PointXYZI>::init() ()
#5  0x00005555555c9a47 in mapLocalization::initializeSystem() ()

How can I fix this problem? Thanks!

shamengjun commented 11 months ago

the same as me!