ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Is there an efficient way to get static transforms from tf

asked 2018-02-14 13:39:30 -0600

ivaughn gravatar image

updated 2022-05-28 17:11:38 -0600

lucasw gravatar image

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.

edit retag flag offensive close merge delete



TF2 has a separate, latched topic for static transforms, but I'm not sure if there are convenience classes for using it by itself.

ahendrix gravatar image ahendrix  ( 2018-02-14 21:57:06 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-02-15 01:28:46 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-02-15 01:32:11 -0600 )edit

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.

ivaughn gravatar image ivaughn  ( 2018-02-15 08:32:46 -0600 )edit

/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.

gvdhoorn gravatar image gvdhoorn  ( 2018-02-15 09:44:18 -0600 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2018-02-15 15:08:03 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-12-05 15:32:46 -0600

tfoote gravatar image

It's rare that an entire tree is static, often static frames are interspursed with dynamic frames so maintaining a separate API. If you know what you're looking for is entirely static you can always do things like setup the listener, query for the value and then shut it down, saving the resultant transform.

Another approach that is a little bit more dynamic would be to take advantage of the Transform server capability to remote query another node that's running a TransformListener already.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-02-14 13:39:30 -0600

Seen: 1,604 times

Last updated: Dec 05 '18