ira_laser_tools icon indicating copy to clipboard operation
ira_laser_tools copied to clipboard

Lookup would require extrapolation into the past. Requested time 1569209705.859023507 but the earliest data is at time 1569209705.978461273, when looking up transform from frame [base_laser1] to frame [base_link]

Open ZhaoXiangBox opened this issue 5 years ago • 2 comments

i have already subscripted scan1 scan2;but occurs this error; relatived code belows:

void LaserscanMerger::scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan, std::string topic) { sensor_msgs::PointCloud tmpCloud1,tmpCloud2; sensor_msgs::PointCloud2 tmpCloud3;

// Verify that TF knows how to transform from the received scan to the destination scan frame
tfListener_.waitForTransform(scan->header.frame_id.c_str(), destination_frame.c_str(), scan->header.stamp, ros::Duration(1));

projector_.transformLaserScanToPointCloud(scan->header.frame_id, *scan, tmpCloud1, tfListener_);
try
{
/****/    tfListener_.transformPointCloud(destination_frame.c_str(), tmpCloud1, tmpCloud2);
    //tfListener_.transformPointCloud(destination_frame.c_str(), ros::Time(0),tmpCloud1,"/base_link", tmpCloud2);
}
catch (tf::TransformException ex)
{
    //ROS_INFO("error transform!");
    ROS_ERROR("%s",ex.what());
    return;
}

.......

ZhaoXiangBox avatar Sep 23 '19 03:09 ZhaoXiangBox

You have this problem when you are using bag file? if you are using the bags you have to set the parameter use_sim_time true and when you start the bag you put --clock

pietrocolombo avatar Feb 13 '20 13:02 pietrocolombo

does this issue appear only once right? this seems to be related to the initialization of the listener [1] and a workaround might be waiting for any transform (valid or not) directly before enabling the callback. However, the best solution would be creating an object outside the class or similar as I understand.

[1] https://answers.ros.org/question/156186/tf-listening-fails-when-called-from-a-specific-class/

trigal avatar Apr 01 '20 18:04 trigal