Skip to content

Special case for rgb field #135

Description

@peci1

I've used a driver that produces pointclouds with a Float32 RGB channel:

sensor_msgs::PointCloud2Modifier modifier(msg);
modifier.setPointCloud2Fields(
  4,
  "x", 1, sensor_msgs::PointField::FLOAT32,
  "y", 1, sensor_msgs::PointField::FLOAT32,
  "z", 1, sensor_msgs::PointField::FLOAT32,
  "rgb", 1, sensor_msgs::PointField::FLOAT32
);
modifier.resize(msg.width * msg.height);
sensor_msgs::PointCloud2Iterator<float> iter_rgb(msg, "rgb");
uint32_t packed_rgb = (static_cast<uint32_t>(r) << 16) | (static_cast<uint32_t>(g) << 8)  | static_cast<uint32_t>(b);
float rgb_float;
std::memcpy(&rgb_float, &packed_rgb, sizeof(float));
*iter_rgb = rgb_float; ++iter_rgb;

According to RViz, this is one of the supported ways of packing colors.

This "RGB" float channel gets compressed down to mostly zeros by cloudini (I guess I understand why). Would it be possible to make an exception for channels named "rgb", "rgba", "bgr" and similar and don't touch them? This would definitely help in this particular case and I think that in general this is what people expect. You even say in readme that RGBA channels are not touched.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions