Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use grasp detector in grab.py #1335

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ 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.82, max_torque: float = 0.15) -> None:
minimum_position: float = -0.75, max_torque: float = 0.1) -> None:
"""
State for detecting whether the robot is holding something using the gripper position.

Expand Down
16 changes: 15 additions & 1 deletion robot_smach_states/src/robot_smach_states/manipulation/grab.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from ..utility import check_arm_requirements, ResolveArm
from ..util.designators import check_type
from ..navigation.navigate_to_grasp import NavigateToGrasp

from ..manipulation.active_grasp_detector import ActiveGraspDetector
from ..manipulation.grasp_point_determination import GraspPointDeterminant
from ..human_interaction.human_interaction import Say
from ..util.designators.arm import ArmDesignator
from ..util.designators.core import Designator

Expand Down Expand Up @@ -339,9 +342,20 @@ def __init__(self, robot: Robot, item: Designator, arm: ArmDesignator, room: Des
'failed': 'RESET_FAILURE'})

smach.StateMachine.add('GRAB', PickUp(robot, arm, item),
transitions={'succeeded': 'done',
transitions={'succeeded': 'CHECK_PICK_SUCCESSFUL',
'failed': 'RESET_FAILURE'})

smach.StateMachine.add("CHECK_PICK_SUCCESSFUL",
ActiveGraspDetector(robot, arm),
transitions={'true': "done",
'false': "SAY_MISSED_GRASP",
'failed': "RESET_FAILURE",
'cannot_determine': "SAY_MISSED_GRASP"}
)

smach.StateMachine.add("SAY_MISSED_GRASP", Say(robot, "Oops, it seems I missed it."),
transitions={"spoken": "RESET_FAILURE"})

smach.StateMachine.add("RESET_FAILURE", ResetOnFailure(robot, arm),
transitions={'done': 'failed'})

Expand Down