ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

tf: Adding a frame to transforms from the past

asked 2018-04-20 06:52:14 -0500

XenoNaij gravatar image

updated 2018-04-20 09:58:24 -0500

jayess gravatar image

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.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2018-05-11 02:25:53 -0500

tfoote gravatar image

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

edit flag offensive delete link more
0

answered 2018-05-11 00:55:54 -0500

cgzb gravatar image

I have the exact problem. My solution will work but not very stable, still testing.

I used the lookuptransform function to save the transformation between "base_link" and "map" when pictures were taken, and publish it as "cam_old" frame. After doing that, set frame in marker message to this "cam_old". Then the marker data should come out from this frame. You can use rviz to display the tf of "cam_old" frame. You should see the "cam_old" frame at the previous position of the "cam" frame.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-04-20 06:52:14 -0500

Seen: 1,251 times

Last updated: May 11 '18