Another question about extrapolation in the past
Hello all,
That's a question that has been asked multiple times but none of the solution have worked so far. I'm playing data from a rosbag and when trying to query the tf I have this error:
[ERROR] [1519650555.804462800, 1504014242.149115352]: Lookup would require extrapolation into the past. Requested time 1504014237.046037623 but the earliest data is at time 1504014237.201914971, when looking up transform from frame [base_link] to frame [world]
Here is the code I'm using to query it :
ros::Time stamp = scan->header.stamp;
//Read transformation UGLY TRICK :P
tf::TransformListener listener(ros::Duration(50.0));
std::cout << listener.DEFAULT_CACHE_TIME << " " << listener.getCacheLength() << std::endl;
tf::StampedTransform transform;
try {
listener.waitForTransform(odom_frame_, "/base_link", stamp, ros::Duration(5.0));
listener.lookupTransform(odom_frame_, "/base_link", stamp, transform);
} catch (tf::TransformException ex) {
ROS_ERROR("%s",ex.what());
}
As visible in the code, I tried to change the buffer size to some higher number but it seems this is ignored :/ ?
Also this function is in the callback to a messageFilter in gmappings code:
scan_filter_ = new tf::MessageFilter<sensor_msgs::LaserScan>(*scan_filter_sub_, tf_, odom_frame_, 1);
scan_filter_->registerCallback(boost::bind(&SlamGMapping::laserCallback, this, _1));
I'm running the rosbag with clock
and I've set use_sim_time
to true. I've also tried slowing down the rosbag to try have my algorithm catch up but I still have the same problem. So I'm at a loss on what the actual problem is. Using `ros::Time(0) instead of the haeder time stamp works.
What is wrong in the approach I'm having ?
Do you get that error for every lookup or just the first few? Surely once the stamp gets past 1504014237.201914971 it starts working?
For all of them. That was the weird thing, it kept moving forward...