Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import random
00019 from math import pi
00020
00021 import rospy
00022 import actionlib
00023 from geometry_msgs.msg import PoseStamped
00024 from tf.transformations import *
00025 import cob_pick_place_action.msg
00026
00027 def cob_place_action_client():
00028
00029
00030 place_action_client = actionlib.SimpleActionClient('cob_place_action', cob_pick_place_action.msg.CobPlaceAction)
00031
00032
00033
00034 place_action_client.wait_for_server()
00035
00036
00037 goal = cob_pick_place_action.msg.CobPlaceGoal()
00038
00039
00040 goal.object_class = 50
00041 goal.object_name = "instantsoup"
00042
00043 pose = PoseStamped()
00044
00045 pose.header.stamp = rospy.Time.now()
00046 pose.header.frame_id = "base_footprint"
00047
00048
00049
00050
00051 pose.pose.position.x = -0.7
00052 pose.pose.position.y = -0.5
00053 pose.pose.position.z = 0.9
00054 pose.pose.orientation.x, pose.pose.orientation.y, pose.pose.orientation.z, pose.pose.orientation.w = quaternion_from_euler(0,0,0)
00055 goal.destinations.append(pose)
00056
00057
00058
00059 place_action_client.send_goal(goal)
00060
00061
00062 finished_before_timeout=place_action_client.wait_for_result(rospy.Duration(300, 0))
00063
00064 if finished_before_timeout:
00065 state=place_action_client.get_state()
00066 print "Action finished: %s"%state
00067
00068 return state
00069
00070 if __name__ == '__main__':
00071 try:
00072
00073
00074 rospy.init_node('CobPlaceAction_client_py')
00075 result = cob_place_action_client()
00076 except rospy.ROSInterruptException:
00077 print "program interrupted before completion"