Ask Your Question

tf message_filters and child_frame_id

asked 2014-10-01 08:22:23 -0500

Tom Moore gravatar image

Message filters are handy when you want to only fire callbacks if a transform is available for the data contained therein. The user sets the target frame_id, and presumably the source frame_id is derived from the message's header.

However, nav_msgs/Odometry messages contain both pose and twist data, with the former being in the message header's frame_id, and the latter being in the message's child_frame_id. Even if no transform exists for the pose data, there may be a transform for the twist data. I can't just set up another filter with the target child_frame_id, as the message filter will then look for a transform from the odometry message's frame_id (i.e., pose data frame) to the target child_frame_id, which will probably not make any sense.

Do I have any recourse here? Clearly, I can just fire all the callbacks and check for the transform availability myself, but I'm guessing I'm going to lose some efficiency that way.

edit retag flag offensive close merge delete


I already break each odometry message into a pose message and a twist message and then manually call their callbacks; I suppose I can manually add those sub-messages to their respective message filters instead. Still, if there's a cleaner way, I'd like to hear it.

Tom Moore gravatar image Tom Moore  ( 2014-10-01 08:34:42 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-01 13:02:59 -0500

tfoote gravatar image

In this case I'd suggest that you create two tf::MessageFIlters, one for each datatype and callback. Then when you recieve the aggregate message, create the individual messages and add them to the respective MessageFilter.

edit flag offensive delete link more


Doing exactly that. Thanks!

Tom Moore gravatar image Tom Moore  ( 2014-10-01 14:03:08 -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: 2014-10-01 08:22:23 -0500

Seen: 1,147 times

Last updated: Oct 01 '14