Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('pr2_delivery')
00004 import rospy
00005 import actionlib
00006 import geometry_msgs.msg
00007 import tf.transformations
00008 from pr2_delivery.msg import DeliverAction, DeliverGoal
00009
00010 def pose_from_xytheta(x, y, theta):
00011 pose = geometry_msgs.msg.PoseStamped()
00012 pose.header.stamp = rospy.Time.now()
00013 pose.header.frame_id = '/map'
00014 pose.pose.position.x = x
00015 pose.pose.position.y = y
00016 pose.pose.position.z = 0
00017 quat = tf.transformations.quaternion_from_euler(0, 0, theta)
00018 pose.pose.orientation = geometry_msgs.msg.Quaternion(*quat)
00019 return pose
00020
00021 if __name__ == '__main__':
00022 rospy.loginfo("starting...")
00023 rospy.init_node('deliver_test_client')
00024 client = actionlib.SimpleActionClient('deliver', DeliverAction)
00025 rospy.loginfo("waiting for action server...")
00026 client.wait_for_server()
00027
00028 goal = DeliverGoal()
00029
00030 goal.get_object_pose = pose_from_xytheta( 29.494, 31.433, -0.101 )
00031 goal.give_object_pose = pose_from_xytheta( 27.503, 34.579, 2.464 )
00032 goal.return_home_pose = pose_from_xytheta( 33.089, 34.547, 3.14 )
00033
00034 rospy.loginfo("sending goal.")
00035 client.send_goal(goal)
00036 client.wait_for_result(rospy.Duration.from_sec(50.0))
00037 rospy.loginfo("got action finished.")
00038 rospy.sleep(50)