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

Revision history [back]

I don't know of anything built-in.


One workaround would be to call rospy.get_published_topics() in a try-except loop that handles socket.error [Errno 111] Connection refused


Example:

import time

import rospy


if __name__ == '__main__':
    ros_master_available = False
    while not rospy.is_shutdown() and not ros_master_available:
        try:  
              # query ROS Master for published topics   
             rospy.get_published_topics()  
             ros_master_available = True
        except socket_error as serr:  
            if serr.errno != errno.ECONNREFUSED:               
                raise serr  # re-raise error if its not the one we want     
            else:    
                print("YOUR STATUS MSG / Waiting for roscore")  
        time.sleep(0.1)  # sleep for 0.1 seconds   

    init_node("MyNode", disable_signals=True)

References: http://wiki.ros.org/Master http://docs.ros.org/api/rospy/html/rospy-module.html#get_published_topics https://stackoverflow.com/a/14425454/8670609

I don't know of anything built-in.


One workaround would be to call rospy.get_published_topics() in a try-except loop that handles socket.error [Errno 111] Connection refused


Example:

import time

import rospy


if __name__ == '__main__':
    ros_master_available = False
    while not rospy.is_shutdown() and not ros_master_available:
        try:  
              # query ROS Master for published topics   
             rospy.get_published_topics()  
             ros_master_available = True
        except socket_error as serr:  
            if serr.errno != errno.ECONNREFUSED:               
                raise serr  # re-raise error if its not the one we want     
            else:    
                print("YOUR STATUS MSG / Waiting for roscore")  
        time.sleep(0.1)  # sleep for 0.1 seconds   

    init_node("MyNode", disable_signals=True)

References: http://wiki.ros.org/Master http://docs.ros.org/api/rospy/html/rospy-module.html#get_published_topics References:
http://wiki.ros.org/Master
http://docs.ros.org/api/rospy/html/rospy-module.html#get_published_topics
https://stackoverflow.com/a/14425454/8670609

I don't know of anything built-in.


One workaround would be to call rospy.get_published_topics() in a try-except loop that handles socket.error [Errno 111] Connection refused


Example:

import time

import rospy


if __name__ == '__main__':
    ros_master_available = False
    while not rospy.is_shutdown() and not ros_master_available:
        try:  
              # query ROS Master for published topics   
             rospy.get_published_topics()  
             ros_master_available = True
        except socket_error as serr:  
            if serr.errno != errno.ECONNREFUSED:               
                raise serr  # re-raise error if its not the one we want     
            else:    
                print("YOUR STATUS MSG / Waiting for roscore")  
        time.sleep(0.1)  # sleep for 0.1 seconds   

    init_node("MyNode", disable_signals=True)

References:
http://wiki.ros.org/Master
http://docs.ros.org/api/rospy/html/rospy-module.html#get_published_topics
https://stackoverflow.com/a/14425454/8670609

I don't know of anything built-in.


One workaround would be to call rospy.get_published_topics() in a try-except loop that handles socket.error [Errno 111] Connection refused


Example:

import time
import errorno
from socket import error as socket_error

import rospy


if __name__ == '__main__':
    ros_master_available = False
    while not rospy.is_shutdown() and not ros_master_available:
        try:  
             # query ROS Master for published topics   
             rospy.get_published_topics()  
             ros_master_available = True
        except socket_error as serr:  
            if serr.errno != errno.ECONNREFUSED:               
                raise serr  # re-raise error if its not the one we want     
            else:    
                print("YOUR STATUS MSG / Waiting for roscore")  
        time.sleep(0.1)  # sleep for 0.1 seconds   

    init_node("MyNode", disable_signals=True)

References:
http://wiki.ros.org/Master
http://docs.ros.org/api/rospy/html/rospy-module.html#get_published_topics
https://stackoverflow.com/a/14425454/8670609

I don't know of anything built-in.


One workaround would be to call rospy.get_published_topics() in a try-except loop that handles socket.error [Errno 111] Connection refused


Example:

import time
import errorno
from socket import error as socket_error

import rospy


if __name__ == '__main__':
    ros_master_available = False
    while not rospy.is_shutdown() and not ros_master_available:
        try:  
             # query ROS Master for published topics   
             rospy.get_published_topics()  
             ros_master_available = True
        except socket_error as serr:  
            if serr.errno != errno.ECONNREFUSED:               
                raise serr  # re-raise error if its not the one we want     
            else:    
                print("YOUR STATUS MSG / Waiting for roscore")  
        time.sleep(0.1)  # sleep for 0.1 seconds   

    init_node("MyNode", rospy.init_node("MyNode", disable_signals=True)

References:
http://wiki.ros.org/Master
http://docs.ros.org/api/rospy/html/rospy-module.html#get_published_topics
https://stackoverflow.com/a/14425454/8670609