# What is the correct way to connect two tf trees?

I have a setup in which two separate tf trees are published, and I'd like to define one with regard to the other, but not from the base link/root node.

For instance two trees one with a tf_prefix, one without such that you might see:

/baseLink


and

/ghost/baseLink


And I want to define /ghost/linkB0 as having an identity transformation from /linkB0. However, since tf is set up with child and parent relationships as a tree and not as a free network, the correct way to do this is unclear.

The only way I can think to do it would be to rebuild the KDL::Tree that the sub-ordinate tree's RobotStatePublisher uses to originate at the desired link, but this would be non-trivial, and not offer a way to easily select a different link at will without doing the same thing for each desired combination.

Is there a better way to do this? Is it even possible given the current architecture?

edit retag close merge delete

Sort by » oldest newest most voted

Your instincts are correct you can simply add a transform from "/baseLink" to "/ghost/baseLink". The graph structure is independent of the names of the frames.

more

6

Problem is that I want to go from /linkA0 to /ghost/linkA0 which cause /ghost/linkA0 to have two parents and fail. I'm working on a work-around where I publish the transfrom from /ghost/linkB0 to /ghost/baseLink as the transform from /linkB0 to /ghost/baseLink to get the same effect.

( 2013-03-19 16:01:06 -0500 )edit
1

Just publish the link the other direction so it's a child, not a parent. You cannot bridge in the middle of a tree.

( 2013-05-27 09:23:06 -0500 )edit

If I got what you want correctly: get the tf from the /base_link to /linkB0 and the tf from /ghost/base_link to /ghost/linkB0 and resolve to have the inbetween tf match an identity.

Either you make the nodes you want to manage the trees' roots or you resolve the inverse kinematics.

more

This is pretty much the work-around I cam up with as well, but it's still a bit off as if certain transforms are updated more frequently than others, there will be more error than if the chain flowed from /linkB0 to /ghost/linkB0

( 2013-03-20 04:57:42 -0500 )edit

What time difference are you seeing? At 50Hz on a wifi I sometimes see delays of half a second and tf view_frames requires multiple runs before drawing the correct trees. So it may well be normal that you have delays sometimes.

( 2013-03-20 06:47:00 -0500 )edit

It's not a measured one difference but inferred. If I publish the transform from /linkB0 to /ghost/baseLink and the joint between /ghost/linkB0 and /ghost/link0 changes before the next update to from /linkB0 to /ghost/baseLink, all transforms in the /ghost/ tree will be incorrect.

( 2013-03-20 09:45:04 -0500 )edit

You could add a transform /base_link -> /ghost/base_link or a common /world parent for both. The problem is that you'll need to compute that based on the trees.

It's the same way that SLAM algorithms provide /map -> /base_link by computing /map -> /odom.

more