Example #1
0
    rospy.loginfo("grasping object...")
    # call object pickup
    goal = PickupGoal()
    # pass one of the graspable objects returned by the collision map processor
    goal.target = col_res.graspable_objects[0]
    # pass the name that the object has in the collision environment, this name was also returned by the collision map processor
    goal.collision_object_name = col_res.collision_object_names[0]
    # pass the collision name of the table, also returned by the collision map processor
    goal.collision_support_surface_name = col_res.collision_support_surface_name
    # pick up the object with the left arm
    goal.arm_name = "left_arm"
    # specify the desired distance between pre-grasp and final grasp
    goal.desired_approach_distance = .1
    goal.min_approach_distance = .05
    # we will be lifting the object along the vertical direction which is along the z axis in the base_link frame
    goal.lift = GripperTranslation()
    goal.lift.direction = create_vector3_stamped([0., 0., 1.], 'base_link')
    # request a vertical lift of 10cm after grasping the object
    goal.lift.desired_distance = .1
    goal.lift.min_distance = .05
    # do not use tactile-based grasping or tactile-based lift
    goal.use_reactive_execution = 0
    goal.use_reactive_lift = 0

    # send the goal
    try:
        grasper_grasp_action_client.send_goal(goal)
    except rospy.ServiceException, e:
        rospy.logerr("error when calling %s: %e" (grasper_grasp_name, e))
        sys.exit()