Ask Your Question

Is there an easy way to publish a static transform between leaves of two tf2 trees?

asked 2018-06-01 16:29:17 -0500

Andy III gravatar image

This is similar to the question:

That was five years ago. Can we do better today?

Given a tree:




Can I do something as simple as static_transform_publisher to describe the link from r0/attach to r1/attach? What if base_link->attach changes over time? Do we need a dynamic_transform_publisher to accomplish this?

One approach is to walk up the tree to the first unparented link in each tree and join them there, but that must be recomputed each time any link is updated.

Another approach is to allow multiple parents (essentially arbitrary linked transforms) but then transforms become a search process instead of a simple lookup.

What is the solution for this (seemingly common) use case? There are transforms we can figure out more easily that others. Yes, they can be transformed, but does this tool exist as a library or node?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-01 18:34:40 -0500

tfoote gravatar image

From what you describe it's moderately easy to simply publish

I'd recommend that you publish r0 -> r1 as the product of (r0 -> a0) * (a0 -> a1) * (a1 -> r1)

Where (a0 -> a1) might be an identity and can be dropped depending on your system. You can query the other two fields trivially from the existing tf2 trees. And then you'll have both trees connected at the times you consider the leaves attached.

This is a relatively straightforward algorithm that could be implemented in a reusable way parameterized on what root links to join and what the detected bridging/attaching elements are expected to be.

edit flag offensive delete link more


Do you think this could be supported by static_transform_publisher in the future? It doesn't need any additional arguments, it would just need to interpret them more generally. And, from the user's perspective these _are_ static transforms. It is only the implementation making them not so static.

Andy III gravatar image Andy III  ( 2018-06-04 09:35:42 -0500 )edit

It doesn't make sense to integrate this with a static transform publisher due to significant semantic difference. It does share many of the same arguments, mostly the transform and two frames, it also needs extra params. It should be implemented as a module, and then wrapped into a separate cli tool

tfoote gravatar image tfoote  ( 2018-06-04 12:31:59 -0500 )edit

So the answer is "No, write your own". I was just checking. Also, I was thinking that you would only need the transform and two frames, but I see now that you'll also need to specify the top-level frames to use, because AFAIK tf2 doesn't have a (public) API to walk up the tree to the top level.

Andy III gravatar image Andy III  ( 2018-06-06 11:46:25 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2018-06-01 16:29:17 -0500

Seen: 378 times

Last updated: Jun 01 '18