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

Revision history [back]

This question comes up a lot. The problem comes from a misunderstanding of how the TransformListener object works, you cannot create it and then query it for transforms straight away.

The object works by listening to the TF topic, so after 100 milliseconds to a second or so it will have collected enough TF messages to be able to correctly respond to transform requests. However if you query it to early before it has had a change to receive many messages then it will not be able to find the transform you're requesting.

The correct way to use this object is to create a single TransformListener object when your node is started then use that object for the lifetime of your node. You can add a one second sleep after creating it to be on the safe side.

Hope this helps.