0
$\begingroup$

Rosanswers logo

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?


Originally posted by Alexandr Buyval on ROS Answers with karma: 641 on 2015-03-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by jarvisschultz with karma: 9031 on 2015-03-26

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by tfoote on 2015-03-26:
Be careful about creating loops too, but inverting a frame is standard practice.

Comment by Alexandr Buyval on 2015-03-26:
Thank you! I will try. However if there are several markers, as I understood, this approach does not work.

Comment by tfoote on 2015-03-26:
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.

Comment by Alexandr Buyval on 2015-03-27:
Thank you! I think it is that I need.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.