ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

The sample code on http://www.ros.org/wiki/rviz/DisplayTypes/PointCloud provides two ways to do the reverse. Shouldn't be too hard to flip it around.

In C++,

int rgb = 0xff0000; 
float float_rgb = *reinterpret_cast<float*>(&rgb);

In Python,

float_rgb = struct.unpack('f', struct.pack('i', 0xff0000))[0]