Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When you create the TransformListener as in your code snippet, it creates a buffer and starts to listen to tf messages on the /tf topic. If you query it immediately before any tf messages are received it will report that it cannot complete the transform since it only has data from since it started listening. You need to give the buffer time to fill.

There are two common solutions to this problem. One is to use the waitForTransform method, and wait for the buffer to fill. And the second is to create the TransformListener as a member of a persistent class such that it persists the buffer.

Any way you do it, your code should be ready to catch the exception which might be caused by any number of other nodes not doing what you expect.

I highly recommend you read through the tf Tutorials They explicitly cover this sort of problem.