$search
00001 #! /usr/bin/env python 00002 00003 import roslib; roslib.load_manifest('srs_decision_making_experimental') 00004 import rospy 00005 00006 # Brings in the SimpleActionClient 00007 import actionlib 00008 00009 # Brings in the messages used by the SRS DM action, including the 00010 # goal message and the result message. 00011 import srs_decision_making.msg as xmsg 00012 00013 def DM_client(): 00014 # Creates the SimpleActionClient, passing the type of the action 00015 # constructor. 00016 client = actionlib.SimpleActionClient('srs_decision_making_actions', xmsg.ExecutionAction) 00017 00018 # Waits until the action server has started up and started 00019 # listening for goals. 00020 client.wait_for_server() 00021 00022 # Creates a goal to send to the action server. 00023 _goal=xmsg.ExecutionGoal() 00024 _goal.action="move" 00025 00026 _goal.parameter="[-0.4 1.19 0]" 00027 _goal.priority=1 00028 # Sends the goal to the action server. 00029 client.send_goal(_goal) 00030 00031 00032 # Waits for the server to finish performing the action. 00033 client.wait_for_result() 00034 00035 # Prints out the result of executing the action 00036 return client.get_result() 00037 00038 00039 00040 00041 00042 if __name__ == '__main__': 00043 try: 00044 # Initializes a rospy node so that the SimpleActionClient can 00045 # publish and subscribe over ROS. 00046 rospy.init_node('dm_client1') 00047 result = DM_client() 00048 rospy.loginfo('result %s',result) 00049 # print ("Result:" result) 00050 except rospy.ROSInterruptException: 00051 print "program interrupted before completion"