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

This is a classic instance of where the transforms are lagging just slightly behind the data arriving. If you ask for TIme(0) you will get the "latest" complete transform(it will be off by the 40th of a second you've identified), and not the transform at the time of the data. For low rate systems that can work but there are much better solutions.

The simplest is to wait for the transform using waitForTransform. This is ok when your writing a script or something else that's low bandwidth and doesn't care much about latency.

But the best solution is to use a MessageFilter which will hold the data until the transform is available and then give you the callback.

http://wiki.ros.org/tf2/Tutorials/Using%20stamped%20datatypes%20with%20tf2%3A%3AMessageFilter

There isn't one built into the python API but you can follow an example like this one: https://answers.ros.org/question/49069/is-there-a-tfmessagefilter-in-the-tf-python-api/