0
$\begingroup$

Rosanswers logo

I attempt to gather scan lines over time using laser_assembler package. I use this package by putting some lines of XML code in my launch file. I have in my code, one cloud variable already(please refer below). But then, it only gives one cloud topic in the option tab in rviz, after clicking it, it doesn't assemble. What could go wrong?

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());
      }

In my launch file:

  <node type="point_cloud_assembler" pkg="laser_assembler" name="my_assembler">
    <remap from="cloud" to="cloud"/>
    <param name="max_clouds" type="int" value="400" />
    <param name="fixed_frame" type="string" value="base_link" />
  </node>

EDIT

My code snippet:

      try
      {
        projector_.transformLaserScanToPointCloud("base_link", previous_scan_, cloud, tfListener_);


        ros::service::waitForService("assemble_scans");
        ros::ServiceClient client = n.serviceClient<AssembleScans>("assemble_scans");
        AssembleScans srv;

        srv.request.begin = ros::Time(0.00);
        srv.request.end   = ros::Time(100.00);
        if (client.call(srv))
        {
           ROS_INFO("Got cloud with %u points\n", srv.response.cloud.points.size());
        }
        else
           ROS_INFO("Service call failed\n");

      }
      catch (tf::TransformException ex)
      {
        ROS_WARN("Problem: %s", ex.what());
      }

Part of my launch file:

  <node type="point_cloud_assembler" pkg="laser_assembler" name="my_assembler"> 
    <remap from="/cloud" to="cloud"/>   
    <param name="max_clouds" type="int" value="400" /> 
    <param name="fixed_frame" type="string" value="base_link" /> 
  </node> 

  <node type="periodic_snapshotter" pkg="laser_assembler" name="periodic_snapshotter"> 
    <remap from="/cloud" to="cloud"/>   
    <param name="max_clouds" type="int" value="400" /> 
    <param name="fixed_frame" type="string" value="base_link" /> 
  </node> 

The problem now is that in rviz when I click to "/cloud"(I could only see each scan line being updated) or "/assembled_cloud"(I could only see the related frames including moving /world frame), I couldn't be able to see the gathered cloud.

At the moment, there is a warning message coming in rxconsole as "msg: Published Cloud with 0 points" from periodic_snapshotter node.


Originally posted by alfa_80 on ROS Answers with karma: 1053 on 2012-01-27

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

laser_scan_assembler doesn't publish assembled clouds by default, you have to call assemble_scans service and pass in the begin and end times to get the composite cloud for that time period (all this is described in section 1.4 of this tutorial).


Originally posted by arebgun with karma: 2121 on 2012-01-27

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by alfa_80 on 2012-01-30:
In the wiki(http://ros.org/wiki/laser_assembler), is it right the following line on the webpage [srv.request.begin = ros::Time(0,0);]? Is it allowed to put comma there? What does it mean by (0,0), if you know..

Comment by alfa_80 on 2012-01-30:
@arebgun: Yes, it is. It starts at 24.182s and ends at 79.268s in specific, this is also verified by rostopic echo /scan.

Comment by arebgun on 2012-01-30:
@alfa_80: are your cloud timestamps range from 0 to 100? You should check what the timestamps of laser scans that get converted to point clouds are.

Comment by alfa_80 on 2012-01-29:
@arebgun: Could you see my above update, still something not yet working. Thanks in advance.

Comment by alfa_80 on 2012-01-27:
Thanks, I'll try this.

$\endgroup$
0
$\begingroup$

Rosanswers logo

Are you publishing your cloud to the "cloud" topic?

EDIT:

Try assembling the cloud with respect to a different frame ( a fixed one like "/odom" or "/world" ).


Originally posted by DimitriProsser with karma: 11163 on 2012-01-27

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by alfa_80 on 2012-01-29:
@DimitriProsser:I've just updated as above, if you have time, could you have a look.

Comment by alfa_80 on 2012-01-27:
You mean setting /world, instead of my current cloud topic of /cloud?

Comment by alfa_80 on 2012-01-27:
The fixed_frame is named base_link as well, as in the above code snippet. But I don't get this() from its tutorial, my_cloud_in is the cloud in my code, right?

Comment by alfa_80 on 2012-01-27:
Yes, it is. Even if I cross check using rostopic echo /cloud, it gives all the coordinates(unassembled one I think) there.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.