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

Revision history [back]

The rgb value is stored in just one single float. You can, for instance, use a function like this to decode it:

void getRGB(float rgb_encoded, unsigned char &r, unsigned char &g, unsigned char &b)
{
  const unsigned char *color = reinterpret_cast<const unsigned char *>(&rgb_encoded);
  r = color[2];
  g = color[1];
  b = color[0];
}

When passing *pstep2 of your example as first parameter, you should get correct rgb values.