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

canTransform(..) is used primarily as a check (an extensive one, as it checks 4 predicates).

If it returns before the timeout expires, this means the requested transform is present in the underlying buffer. It it returns after the timeout expires, the transform is not available.

But BufferCore::lookupTransform(..) which is eventually called (so not Buffer::lookupTransform(..)) will check again whether the buffer contains the transform, regardless of why canTransform(..) returned.

So either the timeout expires, and the frame is not present (BufferCore::lookupTransform(..) will throw a LookupException), or the timeout is not hit and the frame is present (no exception).

For this to work the result of canTransform(..) itself does not need to be passed to the caller.

It does mean there is a chance of a race-condition, where after the timeout expires, the frame becomes available, or, between canTransform(..) returning before timeout expiry, the frame is pruned from the buffer.