|
16 | 16 | from robot_smach_states.world_model.world_model import Inspect |
17 | 17 |
|
18 | 18 |
|
19 | | -class PreparePlace(smach.State): |
20 | | - REQUIRED_ARM_PROPERTIES = {"required_trajectories": ["prepare_place"], } |
21 | | - |
22 | | - def __init__(self, robot, arm): |
23 | | - """ |
24 | | - Drive the robot back a little and move the designated arm to place the designated item at the designated pose |
25 | | -
|
26 | | - :param robot: Robot to execute state with |
27 | | - :param locked arm: Designator -> arm to place with, so Arm that holds entity_to_place, e.g. via |
28 | | - ArmHoldingEntityDesignator |
29 | | - """ |
30 | | - smach.State.__init__(self, outcomes=['succeeded', 'failed']) |
31 | | - |
32 | | - # Check types or designator resolve types |
33 | | - check_type(arm, PublicArm) |
34 | | - |
35 | | - # Assign member variables |
36 | | - self._robot = robot |
37 | | - self._arm_designator = arm |
38 | | - |
39 | | - def execute(self, userdata=None): |
40 | | - |
41 | | - arm = self._arm_designator.resolve() |
42 | | - if not arm: |
43 | | - rospy.logerr("Could not resolve arm") |
44 | | - return "failed" |
45 | | - |
46 | | - # Arm to position in a safe way |
47 | | - arm.send_joint_trajectory('prepare_place', timeout=0) |
48 | | - arm.wait_for_motion_done() |
49 | | - |
50 | | - return 'succeeded' |
51 | | - |
52 | | -# ---------------------------------------------------------------------------------------------------- |
53 | | - |
54 | | - |
55 | 19 | class Put(smach.State): |
56 | 20 | REQUIRED_ARM_PROPERTIES = {"required_gripper_types": [GripperTypes.GRASPING], } |
57 | 21 |
|
@@ -201,9 +165,8 @@ def __init__(self, robot, item_to_place, place_pose, arm, place_volume=None, upd |
201 | 165 | smach.StateMachine.__init__(self, outcomes=['done', 'failed']) |
202 | 166 |
|
203 | 167 | # Check types or designator resolve types |
204 | | - assert(item_to_place.resolve_type == Entity or type(item_to_place) == Entity) |
205 | | - assert(arm.resolve_type == PublicArm or type(arm) == PublicArm) |
206 | | - #assert(place_volume.resolve_type == str or (type(place_volume) == str)) |
| 168 | + check_type(item_to_place, Entity) |
| 169 | + check_type(arm, PublicArm) |
207 | 170 |
|
208 | 171 | # parse place volume |
209 | 172 | if place_volume is not None: |
@@ -244,10 +207,6 @@ def __init__(self, robot, item_to_place, place_pose, arm, place_volume=None, upd |
244 | 207 | 'failed': 'failed'} |
245 | 208 | ) |
246 | 209 | smach.StateMachine.add('RESOLVE_ARM', ResolveArm(arm, self), |
247 | | - transitions={'succeeded': 'PREPARE_PLACE', |
248 | | - 'failed': 'failed'}) |
249 | | - |
250 | | - smach.StateMachine.add('PREPARE_PLACE', PreparePlace(robot, arm), |
251 | 210 | transitions={'succeeded': 'LOCK_DESIGNATOR', |
252 | 211 | 'failed': 'failed'}) |
253 | 212 |
|
|
0 commit comments