pull_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     3b> rosrun rocon_gateway_demos pull_all.py
00025 """
00026 
00027 if __name__ == '__main__':
00028 
00029     parser = argparse.ArgumentParser(description='Pull all connections (unpull if using --cancel')
00030     parser.add_argument('--cancel', action='store_true', help='cancel the pull')
00031     args = parser.parse_args()
00032     if args.cancel:
00033         action_text = "cancelling"
00034     else:
00035         action_text = "pull"
00036 
00037     rospy.init_node('pull_all')
00038 
00039     try:
00040         gateway = rocon_gateway_demos.findFirstRemoteGateway()
00041     except rocon_gateway.GatewayError as e:
00042         rospy.logerr("Pull All : %s, aborting."%(str(e)))
00043         sys.exit(1)
00044     
00045     flip_all = rospy.ServiceProxy('/gateway/pull_all',RemoteAll)
00046     req = RemoteAllRequest() 
00047     req.gateway = gateway
00048     req.cancel = args.cancel
00049     req.blacklist = []
00050 
00051     rospy.loginfo("Pull All : %s all [%s]."%(action_text,req.gateway)) 
00052     resp = flip_all(req)
00053     if resp.result != 0:
00054         rospy.logerr("Pull All : %s"%resp.error_message)
00055 
 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