test_client.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 
18 import rospy
19 import actionlib
20 from cob_sound.msg import *
21 
22 def say_client():
23  client = actionlib.SimpleActionClient('say', SayAction)
24  client.wait_for_server()
25 
26  # Creates a goal to send to the action server.
27  goal = SayGoal()
28  goal.text = "Hello, how are you? I am fine."
29 
30  # Sends the goal to the action server.
31  client.send_goal(goal)
32 
33  # Waits for the server to finish performing the action.
34  client.wait_for_result()
35 
36  # Prints out the result of executing the action
37  return client.get_result()
38  rospy.loginfo("Say action finished")
39 
40 if __name__ == '__main__':
41  try:
42  rospy.init_node('say_client')
43  result = say_client()
44  except rospy.ROSInterruptException:
45  print("program interrupted before completion")
46 
def say_client()
Definition: test_client.py:22


cob_sound
Author(s): Florian Weisshardt, Benjamin Maidel
autogenerated on Wed Apr 7 2021 02:11:51