Skip to content

[common] Warning messages when converting empty PCLPointCloud2 #6092

@at-wat

Description

@at-wat

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

// 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_WARN("[pcl::fromPCLPointCloud2] No data to copy.\n");

or change it to PCL_DEBUG

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions