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

Understanding tf lookup extrapolation into the past error

asked 2019-02-26 08:21:22 -0500

ftbmynameis gravatar image

updated 2019-02-28 04:38:30 -0500

gvdhoorn gravatar image

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-02-27 13:28:30 -0500

ftbmynameis gravatar image

I have figured out the anwser myself so I hope it may help others in the future.

The issue was mainly that I was not using a launch file and didn't set the "use_sim_time" parameter using rosparam set manually before launching my nodes. Doing so can solve the issue or should at least make the timestmaps be much closer to each other (i.e. the seconds should be the same).

Another thing is making sure the listener has enough time before a transform is requested. In my case I simply put a 1 second sleep before the start of my loop. Publishing a transform every 100ms may also be not sufficient depending on your parameters that may be a problem. However if the sim time is set properly and the listener had some time to fill up with transforms there should be only a couple of error messages if the frequency is not high enough so it is fairly easy to see.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-02-26 08:21:22 -0500

Seen: 1,064 times

Last updated: Feb 28 '19