Ask Your Question

RGB color data in ChannelFloat32 of Pointcloud message not working

asked 2019-12-17 06:48:32 -0500

bvibhav gravatar image

I have been trying to publish a point cloud message with RGB color data. The data is simple and I am just publishing a few points every frame. At the moment I am testing single point. There aren't many examples online and the documentation for this is not very useful either. From documentation I gather that following should work.

ch_rgb = ChannelFloat32("rgb", [0x00ffffff])

However it doesn't. I have tried this as well.

*pcl_msg = PointCloud()
pcl_msg.header.stamp =
pcl_msg.header.frame_id = 'girona500'
ch_int = ChannelFloat32("intensity", [0x00])
ch_rgb = ChannelFloat32("rgb", [0xff])
r_channel = ChannelFloat32(name="r", values=[0xff])
g_channel = ChannelFloat32(name="g", values=[0xff])
b_channel = ChannelFloat32(name="b", values=[0xff])
pcl_msg.channels = (ch_int, ch_rgb, r_channel, g_channel, b_channel)

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-20 10:23:00 -0500

bvibhav gravatar image

Found the solution. The issue is with conversion of unsigned integer being converted/packed into floating point.

In python, this could be done with struct.unpack('f', struct.pack('i', 0x00FF00))[0]

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-12-17 06:48:32 -0500

Seen: 251 times

Last updated: Dec 20 '19