Error in building point cloud
In the effort of building a point cloud, I encounter an error. The code snippet 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(qq);
tfb.sendTransform(tf::StampedTransform(xform, ros::Time(pose3D_LD2.header.stamp), "base_frame", "target_frame"));
projector_.transformLaserScanToPointCloud("base_link", previous_scan_, cloud, tfListener_);
The error I obtained is as follows:
terminate called after throwing an instance of 'tf::LookupException'
what(): Frame id / does not exist! Frames (6): Frame /laser exists with parent /base_link.
Frame /base_link exists with parent /world.
Frame /world exists with parent NO_PARENT.
Frame /target_frame exists with parent /base_frame.
Frame /base_frame exists with parent NO_PARENT.
[pointcloud_builder_node-4] process has died [pid 24672, exit code -6].
What could be the potential mistake that I've made looking at the code snippet and the corresponding error message?
EDIT:
Here is the latest version after rewriting the code:
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(qq);
tfb.sendTransform(tf::StampedTransform(xform, ros::Time(pose3D_LD2.header.stamp), "/base_link", "/laser"));
tfListener_.waitForTransform("/base_link", previous_scan_.header.frame_id.c_str(), ros::Time(0), ros::Duration(2.0));
projector_.transformLaserScanToPointCloud("/base_link", previous_scan_, cloud, tfListener_);
Corresponding error after updating the code snippet:
terminate called after throwing an instance of 'tf::LookupException'
what(): Frame id / does not exist! Frames (4): Frame /laser exists with parent /base_link.
Frame /base_link exists with parent /world.
Frame /world exists with parent NO_PARENT.
[pointcloud_builder_node-4] process has died [pid 27786, exit code -6].