Ask Your Question
0

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...
pub_xyz_.publish(xyz);

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

header:
  seq: 38446
  stamp:
    secs: 3167695196
    nsecs: 0
  frame_id: /bta_ros_1/tof_camera
height: 120
width: 160
fields:
 -
    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
1

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 1,116 times

Last updated: Nov 13 '14