laser_assembler generates empty data
Hi, guys
I'm trying to assemble the laser lines into a big pointcloud2.
First I transformed the laser data into pointCloud2, which can be seen in rviz. But after assembling, no data is published. I have also modified the launch file. Please help me.
// Create a publisher for the clouds that we assemble
pubAssembledPointCloud2 = nh.advertise<sensor_msgs::PointCloud2> (assemPC2Topic, 1);
// Assemble the pointcloud2 from laser
ros::service::waitForService("assemble_scans2");
// Create the service client for calling the assembler
client = nh.serviceClient<AssembleScans2> ("assemble_scans2");
firstTime = true;
while(ros::ok()) {
// Start the timer that will trigger the processing loop (timerCallback)
timer = nh.createTimer(ros::Duration(8.0), &LaserCloud::timerCallback, this);
ros::spin();
}
AssembleScans2 srv;
srv.request.begin = e.last_real;
srv.request.end = e.current_real;
if(client.call(srv)) {
pubAssembledPointCloud2.publish(srv.response.cloud);
ROS_INFO("Published pointcloud2 with %u points", (uint32_t)(srv.response.cloud.height*srv.response.cloud.width));
}
else {
ROS_ERROR("Error making service call\n");
}
Thanks