0
$\begingroup$

Rosanswers logo

Hi everyone,

I have a question regarding the usage of tf and hope someone can help me answer it.

The problem setup is the following: Imaging I have a robot with defined base_frame and I send the robots pose transform (in world frame) to tf with a constant rate. Now the robot has a camera rigidly mounted on it. So I define a camera frame with the robots base frame as parent frame and I also send this frame to tf. This way, I can know the cameras pose in the world frame if the robot moves. Assume at time t_0, the robot is at location s_0 and I get an image from the camera, then I do some processing to calculate the pose of a marker in the camera frame. Assume I finish processing the image at time t_K, where the robot moved to s_k. And now I define a marker frame with its parent frame being the camera frame. For this, I first define for the marker its pose transform in the camera frame, and then I send the transform to tf using the API call:

tf::TransformBroadcaster br;
br.sentTransform(tf::StampedTransform(markerTransform, t_0, "camera_frame_tf",  "marker_frame_tf"));

I stamp this marker frame tranform with time t_0 instead of the current time t_k, because the image is taken at time t_0 and the calculated distance from marker to camera should be superposed with the robots/camera position at t_0. So using the above br.sendTransform callback, will the marker frame be superposed correctly to tf from time t_0?

Also at current time t_k, how do I get the markers pose w.r.t. the world frame back at time t_0?

Any clue will be appreciated!

Many thanks in advance.


Originally posted by XenoNaij on ROS Answers with karma: 1 on 2018-04-20

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Your basic operations of publishing the computed transform to the marker at the old timestamp seems to be the right approach.

For how to look it up you should use the advanced API and select the "fixed frame" where you expect the position to be constant. The tutorial on this is here: cpp or python

For a more complete understanding I'd recommend going through the full tutorials. http://wiki.ros.org/tf2/Tutorials


Originally posted by tfoote with karma: 58457 on 2018-05-11

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

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