$search
00001 #! /usr/bin/env python 00002 00003 import roslib; roslib.load_manifest('face_detector') 00004 import rospy 00005 00006 # Brings in the SimpleActionClient 00007 import actionlib 00008 00009 # Brings in the messages used by the face_detector action, including the 00010 # goal message and the result message. 00011 import face_detector.msg 00012 00013 def face_detector_client(): 00014 # Creates the SimpleActionClient, passing the type of the action to the constructor. 00015 client = actionlib.SimpleActionClient('face_detector_action', face_detector.msg.FaceDetectorAction) 00016 00017 # Waits until the action server has started up and started 00018 # listening for goals. 00019 client.wait_for_server() 00020 00021 # Creates a goal to send to the action server. 00022 goal = face_detector.msg.FaceDetectorGoal() 00023 00024 # Sends the goal to the action server. 00025 client.send_goal(goal) 00026 00027 # Waits for the server to finish performing the action. 00028 client.wait_for_result() 00029 00030 # Prints out the result of executing the action 00031 return client.get_result() # A FibonacciResult 00032 00033 if __name__ == '__main__': 00034 try: 00035 # Initializes a rospy node so that the SimpleActionClient can 00036 # publish and subscribe over ROS. 00037 rospy.init_node('face_detector_action_client') 00038 result = face_detector_client() 00039 print "Done action" 00040 except rospy.ROSInterruptException: 00041 print "Program interrupted before completion"