ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Your callbacks are called in ros::spin(), ros::spinOnce() or via asych spinner etc. Your code in contrast just does busy waiting. Modify your wait for first frame like:
// Wait for the first frame:
while(!new_cloud_available_flag)
{
std::cout<<"waiting for first frame\n";
ros::Duration( 0.01 ).sleep();
ros::spinOnce();
}