pick_server_test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import rospy
00004 import actionlib
00005 import actionlib.msg
00006 from calvin_msgs.msg import PickAndStoreAction, PickAndStoreGoal
00007 from moveit_msgs.msg import CollisionObject
00008 from geometry_msgs.msg import Pose, Point, Quaternion
00009 from shape_msgs.msg import SolidPrimitive
00010 from std_msgs.msg import Header
00011 
00012 if __name__ == '__main__':
00013   rospy.init_node('pick_server_test')
00014 
00015   co_pub= rospy.Publisher('/collision_object', CollisionObject, queue_size= 5)
00016   rospy.sleep(rospy.Duration.from_sec(1.5))
00017 
00018   co = CollisionObject(
00019     header=Header(1, rospy.Time.now(), '/base_footprint'),
00020     id='testbox',
00021     primitives=[SolidPrimitive(type=1, dimensions=[0.04, 0.055, 0.08])],
00022     primitive_poses=[Pose(Point(0.5, 0.0, 0.77), Quaternion(0.0, 0.0, 0.0, 1.0))])
00023 
00024   co_pub.publish( co )
00025   rospy.sleep(rospy.Duration.from_sec(5.0))
00026 
00027   try:
00028     move_group_client = actionlib.SimpleActionClient('/calvin_pick_and_store', PickAndStoreAction)
00029     move_group_client.wait_for_server(rospy.Duration.from_sec(10.0))
00030     move_group_client.send_goal( PickAndStoreGoal(co= co, close_gripper_partially= True) )
00031     move_group_client.wait_for_result(rospy.Duration.from_sec(30.0))
00032 
00033     if move_group_client.get_state() != 3:
00034       rospy.logwarn("move group client state is %s", move_group_client.get_state())
00035 
00036   except actionlib.ActionException, e:
00037     rospy.logerr("move_group action failed: %s", e)


calvin_pick_server
Author(s): Michael Stypa
autogenerated on Thu Aug 27 2015 12:38:56