Ask Your Question

Lookup would require extrapolation into the past

asked 2016-07-11 07:20:41 -0600

viki_rover gravatar image

updated 2016-07-11 08:38:44 -0600

Good afternoon,

I have a problem when converting a laser scan into a point cloud map using ros indigo virtual machine. I get the following error :

terminate called after throwing an instance of 'tf2::ExtrapolationException' what(): Lookup would require extrapolation into the past. Requested time 1467669390.062319560 but the earliest data is at time 1467669390.111446506, when looking up transform from frame [LIDAR] to frame [base_link] Aborted (core dumped)

After running this code:

#include <tf/transform_listener.h>
#include <laser_geometry/laser_geometry.h>
#include <ros/ros.h>

class My_Filter {
        void scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan);
        ros::NodeHandle node_;
        laser_geometry::LaserProjection projector_;
        tf::TransformListener tfListener_;

        ros::Publisher point_cloud_publisher_;
        ros::Subscriber scan_sub_;

        scan_sub_ = node_.subscribe<sensor_msgs::LaserScan> ("/scan", 100, &My_Filter::scanCallback, this);
        point_cloud_publisher_ = node_.advertise<sensor_msgs::PointCloud2> ("/cloud", 100, false);

void My_Filter::scanCallback(const sensor_msgs::LaserScan::ConstPtr& scan){
    sensor_msgs::PointCloud2 cloud;
    projector_.transformLaserScanToPointCloud("base_link", *scan, cloud, tfListener_);

int main(int argc, char** argv)
    ros::init(argc, argv, "my_filter");

    My_Filter filter;


    return 0;

Thank you for your help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-11 08:45:22 -0600

updated 2016-07-11 08:49:12 -0600

You are trying to transform the laser scan to base_link before you have the required tf information. You can solve this by either

The message filter is the most idiomatic. Otherwise I'd recommend waitForTransform with a timeout.

edit flag offensive delete link more


Thank you for your answer it worked !

viki_rover gravatar image viki_rover  ( 2016-07-14 05:48:39 -0600 )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

1 follower


Asked: 2016-07-11 07:20:41 -0600

Seen: 3,623 times

Last updated: Jul 11 '16