laser_assembler not gathering scan lines
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.