Beispiel #1
0
 def grasp(self, effort=0.0):
     goal = GripperApplyEffortGoal()
     goal.effort = effort
     result = self.gripper_client.send_goal_and_wait(goal)
     if result == GoalStatus.SUCCEEDED:
         return True
     else:
         return False
 def grasp(self, effort):
     """Gripper torque control"""
     goal = GripperApplyEffortGoal()
     goal.effort = effort
     # Send message to the action server
     if (self._gripper_control_client.send_goal_and_wait(goal) ==GoalStatus.SUCCEEDED):
         return True
     else:
         return False
Beispiel #3
0
 def close_gripper_force(self, force=0.8):
     """
     Closes the gripper with the given force.
     :param force: force to grasp with should be between 0.2 and 0.8 (N)
     :return: applied effort
     """
     rospy.loginfo("Closing gripper with force: {}".format(force))
     f = max(min(0.8, force), 0.2)
     goal = GripperApplyEffortGoal()
     goal.effort = f
     self._gripper_apply_force_client.send_goal(goal)
     if self._gripper_apply_force_client.wait_for_result(
             rospy.Duration(secs=5)):
         result = self._gripper_apply_force_client.get_result()
         rospy.loginfo("close_gripper: force {}".format(result.effort))
     else:
         rospy.logwarn("Close Gripper Server timed out.")
Beispiel #4
0
    def _close_gripper(self, effort=0.1):
        """

        :param effort: (float) Force applied to grasping[N], should be a positive number
        :return: (bool) stating the goalstatus of the Actionlib
        """

        goal = GripperApplyEffortGoal()
        goal.effort = -effort * HAND_MOMENT_ARM_LENGTH
        self._grasp_client.send_goal(goal)

        timeout = rospy.Duration(10)
        if self._grasp_client.wait_for_result(timeout):
            self._grasp_client.get_result()
            state = self._grasp_client.get_state()
            if state != actionlib.GoalStatus.SUCCEEDED:
                rospy.logwarn("State is not SUCCEEDED")
                return False
        else:
            self._grasp_client.cancel_goal()
            rospy.logwarn("Timeout")
            return False

        return True