0
$\begingroup$

Rosanswers logo

I've seen a few posts on this but none have helped me solve the problem. I am trying to look up the TF between two links but keep getting the same extrapolation error.

ros::Duration cache_(10);
tf2_ros::Buffer buf_(cache_);
tf2_ros::TransformListener listener_(buf_);
/* other random stuff */
geometry_msgs::TransformStamped grasp;
try
{
  geometry_msgs::TransformStamped grasp = buf_.lookupTransform("base_footprint", "jaco_link_hand", ros::Time(0), ros::Duration(11));
} catch (tf2::TransformException &ex)
{
  cout << ex.what() << endl;
}

Running this code always results in:

Lookup would require extrapolation at time 1425582589.007301092, but only time 1425582589.107081890 is in the buffer, when looking up transform from frame [jaco_link_hand] to frame [base_footprint]

My understanding was that ros::Time(0) should just give me the latest TF however that does not seem to be the case. This is all running on the robot's onboard computer (my thought was network latency at first), and I have also tried allowing the program to run a while to fill the buffer.

Running tf_monitor results in:

Node: unknown_publisher 108.674 Hz, Average Delay: -0.109925 Max Delay: 0.163927

UPDATE 1

Removing the cache time (the ros::Duration) from the constructor fixes the problem. This seems odd since 10 is the default value so nothing should change.


Originally posted by rtoris288 on ROS Answers with karma: 1173 on 2015-03-05

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Time(0) will give you the latest common time. If this is during initialization(or a recently constructed buffer starting to listen) it's quite possible that there's not a complete set of transforms at any common time. This is a race condition on your query vs incoming data. If you get this error continuously there might be a different issue. Since it's a race condition your changing of the buffer size might be independent/from a side effect.


Originally posted by tfoote with karma: 58457 on 2015-03-05

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by lr101095 on 2018-05-30:
@tfoote I'm getting the same error and i've already tried your suggestion. Would you mind looking at my question and suggesting a fix to my issue? thanks

$\endgroup$

Your Answer

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