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

PointCloud2Modifier::setPointCloud2FieldsByString does not support intensity #263

Open
john-maidbot opened this issue Dec 23, 2024 · 0 comments

Comments

@john-maidbot
Copy link

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • apt
  • Version or commit hash:
  • DDS implementation:
    • CycloneDDS
  • Client library (if applicable):
    • rclcpp

Steps to reproduce issue

    sensor_msgs::msg::PointCloud2::SharedPtr pcl(new sensor_msgs::msg::PointCloud2);
    sensor_msgs::PointCloud2Modifier modifier(*pcl);
    modifier.setPointCloud2FieldsByString(2, "xyz", "intensity");

Expected behavior

Intensity field is created with correct datatype as expected.

Actual behavior

The code crashes with a runtime error.

[deskew_node-1] terminate called after throwing an instance of 'std::runtime_error'
[deskew_node-1]   what():  Field intensity does not exist

Additional information

The intensity field is claimed to be supported here:

# Common PointField names are x, y, z, intensity, rgb, rgba

Yet it is not implemented here:

inline void PointCloud2Modifier::setPointCloud2FieldsByString(int n_fields, ...)

Was there a reason for not including the intensity field?

In the meantime, I think I can work around this as follows:

modifier.setPointCloud2Fields(
    4,  // Number of fields
    "x", 1, sensor_msgs::msg::PointField::FLOAT32,  // x field
    "y", 1, sensor_msgs::msg::PointField::FLOAT32,  // y field
    "z", 1, sensor_msgs::msg::PointField::FLOAT32,  // z field
    "intensity", 1, sensor_msgs::msg::PointField::FLOAT32 // intensity field
);

Thank you for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant