ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The problem is that you're not wrapping these functions:
tfListener_.waitForTransform("/base_link", "/laser", ros::Time(0), ros::Duration(2.0));
projector_.transformLaserScanToPointCloud("/base_link", previous_scan_, cloud, tfListener_);
in a try/catch
block. Both of these operations throw a transform exception that you must catch. This will not solve the problem that is cause the exception, but it will prevent your program from exiting every time one is received. Try the following:
try
{
tfListener_.waitForTransform("/base_link", "/laser", ros::Time(0), ros::Duration(2.0));
projector_.transformLaserScanToPointCloud("/base_link", previous_scan_, cloud, tfListener_);
}
catch (tf::TransformException e)
{
ROS_WARN("My_node: %s", ex.what());
}