Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 import os
00008 import xmlrpclib
00009
00010 caller_id = '/script'
00011
00012 m = xmlrpclib.ServerProxy(os.environ['ROS_MASTER_URI'])
00013
00014 code, msg, val = m.getSystemState(caller_id)
00015
00016 pubcode, statusMessage, topicList = m.getPublishedTopics(caller_id, "")
00017
00018 if code == 1:
00019 pubs, subs, srvs = val
00020 else:
00021 print "call failed", code, msg
00022
00023 print "\nPublished topics:"
00024 for pb in pubs:
00025 for t in topicList:
00026 if t[0] == pb[0]:
00027 if len(pb[1]) < 2:
00028 print " *", pb[0], "[",t[1],"]", len(pb[1]), " publisher"
00029 else:
00030 print " *", pb[0], "[",t[1],"]", len(pb[1]), " publishers"
00031 print "\nSubscribed topics:"
00032 for sb in subs:
00033 for t in topicList:
00034 if t[0] == pb[0]:
00035 if len(sb[1]) < 2:
00036 print " *", sb[0], "[",t[1],"]", len(sb[1]), " subscriber"
00037 else:
00038 print " *", sb[0], "[",t[1],"]", len(sb[1]), " subscribers"