ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In your main(), you can replace the ros::spin() with a while loop that does whatever you want it to. In this example, check_for_done() is a function that you provide. If you use this approach, be sure you sleep() on every iteration of the while loop.

ros::Duration d(0.100);
while(ros::ok) {
    if (check_for_done()) {
        ros::shutdown();
    }
    d.sleep();
}