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

Revision history [back]

There are a few things to fix here.

The points of the object are in the wrong place because you're copying the x, y and z in the wrong order. So your switching the x and z values. That's an easy one to fix.

The color values are also switched but there is another thing to fix here too. The color problem is caused because the point cloud and RVIZ marker describe color values in different ranges. The point cloud uses 0-255 while the RVIZ marker uses 0.0 - 1.0 for this reason you'll need to divide the color values by 255.0 . The '.0' at the end is very important it forces c++ to perform a floating point divide as opposed to an integer divide.

Hope this gets this working for you.