Not being able to lookup transform leading to node's death in building point cloud
I've been trying to build a point cloud using pose information. The code snippet for that is as below:
static tf::TransformBroadcaster tfb;
tf::Transform xform;
xform.setOrigin(tf::Vector3(pose3D_LD2.pose.position.x, pose3D_LD2.pose.position.y, pose3D_LD2.pose.position.z));
xform.setRotation(tf::Quaternion(previous_poseLD_.pose.orientation.x, previous_poseLD_.pose.orientation.y, previous_poseLD_.pose.orientation.z, previous_poseLD_.pose.orientation.w));
tfb.sendTransform(tf::StampedTransform(xform, ros::Time(pose3D_LD2.header.stamp), "/base_link", "/laser"));
tfListener_.waitForTransform("/base_link", "/laser", ros::Time(0), ros::Duration(2.0));
projector_.transformLaserScanToPointCloud("/base_link", previous_scan_, cloud, tfListener_);
However, I receive this error message:
terminate called after throwing an instance of 'tf::ExtrapolationException'
what(): Unable to lookup transform, cache is empty, when looking up transform from frame [/laser] to frame [/base_link]
[pointcloud_builder_node-5] process has died [pid 13012, exit code -6].
what could be the error that leads to the death of the node as stated in the error message? Or am I missing something?
Thanks in advance.
EDIT: I've also tried to comment last 2 lines of the above code snippet which are disabling waitForTransform and transformLaserScanToPointCloud calls, and watching the output up to calling sendTransform. It gives a warning like below:
[ WARN] [1327489676.295791909]: TF_OLD_DATA ignoring data from the past for frame /laser at time 24.279 according to authority /pointcloud_builder_node
Possible reasons are listed at
[ WARN] [1327489676.628911299]: TF_OLD_DATA ignoring data from the past for frame /laser at time 24.328 according to authority /pointcloud_builder_node
Possible reasons are listed at
[ WARN] [1327489676.962231439]: TF_OLD_DATA ignoring data from the past for frame /laser at time 24.348 according to authority /pointcloud_builder_node
Possible reasons are listed at
Any remedy for this kind of error?
UPDATE:
static tf::TransformBroadcaster tfb;
tf::Transform xform;
xform.setOrigin(tf::Vector3(pose3D_LD2.pose.position.x, pose3D_LD2.pose.position.y, pose3D_LD2.pose.position.z));
xform.setRotation(tf::Quaternion(previous_poseLD_.pose.orientation.x, previous_poseLD_.pose.orientation.y, previous_poseLD_.pose.orientation.z, previous_poseLD_.pose.orientation.w));
tfb.sendTransform(tf::StampedTransform(xform, ros::Time(pose3D_LD2.header.stamp), "base_link", "laser"));
tfListener_.waitForTransform("base_link", "laser", previous_scan_.header.stamp, ros::Duration(2.0));
projector_.transformLaserScanToPointCloud("base_link", previous_scan_, cloud, tfListener_);