laser_assembler not giving output
Hi!
I am trying to assemble point clouds (PointCloud2) received from a Kinect sensor mounted on a mobile robot, both of which are being simulated in Gazebo. I have been following these steps. The tf tree is being set up fine. The laser assembler service node (name=Kinect_point_cloud_assembler) is set up and running.
I have the following ros graph:
I have the following tf tree:
The client node I am using is as follows:
#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
#include <laser_assembler/AssembleScans2.h>
#include <pcl_conversions/pcl_conversions.h>
#include <pcl_ros/point_cloud.h>
using namespace laser_assembler;
int main(int argc, char *argv[])
{
ros::init(argc,argv,"point_cloud_assembler");
ros::NodeHandle nh;
ros::service::waitForService("assemble_scans2");
ros::ServiceClient client = nh.serviceClient<AssembleScans2>("assemble_scans2");
AssembleScans2 srv;
srv.request.begin = ros::Time(0,0);
srv.request.end = ros::Time::now();
if(client.call(srv)){
// printf("Got cloud with %u points\n", srv.response.cloud.points.size());
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_assembled(new pcl::PointCloud<pcl::PointXYZ>());
pcl::fromROSMsg(srv.response.cloud,*cloud_assembled);
ROS_INFO("Number of Cloud Points =%d \n",cloud_assembled->width);
}
else{
printf("Service call failed\n");
}
return 0;
}
When I run the client node for requesting the assembled point cloud I get the following output:
[INFO] [1552485878.037815075]: Number of Cloud Points =0
I do not understand what I am doing wrong. Everything seems fine and there are no warnings nor error messages. Please help.
This is the launch file I am using to launch point_cloud2_assembler:
<launch>
<node type="point_cloud2_assembler" pkg="laser_assembler" name="kinect_point_cloud_assembler" output="screen">
<remap from="cloud" to="/camera/depth/points" />
<param name="tf_cache_time_secs" type="double" value="100.0" />
<param name="max_clouds" type="int" value="20" />
<param name="fixed_frame" type="string" value="base_link" />
</node>
</launch>
Sorry, wanted to know if you ever managed to solve this, as I am currently having the same issue...?