ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Error in building point cloud

asked 2012-01-10 03:04:35 -0500

alfa_80 gravatar image

updated 2012-01-10 05:50:17 -0500

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].
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2012-01-10 03:20:07 -0500

DimitriProsser gravatar image

The first major problem that I see is that your tfb.sendTransform() method publishes a transform between "base_link" and "target_frame". This might not be a mistake if you actually have a frame named "target_frame".

Secondly, the function transformLaserScanToPointCloud() transforms the points in the scan from the scan's frame_id to the target frame_id. As such, if your scan is coming in with a frame_id of "/" (which I think it is), this function will not work.

Also, you have to make sure that your tf exists before trying to use it. Before your call to transformLaserScanToPointCloud(), I would add the line:

tfListener_.waitForTransform("/base_link", previous_scan_.header.frame_id.c_str(), ros::Time(0), ros::Duration(2.0));

This will wait until the transform exists before trying to look for it.

edit flag offensive delete link more

Comments

@DimitriProsser: Could the target_frame be set to /laser? or /world? I somehow confused with this..
alfa_80 gravatar image alfa_80  ( 2012-01-10 03:30:01 -0500 )edit
Yes. You just need to change the words "target_frame" to "/laser" or "/world".
DimitriProsser gravatar image DimitriProsser  ( 2012-01-10 03:36:45 -0500 )edit
After changing the code as aou suggested I received this error: 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.
alfa_80 gravatar image alfa_80  ( 2012-01-10 03:40:39 -0500 )edit
Cont'd: Frame /world exists with parent NO_PARENT. [pointcloud_builder_node-4] process has died [pid 25647, exit code -6].
alfa_80 gravatar image alfa_80  ( 2012-01-10 03:41:24 -0500 )edit
@DimitriProsser: "Secondly, the function transformLaserScanToPointCloud() transforms.." Very sorry i don't actually get your point..Could you clarify a bit more..
alfa_80 gravatar image alfa_80  ( 2012-01-10 03:42:52 -0500 )edit
Did you check to see what frame_id the income LaserScan has?
DimitriProsser gravatar image DimitriProsser  ( 2012-01-10 03:58:07 -0500 )edit
Is the previous_scan's frame_id = /laser?
dornhege gravatar image dornhege  ( 2012-01-10 04:00:07 -0500 )edit
From my output of rostopic echo /scan => frame_id: laser
alfa_80 gravatar image alfa_80  ( 2012-01-10 04:03:42 -0500 )edit

Question Tools

Stats

Asked: 2012-01-10 03:04:35 -0500

Seen: 749 times

Last updated: Jan 10 '12