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

tf2 cannot lookup transform (Lookup would require extrapolation)

asked 2015-03-05 13:18:37 -0600

rtoris288 gravatar image

updated 2015-03-05 13:34:14 -0600

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2015-03-05 16:04:33 -0600

tfoote gravatar image

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.

edit flag offensive delete link more

Comments

@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

lr101095 gravatar image lr101095  ( 2018-05-30 00:44:59 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-03-05 13:18:37 -0600

Seen: 3,331 times

Last updated: Mar 05 '15