Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[common] Warning messages when converting empty PCLPointCloud2 #6092

Closed
at-wat opened this issue Jul 24, 2024 · 5 comments · Fixed by #6108
Closed

[common] Warning messages when converting empty PCLPointCloud2 #6092

at-wat opened this issue Jul 24, 2024 · 5 comments · Fixed by #6108
Labels
kind: bug Type of issue status: triage Labels incomplete

Comments

@at-wat
Copy link

at-wat commented Jul 24, 2024

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

@at-wat at-wat added kind: bug Type of issue status: triage Labels incomplete labels Jul 24, 2024
@mvieth
Copy link
Member

mvieth commented Jul 25, 2024

Especially on robotics applications, empty PointCloud2 message is often used to indicate there are no points.

Hi, I do not really understand: why, or for what purpose, is it necessary to explicitly indicate no points? Why should the sender not simply omit the message?

I think the warning could be helpful for users who made a mistake and forgot to fill in the PCLPointCloud2. While an empty PCLPointCloud2 is not an error, I would consider it to be unusual.

@larshg What is your opinion on removing the warning? (since it was your commit that added it)

@at-wat
Copy link
Author

at-wat commented Jul 25, 2024

Hi, I do not really understand: why, or for what purpose, is it necessary to explicitly indicate no points? Why should the sender not simply omit the message?

Hi, thank you for the response.

In our case, PointCloud2 data is transferred as ROS message.

For example, a obstacle detection ROS node (process) detects points which may collide with the robot, and publish detected points as PointCloud2 ROS message
(PointCloud2 ROS message's payload is same as PCL PointCloud2 and usually converted by pcl_conversion package which internally use pcl::fromPCLPointCloud2())
If there are no obstacle points, an empty PointCloud2 message is published.

A motion planner ROS node subscribes the detected obstacle points as PointCloud2 ROS message and plan the robot motion.
If the motion planner ROS node receives empty PointCloud2 message, it means there are no obstacles and the robot can move freely, but if the node doesn't receive any PointCloud2 messages, it may mean the sensor device or the obstacle detection node is dead, so the robot must be stopped.

In such robotics case, empty PointCloud2 has proper meaning which is different from no-data.

@mvieth
Copy link
Member

mvieth commented Aug 1, 2024

Thanks for the explanation, that sounds reasonable. If @larshg is fine with removing the warning then I am as well.

@larshg
Copy link
Contributor

larshg commented Aug 1, 2024

Sure go ahead.

@at-wat
Copy link
Author

at-wat commented Aug 19, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Type of issue status: triage Labels incomplete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants