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

Rviz does not display Pointcloud2 if encoding not FLOAT32

asked 2014-11-12 14:32:06 -0500

updated 2014-11-12 15:45:51 -0500

HI all,

I have written driver for a ToF camera and I have found the following problem. I publish the 3D coordinates as they come from the device, INT16. I create it as follow:

sensor_msgs::PointCloud2Ptr xyz (new sensor_msgs::PointCloud2);
xyz->header.seq = frame->frameCounter;
xyz->header.stamp.sec = frame->timeStamp;
xyz->header.frame_id = nodeName_+"/tof_camera";
xyz->is_dense = true;
xyz->width = xRes;
xyz->height = yRes;
sensor_msgs::PointCloud2Modifier modifier(*xyz);
modifier.setPointCloud2Fields(3, "x", 1, sensor_msgs::PointField::INT16,
                                      "y", 1, sensor_msgs::PointField::INT16,
                                      "z", 1, sensor_msgs::PointField::INT16);
//fill data...

The data is been correctly published, I have checked it using rostopic echo:

  seq: 38446
    secs: 3167695196
    nsecs: 0
  frame_id: /bta_ros_1/tof_camera
height: 120
width: 160
    name: x
    offset: 0
    datatype: 3
    count: 1
    name: y
    offset: 2
    datatype: 3
    count: 1
    name: z
    offset: 4
    datatype: 3
    count: 1
is_bigendian: False
point_step: 6
row_step: 960
data: [11, 99, 112, 140, 160, 161, 64, 100, 244, 139, 142, 162, 138, 101, 123, 139,.......]
is_dense: True

When trying to display the cloud in rviz and after setting the fixed frame (/bta_ros_1/tof_camera), I can not display the cloud. I get the following message: No position transformer available for cloud.

Somehow rviz does not find the transform if data encoding is not FLOAT32. Rviz says "transform [sender=unknown_publisher]" in the transform field for the pointcloud2 when the data is being received. I have tried publishing the data as FLOAT32 (converting and not the data) and it get displayed.

Should the data be converted to FLOAT32 in any case? My assumption is that there is something wrong with rviz when dealing with not float 3d coordinates.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-11-13 03:31:38 -0500

fergs gravatar image

Looking at the plugin code, it definitely assumes Float32 in a number of spots. I would suggest opening a ticket against RVIZ to support other types, but as this is a non-typical use case, it might not get much attention without a Pull Request.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-11-12 14:32:06 -0500

Seen: 2,700 times

Last updated: Nov 13 '14