master_util.py
Go to the documentation of this file.
00001 import rospy
00002 import re
00003 import os
00004 def isMasterAlive():
00005     """
00006     return True if master alive and return False if
00007     master is not alive
00008     """
00009     try:
00010         # first check the host is available
00011         master = rospy.get_master()
00012         master_host = re.search('http://([a-zA-Z0-9\-_]*):', master.getUri()[2]).groups(1)[0]
00013         response = os.system("ping -W 10 -c 1 " + master_host + " > /dev/null")
00014         if response != 0:
00015             return False
00016         master.getSystemState()
00017         return True
00018     except Exception, e:
00019         return False


jsk_topic_tools
Author(s): Kei Okada , Yusuke Furuta
autogenerated on Sun Jan 25 2015 12:38:34