client_likelihood.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #################################################################
00003 # \note likelihood client
00004 # \input(from DEM ) command and candidates
00005 # \output(from DEM to learning) command and candidates
00006 # \feedback(from learning to DEM) candidate and correspomding likelihood
00007 #   Project name: srs learning service for choosing priority 
00008 # \author
00009 #   Tao Cao, email:itaocao@gmail.com
00010 #
00011 # \date Date of creation: Dec 2011
00012 #################################################################
00013 
00014 import roslib; roslib.load_manifest('srs_likelihood_calculation')
00015 
00016 import sys
00017 
00018 import rospy
00019 from srs_likelihood_calculation.srv import *
00020 
00021 def likelihood_client(x, y):
00022     rospy.wait_for_service('likelihood')
00023     try:
00024         likelihood = rospy.ServiceProxy('likelihood', Likelihood)
00025         resp1 = likelihood(x, y)
00026         print "DEM wants to know likelihood for %s  from %s"%(x,y)
00027         return resp1
00028     except rospy.ServiceException, e:
00029         print "Service call failed: %s"%e
00030 
00031 def usage():
00032     return "%s [command candidates]"%sys.argv[0]
00033 
00034 if __name__ == "__main__":
00035   
00036     #input the consulting command
00037     x=raw_input("Please enter the consulting command end with Enter: \n")
00038     #input the cadidates
00039     y=raw_input("Please enter the candidates for the consulting command:the format is\n    cadidate1 candidate2 candidate3 ...,\nend with Enter: \n")
00040     
00041     print likelihood_client(x, y)
00042 


srs_likelihood_calculation
Author(s): Administrator
autogenerated on Mon Oct 6 2014 08:40:46