ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A
Ask Your Question

Error: Lookup would require extrapolation into the past.

asked 2015-03-16 11:41:17 -0500

RosFan19 gravatar image


I seem to be getting the error:

Lookup would require extrapolation into the past. Requested time 1424871421.389785282 but the earliest data is at time 1424871421.599770804, when looking up transform from frame [base_link] to frame [camera_depth_optical_frame] Aborted (core dumped)

Here is my code:

  void callback(const sensor_msgs::PointCloud2::ConstPtr& msg)

    tf::Transform cameraTransform;
    cameraTransform.setOrigin( tf::Vector3(0.0, 0.0, 0.0) );
    tf::Quaternion q;
    q.setRPY(0, 0, 0);
    br.sendTransform(tf::StampedTransform(cameraTransform, msg->header.stamp, "xtion_link", "camera_link"));

    tf::StampedTransform transform;
    if (waitOnTransform == false) {
      listener.waitForTransform("camera_depth_optical_frame", "base_link", ros::Time(0), ros::Duration(10.0) );
      waitOnTransform = true;
    listener.lookupTransform("camera_depth_optical_frame", "base_link", ros::Time(0), transform);

    pcl_ros::transformPointCloud(*base_link, transform, *msg, *msgOut);

Where camera_depth is the subframe of camera_link and xtion_link the subframe of base_link. So I'm creating the link first between camera_link and xtion_link and then try to get the transform. The problem should be solved by lookUpTransform, but it seems that waitForTransform is not working for some reason.

And when I remove the waitForTransform, I still get the error that Requested time 1424871421.389785282, while it should be 10 seconds later.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-03-17 09:45:11 -0500

RosFan19 gravatar image

The problem seemed to be that since the broadcast was in the callback method and a sleep for 10 seconds was called, during that time the broadcasting was not happening.

I created a new node for broadcasting and running that before this node fixed the problem.

edit flag offensive delete link more

answered 2015-03-16 14:19:10 -0500

According to :

The use of ros::Time::now() is for this example. Usually this would be the timestamp of the data wishing to be transformed.

Try replacing ros::Time(0) in your calls to waitForTransform() and lookupTransform() with msg->header.stamp.

edit flag offensive delete link more



At the tutorial it is also said that You can also see we specified a time equal to 0. For tf, time 0 means "the latest available" transform in the buffer. So it is not time now, but the next one in the buffer and that should be the right one for this case.

I tried it anyway, but it didnt work.

RosFan19 gravatar imageRosFan19 ( 2015-03-16 15:09:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-03-16 11:41:17 -0500

Seen: 2,763 times

Last updated: Mar 17 '15