oro_ros_client.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib; roslib.load_manifest('oro_ros')
00003 
00004 import sys
00005 
00006 import rospy
00007 from oro_ros.srv import *
00008 
00009 
00010 def oro_ros_client(query, params):
00011     rospy.wait_for_service('oro/' + query)
00012     try:
00013         query_oro_server = rospy.ServiceProxy('oro/' + query, OroServerQuery)
00014         resp1 = query_oro_server(params)
00015         return resp1.res
00016     except rospy.ServiceException, e:
00017         print "Service call failed: %s"%e
00018 
00019 def usage():
00020     return "%s query [param1, param2, ...]"%sys.argv[0]
00021 
00022 if __name__ == "__main__":
00023         
00024     if len(sys.argv) == 1:
00025         print usage()
00026         sys.exit(1)
00027         
00028     query = sys.argv[1]
00029     #params = sys.argv[2].split('@@')
00030     #params = sys.argv[2][1:-1].split(',')
00031     params = sys.argv[2:]
00032     
00033     oro_ros_client("add", ["[\"robot likes disco_music\", \"disco_music rdf:type Music\"]"])
00034     
00035     print "Requesting %s %s"%(query, params)
00036     print "%s %s => %s"%(query, params, oro_ros_client(query, params))
00037  
00038 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


oro_ros
Author(s): Séverin Lemaignan
autogenerated on Thu May 23 2013 14:57:24