|
17 | 17 | from ..manipulation.grasp_point_determination import GraspPointDeterminant |
18 | 18 | from ..util.designators.arm import ArmDesignator |
19 | 19 | from ..util.designators.core import Designator |
| 20 | +from ..manipulation.active_grasp_detector import ActiveGraspDetector |
| 21 | +from robot_smach_states.human_interaction import Say |
20 | 22 |
|
21 | 23 |
|
22 | 24 | class PrepareEdGrasp(smach.State): |
@@ -349,9 +351,28 @@ def __init__(self, robot, item, arm): |
349 | 351 | 'failed': 'RESET_FAILURE'}) |
350 | 352 |
|
351 | 353 | smach.StateMachine.add('GRAB', PickUp(robot, arm, item), |
352 | | - transitions={'succeeded': 'done', |
| 354 | + transitions={'succeeded': 'GRASP_DETECTOR', |
353 | 355 | 'failed': 'RESET_FAILURE'}) |
354 | 356 |
|
| 357 | + smach.StateMachine.add('GRASP_DETECTOR', ActiveGraspDetector(robot, arm), |
| 358 | + transitions={'true': 'done', |
| 359 | + 'false': 'RETRY_GRAB', |
| 360 | + 'failed': 'done', |
| 361 | + 'cannot determine': 'done'}) |
| 362 | + |
| 363 | + smach.StateMachine.add('RETRY_GRAB', PickUp(robot, arm, item), |
| 364 | + transitions={'succeeded': 'RETRY_GRASP_DETECTOR', |
| 365 | + 'failed': 'RETRY_GRASP_DETECTOR'}) |
| 366 | + |
| 367 | + smach.StateMachine.add('RETRY_GRASP_DETECTOR', ActiveGraspDetector(robot, arm), |
| 368 | + transitions={'true': 'done', |
| 369 | + 'false': 'SAY_FAILED', |
| 370 | + 'failed': 'done', |
| 371 | + 'cannot determine': 'done'}) |
| 372 | + |
| 373 | + smach.StateMachine.add('SAY_FAILED', Say(robot, "I failed grabbing the object"), |
| 374 | + transitions={'spoken': 'failed'}) |
| 375 | + |
355 | 376 | smach.StateMachine.add("RESET_FAILURE", ResetOnFailure(robot, arm), |
356 | 377 | transitions={'done': 'failed'}) |
357 | 378 |
|
|
0 commit comments