broadcast single tf message
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:
self.broadcaster.sendTransform(
(req.x, req.y, 0), quaternion, rospy.Time.now(),
"/mon_tf/" + ROBOT_FOOT, MAP)
Then I create the frame of where the head should be in my map :
self.broadcaster.sendTransform(
trans_foot_to_body, rot_foot_to_body, rospy.Time.now(),
"/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 :
(trans_marker_to_body,
rot_marker_to_body) = self.listener.lookupTransform(
marker, "/my_tf/" + req.robotpart,
rospy.Time(0))
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 rospy.Time.now() 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?