Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 import roslib; roslib.load_manifest('rocon_gateway_demos')
00008 import rospy
00009 import rocon_gateway
00010 import rocon_gateway_demos
00011 from gateway_msgs.msg import *
00012 from gateway_msgs.srv import *
00013 import argparse
00014 import sys
00015
00016 """
00017 Tests a single flip rule.
00018
00019 Usage:
00020 1 > roslaunch rocon_gateway_demos pirate_hub.launch
00021 2a> roslaunch rocon_gateway_demos pirate_gateway_tutorials.launch
00022 3a> roslaunch rocon_gateway_demos pirate_gateway.launch
00023 2b> rosrun rocon_gateway_demos advertise_all.py
00024 2c> rosrun rocon_gateway_demos advertise_all.py --cancel
00025 """
00026
00027 if __name__ == '__main__':
00028
00029 parser = argparse.ArgumentParser(description='Advertise all connections (unadvertise if using --cancel')
00030 parser.add_argument('--cancel', action='store_true', help='cancel the advertisements')
00031 args = parser.parse_args()
00032 if args.cancel:
00033 action_text = "cancelling"
00034 else:
00035 action_text = "advertising"
00036
00037 rospy.init_node('advertise_all')
00038
00039 advertise_all = rospy.ServiceProxy('/gateway/advertise_all',AdvertiseAll)
00040 req = AdvertiseAllRequest()
00041 req.cancel = args.cancel
00042 req.blacklist = []
00043
00044 rospy.loginfo("Advertise All : %s all."%action_text)
00045 resp = advertise_all(req)
00046 if resp.result != 0:
00047 rospy.logerr("Advertise All : error occured (todo: no error message yet)")
00048
00049