ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
It is safe and efficient to call any of the public API methods. This is how it was designed.
It is highly recommended to only have one TransformListener, with multiple threads querying it. On most systems the largest overhead of the tf system is subscribing to the transform data and storing the data.
There are a few mutexes around iterable data structures to protect them from being corrupted by simultaneous operations. Queries are quite fast and will not sit and wait unless you ask for a timeout. But when they're in the timeout period they will not block other threads to have access.
However, from your description it sounds like you should rethink your design and not use waitForTransform. If you're going to be waiting on lots of data you should use a tf2::MessageFilter Here's a tutorial
If you want more details on the design and efficiency see the tf paper
2 | No.2 Revision |
It is safe and efficient to call any of the public API methods. This is how it was designed.
It is highly recommended to only have one TransformListener, with multiple threads querying it. On most systems the largest overhead of the tf system is subscribing to the transform data and storing the data.
There are a few mutexes around iterable data structures to protect them from being corrupted by simultaneous operations. Queries are quite fast and will not sit and wait unless you ask for a timeout. But when they're in the timeout period they will not block other threads to have access.
However, from your description it sounds like you should rethink your design and not use waitForTransform. If you're going to be waiting on lots of data you should use a tf2::MessageFilter tf2::MessageFilter
Here's a tutorial
If you want more details on the design and efficiency see the tf paper