def execute(self, userdata): goal_to_send = ObjectManipulationGoal() goal_to_send.operation = ObjectManipulationGoal.PICK goal_to_send.group = GROUP_NAME goal_to_send.target_pose = userdata.object_pick_position userdata.object_manipulation_goal = goal_to_send print "Data to Send to Pick Object final --> " + str(goal_to_send) return 'succeeded'
def execute(self, userdata): goal_to_send = ObjectManipulationGoal() goal_to_send.operation = ObjectManipulationGoal.PLACE goal_to_send.group = GROUP_NAME goal_to_send.target_pose = userdata.object_place_position userdata.object_manipulation_goal = goal_to_send return 'succeeded'
from moveit_msgs.msg import MoveItErrorCodes from geometry_msgs.msg import PoseStamped, Pose, Point, Quaternion from std_msgs.msg import Header OBJECT_MANIP_AS = '/object_manipulation_server' if __name__ == '__main__': rospy.init_node("send_pick_and_place_") rospy.loginfo("Connecting to reem_tabletop_grasping AS: '" + OBJECT_MANIP_AS + "'") manip_as = actionlib.SimpleActionClient(OBJECT_MANIP_AS, ObjectManipulationAction) manip_as.wait_for_server() rospy.loginfo("Succesfully connected.") goal = ObjectManipulationGoal() goal.group = "right_arm_torso" goal.operation = ObjectManipulationGoal.PICK p = Pose(position=Point(0.3, -0.3, 1.1), orientation=Quaternion(0.0, 0.0, 0.0, 1.0)) target = PoseStamped(header=Header(frame_id="base_link"), pose=p) goal.target_pose = target rospy.loginfo("Sending pick goal:\n" + str(goal)) manip_as.send_goal(goal) manip_as.wait_for_result() result = manip_as.get_result() rospy.loginfo("Got result:\n" + str(result)) if not result.error_code.val == MoveItErrorCodes.SUCCESS: rospy.logerr("Not executing place as pick failed") exit()
# # author: Sammy Pfeiffer import rospy import actionlib from reem_tabletop_grasping.msg import ObjectManipulationAction, ObjectManipulationGoal from geometry_msgs.msg import PoseStamped, Pose, Point, Quaternion from std_msgs.msg import Header OBJECT_MANIP_AS = '/object_manipulation_server' if __name__ == '__main__': rospy.init_node("send_place_") rospy.loginfo("Connecting to reem_tabletop_grasping AS: '" + OBJECT_MANIP_AS + "'") manip_as = actionlib.SimpleActionClient(OBJECT_MANIP_AS, ObjectManipulationAction) manip_as.wait_for_server() rospy.loginfo("Succesfully connected.") goal = ObjectManipulationGoal() goal.group = "right_arm_torso" goal.operation = ObjectManipulationGoal.PLACE p = Pose(position=Point(0.3, -0.3, 1.1), orientation=Quaternion(0.0, 0.0, 0.0, 1.0)) target = PoseStamped(header=Header(frame_id="base_link"), pose=p) goal.target_pose = target rospy.loginfo("Sending goal:\n" + str(goal)) manip_as.send_goal(goal) manip_as.wait_for_result() result = manip_as.get_result() rospy.loginfo("Got result:\n" + str(result))