Is there an efficient way to get static transforms from tf
We are using TF to manage coordinate frames on a mostly-rigid robot and are finding that a lot of processes need to subscribe to TF to get static transforms between instrument and body frames.
Most of these nodes don't need any of the dynamic transforms, and its seems wasteful to incur the overhead of setting a bunch of things to subscribe to high-rate dynamic transforms they don't need.
How are other folks solving this? Is there a static-only TransformSubscriber? Does everyone just grab the transform once and shutdown their connection to /tf?
Thanks in advance.
TF2 has a separate, latched topic for static transforms, but I'm not sure if there are convenience classes for using it by itself.
The default
tf2_ros::TransformListener
subscribers to both/tf
and/tf_static
by default (here). It would perhaps be nice to be able to tell it to not do that.But that is not supported right now. As these are just topics, perhaps remapping could be used to 'disconnect' the listening node(s) from
/tf
. You would need to make sure that/tf_static
provides enough transforms to create a proper 'view' on the TF tree though.Yeah, we noticed that. It seemed interesting that /tf_static is its own thing and but has no public API just static transforms-- although if TF was originally written to help with highly-articulated models like arms or PR2s or whatever that makes perfect sense.
/tf_static
was added in TF2 to reduce the resource usage of TF listeners and broadcasters in case of static frames (no need to blast 1000 msgs/sec across your network for static data). There's just no option right now (that I know of) that let's you just listen to just one of the two topics.Just did a quick test and remapping
/tf
works as expected. Provided the necessary transforms are available on/tf_static
disconnecting the listener from/tf
works fine. A bit of a work-around of course, but easily implementable and configurable.