PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.68k stars 4.59k forks source link

[compile error] pcl-1.12.1 not well used in ROS melodic #6076

Open Aazwhy opened 1 week ago

Aazwhy commented 1 week ago

I used KDtree in my code ,and I defined the variable as : "pcl::KdTreeFLANN::Ptr kdtreeCornerLast(new pcl::KdTreeFLANN())" , later when I ran the code , it went wrong: process has died [pid 27205, exit code -11, cmd /home/l/AAlh/loamApply_ws/devel/lib/loam_apply/loam_apply_laserOdometry name:=loam_apply_laserOdometry log:=/home/l/.ros/log/a5bb3e24-38f9-11ef-9b72-7cb5665f0b77/loam_apply_laserOdometry-4.log]. log file: /home/l/.ros/log/a5bb3e24-38f9-11ef-9b72-7cb5665f0b77/loam_apply_laserOdometry-4*.log

then I defined the variable like:"pcl::KdTreeFLANN::Ptr kdtreeCornerLast(new pcl::KdTreeFLANN()); " ,but there was still something wrong,it noted me : libgomp: Out of memory allocating 750987056064 bytes [loam_apply_laserOdometry-4] process has died [pid 21998, exit code 1, cmd /home/l/AAlh/loamApply_ws/devel/lib/loam_apply/loam_apply_laserOdometry name:=loam_apply_laserOdometry log:=/home/l/.ros/log/eb56a94a-386e-11ef-9b72-7cb5665f0b77/loam_apply_laserOdometry-4.log]. log file: /home/l/.ros/log/eb56a94a-386e-11ef-9b72-7cb5665f0b77/loam_apply_laserOdometry-4*.log

this happened in the sentence "kdtreeCornerLast->nearestKSearch(pointSel, 1, pointSearchIndLast, pointSearchSqDisLast)",there's just a few point in the variable "pointSearchIndLast"。

then I tried to upgrade my pcl version to 1.12.1(the ROS version is melodic),but i cannot compile successfully,here's some of the problem: /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:438:73: error: macro "PCL_DEPRECATED" passed 3 arguments, but takes just 1 PCL_DEPRECATED(1, 16, "use bool getFilterLimitsNegative() instead") ^ /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:787:73: error: macro "PCL_DEPRECATED" passed 3 arguments, but takes just 1 PCL_DEPRECATED(1, 16, "use bool getFilterLimitsNegative() instead")

/usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:159:22: error: ‘Indices’ does not name a type; did you mean ‘IndicesPtr’? const Indices &indices, ^~~ IndicesPtr /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:190:19: error: ‘shared_ptr’ does not name a type; did you mean ‘char16_t’? using Ptr = shared_ptr<VoxelGrid >; ^~~~~~ char16_t /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:191:24: error: ‘shared_ptr’ does not name a type; did you mean ‘char16_t’? using ConstPtr = shared_ptr<const VoxelGrid >; ^~~~~~ char16_t /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:438:7: error: ‘PCL_DEPRECATED’ does not name a type PCL_DEPRECATED(1, 16, "use bool getFilterLimitsNegative() instead") ^~~~~~ /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/filters/voxel_grid.h:787:7: error: ‘PCL_DEPRECATED’ does not name a type PCL_DEPRECATED(1, 16, "use bool getFilterLimitsNegative() instead") ^~~~~~ In file included from /home/l/AAlh/loamApply_ws/src/loam_apply/src/laserOdometry.cpp:39:0: /usr/include/pcl-1.12.1/include/pcl-1.12/pcl/kdtree/kdtree_flann.h:145:22: error: ‘shared_ptr’ does not name a type; did you mean ‘char16_t’? using IndicesPtr = shared_ptr; ^~~~~~

mvieth commented 6 days ago

Regarding the program crash and the out-of-memory error: you would have to at least show some more of your code (from the point where you create the kdtree to where the error happens). Better yet, create a minimal reproducible example (a small, standalone program that I can use to reproduce the crash, including the data you use).

Regarding the compile errors: did you remove all other PCL versions installed on your system? You could try running sudo apt remove libpcl*. If you want to use a self-compiled PCL (not the one from apt), you will also have to compile pcl-ros and pcl-conversion (the ROS packages that depend on PCL) from source.

mvieth commented 1 hour ago

@Aazwhy If you don't reply soon to my last comment, I will assume that the problem is solved and close this issue