tf2 cannot lookup transform (Lookup would require extrapolation)
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.