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

broadcast single tf message

asked 2015-05-29 05:00:52 -0500

updated 2015-06-01 03:15:58 -0500

Hello! I am working on an extrenal camera tracking a robot.

To initialize the tf between the robot and a marker. I put the robot in a known place and with the position of where the mark is detected, I deduce the relation between the mark and the robot.

Fisrt,I create the frame of where I put my robot_foot in my map:

            (req.x, req.y, 0), quaternion,,
            "/mon_tf/" + ROBOT_FOOT, MAP)

Then I create the frame of where the head should be in my map :

            trans_foot_to_body, rot_foot_to_body,,
            "/my_tf/" + req.robotpart,
            "/my_tf/" + ROBOT_FOOT)

Now that the supposed position of the head is known, and in the same branch of our detected marker, we can deduce the relation between the head and the mark :

            rot_marker_to_body) = self.listener.lookupTransform(
            marker, "/my_tf/" + req.robotpart,

I got the error:

Lookup would require extrapolation at time 1432892532.412094116, but only time 1432892532.912867069 is in the buffer, when looking up transform from frame [mon_tf/HeadTouchFront_frame] to frame [ar_marker_2]

I have found some similar questions on ros.answers, so I tried to switch by rospy.Time(0) or to use waitForTransform rather than lookupTransform, and also to put some time.sleep(0.5) because it seems to solve the problem in another similar part of my code...

I would like to know if I am using the wrong tool for what I want to do ( because I am just broadcasting a single message) , or how to solve this tf buffer problem? What about tf2?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-06-01 03:47:11 -0500

tfoote gravatar image

To know what your problem is I'd need to see more of your system running. Overall it looks like you're on the right track, however your code is not robust to latencies in the system, with data and coordinate frames arriving in different orders than you are expecting.

I suggest you walk through the tf tutorials:

Also make sure that you're repeatedly publishing the positions of the frames so that tf can correctly interpolate. If you only publish single datapoints for each frame_id at different times a lookup will never succeed.

edit flag offensive delete link more


OK so the problem must be because my function is called by a service so the broadcaster.sendTransform are not in a loop but called a single time.., I will try to improve that !

scarlett gravatar image scarlett  ( 2015-06-02 02:52:13 -0500 )edit

I made those publish and listener tf in a function which is called in a while loop aaand it works ! Thanks, I missed the importance of the "repeatedly" part while doing the tutorials !

scarlett gravatar image scarlett  ( 2015-06-02 03:20:25 -0500 )edit

Question Tools

1 follower


Asked: 2015-05-29 05:00:52 -0500

Seen: 535 times

Last updated: Jun 01 '15