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

Revision history [back]

You can use ros::master::check().

#include "ros/ros.h"
#include <iostream>

int main(int argc, char *argv[])
{
    ros::init(argc, argv, "master_test");
    ros::Time::init();
    while (!ros::master::check())
    {
        std::cout << "waiting..." << std::endl;
        ros::Duration(0.5).sleep();
    }
    std::cout << "master started!" << std::endl;
    return 0;
}