0
$\begingroup$

Rosanswers logo

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.


Originally posted by amerino on ROS Answers with karma: 13 on 2014-11-12

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by fergs with karma: 13902 on 2014-11-13

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.