test_client.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib
00004 roslib.load_manifest('cob_sound')
00005 import rospy
00006 
00007 # Brings in the SimpleActionClient
00008 import actionlib
00009 
00010 # Brings in the messages used by the fibonacci action, including the
00011 # goal message and the result message.
00012 from cob_sound.msg import *
00013 
00014 def say_client():
00015         # Creates the SimpleActionClient, passing the type of the action
00016         # (FibonacciAction) to the constructor.
00017         client = actionlib.SimpleActionClient('sound_controller/say', SayAction)
00018 
00019         # Waits until the action server has started up and started
00020         # listening for goals.
00021         client.wait_for_server()
00022 
00023         # Creates a goal to send to the action server.
00024         goal = SayGoal()
00025         goal.text.data = "Hello, how are you? I am fine."
00026 
00027         # Sends the goal to the action server.
00028         client.send_goal(goal)
00029 
00030         # Waits for the server to finish performing the action.
00031         client.wait_for_result()
00032 
00033         # Prints out the result of executing the action
00034         return client.get_result()  # A FibonacciResult
00035         rospy.loginfo("Say action finished")
00036 
00037 if __name__ == '__main__':
00038         try:
00039                 # Initializes a rospy node so that the SimpleActionClient can
00040                 # publish and subscribe over ROS.
00041                 rospy.init_node('say_client')
00042                 result = say_client()
00043         except rospy.ROSInterruptException:
00044                 print "program interrupted before completion"
00045 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


cob_sound
Author(s): Florian Weisshardt
autogenerated on Fri Mar 1 2013 17:46:58