test_client_check_diskwasher.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('srs_decision_making')
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="check"
00025     _goal.parameter="Dishwasher"
00026     _goal.priority=1
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()
00035 
00036 if __name__ == '__main__':
00037     try:
00038         # Initializes a rospy node so that the SimpleActionClient can
00039         # publish and subscribe over ROS.
00040         rospy.init_node('dm_client6')
00041         result = DM_client()
00042         rospy.loginfo('result %s',result)
00043         # print ("Result:" result)
00044     except rospy.ROSInterruptException:
00045         print "program interrupted before completion"


srs_decision_making
Author(s): Renxi Qiu
autogenerated on Mon Oct 6 2014 08:38:32