Ask Your Question
0

Scan lines are not gathered in generating a point cloud

asked 2012-01-27 04:17:17 -0500

alfa_80 gravatar image

updated 2012-01-27 06:34:29 -0500

I've have built a point cloud, nevertheless, it is not fully working in the sense that when I watch in rviz, it shows only scan lines. Of course I can I a kind of cloud if i set the decay value in rviz as high as possible, but, it is just a fake one if I do that. I have followed this tutorial, anyway, to build the point cloud.

What I can see is that since the code snippet(see below) for building the point cloud resides in a function, that always being called, including to provide a new scan. It seems that, it enter the function, the cloud object is deleted and replaced with a new one, instead of accumulated over time. Then, I start to put the cloud variable as a class member variable, even though, in the tutorial, it is declared as a local variable. The problem after making it a class member variable is that, in rviz the message is not received(a kind of complaint).

I've tried to comment the transformLaserScanToPointCloud call, and no scan lines at all appears. This could mean, it somehow enters the try block.

Anyone know how to improve this? or Am i using the wrong function transformLaserScanToPointCloud call to implement building a point cloud.

Thanks in advance.

The code snippet(resides in a callback function):

      sensor_msgs::PointCloud cloud;

      static tf::TransformBroadcaster tfb;
      tf::Transform xform;
      xform.setOrigin(tf::Vector3(pose3D_LDD.pose.position.x, pose3D_LDD.pose.position.y, pose3D_LDD.pose.position.z));
      xform.setRotation(tf::Quaternion(pose3D_LDD.pose.orientation.x, pose3D_LDD.pose.orientation.y, pose3D_LDD.pose.orientation.z, pose3D_LDD.pose.orientation.w));
      tfb.sendTransform(tf::StampedTransform(xform, ros::Time(pose3D_LDD.header.stamp), "base_link", "laser"));
      tfListener_.waitForTransform("base_link", "laser", previous_scan_.header.stamp, ros::Duration(2.0));

      try
      {
        projector_.transformLaserScanToPointCloud("base_link", previous_scan_, cloud, tfListener_);           
      }
      catch (tf::TransformException ex)
      {
        ROS_WARN("Problem: %s", ex.what());
      }
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-01-27 05:27:01 -0500

DimitriProsser gravatar image

To assemble over time, use laser_assembler. laser_geometry converts one scan into one cloud. If you want to assemble over time, you need to use that package. Or, you could always use the Point Cloud Library's default types and just add them together. I would strongly recommend the laser_assembler package though.

edit flag offensive delete link more

Comments

Then, what is the point of naming it as a cloud if it just converts to only one cloud. I just couldn't see it.
alfa_80 gravatar image alfa_80  ( 2012-01-27 05:35:16 -0500 )edit
But, would the laser_assembler be able to build out of my pose information like I did above? In the tutorial, it doesn't say much.
alfa_80 gravatar image alfa_80  ( 2012-01-27 05:37:53 -0500 )edit
laser_geometry essentially just changes the data type of the LaserScan (which consists of nothing but an array of ranges) to a PointCloud (which has an x, y, and z value for every point). laser_geometry is supposed to be generic. I have a laser scanner that produces four lines at a time and it works
DimitriProsser gravatar image DimitriProsser  ( 2012-01-27 05:40:15 -0500 )edit
laser_assembler essentially takes your cloud and adds them together over time (laser_assembler also works on clouds).
DimitriProsser gravatar image DimitriProsser  ( 2012-01-27 05:41:28 -0500 )edit
That means I can still use the above cloud to be added by the laser_assembler right instead of PCL one? I think it's easier to stick to what I have now and add them over time. But then I'll have a lot of cloud then.
alfa_80 gravatar image alfa_80  ( 2012-01-27 05:47:14 -0500 )edit
You can just feed the output of the above into the laser_assembler and it will assemble it over time. You can specify how long to assemble for (it's a rolling buffer)
DimitriProsser gravatar image DimitriProsser  ( 2012-01-27 06:03:10 -0500 )edit
I got your point :-) I've included some lines of XML code pertaining to the laser_assembler as above, but, it only gives one cloud topic in the option tab in rviz, after clicking it, it doesn't assemble. What could go wrong?
alfa_80 gravatar image alfa_80  ( 2012-01-27 06:09:09 -0500 )edit
Proper frame_id, proper topic names? Try this tutorial: http://ros.org/wiki/laser_assembler/Tutorials/HowToAssembleLaserScans.
DimitriProsser gravatar image DimitriProsser  ( 2012-01-27 06:21:23 -0500 )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

Stats

Asked: 2012-01-27 04:17:17 -0500

Seen: 182 times

Last updated: Jan 27 '12