Ask Your Question

tf MUX (or multiple-parents)

asked 2011-03-14 02:01:05 -0500

I'm running up against a wall in the form of tf's tree restrictions. Namely, I'd like to have both gmapping and amcl running simultaneously (long story), but both publish XXX => odom_combined (naturally, the parent frame is param-configurable). The problem is, that tf (apparently) does not allow multiple parents (eg. it forces it to be a tree), and there doesn't seem to be a way to flip the directionality of the transform (odom_combined => XXX).

I thought perhaps tf_remap or tf_prefix would fit the bill... but after a few hours of experimentation, both approaches still end up in this same problem. I guess... what I'm really looking for is something akin to topic_tools/mux only for tf topics. Then I could just flip the mux when I want one transform or another.

Has anyone found a good solution to this sort of problem?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-03-14 11:38:17 -0500

tfoote gravatar image

Unfortunately keeping two copies of the sate is not something which the system was designed for.

I have two work arounds, a selective relay or inverting one of the transforms.

I'll start with inverting one of the transforms. To allow multiple odometry frames for a while we would publish the the odom frame as a child instead of a parent, such that it would not conflict with the "odom_combined" frame. To do this you could either modify gmapping or amcl to publish with a different frame_id as a child instead of as a parent. This will provide both frames in a running system but with different names.

If you want to be able to swap them while running I believe what you will need is a selective relay. It will need to listen to the caller_id and forward all messages from /tf to /other_tf except those originating from the localization node on /other_tf. And have a node which is passing back the localization information on /other_tf and pass it back on /tf. You can then turn on and off the pass back capability. To do this you will need a version of relay which relays all messages execept for ones with a specific caller id. And a 2nd one which only forwards a specific caller_id. If you end up doing this I'd suggest providing patches to topic_tools relay/mux which add these as parameters if possible. I'm sure others would find it useful too.

edit flag offensive delete link more



man, you are a genius. I mean, with such a limitation, TF is pretty bad, because a node should be allowed to have multiple parents, but this trick is a great workaround.

mark_vision gravatar image mark_vision  ( 2014-09-28 13:39:38 -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: 2011-03-14 02:01:05 -0500

Seen: 1,223 times

Last updated: Mar 14 '11