How to do it…

Inside the package that we have created in the previous subsection, we will create a new folder named scripts and create a new file named pick_and_place.py there before copying the following code inside of it:

#!/usr/bin/env python import rospy from moveit_commander import RobotCommander, PlanningSceneInterface from moveit_commander import roscpp_initialize, roscpp_shutdown from actionlib import SimpleActionClient, GoalStatus from geometry_msgs.msg import Pose, PoseStamped, PoseArray, Quaternion from moveit_msgs.msg import PickupAction, PickupGoal from moveit_msgs.msg import PlaceAction, PlaceGoal from moveit_msgs.msg import PlaceLocation from moveit_msgs.msg import MoveItErrorCodes from moveit_simple_grasps.msg import GenerateGraspsAction, ...

Get Robot Operating System Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.