Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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] #18

Open
ZhaoXiangBox opened this issue Sep 23, 2019 · 2 comments

Comments

@ZhaoXiangBox
Copy link

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;
}

.......

@pietrocolombo
Copy link
Contributor

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

@trigal
Copy link
Member

trigal commented Apr 1, 2020

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/

pietrocolombo added a commit that referenced this issue Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants