Ask Your Question
0

Frame with two parents in tf2

asked 2015-03-26 09:54:44 -0500

Alexandr Buyval gravatar image

I have the following task. 'ar_track_alvar' node publishes transformation from a camera to a marker. My own node publishes transformation from a world frame to the marker. My aim is to find coordinates of camera relative the world frame. I was trying to lookup a transformation from the world frame to the camera.

transformStamped = node->tfBuffer.lookupTransform("world", markerFrame, ros::Time(0));

However, I faced out that a frame can have only one parent in tf2. Is there approach to solve my issue by tf2?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-03-26 11:21:07 -0500

updated 2015-03-26 11:21:27 -0500

You could invert the world->marker transform. In other words, your node could instead publish the inverse of your current transform i.e. marker->world. Then world would be a child of marker, and you wouldn't have a two-parent problem in your tree.

edit flag offensive delete link more

Comments

1

Be careful about creating loops too, but inverting a frame is standard practice.

tfoote gravatar imagetfoote ( 2015-03-26 12:49:19 -0500 )edit

Thank you! I will try. However if there are several markers, as I understood, this approach does not work.

Alexandr Buyval gravatar imageAlexandr Buyval ( 2015-03-26 14:08:22 -0500 )edit
2

If there are several markers, you'll probably want to use either several different named world frame_ids or publish two frame_id per marker, one connected to the camear and one connected to the world with similar but different frame ids.

tfoote gravatar imagetfoote ( 2015-03-26 15:44:04 -0500 )edit

Thank you! I think it is that I need.

Alexandr Buyval gravatar imageAlexandr Buyval ( 2015-03-27 03:20:33 -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

Stats

Asked: 2015-03-26 09:54:44 -0500

Seen: 314 times

Last updated: Mar 26 '15