-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[common] Warning messages when converting empty PCLPointCloud2 #6092
Description
Describe the bug
Since pcl-1.14.0, pcl::fromPCLPointCloud2() outputs [pcl::fromPCLPointCloud2] No data to copy. as warning when handling empty (but having headers) PCLPointCloud2, and it floods log output.
Context
Especially on robotics applications, empty PointCloud2 message is often used to indicate there are no points.
Expected behavior
No log or lower verbosity level log when converting empty PCLPointCloud2.
Current Behavior
[pcl::fromPCLPointCloud2] No data to copy. is shown as warning.
To Reproduce
// g++ -I/usr/include/pcl-1.14 -I/usr/include/eigen3 test.cpp -lpcl_common
#include <pcl/conversions.h>
#include <pcl/point_types.h>
int main() {
// Create zero points XYZ PointCloud2
pcl::PointCloud<pcl::PointXYZ> pc;
pcl::PCLPointCloud2 pc2;
pcl::toPCLPointCloud2(pc, pc2);
// Convert zero points XYZ PointCloud2
pcl::PointCloud<pcl::PointXYZ> out;
pcl::fromPCLPointCloud2(pc2, out);
}Running this outputs
[pcl::fromPCLPointCloud2] No data to copy.
Screenshots/Code snippets
This problem is introduced by this commit: 788c53e
pcl/common/include/pcl/conversions.h
Lines 241 to 246 in 2661588
| // check if there is data to copy | |
| if (msg.width * msg.height == 0) | |
| { | |
| PCL_WARN("[pcl::fromPCLPointCloud2] No data to copy.\n"); | |
| return; | |
| } |
Your Environment (please complete the following information):
- OS: [Alpine 3.20] (not related to the issue)
- Compiler: [GCC 13.2.1] (not related to the issue)
- PCL Version [1.14.1]
Possible Solution
Remove
pcl/common/include/pcl/conversions.h
Line 244 in 2661588
| PCL_WARN("[pcl::fromPCLPointCloud2] No data to copy.\n"); |
or change it to
PCL_DEBUG
Additional context