0
$\begingroup$

Rosanswers logo

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.


Originally posted by RosFan19 on ROS Answers with karma: 107 on 2015-03-16

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by RosFan19 with karma: 107 on 2015-03-17

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.