Rviz does not display Pointcloud2 if encoding not FLOAT32
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.