23 from geometry_msgs.msg
import PoseStamped
25 import simple_moveit_interface
as smi_
26 import cob_pick_place_action.msg
30 psi = smi_.get_planning_scene_interface()
34 smi_.clear_objects(
"arm_left_7_link")
41 pose.header.frame_id =
"/base_footprint" 42 pose.header.stamp = rospy.Time.now()
43 pose.pose.position.x = -0.9
44 pose.pose.position.y = 0
45 pose.pose.position.z = 0.39
46 pose.pose.orientation.x = 0
47 pose.pose.orientation.y = 0
48 pose.pose.orientation.z = 0
49 pose.pose.orientation.w = 1
51 psi.add_box(
"bookcase", pose, size=(0.5, 1.5, 0.78))
59 pick_action_client.wait_for_server()
64 goal = cob_pick_place_action.msg.CobPickGoal()
71 goal.object_class = 5001
72 goal.object_name =
"pringles" 73 goal.object_pose.header.stamp = rospy.Time.now()
74 goal.object_pose.header.frame_id =
"base_footprint" 85 goal.object_pose.pose.position.x = 0.617 + random.uniform(-0.1, 0.1)
86 goal.object_pose.pose.position.y = 0.589 + random.uniform(-0.1, 0.1)
87 goal.object_pose.pose.position.z = 0.979 + random.uniform(-0.1, 0.1)
88 goal.object_pose.pose.orientation.x, goal.object_pose.pose.orientation.y, goal.object_pose.pose.orientation.z, goal.object_pose.pose.orientation.w = quaternion_from_euler(random.uniform(-pi/2, pi/2),random.uniform(-pi/2, pi/2),random.uniform(-pi/2, pi/2))
90 goal.gripper_type =
"sdhx" 92 goal.gripper_side =
"left" 95 goal.grasp_database =
"OpenRAVE" 98 goal.support_surface =
"bookcase" 101 pick_action_client.send_goal(goal)
104 finished_before_timeout=pick_action_client.wait_for_result(rospy.Duration(300, 0))
106 if finished_before_timeout:
107 state=pick_action_client.get_state()
108 print "Action finished: %s"%state
110 print "Action did not finish within timeout" 113 if __name__ ==
'__main__':
117 rospy.init_node(
'CobPickAction_client_py')
119 except rospy.ROSInterruptException:
120 print "program interrupted before completion"
def cob_pick_action_client()