face_detector_action_client.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 import actionlib
4 
5 from face_detector.msg import FaceDetectorAction, FaceDetectorGoal
6 
7 import rospy
8 
9 
11  # Creates the SimpleActionClient, passing the type of the action to the constructor.
12  client = actionlib.SimpleActionClient('face_detector_action', FaceDetectorAction)
13 
14  # Waits until the action server has started up and started
15  # listening for goals.
16  client.wait_for_server()
17 
18  # Creates a goal to send to the action server. (no parameters)
19  goal = FaceDetectorGoal()
20 
21  # Sends the goal to the action server.
22  client.send_goal(goal)
23 
24  # Waits for the server to finish performing the action.
25  client.wait_for_result()
26 
27  return client.get_result() # people_msgs/PositionMeasurement[] face_positions
28 
29 
30 if __name__ == '__main__':
31  try:
32  # Initializes a rospy node so that the SimpleActionClient can
33  # publish and subscribe over ROS.
34  rospy.init_node('face_detector_action_client')
36  print('Done action')
37  except rospy.ROSInterruptException:
38  print('Program interrupted before completion')


face_detector
Author(s): Caroline Pantofaru
autogenerated on Sun Feb 21 2021 03:56:45