advertise_all.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #       
00003 # License: BSD
00004 #   https://raw.github.com/robotics-in-concert/rocon_multimaster/master/rocon_gateway_demos/LICENSE 
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         #rospy.logerr("Advertise : %s"%resp.error_message)
00049 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


rocon_gateway_demos
Author(s): Daniel Stonier
autogenerated on Fri Nov 23 2012 14:51:15