Ask Your Question
0

RGB color data in ChannelFloat32 of Pointcloud message not working

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

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 = rospy.Time.now()
pcl_msg.header.frame_id = 'girona500'
pcl_msg.points.append(Point32(*mean_pnt))
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)
pub_pcl.publish(pcl_msg)*

Any ideas?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

bvibhav gravatar image

Found the solution. The issue is with conversion of unsigned integer being converted/packed into floating point. http://wiki.ros.org/rviz/DisplayTypes...

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

2 followers

Stats

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

Seen: 24 times

Last updated: Dec 20 '19