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

Error: Lookup would require extrapolation into the past.

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

RosFan19 gravatar image

Hi,

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);
    cameraTransform.setRotation(q);
    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
1

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

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
0

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

Jim Rothrock gravatar image

According to http://wiki.ros.org/tf/Tutorials/tf%2... :

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

Comments

1

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 image RosFan19  ( 2015-03-16 15:09:33 -0600 )edit

Question Tools

2 followers

Stats

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

Seen: 7,230 times

Last updated: Mar 17 '15