Skip to content

Commit

Permalink
Add arm.gripper_position_detector.min_position to compare
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoDCC committed Oct 11, 2022
1 parent 1497e83 commit 4c078d1
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
from robot_smach_states.util.designators.arm import ArmDesignator



class ActiveGraspDetector(smach.State):
REQUIRED_ARM_PROPERTIES = {"required_gripper_types": [GripperTypes.GRASPING], }

def __init__(self, robot: Robot, arm_designator: ArmDesignator, threshold_difference: float = 0.075,
minimum_position: float = -0.75, max_torque: float = 0.15) -> None:
max_torque: float = 0.15) -> None:
"""
State for detecting whether the robot is holding something using the gripper position.
Expand All @@ -34,9 +35,7 @@ def __init__(self, robot: Robot, arm_designator: ArmDesignator, threshold_differ
self.robot = robot

self.arm_designator = arm_designator

self.threshold_difference = threshold_difference
self.minimum_position = minimum_position
self.max_torque = max_torque

def execute(self, userdata=None) -> str:
Expand All @@ -51,7 +50,7 @@ def execute(self, userdata=None) -> str:
if first_position is None:
rospy.logerr("Cannot retrieve first position")
return 'failed'
elif first_position < self.minimum_position:
elif first_position < arm.gripper_position_detector.min_position:
rospy.logdebug("First position is {}".format(first_position))
return 'cannot_determine'

Expand Down

0 comments on commit 4c078d1

Please sign in to comment.