place_action_test.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 import roslib; roslib.load_manifest('iri_place')
00004 import rospy
00005 
00006 # Brings in the SimpleActionClient
00007 import actionlib
00008 
00009 #from estirabot_common import EstirabotGoHome, EstirabotGetKinectImage
00010 
00011 # Brings in the messages used by the action, including the
00012 # goal message and the result message.
00013 from object_manipulation_msgs.msg import PlaceAction,PlaceGoal
00014 from geometry_msgs.msg import  PoseStamped
00015 from math import sqrt
00016 
00017 def place_client():
00018     # Creates the SimpleActionClient, passing the type of the action
00019     # (FibonacciAction) to the constructor.
00020     client = actionlib.SimpleActionClient('/iri_place/place', PlaceAction)
00021 
00022     print "waiting action server"
00023     # Waits until the action server has started up and started
00024     # listening for goals.
00025     client.wait_for_server()
00026 
00027     # Creates a goal to send to the action server.
00028     goal = PlaceGoal()
00029 
00030     place_location = PoseStamped() 
00031     place_location.header.frame_id = "/wam_link0"
00032     place_location.pose.position.x = 0.45;
00033     place_location.pose.position.y = 0;
00034     place_location.pose.position.z = 0;
00035     place_location.pose.orientation.x = sqrt(2)/2;
00036     place_location.pose.orientation.y = sqrt(2)/2;
00037     place_location.pose.orientation.z = 0;
00038     place_location.pose.orientation.w = 0;
00039 
00040     goal.place_locations.append(place_location);
00041 
00042     print "send goal"
00043     # Sends the goal to the action server.
00044     client.send_goal(goal)
00045 
00046     print "wait result"
00047     # Waits for the server to finish performing the action.
00048     client.wait_for_result()
00049 
00050     print "returning result"
00051     # Prints out the result of executing the action
00052     return client.get_result() 
00053 
00054 if __name__ == '__main__':
00055     try:
00056         # Initializes a rospy node so that the SimpleActionClient can
00057         # publish and subscribe over ROS.
00058         rospy.init_node('place_check')
00059         result = place_client()
00060         print "Result: ",result
00061     except rospy.ROSInterruptException:
00062         print "program interrupted before completion"
00063 


iri_place
Author(s): pmonso
autogenerated on Fri Dec 6 2013 22:02:44