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

Revision history [back]

click to hide/show revision 1
initial version

I think the problem is your assumption that because listener is in the main, the buffer should have time to fill (assumptions are always a bit risky ;-). Another issue is that waitForTransform() will timeout upon failure and you are not checking whether it returned true or false.

Thus, I think you can solve your problem by replacing the waitForTransform() with:

if listener->canTransform(...) {
    pcl::transformPointCloud(...);
    pub.publish(output);
}
else {
    ROS_WARN("cannot transform from ... to ...");
}

If you really want to use the waitForTransform() and can afford to wait, do not pass a time as timeout.

If you want to use waitForTransform() with the timeout, make sure you check whether the timeout occurred and do not try to transform the point cloud and publish if it did timeout.

Regarding the way tf_monitor shows the chain, I have yet to understand that too. It appears it goes all the way up to the root, then traverses down to the desired frame, ignoring shorter paths.