Understanding tf lookup extrapolation into the past error
Hi,
I have the quite common issue with tf lookup giving me a "would require extrapolation into the past" error. Since my research didn't yield any results and I the error itself is confusing me a bit, I figured I'd try my luck here. The full error message is:
[ERROR] [1551189860.994610842]: Lookup would require extrapolation into the past. Requested time 1548847264.576701633 but the earliest data is at time 1551189857.045573652, when looking up transform from frame [camera_rgb_optical_frame] to frame [gpuvoxels_origin]
What confuses me is that the timestamp of the earliest data seems to be beyond the requeste time i.e. in the future not in the past. However tf is telling me it would require a lookup into the past. Is it simply because it only does it's search backwards?
About the error itself: I struggle finding reasons for it since I publish the transform with a static transform publisher with a frequency of 10hz, i.e. I would very much expect for a transform to be available within a reasonable timeframe..
I start my static_transform_publisher like this:
rosrun tf static_transform_publisher 0 0 0 0 0 0 camera_rgb_optical_frame gpuvoxels_origin 100
but I have also tried higher frequencys. The back that publishes my pointcloud data is started WITH the --clock parameter to make use of sim_time.
The callback I am using to react on incoming data and to retrieve the transform is the following:
void callback_tf_transform(const sensor_msgs::PointCloud2::ConstPtr& msg)
{
std::size_t size = msg->width * msg->height;
new_points_data.resize(size);
if (m_tf_listener->waitForTransform(msg->header.frame_id, voxel_point_cloud_frame, ros::Time(0), ros::Duration(5.0), ros::Duration(0.05)))
{
// transform new pointcloud to world coordinates
sensor_msgs::PointCloud2 global_cloud;
pcl_ros::transformPointCloud(voxel_point_cloud_frame, *msg, global_cloud, *m_tf_listener);
new_points_data = extract_point_list(global_cloud);
new_data_received = true;
}
else
{
ROS_ERROR_STREAM("callback_tf_transform: could not find a transform from '" << msg->header.frame_id << "' to '" << voxel_point_cloud_frame << "' for 5 seconds!");
}
}
However I am fairly new to ROS and TF so the mistake is probably fairly obvious however I fail to figure it out at the moment and hope someone experience might just see it.
Thanks a lot!