def create(self):
		# x:983 y:56, x:356 y:305, x:268 y:204
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed', 'unkown_id'], input_keys=['part_type', 'pose', 'joint_values'], output_keys=['part_type_left'])
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.pose = []
		_state_machine.userdata.move_group = 'Left_Arm'
		_state_machine.userdata.move_group_prefix = '/ariac/gantry'
		_state_machine.userdata.tool_link = 'left_ee_link'
		_state_machine.userdata.part_offset = 0
		_state_machine.userdata.rotation = 0
		_state_machine.userdata.joint_values = []
		_state_machine.userdata.joint_names = []
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.arm_id = 'Left_Arm'
		_state_machine.userdata.part_type_left = ''

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:70 y:44
			OperatableStateMachine.add('DecideOffset',
										DecideOffsetProduct(target_time=0.5),
										transitions={'succes': 'ComputePick', 'unknown_id': 'unkown_id'},
										autonomy={'succes': Autonomy.Off, 'unknown_id': Autonomy.Off},
										remapping={'part_type': 'part_type', 'part_offset': 'part_offset'})

			# x:427 y:38
			OperatableStateMachine.add('MoveToPartBelt',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'EnableGripper', 'planning_failed': 'failed', 'control_failed': 'EnableGripper'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:629 y:37
			OperatableStateMachine.add('EnableGripper',
										GripperControl(enable=True),
										transitions={'continue': 'ReplacePartName', 'failed': 'failed', 'invalid_id': 'unkown_id'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:237 y:40
			OperatableStateMachine.add('ComputePick',
										ComputeGraspAriacState(joint_names=['left_elbow_joint', 'left_shoulder_lift_joint', 'left_shoulder_pan_joint', 'left_wrist_1_joint', 'left_wrist_2_joint', 'left_wrist_2_joint']),
										transitions={'continue': 'MoveToPartBelt', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:779 y:36
			OperatableStateMachine.add('ReplacePartName',
										ReplaceState(),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'part_type', 'result': 'part_type_left'})


		return _state_machine
    def create(self):
        # x:1723 y:19, x:585 y:171
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'ref_frame', 'config_name', 'move_group_prefix', 'arm_id',
                'agv_id', 'part_type'
            ],
            output_keys=[
                'move_group_prefix', 'config_name', 'arm_id', 'ref_frame',
                'camera_topic', 'camera_frame', 'part_offset', 'overzet'
            ])
        _state_machine.userdata.ref_frame = ''
        _state_machine.userdata.bin3_pose = ''
        _state_machine.userdata.config_name = ''
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.move_group_prefix = ''
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.arm_id = ''
        _state_machine.userdata.offset = 0.5
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.agv1_id = 'agv1'
        _state_machine.userdata.agv2_id = 'agv2'
        _state_machine.userdata.part_offset = 0
        _state_machine.userdata.partoffset1 = 0.037
        _state_machine.userdata.partoffset2 = 0.085
        _state_machine.userdata.partoffset3 = 0.02
        _state_machine.userdata.partoffset4 = 0.025
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.part1 = 'gasket_part'
        _state_machine.userdata.part2 = 'pulley_part'
        _state_machine.userdata.part3 = 'piston_rod_part'
        _state_machine.userdata.part4 = 'gear_part'
        _state_machine.userdata.move_group_prefix1 = '/ariac/arm1'
        _state_machine.userdata.move_group_prefix2 = '/ariac/arm2'
        _state_machine.userdata.config_namer1 = 'R1PreBin4'
        _state_machine.userdata.config_namer2 = 'R2PreBin4'
        _state_machine.userdata.arm1_id = 'arm1'
        _state_machine.userdata.arm2_id = 'arm2'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.camera_topic4 = '/ariac/Camera_Bin_4'
        _state_machine.userdata.camera_frame4 = 'Camera_Bin_4_frame'
        _state_machine.userdata.overzet = ''
        _state_machine.userdata.overzetnee = 'nee'
        _state_machine.userdata.ref_frame1 = 'arm1_linear_arm_actuator'
        _state_machine.userdata.ref_frame2 = 'arm2_linear_arm_actuator'
        _state_machine.userdata.config_name1 = 'R1PreBin1'
        _state_machine.userdata.config_name4 = 'R2PreBin6'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:91 y:23
            OperatableStateMachine.add('Arm?',
                                       EqualState(),
                                       transitions={
                                           'true': 'R1',
                                           'false': 'R2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'arm_id',
                                           'value_b': 'arm1_id'
                                       })

            # x:630 y:12
            OperatableStateMachine.add('PreBin3',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputeDrop3',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:907 y:30
            OperatableStateMachine.add(
                'ComputeDrop3',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'DropBin3',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'bin3_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1122 y:79
            OperatableStateMachine.add('DropBin3',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'OpengripperBin3',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1142 y:173
            OperatableStateMachine.add('OpengripperBin3',
                                       UseGripper(enable=False),
                                       transitions={
                                           'continue': 'WachtenGripper',
                                           'failed': 'failed',
                                           'invalid_arm': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:984 y:236
            OperatableStateMachine.add('WachtenGripper',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'PreBin3Back'},
                                       autonomy={'done': Autonomy.Off})

            # x:799 y:244
            OperatableStateMachine.add('PreBin3Back',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'AGV?',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:16 y:99
            OperatableStateMachine.add('AGV?',
                                       EqualState(),
                                       transitions={
                                           'true': 'PreBin4',
                                           'false': 'PreBin1'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'agv_id',
                                           'value_b': 'agv1_id'
                                       })

            # x:186 y:106
            OperatableStateMachine.add('R1',
                                       ReplaceState(),
                                       transitions={'done': 'Getbin3Pose'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_namer1',
                                           'result': 'config_name'
                                       })

            # x:254 y:189
            OperatableStateMachine.add('R2',
                                       ReplaceState(),
                                       transitions={'done': 'Getbin3Pose_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_namer2',
                                           'result': 'config_name'
                                       })

            # x:331 y:21
            OperatableStateMachine.add(
                'Getbin3Pose',
                GetObjectPoseState(object_frame='bin3_frame',
                                   ref_frame='arm1_linear_arm_actuator'),
                transitions={
                    'continue': 'PreBin3',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'pose': 'bin3_pose'})

            # x:1615 y:384
            OperatableStateMachine.add('CameraTopic',
                                       ReplaceState(),
                                       transitions={'done': 'CameraFrame'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'camera_topic4',
                                           'result': 'camera_topic'
                                       })

            # x:1644 y:217
            OperatableStateMachine.add('CameraFrame',
                                       ReplaceState(),
                                       transitions={'done': 'Overzetnee'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'camera_frame4',
                                           'result': 'camera_frame'
                                       })

            # x:1651 y:97
            OperatableStateMachine.add('Overzetnee',
                                       ReplaceState(),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'overzetnee',
                                           'result': 'overzet'
                                       })

            # x:170 y:444
            OperatableStateMachine.add('rod',
                                       EqualState(),
                                       transitions={
                                           'true': 'RepaceOffset_3',
                                           'false': 'RepaceOffset_4'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'part_type',
                                           'value_b': 'part3'
                                       })

            # x:73 y:289
            OperatableStateMachine.add('gasket',
                                       EqualState(),
                                       transitions={
                                           'true': 'RepaceOffset',
                                           'false': 'pulley'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'part_type',
                                           'value_b': 'part1'
                                       })

            # x:171 y:357
            OperatableStateMachine.add('pulley',
                                       EqualState(),
                                       transitions={
                                           'true': 'RepaceOffset_2',
                                           'false': 'rod'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'part_type',
                                           'value_b': 'part2'
                                       })

            # x:86 y:713
            OperatableStateMachine.add('rod_2',
                                       EqualState(),
                                       transitions={
                                           'true': 'RepaceOffset_7',
                                           'false': 'RepaceOffset_8'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'part_type',
                                           'value_b': 'part3'
                                       })

            # x:43 y:523
            OperatableStateMachine.add('gasket_2',
                                       EqualState(),
                                       transitions={
                                           'true': 'RepaceOffset_5',
                                           'false': 'pulley_2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'part_type',
                                           'value_b': 'part1'
                                       })

            # x:110 y:608
            OperatableStateMachine.add('pulley_2',
                                       EqualState(),
                                       transitions={
                                           'true': 'RepaceOffset_6',
                                           'false': 'rod_2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'part_type',
                                           'value_b': 'part2'
                                       })

            # x:451 y:287
            OperatableStateMachine.add('RepaceOffset',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset1',
                                           'result': 'part_offset'
                                       })

            # x:451 y:344
            OperatableStateMachine.add('RepaceOffset_2',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset2',
                                           'result': 'part_offset'
                                       })

            # x:450 y:402
            OperatableStateMachine.add('RepaceOffset_3',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset3',
                                           'result': 'part_offset'
                                       })

            # x:450 y:463
            OperatableStateMachine.add('RepaceOffset_4',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset4',
                                           'result': 'part_offset'
                                       })

            # x:452 y:557
            OperatableStateMachine.add('RepaceOffset_5',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset1',
                                           'result': 'part_offset'
                                       })

            # x:453 y:614
            OperatableStateMachine.add('RepaceOffset_6',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset2',
                                           'result': 'part_offset'
                                       })

            # x:453 y:674
            OperatableStateMachine.add('RepaceOffset_7',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset3',
                                           'result': 'part_offset'
                                       })

            # x:454 y:733
            OperatableStateMachine.add('RepaceOffset_8',
                                       ReplaceState(),
                                       transitions={'done': 'R1PreBin3_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'partoffset4',
                                           'result': 'part_offset'
                                       })

            # x:802 y:342
            OperatableStateMachine.add('R1PreBin3',
                                       ReplaceState(),
                                       transitions={'done': 'RefFrame'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_namer1',
                                           'result': 'config_name'
                                       })

            # x:958 y:342
            OperatableStateMachine.add('RefFrame',
                                       ReplaceState(),
                                       transitions={'done': 'MoveGroupPrefix'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'ref_frame1',
                                           'result': 'ref_frame'
                                       })

            # x:1115 y:342
            OperatableStateMachine.add('MoveGroupPrefix',
                                       ReplaceState(),
                                       transitions={'done': 'ArmID'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'move_group_prefix1',
                                           'result': 'move_group_prefix'
                                       })

            # x:1273 y:342
            OperatableStateMachine.add('ArmID',
                                       ReplaceState(),
                                       transitions={'done': 'CameraTopic'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'arm1_id',
                                           'result': 'arm_id'
                                       })

            # x:802 y:419
            OperatableStateMachine.add('R1PreBin3_2',
                                       ReplaceState(),
                                       transitions={'done': 'RefFrame_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_namer2',
                                           'result': 'config_name'
                                       })

            # x:958 y:419
            OperatableStateMachine.add(
                'RefFrame_2',
                ReplaceState(),
                transitions={'done': 'MoveGroupPrefix_2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'ref_frame2',
                    'result': 'ref_frame'
                })

            # x:1115 y:419
            OperatableStateMachine.add('MoveGroupPrefix_2',
                                       ReplaceState(),
                                       transitions={'done': 'ArmID_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'move_group_prefix2',
                                           'result': 'move_group_prefix'
                                       })

            # x:1273 y:419
            OperatableStateMachine.add('ArmID_2',
                                       ReplaceState(),
                                       transitions={'done': 'CameraTopic'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'arm2_id',
                                           'result': 'arm_id'
                                       })

            # x:397 y:93
            OperatableStateMachine.add(
                'Getbin3Pose_2',
                GetObjectPoseState(object_frame='bin3_frame',
                                   ref_frame='arm2_linear_arm_actuator'),
                transitions={
                    'continue': 'PreBin3',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'pose': 'bin3_pose'})

            # x:73 y:182
            OperatableStateMachine.add('PreBin4',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'gasket',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name4',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:17 y:343
            OperatableStateMachine.add('PreBin1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'gasket_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name1',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

        return _state_machine
    def create(self):
        # x:860 y:686, x:845 y:354
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['agv_id', 'part_pose_right', 'part_pose_left'])
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.agv1 = 'agv1'
        _state_machine.userdata.agv2 = 'agv2'
        _state_machine.userdata.Gantry_AGV1_right = 'Gantry_AGV1Right'
        _state_machine.userdata.move_group_right = 'Right_Arm'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.move_group_gantry = 'Gantry'
        _state_machine.userdata.PreGrasp_rightArm = 'Right_AGV'
        _state_machine.userdata.PreGrasp_leftArm = 'Left_AGV'
        _state_machine.userdata.tool_link_right = 'right_ee_link'
        _state_machine.userdata.tool_link_left = 'left_ee_link'
        _state_machine.userdata.offset = 0.115
        _state_machine.userdata.part_pose_right = ''
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.part_pose_left = ''
        _state_machine.userdata.arm_right = 'right_arm'
        _state_machine.userdata.arm_left = 'left_arm'
        _state_machine.userdata.Gantry_AGV1_left = 'Gantry_AGV1Left'
        _state_machine.userdata.move_group_left = 'Left_Arm'
        _state_machine.userdata.gantry_home = 'Gantry_Home'
        _state_machine.userdata.Home_right_arm = 'Right_PreGrasp'
        _state_machine.userdata.Home_left_arm = 'Left_PreGrasp'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:31 y:18
            OperatableStateMachine.add('Gantry_Home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'AGV1',
                                           'planning_failed': 'Retry',
                                           'control_failed': 'Retry',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'gantry_home',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:24 y:608
            OperatableStateMachine.add('AGV2',
                                       EqualState(),
                                       transitions={
                                           'true': 'GetAgv2Pose',
                                           'false': 'failed'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'agv_id',
                                           'value_b': 'agv2'
                                       })

            # x:254 y:615
            OperatableStateMachine.add('GetAgv2Pose',
                                       GetObjectPoseState(
                                           object_frame='kit_tray_2',
                                           ref_frame='Gantry'),
                                       transitions={
                                           'continue': 'finished',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'agv_pose'})

            # x:202 y:85
            OperatableStateMachine.add(
                'GetAgv1Pose',
                GetObjectPoseState(object_frame='kit_tray_1',
                                   ref_frame='world'),
                transitions={
                    'continue': 'PreDropTrayGantryRight',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'pose': 'agv_pose'})

            # x:351 y:86
            OperatableStateMachine.add('PreDropTrayGantryRight',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreDropTrayRightArm',
                                           'planning_failed': 'Retry_1',
                                           'control_failed': 'Retry_1',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'Gantry_AGV1_right',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:378 y:4
            OperatableStateMachine.add(
                'Retry_1',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayGantryRight'},
                autonomy={'done': Autonomy.Off})

            # x:531 y:89
            OperatableStateMachine.add('PreDropTrayRightArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputeDropPartPose',
                                           'planning_failed': 'Retry_2',
                                           'control_failed': 'Retry_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_rightArm',
                                           'move_group': 'move_group_right',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:553 y:6
            OperatableStateMachine.add(
                'Retry_2',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayRightArm'},
                autonomy={'done': Autonomy.Off})

            # x:690 y:92
            OperatableStateMachine.add(
                'ComputeDropPartPose',
                ComputeGraspPartOffsetAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToDrop',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_right',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_right',
                    'pose': 'agv_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'part_pose': 'part_pose_right',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:902 y:89
            OperatableStateMachine.add('MoveToDrop',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'GripperOff',
                                           'planning_failed': 'Retry_3',
                                           'control_failed': 'Retry_3'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_right',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:933 y:10
            OperatableStateMachine.add('Retry_3',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'MoveToDrop'},
                                       autonomy={'done': Autonomy.Off})

            # x:1086 y:86
            OperatableStateMachine.add('GripperOff',
                                       VacuumGripperControlState(enable=False),
                                       transitions={
                                           'continue': 'PreDropTrayRightArm_2',
                                           'failed': 'MoveToDrop',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_right'})

            # x:1267 y:87
            OperatableStateMachine.add('PreDropTrayRightArm_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached':
                                           'PreDropTrayRightArm_2_2',
                                           'planning_failed': 'Retry_4',
                                           'control_failed': 'Retry_4',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_rightArm',
                                           'move_group': 'move_group_right',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1291 y:8
            OperatableStateMachine.add(
                'Retry_4',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayRightArm_2'},
                autonomy={'done': Autonomy.Off})

            # x:1551 y:189
            OperatableStateMachine.add('PreDropTrayGantryLeft',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreDropTrayLeftArm',
                                           'planning_failed': 'Retry_5',
                                           'control_failed': 'Retry_5',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'Gantry_AGV1_left',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1555 y:266
            OperatableStateMachine.add('PreDropTrayLeftArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputeDropPartPose_2',
                                           'planning_failed': 'Retry_6',
                                           'control_failed': 'Retry_6',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_leftArm',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1518 y:345
            OperatableStateMachine.add(
                'ComputeDropPartPose_2',
                ComputeGraspPartOffsetAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToDrop_2',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_left',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_left',
                    'pose': 'agv_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'part_pose': 'part_pose_left',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1519 y:419
            OperatableStateMachine.add('MoveToDrop_2',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'GripperOff_2',
                                           'planning_failed': 'Retry_7',
                                           'control_failed': 'Retry_7'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_left',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1523 y:510
            OperatableStateMachine.add('GripperOff_2',
                                       VacuumGripperControlState(enable=False),
                                       transitions={
                                           'continue': 'PreDropTrayLeftArm_2',
                                           'failed': 'MoveToDrop_2',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_left'})

            # x:1542 y:606
            OperatableStateMachine.add('PreDropTrayLeftArm_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached':
                                           'PreDropTrayLeftArm_2_2_2',
                                           'planning_failed': 'Retry_8',
                                           'control_failed': 'Retry_8',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_leftArm',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1719 y:183
            OperatableStateMachine.add(
                'Retry_5',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayGantryLeft'},
                autonomy={'done': Autonomy.Off})

            # x:1720 y:264
            OperatableStateMachine.add(
                'Retry_6',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayLeftArm'},
                autonomy={'done': Autonomy.Off})

            # x:1715 y:416
            OperatableStateMachine.add('Retry_7',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'MoveToDrop_2'},
                                       autonomy={'done': Autonomy.Off})

            # x:1717 y:597
            OperatableStateMachine.add(
                'Retry_8',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayLeftArm_2'},
                autonomy={'done': Autonomy.Off})

            # x:207 y:9
            OperatableStateMachine.add('Retry',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'Gantry_Home'},
                                       autonomy={'done': Autonomy.Off})

            # x:25 y:157
            OperatableStateMachine.add('AGV1',
                                       EqualState(),
                                       transitions={
                                           'true': 'AttachedRight',
                                           'false': 'AGV2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'agv_id',
                                           'value_b': 'agv1'
                                       })

            # x:1462 y:93
            OperatableStateMachine.add('PreDropTrayRightArm_2_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Attached_Left',
                                           'planning_failed': 'Retry_9_2',
                                           'control_failed': 'Retry_9_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'Home_right_arm',
                                           'move_group': 'move_group_right',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1524 y:697
            OperatableStateMachine.add('PreDropTrayLeftArm_2_2_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Home_Gantry',
                                           'planning_failed': 'Retry_9',
                                           'control_failed': 'Retry_9',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'Home_left_arm',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1720 y:705
            OperatableStateMachine.add(
                'Retry_9',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayLeftArm_2_2_2'},
                autonomy={'done': Autonomy.Off})

            # x:1495 y:6
            OperatableStateMachine.add(
                'Retry_9_2',
                WaitState(wait_time=3),
                transitions={'done': 'PreDropTrayRightArm_2_2'},
                autonomy={'done': Autonomy.Off})

            # x:1124 y:654
            OperatableStateMachine.add('Home_Gantry',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'Retry_9_3',
                                           'control_failed': 'Retry_9_3',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'gantry_home',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1147 y:732
            OperatableStateMachine.add('Retry_9_3',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'Home_Gantry'},
                                       autonomy={'done': Autonomy.Off})

            # x:201 y:157
            OperatableStateMachine.add('AttachedRight',
                                       CheckGripperattached(),
                                       transitions={
                                           'True': 'TestMessagePositie1',
                                           'False': 'Home_Gantry',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'True': Autonomy.Off,
                                           'False': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_right'})

            # x:1671 y:94
            OperatableStateMachine.add('Attached_Left',
                                       CheckGripperattached(),
                                       transitions={
                                           'True': 'PreDropTrayGantryLeft',
                                           'False': 'Home_Gantry',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'True': Autonomy.Off,
                                           'False': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_left'})

            # x:199 y:253
            OperatableStateMachine.add(
                'TestMessagePositie1',
                MessageState(),
                transitions={'continue': 'GetAgv1Pose'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_pose_right'})

        return _state_machine
Пример #4
0
    def create(self):
        # x:70 y:501, x:515 y:301
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.part = 'gasket_part'
        _state_machine.userdata.offset = 0.1
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.move_group_prefix = '/ariac/arm1'
        _state_machine.userdata.config_name_home = 'home'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.config_name_bin3PreGrasp = 'bin3PreGrasp'
        _state_machine.userdata.config_name_tray1PreDrop = 'tray1PreDrop'
        _state_machine.userdata.camera_ref_frame = 'arm1_linear_arm_actuator'
        _state_machine.userdata.camera_topic = '/ariac/logical_camera_1'
        _state_machine.userdata.camera_frame = 'logical_camera_1_frame'
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.agv_pose = []
        _state_machine.userdata.part_offset = 0.035
        _state_machine.userdata.part_rotation = 0
        _state_machine.userdata.conveyor_belt_power = 100.0

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:20 y:140
            OperatableStateMachine.add(
                'StartAssignment',
                StartAssignment(),
                transitions={'continue': 'SetConveyorbeltPower'},
                autonomy={'continue': Autonomy.Off})

            # x:909 y:288
            OperatableStateMachine.add('WachtEven',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'MoveR1PreGrasp2'},
                                       autonomy={'done': Autonomy.Off})

            # x:746 y:427
            OperatableStateMachine.add(
                'GetAgvPose',
                GetObjectPoseState(object_frame='kit_tray_1',
                                   ref_frame='arm1_linear_arm_actuator'),
                transitions={
                    'continue': 'ComuteDorp',
                    'failed': 'ComuteDorp'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'pose': 'agv_pose'})

            # x:373 y:13
            OperatableStateMachine.add('WaitRetry1',
                                       WaitState(wait_time=5),
                                       transitions={'done': 'MoveR1Home'},
                                       autonomy={'done': Autonomy.Off})

            # x:755 y:14
            OperatableStateMachine.add('WaitRetry2',
                                       WaitState(wait_time=5),
                                       transitions={'done': 'MoveR1PreGrasp1'},
                                       autonomy={'done': Autonomy.Off})

            # x:1107 y:222
            OperatableStateMachine.add('WaitRetry3',
                                       WaitState(wait_time=5),
                                       transitions={'done': 'MoveR1ToPick1'},
                                       autonomy={'done': Autonomy.Off})

            # x:1104 y:355
            OperatableStateMachine.add('WaitRetry4',
                                       WaitState(wait_time=5),
                                       transitions={'done': 'MoveR1PreGrasp2'},
                                       autonomy={'done': Autonomy.Off})

            # x:383 y:523
            OperatableStateMachine.add('WaitRetry6',
                                       WaitState(wait_time=5),
                                       transitions={'done': 'MoveR1ToDrop'},
                                       autonomy={'done': Autonomy.Off})

            # x:1104 y:430
            OperatableStateMachine.add('WaitRetry5',
                                       WaitState(wait_time=5),
                                       transitions={'done': 'MoveR1PreDrop'},
                                       autonomy={'done': Autonomy.Off})

            # x:158 y:420
            OperatableStateMachine.add('DeliverShipment',
                                       self.use_behavior(
                                           notify_shipment_readySM,
                                           'DeliverShipment'),
                                       transitions={
                                           'finished': 'EndAssignment',
                                           'failed': 'ComuteDorp'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:733 y:148
            OperatableStateMachine.add('MoveR1PreGrasp1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComutePick',
                                           'planning_failed': 'WaitRetry2',
                                           'control_failed': 'WaitRetry2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin3PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:910 y:355
            OperatableStateMachine.add('MoveR1PreGrasp2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'MoveR1PreDrop',
                                           'planning_failed': 'WaitRetry4',
                                           'control_failed': 'WaitRetry4',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin3PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:913 y:428
            OperatableStateMachine.add('MoveR1PreDrop',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'GetAgvPose',
                                           'planning_failed': 'WaitRetry5',
                                           'control_failed': 'WaitRetry5',
                                           'param_error': 'ComuteDorp'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_tray1PreDrop',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:908 y:220
            OperatableStateMachine.add('MoveR1ToPick1',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'WachtEven',
                                           'planning_failed': 'WaitRetry3',
                                           'control_failed': 'WaitRetry3'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:349 y:422
            OperatableStateMachine.add('MoveR1ToDrop',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'DeliverShipment',
                                           'planning_failed': 'WaitRetry6',
                                           'control_failed': 'WaitRetry6'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:526 y:146
            OperatableStateMachine.add(
                'DetectCameraPart',
                DetectPartCameraAriacState(time_out=5.0),
                transitions={
                    'continue': 'MoveR1PreGrasp1',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part',
                    'pose': 'pose'
                })

            # x:908 y:148
            OperatableStateMachine.add(
                'ComutePick',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveR1ToPick1',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:539 y:424
            OperatableStateMachine.add(
                'ComuteDorp',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveR1ToDrop',
                    'failed': 'MoveR1ToDrop'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'agv_pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:353 y:143
            OperatableStateMachine.add('MoveR1Home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DetectCameraPart',
                                           'planning_failed': 'WaitRetry1',
                                           'control_failed': 'WaitRetry1',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:28 y:422
            OperatableStateMachine.add('EndAssignment',
                                       EndAssignment(),
                                       transitions={'continue': 'finished'},
                                       autonomy={'continue': Autonomy.Off})

            # x:165 y:144
            OperatableStateMachine.add(
                'SetConveyorbeltPower',
                SetConveyorbeltPowerState(),
                transitions={
                    'continue': 'MoveR1Home',
                    'fail': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'fail': Autonomy.Off
                },
                remapping={'power': 'conveyor_belt_power'})

        return _state_machine
Пример #5
0
    def create(self):
        # x:884 y:573, x:130 y:365
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.arm_id = 'Left_Arm'
        _state_machine.userdata.offset = 0.021
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = '/ariac/logical_camera_stock1'
        _state_machine.userdata.camera_frame = 'logical_camera_stock1_frame'
        _state_machine.userdata.home = 'Gantry_Home'
        _state_machine.userdata.part = 'piston_rod_part_red'
        _state_machine.userdata.full_home = 'Full_Home'
        _state_machine.userdata.clearance = 0.05
        _state_machine.userdata.bin = 'Gantry_Bin_Red'
        _state_machine.userdata.bin_pose = []
        _state_machine.userdata.binOffset = -1
        _state_machine.userdata.one = 1

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:102 y:30
            OperatableStateMachine.add('Move_Bin',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Get_Object_Place',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'bin',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:312 y:27
            OperatableStateMachine.add('Compute_Place',
                                       ComputeDropPart(),
                                       transitions={
                                           'continue': 'Move_To_Place',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'binOffset': 'binOffset',
                                           'bin_pose': 'bin_pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:698 y:26
            OperatableStateMachine.add('Gripper_Off',
                                       GripperControl(enable=False),
                                       transitions={
                                           'continue': 'Add_Clearance',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:842 y:232
            OperatableStateMachine.add('Move_Clear',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Move_Home',
                                           'planning_failed': 'Move_Home',
                                           'control_failed': 'Move_Clear'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:844 y:24
            OperatableStateMachine.add('Add_Clearance',
                                       AddNumericState(),
                                       transitions={'done': 'Compute_Place_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'clearance',
                                           'value_b': 'offset',
                                           'result': 'offset'
                                       })

            # x:846 y:330
            OperatableStateMachine.add('Move_Home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'AddPart',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'full_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:482 y:20
            OperatableStateMachine.add('Move_To_Place',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripper_Off',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Gripper_Off'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:68 y:266
            OperatableStateMachine.add('Get_Object_Place',
                                       GetObjectPoseState(
                                           object_frame='bin5_frame',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'Offset',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'bin_pose'})

            # x:854 y:117
            OperatableStateMachine.add('Compute_Place_2',
                                       ComputeDropPart(),
                                       transitions={
                                           'continue': 'Move_Clear',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'binOffset': 'binOffset',
                                           'bin_pose': 'bin_pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:220 y:154
            OperatableStateMachine.add('Offset',
                                       part_offsetCalc(),
                                       transitions={
                                           'succes': 'Compute_Place',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'part_offset': 'offset'
                                       })

            # x:815 y:435
            OperatableStateMachine.add('AddPart',
                                       AddNumericState(),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'binOffset',
                                           'value_b': 'one',
                                           'result': 'binOffset'
                                       })

        return _state_machine
Пример #6
0
    def create(self):
        # x:811 y:574, x:283 y:395
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'move_group_prefix', 'part_type', 'bin', 'camera_topic',
                'camera_frame', 'agv_id', 'ref_frame'
            ])
        _state_machine.userdata.agv_id = []
        _state_machine.userdata.part_type = []
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.move_group_prefix = []
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.bin = []
        _state_machine.userdata.camera_topic = []
        _state_machine.userdata.camera_frame = []
        _state_machine.userdata.ref_frame = []
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.arm_id = ''
        _state_machine.userdata.config_name_home = 'home'
        _state_machine.userdata.pose = []
        _state_machine.userdata.part_offset = 0.08
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.agv1 = 'agv1'
        _state_machine.userdata.bin3 = 'transferBin3'
        _state_machine.userdata.bin4 = 'transferBin4'
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:30 y:40
            OperatableStateMachine.add('MoveToHome',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ArmId',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:306 y:28
            OperatableStateMachine.add('MoveToBin',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DetectPartPose',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'bin',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:453 y:26
            OperatableStateMachine.add(
                'DetectPartPose',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'ComputeGrasp',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'pose'
                })

            # x:659 y:29
            OperatableStateMachine.add(
                'ComputeGrasp',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPart',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:177 y:27
            OperatableStateMachine.add('PartOffset',
                                       part_offsetCalc(),
                                       transitions={
                                           'succes': 'MoveToBin',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'part_offset': 'part_offset'
                                       })

            # x:825 y:30
            OperatableStateMachine.add('MoveToPart',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'EnableGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'EnableGripper'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1033 y:60
            OperatableStateMachine.add('EnableGripper',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'agv1?',
                                           'failed': 'MoveToPart',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1012 y:345
            OperatableStateMachine.add('MoveToTransferBin',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DisableGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'bin',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1018 y:130
            OperatableStateMachine.add('agv1?',
                                       EqualState(),
                                       transitions={
                                           'true': 'bin4',
                                           'false': 'bin3'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'agv1',
                                           'value_b': 'agv_id'
                                       })

            # x:880 y:207
            OperatableStateMachine.add('bin3',
                                       ReplaceState(),
                                       transitions={'done': 'MoveToHome_3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'bin3',
                                           'result': 'bin'
                                       })

            # x:880 y:273
            OperatableStateMachine.add('bin4',
                                       ReplaceState(),
                                       transitions={'done': 'MoveToHome_3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'bin4',
                                           'result': 'bin'
                                       })

            # x:1034 y:438
            OperatableStateMachine.add('DisableGripper',
                                       GripperControl(enable=False),
                                       transitions={
                                           'continue': 'MoveToHome_2',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:942 y:514
            OperatableStateMachine.add('MoveToHome_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1074 y:235
            OperatableStateMachine.add('MoveToHome_3',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'MoveToTransferBin',
                                           'planning_failed': 'failed',
                                           'control_failed': 'MoveToHome_3',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:30 y:102
            OperatableStateMachine.add('ArmId',
                                       chooseArmID(),
                                       transitions={
                                           'continue': 'PartOffset',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'arm_id': 'arm_id'
                                       })

        return _state_machine
    def create(self):
        # x:27 y:469, x:793 y:325
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['pose_on_agv', 'part_type'],
            output_keys=['pose_on_agv_l', 'pose_on_agv_r'])
        _state_machine.userdata.powerOn = 100
        _state_machine.userdata.config_name = ''
        _state_machine.userdata.move_group = 'Gantry'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = 'gantry'
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.tool_link_r = 'right_ee_link'
        _state_machine.userdata.pose = ''
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.move_groupR = 'Right_Arm'
        _state_machine.userdata.arm_id_r = 'Right_Arm'
        _state_machine.userdata.Grasp5 = 'bingr5Grasp'
        _state_machine.userdata.arm_id_l = 'Left_Arm'
        _state_machine.userdata.move_groupL = 'Left_Arm'
        _state_machine.userdata.tool_link_l = 'left_ee_link'
        _state_machine.userdata.pose_on_agv = []
        _state_machine.userdata.pose_on_agv_l = []
        _state_machine.userdata.pose_on_agv_r = []

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:204 y:22
            OperatableStateMachine.add('move_home_pick',
                                       self.use_behavior(
                                           move_home_pickSM, 'move_home_pick'),
                                       transitions={
                                           'finished': 'Find_product_location',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:660 y:108
            OperatableStateMachine.add('move_gantry_bin_gr1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'move_gantry_bin_gr1_2',
                                           'planning_failed': 'Waitretry',
                                           'control_failed': 'Waitretry',
                                           'param_error': 'Waitretry'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'bin',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:471 y:43
            OperatableStateMachine.add('Find_product_location',
                                       FindCorrectBin(time_out=0.5),
                                       transitions={
                                           'continue': 'move_gantry_bin_gr1',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'bin': 'bin',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame',
                                           'ref_frame': 'ref_frame'
                                       })

            # x:1089 y:258
            OperatableStateMachine.add(
                'compute_pick _r',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move to pick',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_groupR',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_r',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1096 y:74
            OperatableStateMachine.add(
                'find part',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Offset bepalen',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'pose'
                })

            # x:1300 y:88
            OperatableStateMachine.add('Offset bepalen',
                                       DecideOffsetProduct(target_time=0.5),
                                       transitions={
                                           'succes': 'gripper check',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'part_offset': 'part_offset'
                                       })

            # x:1024 y:463
            OperatableStateMachine.add('Gripper_enable',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'pose safe r',
                                           'failed': 'Move to pick',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id_r'})

            # x:648 y:701
            OperatableStateMachine.add('move_home_robot_r',
                                       self.use_behavior(
                                           move_home_robot_rSM,
                                           'move_home_robot_r'),
                                       transitions={
                                           'finished': 'finished',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:1064 y:360
            OperatableStateMachine.add('Move to pick',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripper_enable',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Gripper_enable'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_groupR',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:870 y:107
            OperatableStateMachine.add('move_gantry_bin_gr1_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'find part',
                                           'planning_failed': 'Waitretry_2',
                                           'control_failed': 'Waitretry_2',
                                           'param_error': 'Waitretry_2'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'Grasp5',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:882 y:10
            OperatableStateMachine.add(
                'Waitretry_2',
                WaitState(wait_time=2),
                transitions={'done': 'move_gantry_bin_gr1_2'},
                autonomy={'done': Autonomy.Off})

            # x:686 y:12
            OperatableStateMachine.add(
                'Waitretry',
                WaitState(wait_time=2),
                transitions={'done': 'move_gantry_bin_gr1'},
                autonomy={'done': Autonomy.Off})

            # x:1306 y:173
            OperatableStateMachine.add('gripper check',
                                       GripperActiveCheck(),
                                       transitions={
                                           'Left': 'compute_pick _l',
                                           'Right': 'compute_pick _r',
                                           'failed': 'failed',
                                           'Full': 'move_home_pick'
                                       },
                                       autonomy={
                                           'Left': Autonomy.Off,
                                           'Right': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'Full': Autonomy.Off
                                       },
                                       remapping={
                                           'arm_id': 'arm_id',
                                           'tool_link': 'tool_link',
                                           'move_group': 'move_group'
                                       })

            # x:1527 y:231
            OperatableStateMachine.add(
                'compute_pick _l',
                ComputeGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move to pick_l',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_groupL',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_l',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1573 y:425
            OperatableStateMachine.add('Gripper_enable_2',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'pose safe l',
                                           'failed': 'Move to pick_l',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id_l'})

            # x:1530 y:319
            OperatableStateMachine.add('Move to pick_l',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripper_enable_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Gripper_enable_2'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_groupL',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:865 y:537
            OperatableStateMachine.add(
                'pose safe r',
                ReplaceState(),
                transitions={'done': 'move_home_robot_r'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'pose_on_agv',
                    'result': 'pose_on_agv_r'
                })

            # x:1502 y:553
            OperatableStateMachine.add(
                'pose safe l',
                ReplaceState(),
                transitions={'done': 'move_home_robot_r'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'pose_on_agv',
                    'result': 'pose_on_agv_l'
                })

        return _state_machine
    def create(self):
        # x:1089 y:770, x:1143 y:423, x:1266 y:674
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed', 'end'],
            input_keys=[
                'move_group_prefix', 'move_group_right_arm',
                'move_group_left_arm', 'action_topic', 'camera_frame',
                'camera_topic', 'ref_frame', 'move_group_gantry', 'robot_name',
                'offset_var_left', 'offset_var_right', 'offset_gasket',
                'offset_piston', 'arm_idL', 'arm_idR',
                'config_name_Right_Home', 'config_name_Left_Home',
                'config_name_RA_pre', 'config_name_LA_pre'
            ])
        _state_machine.userdata.move_group_prefix = ''
        _state_machine.userdata.move_group_right_arm = ''
        _state_machine.userdata.move_group_left_arm = ''
        _state_machine.userdata.action_topic = ''
        _state_machine.userdata.camera_frame = '/ariac/logical_camera_0'
        _state_machine.userdata.camera_topic = 'logical_camera_0_frame'
        _state_machine.userdata.ref_frame = ''
        _state_machine.userdata.move_group_gantry = ''
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.offset_var_left = 0
        _state_machine.userdata.offset_var_right = 0
        _state_machine.userdata.offset_gasket = 0
        _state_machine.userdata.offset_piston = 0
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.tool_link_left = 'left_ee_link'
        _state_machine.userdata.tool_link_right = 'right_ee_link'
        _state_machine.userdata.arm_idL = ''
        _state_machine.userdata.arm_idR = ''
        _state_machine.userdata.config_name_Right_Home = ''
        _state_machine.userdata.config_name_Left_Home = ''
        _state_machine.userdata.pose = ''
        _state_machine.userdata.bin_id = ''
        _state_machine.userdata.bin1 = 'bin1'
        _state_machine.userdata.bin2 = 'bin2'
        _state_machine.userdata.offset_id = 0
        _state_machine.userdata.arm_id = ''
        _state_machine.userdata.config_name_R_bin1 = 'Gantry_PreGrasp_R_bin1'
        _state_machine.userdata.config_name_L_bin1 = 'Gantry_PreGrasp_L_bin1'
        _state_machine.userdata.config_name_bin1_var = ''
        _state_machine.userdata.config_name_RA_pre = ''
        _state_machine.userdata.config_name_LA_pre = ''
        _state_machine.userdata.offsetx_bin1 = 0
        _state_machine.userdata.offsety_bin1 = 0
        _state_machine.userdata.offsetx_set = 0.33418
        _state_machine.userdata.offsety_set = 0.1827866667
        _state_machine.userdata.plus1 = 1
        _state_machine.userdata.xproduct_bin1 = 0
        _state_machine.userdata.yproduct_bin1 = 0
        _state_machine.userdata.drie = 3
        _state_machine.userdata.twee = 2
        _state_machine.userdata.zero = 0
        _state_machine.userdata.offsety_bin2 = 0
        _state_machine.userdata.offsetx_bin2 = 0
        _state_machine.userdata.yproduct_bin2 = 0
        _state_machine.userdata.xproduct_bin2 = 0

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        # x:1623 y:384, x:886 y:382, x:1759 y:258
        _sm_offset_verschuiven_0 = OperatableStateMachine(
            outcomes=['finished', 'failed', 'end'],
            input_keys=[
                'bin_id', 'bin1', 'zero', 'twee', 'drie', 'bin2',
                'offsetx_set', 'offsety_set', 'plus1', 'offsetx_bin1',
                'offsety_bin2', 'offsetx_bin2', 'offsety_bin1',
                'xproduct_bin1', 'yproduct_bin1', 'xproduct_bin2',
                'yproduct_bin2'
            ],
            output_keys=[
                'offsety_bin2', 'offsetx_bin2', 'offsety_bin1', 'offsetx_bin1'
            ])

        with _sm_offset_verschuiven_0:
            # x:146 y:40
            OperatableStateMachine.add('bin1 vergelijk',
                                       EqualState(),
                                       transitions={
                                           'true': 'set offsetyyy',
                                           'false': 'set offsetyy'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'bin1',
                                           'value_b': 'bin_id'
                                       })

            # x:610 y:50
            OperatableStateMachine.add(
                'x producten tellen',
                AddNumericState(),
                transitions={'done': '3 products x bin?'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'xproduct_bin1',
                    'value_b': 'plus1',
                    'result': 'xproduct_bin1'
                })

            # x:818 y:45
            OperatableStateMachine.add('3 products x bin?',
                                       EqualState(),
                                       transitions={
                                           'true': 'set offsety',
                                           'false': 'finished'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'xproduct_bin1',
                                           'value_b': 'drie'
                                       })

            # x:1069 y:54
            OperatableStateMachine.add(
                'set offsety',
                ReplaceState(),
                transitions={'done': 'set offsety back to zero'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offsetx_set',
                    'result': 'offsety_bin1'
                })

            # x:1263 y:51
            OperatableStateMachine.add('set offsety back to zero',
                                       ReplaceState(),
                                       transitions={'done': '2 products x?'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero',
                                           'result': 'offsety_bin1'
                                       })

            # x:1471 y:55
            OperatableStateMachine.add('2 products x?',
                                       EqualState(),
                                       transitions={
                                           'true': 'st offsetx back to zero',
                                           'false': 'finished'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'twee',
                                           'value_b': 'xproduct_bin1'
                                       })

            # x:389 y:38
            OperatableStateMachine.add(
                'set offsetyyy',
                AddNumericState(),
                transitions={'done': 'x producten tellen'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'offsety_set',
                    'value_b': 'offsetx_bin1',
                    'result': 'offsetx_bin1'
                })

            # x:610 y:161
            OperatableStateMachine.add(
                'y producten tellen_2',
                AddNumericState(),
                transitions={'done': '3 products y bin2?'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'yproduct_bin2',
                    'value_b': 'plus1',
                    'result': 'yproduct_bin2'
                })

            # x:818 y:152
            OperatableStateMachine.add('3 products y bin2?',
                                       EqualState(),
                                       transitions={
                                           'true': 'set offsety_2',
                                           'false': 'finished'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'yproduct_bin2',
                                           'value_b': 'drie'
                                       })

            # x:1066 y:165
            OperatableStateMachine.add(
                'set offsety_2',
                ReplaceState(),
                transitions={'done': 'set offsety back to zero_2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offsetx_set',
                    'result': 'offsetx_bin2'
                })

            # x:1263 y:176
            OperatableStateMachine.add(
                'set offsety back to zero_2',
                ReplaceState(),
                transitions={'done': '2 products x bin2?'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'zero',
                    'result': 'offsety_bin2'
                })

            # x:1472 y:149
            OperatableStateMachine.add('2 products x bin2?',
                                       EqualState(),
                                       transitions={
                                           'true':
                                           'set offsetx back to zero bin2',
                                           'false': 'finished'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'twee',
                                           'value_b': 'xproduct_bin2'
                                       })

            # x:389 y:152
            OperatableStateMachine.add(
                'set offsetyy',
                AddNumericState(),
                transitions={'done': 'y producten tellen_2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'offsety_set',
                    'value_b': 'offsety_bin2',
                    'result': 'offsety_bin2'
                })

            # x:1651 y:50
            OperatableStateMachine.add('st offsetx back to zero',
                                       ReplaceState(),
                                       transitions={'done': 'end'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero',
                                           'result': 'offsetx_bin1'
                                       })

            # x:1653 y:146
            OperatableStateMachine.add('set offsetx back to zero bin2',
                                       ReplaceState(),
                                       transitions={'done': 'end'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero',
                                           'result': 'offsetx_bin2'
                                       })

        # x:30 y:401, x:130 y:401
        _sm_setten_voor_right_1 = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'arm_idR', 'move_group_right_arm', 'config_name_Right_Home',
                'tool_link_right', 'config_name_RA_pre', 'offset_var_right'
            ],
            output_keys=[
                'arm_id_var', 'move_group_var', 'config_name_var',
                'tool_link_var', 'config_name_pre_var', 'offset_id'
            ])

        with _sm_setten_voor_right_1:
            # x:30 y:40
            OperatableStateMachine.add('Set arm id',
                                       ReplaceState(),
                                       transitions={'done': 'Set config name'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'arm_idR',
                                           'result': 'arm_id_var'
                                       })

            # x:30 y:117
            OperatableStateMachine.add('Set config name',
                                       ReplaceState(),
                                       transitions={'done': 'Set toollink'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_name_Right_Home',
                                           'result': 'config_name_var'
                                       })

            # x:30 y:194
            OperatableStateMachine.add('Set toollink',
                                       ReplaceState(),
                                       transitions={'done': 'Set move group'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'tool_link_right',
                                           'result': 'tool_link_var'
                                       })

            # x:30 y:271
            OperatableStateMachine.add(
                'Set move group',
                ReplaceState(),
                transitions={'done': 'Set config name_2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'move_group_right_arm',
                    'result': 'move_group_var'
                })

            # x:230 y:266
            OperatableStateMachine.add(
                'Set config name_2',
                ReplaceState(),
                transitions={'done': 'set config pre pick'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offset_var_right',
                    'result': 'offset_id'
                })

            # x:233 y:344
            OperatableStateMachine.add('laat zien',
                                       MessageState(),
                                       transitions={'continue': 'finished'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'move_group_var'})

            # x:438 y:268
            OperatableStateMachine.add('set config pre pick',
                                       ReplaceState(),
                                       transitions={'done': 'laat zien'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_name_RA_pre',
                                           'result': 'config_name_pre_var'
                                       })

        # x:30 y:401
        _sm_setten_voor_left_2 = OperatableStateMachine(
            outcomes=['finished'],
            input_keys=[
                'arm_idL', 'move_group_left_arm', 'config_name_Left_Home',
                'tool_link_left', 'config_name_LA_pre', 'offset_var_left'
            ],
            output_keys=[
                'arm_id_var', 'move_group_var', 'config_name_var',
                'tool_link_var', 'config_name_pre_var', 'offset_id'
            ])

        with _sm_setten_voor_left_2:
            # x:30 y:40
            OperatableStateMachine.add('Set arm id',
                                       ReplaceState(),
                                       transitions={'done': 'Set config name'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'arm_idL',
                                           'result': 'arm_id_var'
                                       })

            # x:30 y:117
            OperatableStateMachine.add('Set config name',
                                       ReplaceState(),
                                       transitions={'done': 'Set toollink'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_name_Left_Home',
                                           'result': 'config_name_var'
                                       })

            # x:30 y:194
            OperatableStateMachine.add('Set toollink',
                                       ReplaceState(),
                                       transitions={'done': 'Set move group'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'tool_link_left',
                                           'result': 'tool_link_var'
                                       })

            # x:30 y:271
            OperatableStateMachine.add('Set move group',
                                       ReplaceState(),
                                       transitions={'done': 'Set offset'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'move_group_left_arm',
                                           'result': 'move_group_var'
                                       })

            # x:397 y:386
            OperatableStateMachine.add('laat zien',
                                       MessageState(),
                                       transitions={'continue': 'finished'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'move_group_var'})

            # x:383 y:274
            OperatableStateMachine.add('set config name pre pick',
                                       ReplaceState(),
                                       transitions={'done': 'laat zien'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_name_LA_pre',
                                           'result': 'config_name_pre_var'
                                       })

            # x:209 y:266
            OperatableStateMachine.add(
                'Set offset',
                ReplaceState(),
                transitions={'done': 'set config name pre pick'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offset_var_left',
                    'result': 'offset_id'
                })

        with _state_machine:
            # x:97 y:17
            OperatableStateMachine.add(
                'Setten voor Left',
                _sm_setten_voor_left_2,
                transitions={'finished': 'Left product'},
                autonomy={'finished': Autonomy.Inherit},
                remapping={
                    'arm_idL': 'arm_idL',
                    'move_group_left_arm': 'move_group_left_arm',
                    'config_name_Left_Home': 'config_name_Left_Home',
                    'tool_link_left': 'tool_link_left',
                    'config_name_LA_pre': 'config_name_LA_pre',
                    'offset_var_left': 'offset_var_left',
                    'arm_id_var': 'arm_id_var',
                    'move_group_var': 'move_group_var',
                    'config_name_var': 'config_name_var',
                    'tool_link_var': 'tool_link_var',
                    'config_name_pre_var': 'config_name_pre_var',
                    'offset_id': 'offset_id'
                })

            # x:190 y:708
            OperatableStateMachine.add(
                'Setten voor Right',
                _sm_setten_voor_right_1,
                transitions={
                    'finished': 'Right product',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={
                    'arm_idR': 'arm_idR',
                    'move_group_right_arm': 'move_group_right_arm',
                    'config_name_Right_Home': 'config_name_Right_Home',
                    'tool_link_right': 'tool_link_right',
                    'config_name_RA_pre': 'config_name_RA_pre',
                    'offset_var_right': 'offset_var_right',
                    'arm_id_var': 'arm_id_var',
                    'move_group_var': 'move_group_var',
                    'config_name_var': 'config_name_var',
                    'tool_link_var': 'tool_link_var',
                    'config_name_pre_var': 'config_name_pre_var',
                    'offset_id': 'offset_id'
                })

            # x:77 y:172
            OperatableStateMachine.add('Left product',
                                       EqualState(),
                                       transitions={
                                           'true': 'bin1',
                                           'false': 'bin2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'offset_gasket',
                                           'value_b': 'offset_id'
                                       })

            # x:311 y:29
            OperatableStateMachine.add('bin1',
                                       ReplaceState(),
                                       transitions={'done': 'Zie bin1_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'bin1',
                                           'result': 'bin_id'
                                       })

            # x:300 y:252
            OperatableStateMachine.add('bin2',
                                       ReplaceState(),
                                       transitions={'done': 'Zie bin1_2_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'bin2',
                                           'result': 'bin_id'
                                       })

            # x:116 y:534
            OperatableStateMachine.add('Right product',
                                       EqualState(),
                                       transitions={
                                           'true': 'bin1_2',
                                           'false': 'bin2_2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'offset_gasket',
                                           'value_b': 'offset_id'
                                       })

            # x:1673 y:531
            OperatableStateMachine.add('turn off vacuum',
                                       VacuumGripperControlState(enable=False),
                                       transitions={
                                           'continue': 'Move to home',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id_var'})

            # x:299 y:610
            OperatableStateMachine.add('bin1_2',
                                       ReplaceState(),
                                       transitions={'done': 'Zie bin1'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'bin1',
                                           'result': 'bin_id'
                                       })

            # x:294 y:377
            OperatableStateMachine.add('bin2_2',
                                       ReplaceState(),
                                       transitions={'done': 'Zie bin2_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'bin2',
                                           'result': 'bin_id'
                                       })

            # x:731 y:21
            OperatableStateMachine.add('gantry bin pose',
                                       ReplaceState(),
                                       transitions={'done': 'Move to bin'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_name_L_bin1',
                                           'result': 'config_name_bin1_var'
                                       })

            # x:722 y:342
            OperatableStateMachine.add('gantry bin pose_2',
                                       ReplaceState(),
                                       transitions={'done': 'Move to bin'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'config_name_R_bin1',
                                           'result': 'config_name_bin1_var'
                                       })

            # x:1691 y:675
            OperatableStateMachine.add('Move to home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Offset verschuiven',
                                           'planning_failed': 'retry_4',
                                           'control_failed': 'retry_4',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_var',
                                           'move_group': 'move_group_var',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:987 y:701
            OperatableStateMachine.add('Right robot end',
                                       EqualState(),
                                       transitions={
                                           'true': 'finished',
                                           'false': 'Setten voor Right'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'move_group_right_arm',
                                           'value_b': 'move_group_var'
                                       })

            # x:954 y:146
            OperatableStateMachine.add('retry',
                                       WaitState(wait_time=0.1),
                                       transitions={'done': 'Move to bin'},
                                       autonomy={'done': Autonomy.Off})

            # x:1578 y:610
            OperatableStateMachine.add('retry_4',
                                       WaitState(wait_time=0.1),
                                       transitions={'done': 'Move to home'},
                                       autonomy={'done': Autonomy.Off})

            # x:956 y:21
            OperatableStateMachine.add('Move to bin',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Check for bin',
                                           'planning_failed': 'retry',
                                           'control_failed': 'retry',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin1_var',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1691 y:248
            OperatableStateMachine.add(
                'Computebin right',
                ComputeDropBinsState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move to drop',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_var',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_var',
                    'pose': 'pose',
                    'offset': 'offset_id',
                    'rotation': 'rotation',
                    'offsety': 'offsety',
                    'offsetx': 'offsetx',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1550 y:336
            OperatableStateMachine.add(
                'Computebin left',
                ComputeDropBinsState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move to drop',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_var',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_var',
                    'pose': 'pose',
                    'offset': 'offset_id',
                    'rotation': 'rotation',
                    'offsety': 'offsety',
                    'offsetx': 'offsetx',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:516 y:599
            OperatableStateMachine.add('Zie bin1',
                                       GetObjectPoseState(
                                           object_frame='bin1_frame',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'gantry bin pose_2',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'pose'})

            # x:529 y:34
            OperatableStateMachine.add('Zie bin1_2',
                                       GetObjectPoseState(
                                           object_frame='bin1_frame',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'gantry bin pose',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'pose'})

            # x:534 y:239
            OperatableStateMachine.add('Zie bin1_2_2',
                                       GetObjectPoseState(
                                           object_frame='bin2_frame',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'gantry bin pose_2',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'pose'})

            # x:523 y:373
            OperatableStateMachine.add('Zie bin2_2',
                                       GetObjectPoseState(
                                           object_frame='bin2_frame',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'gantry bin pose',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'pose'})

            # x:1668 y:30
            OperatableStateMachine.add('Right robot end_2',
                                       EqualState(),
                                       transitions={
                                           'true': 'Computebin right',
                                           'false': 'Computebin left'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'move_group_right_arm',
                                           'value_b': 'move_group_var'
                                       })

            # x:1657 y:420
            OperatableStateMachine.add('Move to drop',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'turn off vacuum',
                                           'planning_failed': 'failed',
                                           'control_failed': 'turn off vacuum'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_var',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1428 y:672
            OperatableStateMachine.add('Offset verschuiven',
                                       _sm_offset_verschuiven_0,
                                       transitions={
                                           'finished': 'Right robot end',
                                           'failed': 'failed',
                                           'end': 'end'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit,
                                           'end': Autonomy.Inherit
                                       },
                                       remapping={
                                           'bin_id': 'bin_id',
                                           'bin1': 'bin1',
                                           'zero': 'zero',
                                           'twee': 'twee',
                                           'drie': 'drie',
                                           'bin2': 'bin2',
                                           'offsetx_set': 'offsetx_set',
                                           'offsety_set': 'offsety_set',
                                           'plus1': 'plus1',
                                           'offsetx_bin1': 'offsetx_bin1',
                                           'offsety_bin2': 'offsety_bin2',
                                           'offsetx_bin2': 'offsetx_bin2',
                                           'offsety_bin1': 'offsety_bin1',
                                           'xproduct_bin1': 'xproduct_bin1',
                                           'yproduct_bin1': 'yproduct_bin1',
                                           'xproduct_bin2': 'xproduct_bin2',
                                           'yproduct_bin2': 'yproduct_bin2'
                                       })

            # x:1156 y:3
            OperatableStateMachine.add('Check for bin',
                                       EqualState(),
                                       transitions={
                                           'true': 'set offset voor bin 1',
                                           'false': 'set offset voor bin 2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'bin1',
                                           'value_b': 'bin_id'
                                       })

            # x:1406 y:0
            OperatableStateMachine.add(
                'set offset voor bin 1',
                ReplaceState(),
                transitions={'done': 'set offset voor y bin 1'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offsetx_bin1',
                    'result': 'offsetx'
                })

            # x:1441 y:64
            OperatableStateMachine.add(
                'set offset voor y bin 1',
                ReplaceState(),
                transitions={'done': 'Right robot end_2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offsety_bin1',
                    'result': 'offsety'
                })

            # x:1236 y:110
            OperatableStateMachine.add(
                'set offset voor bin 2',
                ReplaceState(),
                transitions={'done': 'set offset voor y bin 2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offsetx_bin2',
                    'result': 'offsetx'
                })

            # x:1425 y:141
            OperatableStateMachine.add(
                'set offset voor y bin 2',
                ReplaceState(),
                transitions={'done': 'Right robot end_2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'offsety_bin2',
                    'result': 'offsety'
                })

        return _state_machine
Пример #9
0
    def create(self):
        # x:1374 y:114, x:1202 y:412
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'ARMidMAIN', 'PartPose', 'PartOffset', 'exactparttype',
                'PartTYPE'
            ],
            output_keys=['RightArmItem', 'LeftArmItem'])
        _state_machine.userdata.ARMidMAIN = ''
        _state_machine.userdata.arm_idR = 'right_arm'
        _state_machine.userdata.move_groupR = 'Right_Arm'
        _state_machine.userdata.move_groupL = 'Left_Arm'
        _state_machine.userdata.tool_linkR = 'right_ee_link'
        _state_machine.userdata.tool_linkL = 'left_ee_link'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.PartOffset = 0
        _state_machine.userdata.PartPose = []
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.arm_idL = 'left_arm'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.exactparttype = ''
        _state_machine.userdata.RightArmItem = ''
        _state_machine.userdata.LeftArmItem = ''
        _state_machine.userdata.PartTYPE = ''

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:232 y:59
            OperatableStateMachine.add('UseRightArm?',
                                       EqualState(),
                                       transitions={
                                           'true':
                                           'ComputeBeltPickForRightArm',
                                           'false': 'ComputeBeltPickForLeftArm'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'ARMidMAIN',
                                           'value_b': 'arm_idR'
                                       })

            # x:484 y:63
            OperatableStateMachine.add(
                'ComputeBeltPickForRightArm',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'GoToPickRight',
                    'failed': 'WaitFailed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_groupR',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_linkR',
                    'pose': 'PartPose',
                    'offset': 'PartOffset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:484 y:155
            OperatableStateMachine.add(
                'ComputeBeltPickForLeftArm',
                ComputeGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'GoToPickLeft',
                    'failed': 'WaitFailed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_groupL',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_linkL',
                    'pose': 'PartPose',
                    'offset': 'PartOffset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:701 y:57
            OperatableStateMachine.add('GoToPickRight',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'TurnGripperONRight',
                                           'planning_failed':
                                           'TurnGripperONRight',
                                           'control_failed':
                                           'TurnGripperONRight'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_groupR',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:701 y:164
            OperatableStateMachine.add('GoToPickLeft',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'TurnGripperONLeft',
                                           'planning_failed':
                                           'TurnGripperONLeft',
                                           'control_failed':
                                           'TurnGripperONLeft'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_groupL',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:874 y:58
            OperatableStateMachine.add('TurnGripperONRight',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'SetRightArmItem',
                                           'failed':
                                           'ComputeBeltPickForRightArm',
                                           'invalid_arm_id': 'WaitFailed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_idR'})

            # x:874 y:165
            OperatableStateMachine.add('TurnGripperONLeft',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'SetLeftArmItem',
                                           'failed':
                                           'ComputeBeltPickForLeftArm',
                                           'invalid_arm_id': 'WaitFailed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_idL'})

            # x:848 y:478
            OperatableStateMachine.add('WaitFailed',
                                       WaitState(wait_time=2),
                                       transitions={'done': 'failed'},
                                       autonomy={'done': Autonomy.Off})

            # x:1045 y:58
            OperatableStateMachine.add('SetRightArmItem',
                                       ReplaceState(),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'PartTYPE',
                                           'result': 'RightArmItem'
                                       })

            # x:1041 y:163
            OperatableStateMachine.add('SetLeftArmItem',
                                       ReplaceState(),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'PartTYPE',
                                           'result': 'LeftArmItem'
                                       })

        return _state_machine
Пример #10
0
	def create(self):
		# x:944 y:732, x:764 y:355
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.agv_id = ''
		_state_machine.userdata.part_type = 'gear_part_red'
		_state_machine.userdata.joint_values = []
		_state_machine.userdata.joint_names = []
		_state_machine.userdata.offset = 0.025
		_state_machine.userdata.move_group_G = 'Gantry'
		_state_machine.userdata.move_group_prefix = '/ariac/gantry'
		_state_machine.userdata.config_name_home = 'home'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.ref_frame = 'world'
		_state_machine.userdata.camera_topic = '/ariac/logical_camera_bins1'
		_state_machine.userdata.camera_frame = 'logical_camera_bins1_frame'
		_state_machine.userdata.tool_link_R = 'right_ee_link'
		_state_machine.userdata.arm_id = 'Left_Arm'
		_state_machine.userdata.config_name_Gantry_pick = 'Gantry_Bins_LinksBovenRechts'
		_state_machine.userdata.null = 0
		_state_machine.userdata.config_name_Gantry_Transportband = 'Gantry_Transportband'
		_state_machine.userdata.config_name_Gantry_AGV = 'Gantry_AGV_Rechts_L'
		_state_machine.userdata.config_name_Left_home = 'Left_Home'
		_state_machine.userdata.config_name_Right_home = 'Right_Home'
		_state_machine.userdata.move_group_L = 'Left_Arm'
		_state_machine.userdata.move_group_R = 'Right_Arm'
		_state_machine.userdata.config_name_L = 'Links_PreDrop_Stelling'
		_state_machine.userdata.config_name_R = 'Rechts_PreDrop_Stelling'
		_state_machine.userdata.tool_link_L = 'left_ee_link'
		_state_machine.userdata.rotation = 0
		_state_machine.userdata.camera_ref_frame = 'world'
		_state_machine.userdata.config_name_PrePick = 'Links_PreGrasp_Bins'
		_state_machine.userdata.config_name_PreDrop = 'Links_PreDrop_AGV'
		_state_machine.userdata.pose = []

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:73 y:57
			OperatableStateMachine.add('StartAssignment',
										StartAssignment(),
										transitions={'continue': 'stop belt'},
										autonomy={'continue': Autonomy.Off})

			# x:1574 y:26
			OperatableStateMachine.add('Pregrasp_G',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'PrePick', 'planning_failed': 'failed', 'control_failed': 'PrePick', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_Gantry_pick', 'move_group': 'move_group_G', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:261 y:30
			OperatableStateMachine.add('stop belt',
										SetConveyorbeltPowerState(),
										transitions={'continue': 'PreLeftHome', 'fail': 'failed'},
										autonomy={'continue': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'power': 'null'})

			# x:988 y:18
			OperatableStateMachine.add('LeftHome',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'RightHome', 'planning_failed': 'failed', 'control_failed': 'RightHome', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_Left_home', 'move_group': 'move_group_L', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1259 y:20
			OperatableStateMachine.add('RightHome',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'Pregrasp_G', 'planning_failed': 'failed', 'control_failed': 'Pregrasp_G', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_Right_home', 'move_group': 'move_group_R', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:522 y:12
			OperatableStateMachine.add('PreLeftHome',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'PreRightHome', 'planning_failed': 'failed', 'control_failed': 'PreRightHome', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_L', 'move_group': 'move_group_L', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:759 y:14
			OperatableStateMachine.add('PreRightHome',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'LeftHome', 'planning_failed': 'failed', 'control_failed': 'LeftHome', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_R', 'move_group': 'move_group_R', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1566 y:263
			OperatableStateMachine.add('CheckPartPoseBin',
										DetectPartCameraAriacState(time_out=2),
										transitions={'continue': 'ComputePick', 'failed': 'failed', 'not_found': 'Retry'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'camera_ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part_type', 'pose': 'pose'})

			# x:1579 y:349
			OperatableStateMachine.add('ComputePick',
										ComputeGraspAriacState(joint_names=['left_shoulder_pan_joint', 'left_shoulder_lift_joint', 'left_elbow_joint', 'left_wrist_1_joint', 'left_wrist_2_joint', 'left_wrist_3_joint']),
										transitions={'continue': 'Pick', 'failed': 'Retry'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group_L', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link_L', 'pose': 'pose', 'offset': 'offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1326 y:337
			OperatableStateMachine.add('Retry',
										WaitState(wait_time=0.2),
										transitions={'done': 'PrePick'},
										autonomy={'done': Autonomy.Off})

			# x:1579 y:157
			OperatableStateMachine.add('PrePick',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'CheckPartPoseBin', 'planning_failed': 'CheckPartPoseBin', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_PrePick', 'move_group': 'move_group_L', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1329 y:732
			OperatableStateMachine.add('LeftHome_2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'finished', 'planning_failed': 'failed', 'control_failed': 'finished', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_Left_home', 'move_group': 'move_group_L', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1602 y:444
			OperatableStateMachine.add('Pick',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'GripperEnable', 'planning_failed': 'failed', 'control_failed': 'GripperEnable'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group_L', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1597 y:703
			OperatableStateMachine.add('PrePick_2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'LeftHome_2', 'planning_failed': 'failed', 'control_failed': 'LeftHome_2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_PrePick', 'move_group': 'move_group_L', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1582 y:575
			OperatableStateMachine.add('GripperEnable',
										VacuumGripperControlState(enable=True),
										transitions={'continue': 'PrePick_2', 'failed': 'Retry', 'invalid_arm_id': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})


		return _state_machine
Пример #11
0
	def create(self):
		# x:52 y:611, x:343 y:359
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.agv_id = 'agv1'
		_state_machine.userdata.part_type = 'gear_part'
		_state_machine.userdata.pose_on_agv = []
		_state_machine.userdata.pose = []
		_state_machine.userdata.part_pose = []
		_state_machine.userdata.joint_values = []
		_state_machine.userdata.joint_names = []
		_state_machine.userdata.offset = 0.1
		_state_machine.userdata.move_group = 'manipulator'
		_state_machine.userdata.move_group_prefix = '/ariac/arm1'
		_state_machine.userdata.config_name_home = 'home'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.config_name_bin3PreGrasp = 'bin3PreGrasp'
		_state_machine.userdata.config_name_tray1PreDrop = 'tray1PreDrop'
		_state_machine.userdata.camera_ref_frame = 'arm1_linear_arm_actuator'
		_state_machine.userdata.camera_topic = '/ariac/logical_camera_5'
		_state_machine.userdata.camera_frame = 'logical_camera_5_frame'
		_state_machine.userdata.tool_link = 'ee_link'
		_state_machine.userdata.agv_pose = []
		_state_machine.userdata.part_offset = 0.035
		_state_machine.userdata.part_rotation = 0
		_state_machine.userdata.conveyor_belt_power = 100.0
		_state_machine.userdata.config_name_bin1PreGrasp = 'bin1PreGrasp'
		_state_machine.userdata.arm_id = "arm1"
		_state_machine.userdata.part_drop_offset = 0.1
		_state_machine.userdata.StartText = 'Opdracht gestart'
		_state_machine.userdata.StopText = 'Opdracht gestopt'
		_state_machine.userdata.Shipments = []
		_state_machine.userdata.material_locations = []
		_state_machine.userdata.NumberOfShipments = 0
		_state_machine.userdata.OrderId = ''
		_state_machine.userdata.Products = []
		_state_machine.userdata.NumberOfProducts = 0
		_state_machine.userdata.MaterialsLocationList = []
		_state_machine.userdata.config_name_bin3PreDrop = 'bin3PreDrop'
		_state_machine.userdata.part = 'gasket_part'

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:54 y:102
			OperatableStateMachine.add('StartAssignment',
										StartAssignment(),
										transitions={'continue': 'ConveyorBelt'},
										autonomy={'continue': Autonomy.Off})

			# x:197 y:603
			OperatableStateMachine.add('EndAssignment',
										EndAssignment(),
										transitions={'continue': 'finished'},
										autonomy={'continue': Autonomy.Off})

			# x:654 y:113
			OperatableStateMachine.add('MoveR1Home',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'DetectCameraPart', 'planning_failed': 'WaitRetry1', 'control_failed': 'WaitRetry1', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:666 y:12
			OperatableStateMachine.add('WaitRetry1',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1Home'},
										autonomy={'done': Autonomy.Off})

			# x:836 y:111
			OperatableStateMachine.add('DetectCameraPart',
										DetectPartCameraAriacState(time_out=5.0),
										transitions={'continue': 'MoveR1PreGrasp1', 'failed': 'failed', 'not_found': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'camera_ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part', 'pose': 'pose'})

			# x:1039 y:116
			OperatableStateMachine.add('MoveR1PreGrasp1',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'ComputePick', 'planning_failed': 'WaitRetry2', 'control_failed': 'WaitRetry2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_bin1PreGrasp', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1048 y:21
			OperatableStateMachine.add('WaitRetry2',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1PreGrasp1'},
										autonomy={'done': Autonomy.Off})

			# x:1038 y:200
			OperatableStateMachine.add('ComputePick',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveR1ToPick1', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offset', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1069 y:379
			OperatableStateMachine.add('Wait',
										WaitState(wait_time=1),
										transitions={'done': 'transport_part_from_bin_to_agv_1'},
										autonomy={'done': Autonomy.Off})

			# x:1303 y:280
			OperatableStateMachine.add('WaitRetry3',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1ToPick1'},
										autonomy={'done': Autonomy.Off})

			# x:1035 y:284
			OperatableStateMachine.add('MoveR1ToPick1',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'EnableGripper', 'planning_failed': 'WaitRetry3', 'control_failed': 'EnableGripper'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:818 y:282
			OperatableStateMachine.add('EnableGripper',
										VacuumGripperControlState(enable=True),
										transitions={'continue': 'Wait', 'failed': 'failed', 'invalid_arm_id': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:294 y:484
			OperatableStateMachine.add('DisableGripper',
										VacuumGripperControlState(enable=False),
										transitions={'continue': 'EndAssignment', 'failed': 'failed', 'invalid_arm_id': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:975 y:541
			OperatableStateMachine.add('transport_part_from_bin_to_agv_1',
										self.use_behavior(transport_part_from_bin_to_agv_1SM, 'transport_part_from_bin_to_agv_1'),
										transitions={'finished': 'DisableGripper', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit})

			# x:222 y:106
			OperatableStateMachine.add('ConveyorBelt',
										SetConveyorbeltPowerState(),
										transitions={'continue': 'MoveR1Home', 'fail': 'failed'},
										autonomy={'continue': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'power': 'conveyor_belt_power'})


		return _state_machine
    def create(self):
        # x:448 y:497, x:101 y:396
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.arm_id = ''
        _state_machine.userdata.power_on = 80
        _state_machine.userdata.power_off = 0
        _state_machine.userdata.config_name_home = 'home'
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.move_group_prefix1 = '/ariac/arm1'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.move_group_prefix2 = '/ariac/arm2'
        _state_machine.userdata.ref_frame = 'arm1_linear_arm_actuator'
        _state_machine.userdata.camera_topic = '/ariac/logical_camera_belt1'
        _state_machine.userdata.camera_frame = 'logical_camera_belt1_frame'
        _state_machine.userdata.part_type = 'disk_part'
        _state_machine.userdata.pose = []
        _state_machine.userdata.config_name_belt = 'robotBelt'
        _state_machine.userdata.sensor_topic = '/ariac/break_beam_1'
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.part_offset = 0.04
        _state_machine.userdata.part_rotation = 0

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:32 y:30
            OperatableStateMachine.add(
                'StartAssignment',
                StartAssignment(),
                transitions={'continue': 'TurnOnConveyor'},
                autonomy={'continue': Autonomy.Off})

            # x:522 y:27
            OperatableStateMachine.add('MoveR2home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'MoveR1Belt',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:176 y:29
            OperatableStateMachine.add('TurnOnConveyor',
                                       SetConveyorbeltPowerState(),
                                       transitions={
                                           'continue': 'MoveR1Home',
                                           'fail': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={'power': 'power_on'})

            # x:360 y:28
            OperatableStateMachine.add('MoveR1Home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'MoveR2home',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:690 y:25
            OperatableStateMachine.add('MoveR1Belt',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DetectPart',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_belt',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:863 y:25
            OperatableStateMachine.add(
                'DetectPart',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'TurnOffConveyor',
                    'failed': 'WaitRetry',
                    'not_found': 'WaitRetry'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'pose'
                })

            # x:715 y:141
            OperatableStateMachine.add('WaitRetry',
                                       WaitState(wait_time=0.1),
                                       transitions={'done': 'DetectPart'},
                                       autonomy={'done': Autonomy.Off})

            # x:1127 y:363
            OperatableStateMachine.add('MoveToPart',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'EnableGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'EnableGripper'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1136 y:455
            OperatableStateMachine.add('EnableGripper',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'MoveHome',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1115 y:267
            OperatableStateMachine.add(
                'ComputeGrasp',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPart',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix1',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1081 y:544
            OperatableStateMachine.add('MoveHome',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1043 y:58
            OperatableStateMachine.add('TurnOffConveyor',
                                       SetConveyorbeltPowerState(),
                                       transitions={
                                           'continue': 'DetectPart_2',
                                           'fail': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={'power': 'power_off'})

            # x:1071 y:136
            OperatableStateMachine.add(
                'DetectPart_2',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'ComputeGrasp',
                    'failed': 'failed',
                    'not_found': 'WaitRetry'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'pose'
                })

        return _state_machine
Пример #13
0
	def create(self):
		# x:1227 y:622, x:267 y:397
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.powerOn = 100
		_state_machine.userdata.move_group_g = 'Gantry'
		_state_machine.userdata.move_group_prefix = '/ariac/gantry'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.joint_values = []
		_state_machine.userdata.joint_names = []
		_state_machine.userdata.powerOff = 0
		_state_machine.userdata.ref_frame = 'world'
		_state_machine.userdata.camera_topic = '/ariac/logical_camera_6'
		_state_machine.userdata.camera_frame = 'logical_camera_6_frame'
		_state_machine.userdata.pose = []
		_state_machine.userdata.camera_topic_7 = '/ariac/logical_camera_7'
		_state_machine.userdata.camera_frame_7 = 'logical_camera_7_frame'
		_state_machine.userdata.part_offset = 0
		_state_machine.userdata.rotation = 0
		_state_machine.userdata.tool_link = 'right_ee_link'
		_state_machine.userdata.config_name_pregrasp = 'beltPreGrasp'
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.move_group = 'Right_Arm'
		_state_machine.userdata.joint_names_r = ['right_shoulder_pan_joint', 'right_shoulder_lift_joint', 'right_elbow_joint', 'right_wrist_1_joint', 'right_wrist_2_joint', 'right_wrist_3_joint']
		_state_machine.userdata.robot_name_g = ''
		_state_machine.userdata.arm_id = 'Right_Arm'
		_state_machine.userdata.config_name_r_home = 'Right_Home'

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:30 y:40
			OperatableStateMachine.add('StartAssignment',
										StartAssignment(),
										transitions={'continue': 'TurnOnConveyor'},
										autonomy={'continue': Autonomy.Off})

			# x:172 y:41
			OperatableStateMachine.add('TurnOnConveyor',
										SetConveyorbeltPowerState(),
										transitions={'continue': 'move_home_belt', 'fail': 'failed'},
										autonomy={'continue': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'power': 'powerOn'})

			# x:361 y:39
			OperatableStateMachine.add('move_home_belt',
										self.use_behavior(move_home_beltSM, 'move_home_belt'),
										transitions={'finished': 'DetectFirstPartBelt', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit})

			# x:769 y:38
			OperatableStateMachine.add('TurnOffConveyor',
										SetConveyorbeltPowerState(),
										transitions={'continue': 'DetectFirstPartBelt_2', 'fail': 'failed'},
										autonomy={'continue': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'power': 'powerOff'})

			# x:1156 y:204
			OperatableStateMachine.add('ComputeGrasp',
										ComputeGraspAriacState(joint_names=['right_shoulder_pan_joint', 'right_shoulder_lift_joint', 'right_elbow_joint', 'right_wrist_1_joint', 'right_wrist_2_joint', 'right_wrist_3_joint']),
										transitions={'continue': 'PickProduct', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:470 y:134
			OperatableStateMachine.add('WaitRetry',
										WaitState(wait_time=0.5),
										transitions={'done': 'DetectFirstPartBelt'},
										autonomy={'done': Autonomy.Off})

			# x:1143 y:288
			OperatableStateMachine.add('PickProduct',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'EnableGripper', 'planning_failed': 'failed', 'control_failed': 'EnableGripper'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:561 y:38
			OperatableStateMachine.add('DetectFirstPartBelt',
										DetectFirstPartCameraAriacState(part_list=['piston_rod_part_red', 'gasket_part_blue_0', 'gasket_part_blue_1', 'gasket_part_blue_2'], time_out=0.5),
										transitions={'continue': 'TurnOffConveyor', 'failed': 'WaitRetry', 'not_found': 'WaitRetry'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part_type', 'pose': 'pose'})

			# x:958 y:36
			OperatableStateMachine.add('DetectFirstPartBelt_2',
										DetectFirstPartCameraAriacState(part_list=['piston_rod_part_red', 'gasket_part_blue_0', 'gasket_part_blue_1', 'gasket_part_blue_2'], time_out=0.5),
										transitions={'continue': 'MovePreGraspBelt', 'failed': 'failed', 'not_found': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part_type', 'pose': 'pose'})

			# x:1164 y:36
			OperatableStateMachine.add('MovePreGraspBelt',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'DecideOffset', 'planning_failed': 'failed', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_pregrasp', 'move_group': 'move_group_g', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name_g', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1167 y:449
			OperatableStateMachine.add('MoveUp',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'finished', 'planning_failed': 'failed', 'control_failed': 'finished', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_r_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1186 y:368
			OperatableStateMachine.add('EnableGripper',
										GripperControl(enable=True),
										transitions={'continue': 'MoveUp', 'failed': 'PickProduct', 'invalid_id': 'PickProduct'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:1177 y:119
			OperatableStateMachine.add('DecideOffset',
										DecideOffsetProduct(target_time=0.5),
										transitions={'succes': 'ComputeGrasp', 'unknown_id': 'DetectFirstPartBelt_2'},
										autonomy={'succes': Autonomy.Off, 'unknown_id': Autonomy.Off},
										remapping={'part_type': 'part_type', 'part_offset': 'part_offset'})


		return _state_machine
Пример #14
0
    def create(self):
        # x:813 y:383, x:130 y:365
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.config_name_left_home = 'Left_Home'
        _state_machine.userdata.move_group_left = 'Left_Arm'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.joint_value = []
        _state_machine.userdata.joint_names = ''
        _state_machine.userdata.pose = []
        _state_machine.userdata.part_offset = 0
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.tool_link = 'left_ee_link'
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.arm_id = 'Left_Arm'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:30 y:40
            OperatableStateMachine.add('MovePreGraspBeltRight',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DecideOffset',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_left_home',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:207 y:40
            OperatableStateMachine.add('DecideOffset',
                                       DecideOffsetProduct(target_time=0.5),
                                       transitions={
                                           'succes': 'ComputeGraspRight',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'part_offset': 'part_offset'
                                       })

            # x:369 y:39
            OperatableStateMachine.add(
                'ComputeGraspRight',
                ComputeGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPickRight',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_left',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:548 y:40
            OperatableStateMachine.add('MoveToPickRight',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'EnableRightGripper',
                                           'planning_failed': 'failed',
                                           'control_failed':
                                           'EnableRightGripper'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_left',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:750 y:38
            OperatableStateMachine.add('EnableRightGripper',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'MoveRightUp',
                                           'failed': 'MovePreGraspBeltRight',
                                           'invalid_id':
                                           'MovePreGraspBeltRight'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:741 y:201
            OperatableStateMachine.add('MoveRightUp',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_left_home',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

        return _state_machine
Пример #15
0
    def create(self):
        # x:761 y:731, x:442 y:741
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['agv_id', 'pose_on_agv_l', 'pose_on_agv_r'])
        _state_machine.userdata.config_name_left = 'Left_Home_B'
        _state_machine.userdata.config_name_right = 'Right_Home_B'
        _state_machine.userdata.config_name_gantry = 'Gantry_Home'
        _state_machine.userdata.move_group_g = 'Gantry'
        _state_machine.userdata.move_group_prefix_g = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = 'gantry'
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.move_group_l = 'Left_Arm'
        _state_machine.userdata.move_group_r = 'Right_Arm'
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.config_name_agv1_r = 'Gantry_AGV1_R'
        _state_machine.userdata.config_name_agv1_l = 'Gantry_AGV1_L'
        _state_machine.userdata.config_name_agv2_l = 'Gantry_AGV2_L'
        _state_machine.userdata.config_name_agv2_r = 'Gantry_AGV2_R'
        _state_machine.userdata.agv2 = 'agv2'
        _state_machine.userdata.arm_id_r = 'Right_Arm'
        _state_machine.userdata.arm_id_l = 'Left_Arm'
        _state_machine.userdata.agv_pose = []
        _state_machine.userdata.offset = 0.09
        _state_machine.userdata.tool_link_r = 'right_ee_link'
        _state_machine.userdata.tool_link_l = 'left_ee_link'
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.pose_on_agv_r = []
        _state_machine.userdata.pose_on_agv_l = []

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:43 y:101
            OperatableStateMachine.add('MoveGantryagv1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Getet agv pose',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_agv2_r',
                                           'move_group': 'move_group_g',
                                           'move_group_prefix':
                                           'move_group_prefix_g',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:57 y:574
            OperatableStateMachine.add('gripper active check',
                                       GripperActiveCheck(),
                                       transitions={
                                           'Left': 'finished',
                                           'Right': 'MoveGantryagv1-2',
                                           'failed': 'failed',
                                           'Full': 'MoveGantryagv1-2'
                                       },
                                       autonomy={
                                           'Left': Autonomy.Off,
                                           'Right': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'Full': Autonomy.Off
                                       },
                                       remapping={
                                           'arm_id': 'arm_id',
                                           'tool_link': 'tool_link',
                                           'move_group': 'move_group'
                                       })

            # x:52 y:649
            OperatableStateMachine.add('MoveGantryagv1-2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Getet agv pose_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_agv2_l',
                                           'move_group': 'move_group_g',
                                           'move_group_prefix':
                                           'move_group_prefix_g',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:63 y:418
            OperatableStateMachine.add('gripper disabble',
                                       GripperControl(enable=False),
                                       transitions={
                                           'continue': 'MoveRightArm_2',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id_r'})

            # x:37 y:177
            OperatableStateMachine.add('Getet agv pose',
                                       GetObjectPoseState(
                                           object_frame='kit_tray_2',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'test',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'agv_pose'})

            # x:32 y:325
            OperatableStateMachine.add('move to drop',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'gripper disabble',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix_g',
                                           'move_group': 'move_group_r',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:17 y:258
            OperatableStateMachine.add(
                'test',
                ComputeDropPartOffsetGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'move to drop',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_r',
                    'move_group_prefix': 'move_group_prefix_g',
                    'tool_link': 'tool_link_r',
                    'part_pose': 'pose_on_agv_r',
                    'pose': 'agv_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:479 y:321
            OperatableStateMachine.add('gripper disabble_2',
                                       GripperControl(enable=False),
                                       transitions={
                                           'continue': 'MoveLeftArm_2',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id_l'})

            # x:355 y:72
            OperatableStateMachine.add('Getet agv pose_2',
                                       GetObjectPoseState(
                                           object_frame='kit_tray_2',
                                           ref_frame='world'),
                                       transitions={
                                           'continue': 'test_2',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'pose': 'agv_pose'})

            # x:440 y:245
            OperatableStateMachine.add('move to drop_2',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'gripper disabble_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix_g',
                                           'move_group': 'move_group_l',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:322 y:159
            OperatableStateMachine.add(
                'test_2',
                ComputeDropPartOffsetGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'move to drop_2',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_l',
                    'move_group_prefix': 'move_group_prefix_g',
                    'tool_link': 'tool_link_l',
                    'part_pose': 'pose_on_agv_l',
                    'pose': 'agv_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:59 y:504
            OperatableStateMachine.add('MoveRightArm_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'gripper active check',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_right',
                                           'move_group': 'move_group_r',
                                           'move_group_prefix':
                                           'move_group_prefix_g',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:509 y:417
            OperatableStateMachine.add('MoveLeftArm_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_left',
                                           'move_group': 'move_group_l',
                                           'move_group_prefix':
                                           'move_group_prefix_g',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

        return _state_machine
Пример #16
0
	def create(self):
		# x:1181 y:653, x:597 y:393
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['bin', 'move_group_prefix', 'camera_topic', 'camera_frame', 'ref_frame', 'agv_id', 'part_type'])
		_state_machine.userdata.config_name_home = 'home'
		_state_machine.userdata.move_group_prefix = []
		_state_machine.userdata.move_group = 'manipulator'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.agv_id = []
		_state_machine.userdata.joint_values = []
		_state_machine.userdata.joint_names = []
		_state_machine.userdata.bin = []
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.config_name_tray = 'tray1PreDrop'
		_state_machine.userdata.pose = []
		_state_machine.userdata.part_offset = 0.08
		_state_machine.userdata.part_rotation = 0
		_state_machine.userdata.tool_link = 'ee_link'
		_state_machine.userdata.arm_id = 'arm2'
		_state_machine.userdata.camera_topic = []
		_state_machine.userdata.camera_frame = []
		_state_machine.userdata.ref_frame = []
		_state_machine.userdata.pose_on_agv = []

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:93 y:87
			OperatableStateMachine.add('OffsetCalc',
										part_offsetCalc(),
										transitions={'succes': 'MoveToHome', 'unknown_id': 'failed'},
										autonomy={'succes': Autonomy.Off, 'unknown_id': Autonomy.Off},
										remapping={'part_type': 'part_type', 'part_offset': 'part_offset'})

			# x:247 y:61
			OperatableStateMachine.add('MoveToHome',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'DetectPartPose', 'planning_failed': 'failed', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:648 y:61
			OperatableStateMachine.add('MoveBin',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'ComputeGrasp', 'planning_failed': 'failed', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'bin', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1076 y:319
			OperatableStateMachine.add('MoveToTray',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'GripperDisabled', 'planning_failed': 'failed', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_tray', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:808 y:60
			OperatableStateMachine.add('ComputeGrasp',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveToPart', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offset', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1061 y:134
			OperatableStateMachine.add('GripperEnabled',
										GripperControl(enable=True),
										transitions={'continue': 'MoveToHome_2', 'failed': 'failed', 'invalid_id': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:423 y:55
			OperatableStateMachine.add('DetectPartPose',
										DetectPartCameraAriacState(time_out=.5),
										transitions={'continue': 'MoveBin', 'failed': 'failed', 'not_found': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part_type', 'pose': 'pose'})

			# x:982 y:61
			OperatableStateMachine.add('MoveToPart',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'GripperEnabled', 'planning_failed': 'failed', 'control_failed': 'GripperEnabled'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1126 y:214
			OperatableStateMachine.add('MoveToHome_2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'MoveToTray', 'planning_failed': 'failed', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1060 y:407
			OperatableStateMachine.add('GripperDisabled',
										GripperControl(enable=False),
										transitions={'continue': 'transport_part_form_bin_to_agv_state', 'failed': 'failed', 'invalid_id': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:852 y:488
			OperatableStateMachine.add('transport_part_form_bin_to_agv_state',
										self.use_behavior(transport_part_form_bin_to_agv_stateSM, 'transport_part_form_bin_to_agv_state'),
										transitions={'finished': 'MoveToHome_3', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'part_type': 'part_type', 'agv_id': 'agv_id', 'pose_on_agv': 'pose_on_agv'})

			# x:971 y:604
			OperatableStateMachine.add('MoveToHome_3',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'finished', 'planning_failed': 'failed', 'control_failed': 'failed', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})


		return _state_machine
Пример #17
0
    def create(self):
        # x:27 y:469, x:242 y:360
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.powerOn = 100
        _state_machine.userdata.config_name = ''
        _state_machine.userdata.move_group_g = 'Gantry'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = 'gantry'
        _state_machine.userdata.part_type = 'gear_part_blue'
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.tool_link = ''
        _state_machine.userdata.pose = ''
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.arm_id = ''

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:145 y:28
            OperatableStateMachine.add('move_home_pick',
                                       self.use_behavior(
                                           move_home_pickSM, 'move_home_pick'),
                                       transitions={
                                           'finished': 'Find_product_location',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:701 y:151
            OperatableStateMachine.add('move_gantry_bin_gr1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'find part',
                                           'planning_failed': 'Waitretry',
                                           'control_failed': 'Waitretry',
                                           'param_error': 'Waitretry'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'bin',
                                           'move_group': 'move_group_g',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:479 y:25
            OperatableStateMachine.add('Find_product_location',
                                       FindCorrectBin(time_out=0.5),
                                       transitions={
                                           'continue': 'partype mesage',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'bin': 'bin',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame',
                                           'ref_frame': 'ref_frame'
                                       })

            # x:694 y:497
            OperatableStateMachine.add(
                'compute_pick _r',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move to pick',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:713 y:240
            OperatableStateMachine.add(
                'find part',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Offset bepalen',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'pose'
                })

            # x:760 y:314
            OperatableStateMachine.add('Offset bepalen',
                                       DecideOffsetProduct(target_time=0.5),
                                       transitions={
                                           'succes': 'check_free_gripper',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'part_offset': 'part_offset'
                                       })

            # x:433 y:563
            OperatableStateMachine.add('Gripper_enable',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'move_home_robot_r',
                                           'failed': 'Move to pick',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:234 y:591
            OperatableStateMachine.add('move_home_robot_r',
                                       self.use_behavior(
                                           move_home_robot_rSM,
                                           'move_home_robot_r'),
                                       transitions={
                                           'finished': 'finished',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:619 y:590
            OperatableStateMachine.add('Move to pick',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripper_enable',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Gripper_enable'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:812 y:393
            OperatableStateMachine.add('check_free_gripper',
                                       GripperActiveCheck(),
                                       transitions={
                                           'Left': 'compute_pick _l',
                                           'Right': 'compute_pick _r',
                                           'failed': 'failed',
                                           'Full': 'move_home_pick'
                                       },
                                       autonomy={
                                           'Left': Autonomy.Off,
                                           'Right': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'Full': Autonomy.Off
                                       },
                                       remapping={
                                           'arm_id': 'arm_id',
                                           'tool_link': 'tool_link',
                                           'move_group': 'move_group'
                                       })

            # x:942 y:468
            OperatableStateMachine.add(
                'compute_pick _l',
                ComputeGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move to pick',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:627 y:57
            OperatableStateMachine.add(
                'partype mesage',
                MessageState(),
                transitions={'continue': 'move_gantry_bin_gr1'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_type'})

            # x:810 y:40
            OperatableStateMachine.add(
                'Waitretry',
                WaitState(wait_time=2),
                transitions={'done': 'move_gantry_bin_gr1'},
                autonomy={'done': Autonomy.Off})

        return _state_machine
    def create(self):
        # x:1770 y:298, x:81 y:372
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'part_type', 'agv_id', 'pose_on_agv', 'camera_ref_frame',
                'camera_frame', 'camera_topic'
            ],
            output_keys=['part_type', 'camera_ref_frame', 'camera_frame'])
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.move_group_prefix1 = '/ariac/arm1'
        _state_machine.userdata.move_group_prefix2 = '/ariac/arm2'
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.pose_on_agv = []
        _state_machine.userdata.config_name_bin1PreGrasp = 'bin1PreGrasp'
        _state_machine.userdata.camera_ref_frame2 = 'arm2_linear_arm_actuator'
        _state_machine.userdata.camera_ref_frame1 = 'arm1_linear_arm_actuator'
        _state_machine.userdata.camera_frame2 = 'Camera_bin_2_frame'
        _state_machine.userdata.camera_frame5 = 'Camera_bin_5_frame'
        _state_machine.userdata.camera_frame6 = 'Camera_bin_6_frame'
        _state_machine.userdata.config_name_bin2PreGrasp = 'bin2PreGrasp'
        _state_machine.userdata.config_name_bin5PreGrasp = 'bin5PreGrasp'
        _state_machine.userdata.camera_ref_frame = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.camera_frame1 = 'Camera_bin_1_frame'
        _state_machine.userdata.config_name_bin6PreGrasp = 'bin6PreGrasp'
        _state_machine.userdata.joint_names = ''
        _state_machine.userdata.part_rotation = 0
        _state_machine.userdata.arm_id = 'arm1'
        _state_machine.userdata.gripper1 = 'arm1'
        _state_machine.userdata.gripper2 = 'arm2'
        _state_machine.userdata.camera_topic = ''

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:71 y:54
            OperatableStateMachine.add('binSelectie',
                                       self.use_behavior(
                                           binSelectieSM, 'binSelectie'),
                                       transitions={
                                           'finished': 'arm1',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'camera_topic': 'camera_topic',
                                           'camera_ref_frame':
                                           'camera_ref_frame',
                                           'camera_frame': 'camera_frame',
                                           'part_offset': 'part_offset'
                                       })

            # x:1675 y:697
            OperatableStateMachine.add('PartTypeMessage',
                                       MessageState(),
                                       transitions={'continue': 'MoseMessage'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'part_type'})

            # x:1675 y:758
            OperatableStateMachine.add(
                'AgvIdMessage',
                MessageState(),
                transitions={'continue': 'PartTypeMessage'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'agv_id'})

            # x:262 y:58
            OperatableStateMachine.add('arm1',
                                       EqualState(),
                                       transitions={
                                           'true': 'bin5',
                                           'false': 'arm2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'camera_ref_frame',
                                           'value_b': 'camera_ref_frame1'
                                       })

            # x:266 y:389
            OperatableStateMachine.add('arm2',
                                       EqualState(),
                                       transitions={
                                           'true': 'bin1',
                                           'false': 'failed'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'camera_ref_frame',
                                           'value_b': 'camera_ref_frame2'
                                       })

            # x:470 y:353
            OperatableStateMachine.add('bin1',
                                       EqualState(),
                                       transitions={
                                           'true': 'pregraspbin1',
                                           'false': 'bin2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'camera_frame',
                                           'value_b': 'camera_frame1'
                                       })

            # x:475 y:527
            OperatableStateMachine.add('bin2',
                                       EqualState(),
                                       transitions={
                                           'true': 'pregraspbin2',
                                           'false': 'failed'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'camera_frame',
                                           'value_b': 'camera_frame2'
                                       })

            # x:467 y:59
            OperatableStateMachine.add('bin5',
                                       EqualState(),
                                       transitions={
                                           'true': 'pregraspbin5',
                                           'false': 'bin6'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'camera_frame',
                                           'value_b': 'camera_frame5'
                                       })

            # x:470 y:277
            OperatableStateMachine.add('bin6',
                                       EqualState(),
                                       transitions={
                                           'true': 'pregraspbin6',
                                           'false': 'failed'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'camera_frame',
                                           'value_b': 'camera_frame6'
                                       })

            # x:663 y:58
            OperatableStateMachine.add('pregraspbin5',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'detectpartbin5',
                                           'planning_failed': 'failed',
                                           'control_failed': 'detectpartbin5',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin5PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:652 y:273
            OperatableStateMachine.add('pregraspbin6',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'detectpartbin6',
                                           'planning_failed': 'failed',
                                           'control_failed': 'detectpartbin6',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin6PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:653 y:351
            OperatableStateMachine.add('pregraspbin1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'detectpartbin1',
                                           'planning_failed': 'failed',
                                           'control_failed': 'detectpartbin1',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin1PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:657 y:531
            OperatableStateMachine.add('pregraspbin2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'detectpartbin2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'detectpartbin2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin2PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1164 y:44
            OperatableStateMachine.add('pickbin5',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'gripperkeuze',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Retry'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1173 y:269
            OperatableStateMachine.add('pickbin6',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripperaan_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Retry_2'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1171 y:353
            OperatableStateMachine.add('pickbin1',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripperaan_4',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Retry_3'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1185 y:524
            OperatableStateMachine.add('pickbin2',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripperaan_3',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Retry_4'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1568 y:43
            OperatableStateMachine.add('pregraspbin5_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin5PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1568 y:262
            OperatableStateMachine.add('pregraspbin6_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin5PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix1',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1566 y:349
            OperatableStateMachine.add('pregraspbin1_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin1PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1569 y:515
            OperatableStateMachine.add('pregraspbin2_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_bin2PreGrasp',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix2',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1674 y:635
            OperatableStateMachine.add('MoseMessage',
                                       MessageState(),
                                       transitions={'continue': 'finished'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'part_pose'})

            # x:818 y:46
            OperatableStateMachine.add(
                'detectpartbin5',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Computegraspbin5',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'part_pose'
                })

            # x:1193 y:136
            OperatableStateMachine.add('Retry',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'gripperkeuze'},
                                       autonomy={'done': Autonomy.Off})

            # x:820 y:265
            OperatableStateMachine.add(
                'detectpartbin6',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Computegraspbin5_2',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'part_pose'
                })

            # x:820 y:348
            OperatableStateMachine.add(
                'detectpartbin1',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Computegraspbin5_3',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'part_pose'
                })

            # x:833 y:530
            OperatableStateMachine.add(
                'detectpartbin2',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Computegraspbin5_4',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'part_pose'
                })

            # x:997 y:44
            OperatableStateMachine.add(
                'Computegraspbin5',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Computegraspbin5',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix1',
                    'tool_link': 'tool_link',
                    'pose': 'part_pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1382 y:37
            OperatableStateMachine.add('Gripperaan',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'pregraspbin5_2',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1363 y:129
            OperatableStateMachine.add('gripperkeuze',
                                       ReplaceState(),
                                       transitions={'done': 'Gripperaan'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'gripper1',
                                           'result': 'arm_id'
                                       })

            # x:1000 y:254
            OperatableStateMachine.add(
                'Computegraspbin5_2',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Computegraspbin5_2',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix1',
                    'tool_link': 'tool_link',
                    'pose': 'part_pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1003 y:346
            OperatableStateMachine.add(
                'Computegraspbin5_3',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Computegraspbin5_3',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix1',
                    'tool_link': 'tool_link',
                    'pose': 'part_pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1023 y:524
            OperatableStateMachine.add(
                'Computegraspbin5_4',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Computegraspbin5_4',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix1',
                    'tool_link': 'tool_link',
                    'pose': 'part_pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1193 y:198
            OperatableStateMachine.add('Retry_2',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'gripperkeuze_2'},
                                       autonomy={'done': Autonomy.Off})

            # x:1206 y:434
            OperatableStateMachine.add('Retry_3',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'gripperkeuze_3'},
                                       autonomy={'done': Autonomy.Off})

            # x:1200 y:628
            OperatableStateMachine.add('Retry_4',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'gripperkeuze_4'},
                                       autonomy={'done': Autonomy.Off})

            # x:1362 y:199
            OperatableStateMachine.add('gripperkeuze_2',
                                       ReplaceState(),
                                       transitions={'done': 'Gripperaan_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'gripper1',
                                           'result': 'arm_id'
                                       })

            # x:1359 y:426
            OperatableStateMachine.add('gripperkeuze_3',
                                       ReplaceState(),
                                       transitions={'done': 'Gripperaan_4'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'gripper2',
                                           'result': 'arm_id'
                                       })

            # x:1357 y:642
            OperatableStateMachine.add('gripperkeuze_4',
                                       ReplaceState(),
                                       transitions={'done': 'Gripperaan_3'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'gripper2',
                                           'result': 'arm_id'
                                       })

            # x:1359 y:261
            OperatableStateMachine.add('Gripperaan_2',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'pregraspbin6_2',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1377 y:511
            OperatableStateMachine.add('Gripperaan_3',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'pregraspbin2_2',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1362 y:345
            OperatableStateMachine.add('Gripperaan_4',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'pregraspbin1_2',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

        return _state_machine
Пример #19
0
    def create(self):
        # x:24 y:502, x:938 y:468
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['part_type', 'agv_id', 'part_pose'],
            output_keys=['pose'])
        _state_machine.userdata.arm_id = ''
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.offset = 0.2
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.move_group_prefix = ''
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.srdf_param = 'ur10.srdf'
        _state_machine.userdata.ref_frame1 = 'arm1_linear_arm_actuator'
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.pose = []
        _state_machine.userdata.part = ''
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.part_offset = 0
        _state_machine.userdata.part_rotation = 0
        _state_machine.userdata.agv_pose = []
        _state_machine.userdata.material_locations = []
        _state_machine.userdata.bin_location = ''
        _state_machine.userdata.zero_value = ''
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.ref_frame2 = 'arm2_linear_arm_actuator'
        _state_machine.userdata.agv2 = 'agv2'
        _state_machine.userdata.ref_frame = ''
        _state_machine.userdata.part1 = 'gasket_part'
        _state_machine.userdata.part2 = 'pulley_part'
        _state_machine.userdata.part3 = 'piston_rod_part'
        _state_machine.userdata.part4 = 'gear_part'
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.overzet = ''
        _state_machine.userdata.overzetja = 'ja'
        _state_machine.userdata.overzetnee = 'nee'
        _state_machine.userdata.agv1_id = 'agv1'
        _state_machine.userdata.agv2_id = 'agv2'
        _state_machine.userdata.config_namer1b1 = 'R1PreBin1'
        _state_machine.userdata.config_namer2b4 = 'R2PreBin6'
        _state_machine.userdata.config_name_preagv = ''

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:468 y:36
            OperatableStateMachine.add(
                'AgvIdMessage',
                MessageState(),
                transitions={'continue': 'PartTypeMessage'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'agv_id'})

            # x:648 y:35
            OperatableStateMachine.add('PartTypeMessage',
                                       MessageState(),
                                       transitions={'continue': 'MoseMessage'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'part_type'})

            # x:460 y:161
            OperatableStateMachine.add('R1PreGrasp1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'OpenGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:688 y:174
            OperatableStateMachine.add('OpenGripper',
                                       UseGripper(enable=False),
                                       transitions={
                                           'continue': 'ComputePick',
                                           'failed': 'failed',
                                           'invalid_arm': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:235 y:96
            OperatableStateMachine.add('CheckPosePartsinBIn',
                                       DetectPartCameraAriacState(time_out=2),
                                       transitions={
                                           'continue': 'R1PreGrasp1',
                                           'failed': 'retry',
                                           'not_found': 'retry'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'ref_frame': 'ref_frame',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame',
                                           'part': 'part_type',
                                           'pose': 'pose'
                                       })

            # x:1325 y:349
            OperatableStateMachine.add('R1PreGrasp1Back',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Overzetten?',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:884 y:176
            OperatableStateMachine.add(
                'ComputePick',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'R1ToPick',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1106 y:178
            OperatableStateMachine.add('R1ToPick',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'CloseGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'R1PreGrasp1'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1336 y:188
            OperatableStateMachine.add('CloseGripper',
                                       UseGripper(enable=True),
                                       transitions={
                                           'continue': 'Wacht1',
                                           'failed': 'failed',
                                           'invalid_arm': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1517 y:718
            OperatableStateMachine.add('R1PreAGV1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputePlacePose',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_preagv',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1352 y:259
            OperatableStateMachine.add('Wacht1',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'R1PreGrasp1Back'},
                                       autonomy={'done': Autonomy.Off})

            # x:986 y:718
            OperatableStateMachine.add('R1ToPlace',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'OpenGripper2',
                                           'planning_failed': 'Retry',
                                           'control_failed': 'Retry'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:293 y:698
            OperatableStateMachine.add('R1PreAGV1Back',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Robot?',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name_preagv',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:679 y:693
            OperatableStateMachine.add('OpenGripper2',
                                       UseGripper(enable=False),
                                       transitions={
                                           'continue': 'Wacht2',
                                           'failed': 'failed',
                                           'invalid_arm': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:488 y:694
            OperatableStateMachine.add('Wacht2',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'R1PreAGV1Back'},
                                       autonomy={'done': Autonomy.Off})

            # x:951 y:616
            OperatableStateMachine.add('Retry',
                                       WaitState(wait_time=0.1),
                                       transitions={'done': 'R1ToPlace'},
                                       autonomy={'done': Autonomy.Off})

            # x:834 y:33
            OperatableStateMachine.add(
                'MoseMessage',
                MessageState(),
                transitions={'continue': 'CameraRobotSelector'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_pose'})

            # x:1233 y:728
            OperatableStateMachine.add(
                'ComputePlacePose',
                ComputeGraspPartOffsetAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'R1ToPlace',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'agv_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'part_pose': 'part_pose',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:266 y:9
            OperatableStateMachine.add(
                'retry',
                WaitState(wait_time=0.5),
                transitions={'done': 'CheckPosePartsinBIn'},
                autonomy={'done': Autonomy.Off})

            # x:42 y:416
            OperatableStateMachine.add('RefMSG',
                                       MessageState(),
                                       transitions={'continue': 'TopicMSG'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'ref_frame'})

            # x:190 y:412
            OperatableStateMachine.add('TopicMSG',
                                       MessageState(),
                                       transitions={'continue': 'FrameMSG'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'camera_topic'})

            # x:330 y:414
            OperatableStateMachine.add(
                'FrameMSG',
                MessageState(),
                transitions={'continue': 'CheckPosePartsinBIn'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'camera_frame'})

            # x:133 y:217
            OperatableStateMachine.add('CameraRobotSelector',
                                       self.use_behavior(
                                           CameraRobotSelectorSM,
                                           'CameraRobotSelector'),
                                       transitions={
                                           'finished': 'RefMSG',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'agv_id':
                                           'agv_id',
                                           'part_type':
                                           'part_type',
                                           'part_pose':
                                           'part_pose',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'config_name':
                                           'config_name',
                                           'arm_id':
                                           'arm_id',
                                           'ref_frame':
                                           'ref_frame',
                                           'camera_topic':
                                           'camera_topic',
                                           'camera_frame':
                                           'camera_frame',
                                           'part':
                                           'part',
                                           'part_offset':
                                           'part_offset',
                                           'overzet':
                                           'overzet',
                                           'config_name_preagv':
                                           'config_name_preagv'
                                       })

            # x:1551 y:346
            OperatableStateMachine.add(
                'Overzetten?',
                EqualState(),
                transitions={
                    'true': 'AGV?',
                    'false': 'op_overzetbin_plaatsen_en_frame_kiezen'
                },
                autonomy={
                    'true': Autonomy.Off,
                    'false': Autonomy.Off
                },
                remapping={
                    'value_a': 'overzet',
                    'value_b': 'overzetnee'
                })

            # x:1179 y:60
            OperatableStateMachine.add(
                'op_overzetbin_plaatsen_en_frame_kiezen',
                self.use_behavior(op_overzetbin_plaatsen_en_frame_kiezenSM,
                                  'op_overzetbin_plaatsen_en_frame_kiezen'),
                transitions={
                    'finished': 'CheckPosePartsinBIn',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'config_name': 'config_name',
                    'move_group_prefix': 'move_group_prefix',
                    'arm_id': 'arm_id',
                    'agv_id': 'agv_id',
                    'part_type': 'part_type',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part_offset': 'part_offset',
                    'overzet': 'overzet'
                })

            # x:1324 y:446
            OperatableStateMachine.add(
                'GetAGV1Pose',
                GetObjectPoseState(object_frame='kit_tray_1',
                                   ref_frame='arm1_linear_arm_actuator'),
                transitions={
                    'continue': 'R1PreAGV1_2',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'pose': 'agv_pose'})

            # x:1531 y:492
            OperatableStateMachine.add(
                'GetAGV1Pose_2',
                GetObjectPoseState(object_frame='kit_tray_2',
                                   ref_frame='arm2_linear_arm_actuator'),
                transitions={
                    'continue': 'R1PreAGV1_3',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'pose': 'agv_id'})

            # x:1670 y:414
            OperatableStateMachine.add('AGV?',
                                       EqualState(),
                                       transitions={
                                           'true': 'GetAGV1Pose',
                                           'false': 'GetAGV1Pose_2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'agv_id',
                                           'value_b': 'agv1_id'
                                       })

            # x:207 y:475
            OperatableStateMachine.add('R1PreAGV1Back_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_namer1b1',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:105 y:672
            OperatableStateMachine.add('R1PreAGV1Back_3',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_namer2b4',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:471 y:517
            OperatableStateMachine.add('Robot?',
                                       EqualState(),
                                       transitions={
                                           'true': 'R1PreAGV1Back_2',
                                           'false': 'R1PreAGV1Back_3'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'agv_id',
                                           'value_b': 'agv1_id'
                                       })

            # x:1419 y:573
            OperatableStateMachine.add('R1PreAGV1_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'R1PreAGV1',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_namer1b1',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1569 y:574
            OperatableStateMachine.add('R1PreAGV1_3',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'R1PreAGV1',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_namer2b4',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

        return _state_machine
Пример #20
0
    def create(self):
        # x:982 y:568, x:604 y:185
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'], input_keys=['part', 'arm_id'])
        _state_machine.userdata.config_name = ''
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.arm_id = 'Right_Arm'
        _state_machine.userdata.tool_link = ''
        _state_machine.userdata.pose = []
        _state_machine.userdata.offset = 0.15
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.part = 'gear_part_red'
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.home = 'Home'
        _state_machine.userdata.safe = 'Full_Bin'
        _state_machine.userdata.Up = 0.2
        _state_machine.userdata.preShelf = 'Gantry_PreShelf'
        _state_machine.userdata.shelf = 'Full_Shelf'
        _state_machine.userdata.one = 1
        _state_machine.userdata.bin = 0
        _state_machine.userdata.zero = 0

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:118 y:24
            OperatableStateMachine.add('FindPart',
                                       FindPart(time_out=0.2),
                                       transitions={
                                           'bin': 'BinTo1',
                                           'shelf': 'BinTo0',
                                           'failed': 'failed',
                                           'not_found': 'failed'
                                       },
                                       autonomy={
                                           'bin': Autonomy.Off,
                                           'shelf': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'arm_id': 'arm_id',
                                           'gantry_pos': 'config_name',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame'
                                       })

            # x:839 y:25
            OperatableStateMachine.add('MoveToPart',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'EnableGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'EnableGripper'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1048 y:25
            OperatableStateMachine.add('EnableGripper',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'OffsetUp',
                                           'failed': 'MoveToPart',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:167 y:236
            OperatableStateMachine.add('SafePosBetweenBin',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'GetPartPose',
                                           'planning_failed': 'failed',
                                           'control_failed':
                                           'SafePosBetweenBin',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'safe',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:107 y:400
            OperatableStateMachine.add('PreGrasp',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputePick_3',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:361 y:25
            OperatableStateMachine.add('Offset',
                                       part_offsetCalc(),
                                       transitions={
                                           'succes': 'ComputePick',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'part_offset': 'offset'
                                       })

            # x:1044 y:400
            OperatableStateMachine.add('ArmHome_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'SafePosBetweenBin_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'home',
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1038 y:475
            OperatableStateMachine.add('SafePosBetweenBin_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed':
                                           'SafePosBetweenBin_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'safe',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1025 y:89
            OperatableStateMachine.add('OffsetUp',
                                       ReplaceState(),
                                       transitions={'done': 'ComputePick_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'Up',
                                           'result': 'offset'
                                       })

            # x:970 y:155
            OperatableStateMachine.add('ComputePick_2',
                                       ComputeGraspAriacState(),
                                       transitions={
                                           'continue': 'MoveToPart_2',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'pose': 'pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:938 y:244
            OperatableStateMachine.add('MoveToPart_2',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Bin1?',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:103 y:469
            OperatableStateMachine.add('ComputePick_3',
                                       ComputeGraspAriacState(),
                                       transitions={
                                           'continue': 'MoveToPart_3',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'pose': 'pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:95 y:540
            OperatableStateMachine.add('MoveToPart_3',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Offset',
                                           'planning_failed': 'MoveToPart_3',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:647 y:24
            OperatableStateMachine.add('ComputePick',
                                       ComputeGraspAriacState(),
                                       transitions={
                                           'continue': 'MoveToPart',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'pose': 'pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:0 y:171
            OperatableStateMachine.add('ToShelf',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ToShelf1',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'preShelf',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:0 y:233
            OperatableStateMachine.add('ToShelf1',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'GetPartPose',
                                           'planning_failed': 'failed',
                                           'control_failed': 'ToShelf1',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'shelf',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:936 y:329
            OperatableStateMachine.add('Bin1?',
                                       EqualState(),
                                       transitions={
                                           'true': 'ArmHome_2',
                                           'false': 'ToShelf1_2'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'bin',
                                           'value_b': 'one'
                                       })

            # x:160 y:170
            OperatableStateMachine.add(
                'BinTo1',
                ReplaceState(),
                transitions={'done': 'SafePosBetweenBin'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'one',
                    'result': 'bin'
                })

            # x:830 y:467
            OperatableStateMachine.add('ToShelf_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'preShelf',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:826 y:396
            OperatableStateMachine.add('ToShelf1_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ToShelf_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'ToShelf1_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'shelf',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:96 y:330
            OperatableStateMachine.add(
                'GetPartPose',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'PreGrasp',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part',
                    'pose': 'pose'
                })

            # x:0 y:113
            OperatableStateMachine.add('BinTo0',
                                       ReplaceState(),
                                       transitions={'done': 'ToShelf'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero',
                                           'result': 'bin'
                                       })

        return _state_machine
    def create(self):
        # x:1393 y:668, x:704 y:381
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['part_type', 'agv_id', 'pose_on_agv'])
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.pose_on_agv = []
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.move_group = 'manipulator'
        _state_machine.userdata.move_group_prefix = '/ariac/arm1'
        _state_machine.userdata.arm_id = 'arm1'
        _state_machine.userdata.config_name_R1Bin1Pre = 'R1Bin1Pre'
        _state_machine.userdata.config_name_R1AGVPre = 'R1AGVPre'
        _state_machine.userdata.config_name_R2Bin5Pre = 'R2Bin5Pre'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.arm2_gebruiken = '/ariac/arm2'
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.part = 'gasket_part'
        _state_machine.userdata.part_offset = 0.030
        _state_machine.userdata.part_drop_offset = 0.1
        _state_machine.userdata.conveyor_power = 100.0
        _state_machine.userdata.part_rotation = 0
        _state_machine.userdata.camera_frame = 'logical_camera_3_frame'
        _state_machine.userdata.camera_topic = '/ariac/logical_camera_3'
        _state_machine.userdata.camera_ref_frame = 'arm1_linear_arm_actuator'
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.bin_location = []
        _state_machine.userdata.material_locations = []
        _state_machine.userdata.zero_value = 0

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:12 y:198
            OperatableStateMachine.add(
                'get part location',
                GetMaterialLocationsState(),
                transitions={'continue': 'bin location'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'part': 'part_type',
                    'material_locations': 'material_locations'
                })

            # x:305 y:37
            OperatableStateMachine.add(
                'MoseMessage',
                MessageState(),
                transitions={'continue': 'detect object'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'pose_on_agv'})

            # x:171 y:37
            OperatableStateMachine.add('PartTypeMessage',
                                       MessageState(),
                                       transitions={'continue': 'MoseMessage'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={'message': 'part_type'})

            # x:681 y:38
            OperatableStateMachine.add('pre grasp',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'compute grasp',
                                           'planning_failed': 'failed',
                                           'control_failed': 'compute grasp',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_R1Bin1Pre',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1433 y:179
            OperatableStateMachine.add('move_agv',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'gripper uit',
                                           'planning_failed': 'failed',
                                           'control_failed': 'gripper uit',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_R1AGVPre',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1255 y:51
            OperatableStateMachine.add('gripper aan',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'wait',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1405 y:434
            OperatableStateMachine.add('robot_2_selecteren',
                                       ReplaceState(),
                                       transitions={'done': 'robot_2_bewegen'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'arm2_gebruiken',
                                           'result': 'move_group_prefix'
                                       })

            # x:1424 y:526
            OperatableStateMachine.add('robot_2_bewegen',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_R2Bin5Pre',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:465 y:35
            OperatableStateMachine.add(
                'detect object',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'pre grasp',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part',
                    'pose': 'pose'
                })

            # x:862 y:38
            OperatableStateMachine.add(
                'compute grasp',
                ComputeGraspAriacState(joint_names=[
                    'linear_arm_actuator_joint', 'shoulder_pan_joint',
                    'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint',
                    'wrist_2_joint', 'wrist_3_joint'
                ]),
                transitions={
                    'continue': 'pick_positie',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'part_offset',
                    'rotation': 'part_rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1475 y:50
            OperatableStateMachine.add('wait',
                                       WaitState(wait_time=1),
                                       transitions={'done': 'move_agv'},
                                       autonomy={'done': Autonomy.Off})

            # x:1414 y:297
            OperatableStateMachine.add('gripper uit',
                                       VacuumGripperControlState(enable=False),
                                       transitions={
                                           'continue': 'robot_2_selecteren',
                                           'failed': 'failed',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1047 y:40
            OperatableStateMachine.add('pick_positie',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'gripper aan',
                                           'planning_failed': 'failed',
                                           'control_failed': 'gripper aan'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:150 y:300
            OperatableStateMachine.add('bin location',
                                       GetItemFromListState(),
                                       transitions={
                                           'done': 'AgvIdMessage',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'done': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'list': 'material_locations',
                                           'index': 'zero_value',
                                           'item': 'bin_location'
                                       })

            # x:176 y:126
            OperatableStateMachine.add(
                'AgvIdMessage',
                MessageState(),
                transitions={'continue': 'PartTypeMessage'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'agv_id'})

        return _state_machine
Пример #22
0
	def create(self):
		# x:37 y:662, x:476 y:317
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.conveyor_belt_power = 100.0
		_state_machine.userdata.config_name_home = 'home'
		_state_machine.userdata.move_group = 'manipulator'
		_state_machine.userdata.move_group_prefix = '/ariac/arm1'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.camera_ref_frame = 'arm1_linear_arm_actuator'
		_state_machine.userdata.camera_topic = '/ariac/logical_camera_6'
		_state_machine.userdata.camera_frame = 'logical_camera_6_frame'
		_state_machine.userdata.part = 'gasket_part'
		_state_machine.userdata.config_name_bin6PreGrasp = 'bin6PreGrasp'
		_state_machine.userdata.tool_link = 'ee_link'
		_state_machine.userdata.part_offset = 0.1
		_state_machine.userdata.part_rotation = 0
		_state_machine.userdata.config_name_tray1PreDrop = 'tray1PreDrop'
		_state_machine.userdata.agv_pose = []

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:71 y:109
			OperatableStateMachine.add('StartAssignment',
										StartAssignment(),
										transitions={'continue': 'MoveR1Home'},
										autonomy={'continue': Autonomy.Off})

			# x:182 y:656
			OperatableStateMachine.add('EndAssignment',
										EndAssignment(),
										transitions={'continue': 'finished'},
										autonomy={'continue': Autonomy.Off})

			# x:233 y:110
			OperatableStateMachine.add('MoveR1Home',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'DetectCameraPart', 'planning_failed': 'WaitRetry1', 'control_failed': 'WaitRetry1', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:233 y:8
			OperatableStateMachine.add('WaitRetry1',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1Home'},
										autonomy={'done': Autonomy.Off})

			# x:438 y:112
			OperatableStateMachine.add('DetectCameraPart',
										DetectPartCameraAriacState(time_out=5),
										transitions={'continue': 'MoveR1PreGrasp1', 'failed': 'failed', 'not_found': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'camera_ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part', 'pose': 'pose'})

			# x:641 y:111
			OperatableStateMachine.add('MoveR1PreGrasp1',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'ComputePick', 'planning_failed': 'WaitRetry2', 'control_failed': 'WaitRetry2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_bin6PreGrasp', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:640 y:6
			OperatableStateMachine.add('WaitRetry2',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1PreGrasp1'},
										autonomy={'done': Autonomy.Off})

			# x:840 y:113
			OperatableStateMachine.add('ComputePick',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveR1ToPick1', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offset', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1023 y:110
			OperatableStateMachine.add('MoveR1ToPick1',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'WachtEven', 'planning_failed': 'WaitRetry3', 'control_failed': 'WaitRetry3'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1215 y:107
			OperatableStateMachine.add('WaitRetry3',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1ToPick1'},
										autonomy={'done': Autonomy.Off})

			# x:1022 y:200
			OperatableStateMachine.add('WachtEven',
										WaitState(wait_time=1),
										transitions={'done': 'MoveR1PreGrasp2'},
										autonomy={'done': Autonomy.Off})

			# x:1017 y:280
			OperatableStateMachine.add('MoveR1PreGrasp2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'MoveR1PreDrop', 'planning_failed': 'WaitRetry4', 'control_failed': 'WaitRetry4', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_bin6PreGrasp', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1215 y:278
			OperatableStateMachine.add('WaitRetry4',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1PreGrasp2'},
										autonomy={'done': Autonomy.Off})

			# x:1005 y:369
			OperatableStateMachine.add('MoveR1PreDrop',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'GetAgvPose', 'planning_failed': 'WaitRetry5', 'control_failed': 'WaitRetry5', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_tray1PreDrop', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1210 y:372
			OperatableStateMachine.add('WaitRetry5',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1PreDrop'},
										autonomy={'done': Autonomy.Off})

			# x:1002 y:454
			OperatableStateMachine.add('GetAgvPose',
										GetObjectPoseState(object_frame='kit_tray_1', ref_frame='arm1_linear_arm_actuator'),
										transitions={'continue': 'ComputeDrop', 'failed': 'ComputeDrop'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'pose': 'agv_pose'})

			# x:998 y:592
			OperatableStateMachine.add('ComputeDrop',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveR1ToDrop', 'failed': 'MoveR1ToDrop'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'agv_pose', 'offset': 'part_offset', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:661 y:522
			OperatableStateMachine.add('MoveR1ToDrop',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'notify_shipment_ready', 'planning_failed': 'WaitRetry6', 'control_failed': 'WaitRetry6'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:661 y:640
			OperatableStateMachine.add('WaitRetry6',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1ToDrop'},
										autonomy={'done': Autonomy.Off})

			# x:418 y:581
			OperatableStateMachine.add('notify_shipment_ready',
										self.use_behavior(notify_shipment_readySM, 'notify_shipment_ready'),
										transitions={'finished': 'EndAssignment', 'failed': 'EndAssignment'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit})


		return _state_machine
Пример #23
0
    def create(self):
        # x:92 y:307, x:966 y:441
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'offset_part_left', 'PreGrasp', 'camera_topic', 'camera_frame',
                'offset_part_left', 'part_type', 'arm_id_left', 'part_pose'
            ],
            output_keys=['part_pose_left'])
        _state_machine.userdata.move_group_gantry = 'Gantry'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.move_group_right_arm = 'Right_Arm'
        _state_machine.userdata.move_group_left_arm = 'Left_Arm'
        _state_machine.userdata.config_name_pre_shelves = 'Gantry_PreGrasp_Pre_shelves'
        _state_machine.userdata.PreGrasp = ''
        _state_machine.userdata.camera_ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.offset_part_left = 0
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.tool_link_left = 'left_ee_link'
        _state_machine.userdata.arm_id_left = ''
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.part_pose_left = []
        _state_machine.userdata.config_name_left_arm2 = 'Left_Home_shelves'
        _state_machine.userdata.config_name_shelves = 'Gantry_PreGrasp_shelves'
        _state_machine.userdata.config_name_right_arm2 = 'Right_Home_shelves'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:745 y:152
            OperatableStateMachine.add('PreShelf',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DetectPart',
                                           'planning_failed': 'Retry_4',
                                           'control_failed': 'Retry_4',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_pre_shelves',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:773 y:27
            OperatableStateMachine.add('Retry_4',
                                       WaitState(wait_time=0.3),
                                       transitions={'done': 'PreShelf'},
                                       autonomy={'done': Autonomy.Off})

            # x:1558 y:259
            OperatableStateMachine.add('PreGrasp',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputePick',
                                           'planning_failed': 'Retry_5',
                                           'control_failed': 'Retry_5',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1730 y:262
            OperatableStateMachine.add('Retry_5',
                                       WaitState(wait_time=0.3),
                                       transitions={'done': 'PreGrasp'},
                                       autonomy={'done': Autonomy.Off})

            # x:1548 y:361
            OperatableStateMachine.add(
                'ComputePick',
                ComputeGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'Move_to_pick',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_left_arm',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link_left',
                    'pose': 'pose',
                    'offset': 'offset_part_left',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:918 y:149
            OperatableStateMachine.add(
                'DetectPart',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Move_left_arm_home2',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'camera_ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'pose'
                })

            # x:1734 y:461
            OperatableStateMachine.add('Retry_6',
                                       WaitState(wait_time=0.3),
                                       transitions={'done': 'Move_to_pick'},
                                       autonomy={'done': Autonomy.Off})

            # x:1533 y:463
            OperatableStateMachine.add('Move_to_pick',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'GripperOn',
                                           'planning_failed': 'Retry_6',
                                           'control_failed': 'GripperOn'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_left_arm',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1535 y:573
            OperatableStateMachine.add('GripperOn',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'Move_left_arm_home_2',
                                           'failed': 'ComputePick',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id_left'})

            # x:1378 y:653
            OperatableStateMachine.add('Move_left_arm_home_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Shelves_2',
                                           'planning_failed': 'Retry_7',
                                           'control_failed': 'Retry_7',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_left_arm2',
                                           'move_group': 'move_group_left_arm',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1426 y:747
            OperatableStateMachine.add(
                'Retry_7',
                WaitState(wait_time=0.3),
                transitions={'done': 'Move_left_arm_home_2'},
                autonomy={'done': Autonomy.Off})

            # x:867 y:641
            OperatableStateMachine.add('PreShelf_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Pose',
                                           'planning_failed': 'Retry_8',
                                           'control_failed': 'Retry_8',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_pre_shelves',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:889 y:738
            OperatableStateMachine.add('Retry_8',
                                       WaitState(wait_time=0.3),
                                       transitions={'done': 'PreShelf_2'},
                                       autonomy={'done': Autonomy.Off})

            # x:127 y:421
            OperatableStateMachine.add('Pose',
                                       ReplaceState(),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'part_pose',
                                           'result': 'part_pose_left'
                                       })

            # x:1135 y:148
            OperatableStateMachine.add('Move_left_arm_home2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Move_right_arm_home2',
                                           'planning_failed': 'Retry_9',
                                           'control_failed': 'Retry_9',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_left_arm2',
                                           'move_group': 'move_group_left_arm',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1159 y:31
            OperatableStateMachine.add(
                'Retry_9',
                WaitState(wait_time=0.3),
                transitions={'done': 'Move_left_arm_home2'},
                autonomy={'done': Autonomy.Off})

            # x:1346 y:147
            OperatableStateMachine.add(
                'Move_right_arm_home2',
                SrdfStateToMoveitAriac(),
                transitions={
                    'reached': 'Shelves',
                    'planning_failed': 'Retry_10',
                    'control_failed': 'Retry_10',
                    'param_error': 'failed'
                },
                autonomy={
                    'reached': Autonomy.Off,
                    'planning_failed': Autonomy.Off,
                    'control_failed': Autonomy.Off,
                    'param_error': Autonomy.Off
                },
                remapping={
                    'config_name': 'config_name_right_arm2',
                    'move_group': 'move_group_right_arm',
                    'move_group_prefix': 'move_group_prefix',
                    'action_topic': 'action_topic',
                    'robot_name': 'robot_name',
                    'config_name_out': 'config_name_out',
                    'move_group_out': 'move_group_out',
                    'robot_name_out': 'robot_name_out',
                    'action_topic_out': 'action_topic_out',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1381 y:35
            OperatableStateMachine.add(
                'Retry_10',
                WaitState(wait_time=0.3),
                transitions={'done': 'Move_right_arm_home2'},
                autonomy={'done': Autonomy.Off})

            # x:1561 y:148
            OperatableStateMachine.add('Shelves',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreGrasp',
                                           'planning_failed': 'Retry_11',
                                           'control_failed': 'Retry_11',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_shelves',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1591 y:35
            OperatableStateMachine.add('Retry_11',
                                       WaitState(wait_time=0.3),
                                       transitions={'done': 'Shelves'},
                                       autonomy={'done': Autonomy.Off})

            # x:1063 y:639
            OperatableStateMachine.add('Shelves_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreShelf_2',
                                           'planning_failed': 'Retry_12',
                                           'control_failed': 'Retry_12',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'config_name_shelves',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1074 y:746
            OperatableStateMachine.add('Retry_12',
                                       WaitState(wait_time=0.3),
                                       transitions={'done': 'Shelves_2'},
                                       autonomy={'done': Autonomy.Off})

        return _state_machine
Пример #24
0
    def create(self):
        # x:1184 y:332, x:604 y:185
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'], input_keys=['part', 'arm_id'])
        _state_machine.userdata.config_name = ''
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.arm_id = 'Right_Arm'
        _state_machine.userdata.tool_link = 'right_ee_link'
        _state_machine.userdata.pose = []
        _state_machine.userdata.offset = 0.15
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.part = 'gear_part_red'
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.home = 'Home'
        _state_machine.userdata.safe = 'Gantry_Bin'
        _state_machine.userdata.Up = 0.2

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:33 y:31
            OperatableStateMachine.add('FindParts',
                                       FindPart(time_out=0.2),
                                       transitions={
                                           'found': 'ArmHome',
                                           'failed': 'failed',
                                           'not_found': 'failed'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'gantry_pos': 'config_name',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame'
                                       })

            # x:647 y:24
            OperatableStateMachine.add(
                'ComputePick',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPart',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'arm_id',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:16 y:242
            OperatableStateMachine.add(
                'GetPartPose',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'PreGrasp',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part',
                    'pose': 'pose'
                })

            # x:839 y:25
            OperatableStateMachine.add('MoveToPart',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'EnableGripper',
                                           'planning_failed': 'failed',
                                           'control_failed': 'EnableGripper'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1048 y:25
            OperatableStateMachine.add('EnableGripper',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'OffsetUp',
                                           'failed': 'MoveToPart',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:27 y:178
            OperatableStateMachine.add('SafePosBetweenBin',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'GetPartPose',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'safe',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:23 y:320
            OperatableStateMachine.add('PreGrasp',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputePick_3',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:25 y:100
            OperatableStateMachine.add('ArmHome',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'SafePosBetweenBin',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'home',
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:361 y:25
            OperatableStateMachine.add('Offset',
                                       part_offsetCalc(),
                                       transitions={
                                           'succes': 'ComputePick',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'part_offset': 'offset'
                                       })

            # x:1041 y:361
            OperatableStateMachine.add('ArmHome_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'SafePosBetweenBin_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'home',
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1041 y:442
            OperatableStateMachine.add('SafePosBetweenBin_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'safe',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1025 y:89
            OperatableStateMachine.add('OffsetUp',
                                       ReplaceState(),
                                       transitions={'done': 'ComputePick_2'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'Up',
                                           'result': 'offset'
                                       })

            # x:1034 y:188
            OperatableStateMachine.add(
                'ComputePick_2',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPart_2',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'arm_id',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1029 y:261
            OperatableStateMachine.add('MoveToPart_2',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'ArmHome_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:22 y:413
            OperatableStateMachine.add(
                'ComputePick_3',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPart_3',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'arm_id',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:331 y:410
            OperatableStateMachine.add('MoveToPart_3',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Offset',
                                           'planning_failed': 'MoveToPart_3',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

        return _state_machine
Пример #25
0
    def create(self):
        # x:1144 y:563, x:642 y:465
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.arm_id = 'Right_Arm'
        _state_machine.userdata.pose = []
        _state_machine.userdata.offset = 0.020
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = '/ariac/logical_camera_belt'
        _state_machine.userdata.camera_frame = 'logical_camera_belt_frame'
        _state_machine.userdata.home = 'Gantry_Home'
        _state_machine.userdata.part = 'gasket_part_blue'
        _state_machine.userdata.belt = 'Gantry_Belt_Right'
        _state_machine.userdata.full_home = 'Full_Home_Blue'
        _state_machine.userdata.clearance = 0.05

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:29 y:50
            OperatableStateMachine.add(
                'Detect_Blue_Part',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Move_Belt',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part',
                    'pose': 'pose'
                })

            # x:240 y:46
            OperatableStateMachine.add('Compute_Pick',
                                       ComputeGraspAriacState(),
                                       transitions={
                                           'continue': 'Move_to_Pick',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'pose': 'pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:454 y:50
            OperatableStateMachine.add('Move_to_Pick',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripper_On',
                                           'planning_failed': 'failed',
                                           'control_failed': 'Gripper_On'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:671 y:56
            OperatableStateMachine.add('Gripper_On',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'Move_Belt_2',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:838 y:52
            OperatableStateMachine.add('Move_Belt_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Add_Clearance',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'belt',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:50 y:152
            OperatableStateMachine.add('Move_Belt',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Offset',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'belt',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1046 y:358
            OperatableStateMachine.add('Left_Arm_Home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'finished',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'full_home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1041 y:144
            OperatableStateMachine.add('Compute_Grasp',
                                       ComputeGraspAriacState(),
                                       transitions={
                                           'continue': 'Move_Clearance',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group': 'arm_id',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'pose': 'pose',
                                           'offset': 'offset',
                                           'rotation': 'rotation',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1013 y:50
            OperatableStateMachine.add('Add_Clearance',
                                       AddNumericState(),
                                       transitions={'done': 'Compute_Grasp'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'clearance',
                                           'value_b': 'offset',
                                           'result': 'offset'
                                       })

            # x:1039 y:226
            OperatableStateMachine.add('Move_Clearance',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Left_Arm_Home',
                                           'planning_failed': 'Left_Arm_Home',
                                           'control_failed': 'Move_Clearance'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'arm_id',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:195 y:108
            OperatableStateMachine.add('Offset',
                                       part_offsetCalc(),
                                       transitions={
                                           'succes': 'Compute_Pick',
                                           'unknown_id': 'failed'
                                       },
                                       autonomy={
                                           'succes': Autonomy.Off,
                                           'unknown_id': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'part_offset': 'offset'
                                       })

        return _state_machine
Пример #26
0
    def create(self):
        # x:328 y:654, x:130 y:365
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'], input_keys=['part_type_R'])
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.move_group_R = 'Right_Arm'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = 'gantry'
        _state_machine.userdata.pose = []
        _state_machine.userdata.offset = 0.03
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.joint_values = []
        _state_machine.userdata.joint_names = []
        _state_machine.userdata.tool_link = 'right_ee_link'
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.config_name = 'Gantry_Pulley_R'
        _state_machine.userdata.part_type_R = 'pulley_part_red'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:30 y:40
            OperatableStateMachine.add('start',
                                       StartAssignment(),
                                       transitions={'continue': 'Find'},
                                       autonomy={'continue': Autonomy.Off})

            # x:285 y:343
            OperatableStateMachine.add(
                'Compute grasp',
                ComputeGraspAriacState(joint_names=[
                    'right_elbow_joint', 'right_shoulder_lift_joint',
                    'right_shoulder_pan_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'move',
                    'failed': 'Compute grasp'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_R',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:279 y:232
            OperatableStateMachine.add(
                'cam',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Compute grasp',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type_R',
                    'pose': 'pose'
                })

            # x:277 y:429
            OperatableStateMachine.add('move',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'grip',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:274 y:503
            OperatableStateMachine.add('grip',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'MOve_2_2',
                                           'failed': 'move',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'move_group_R'})

            # x:293 y:68
            OperatableStateMachine.add('MOve_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'cam',
                                           'planning_failed': 'failed',
                                           'control_failed': 'MOve_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:469 y:553
            OperatableStateMachine.add('MOve_2_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'failed',
                                           'control_failed': 'MOve_2_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:30 y:102
            OperatableStateMachine.add('Find',
                                       FindPart(time_out=0.2),
                                       transitions={
                                           'found': 'MOve_2',
                                           'failed': 'failed',
                                           'not_found': 'failed'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part_type_R',
                                           'gantry_pos': 'gantry_pos',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame'
                                       })

        return _state_machine
Пример #27
0
    def create(self):
        # x:1129 y:453, x:560 y:460
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.config_name = ''
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.arm_id = 'Right_Arm'
        _state_machine.userdata.tool_link = 'right_ee_link'
        _state_machine.userdata.pose = []
        _state_machine.userdata.offset = 0.04
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.part = 'gear_part_red'
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.move_group_R = 'Right_Arm'
        _state_machine.userdata.home = 'Home'
        _state_machine.userdata.safe = 'Gantry_Bin'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:30 y:95
            OperatableStateMachine.add('home',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'FindParts',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'home',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:242 y:32
            OperatableStateMachine.add('Pos',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PartPose',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'config_name',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:672 y:30
            OperatableStateMachine.add(
                'Compute ',
                ComputeGraspAriacState(joint_names=[
                    'right_shoulder_pan_joint', 'right_shoulder_lift_joint',
                    'right_elbow_joint', 'right_wrist_1_joint',
                    'right_wrist_2_joint', 'right_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPart',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_R',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:436 y:43
            OperatableStateMachine.add(
                'PartPose',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'Compute ',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part',
                    'pose': 'pose'
                })

            # x:874 y:46
            OperatableStateMachine.add('MoveToPart',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'Gripper_2',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_R',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:730 y:175
            OperatableStateMachine.add('Gripper_2',
                                       GripperControl(enable=True),
                                       transitions={
                                           'continue': 'finished',
                                           'failed': 'failed',
                                           'invalid_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:148 y:154
            OperatableStateMachine.add('SafePos',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'Pos',
                                           'planning_failed': 'failed',
                                           'control_failed': 'failed',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'safe',
                                           'move_group': 'move_group',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:30 y:219
            OperatableStateMachine.add('FindParts',
                                       FindPart(time_out=0.2),
                                       transitions={
                                           'found': 'SafePos',
                                           'failed': 'failed',
                                           'not_found': 'failed'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'part_type': 'part',
                                           'gantry_pos': 'config_name',
                                           'camera_topic': 'camera_topic',
                                           'camera_frame': 'camera_frame'
                                       })

        return _state_machine
Пример #28
0
	def create(self):
		# x:37 y:662, x:1132 y:221
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.conveyor_belt_power = 100.0
		_state_machine.userdata.config_name_home = 'home'
		_state_machine.userdata.move_group = 'manipulator'
		_state_machine.userdata.move_group_prefix = '/ariac/arm1'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.camera_ref_frame = 'arm1_linear_arm_actuator'
		_state_machine.userdata.camera_topic = '/ariac/logical_camera_6'
		_state_machine.userdata.camera_frame = 'logical_camera_6_frame'
		_state_machine.userdata.part = 'gasket_part'
		_state_machine.userdata.config_name_bin6PreGrasp = 'bin6PreGrasp'
		_state_machine.userdata.tool_link = 'ee_link'
		_state_machine.userdata.part_offset = 0.04
		_state_machine.userdata.part_rotation = 0
		_state_machine.userdata.config_name_tray1PreDrop = 'tray1PreDrop'
		_state_machine.userdata.agv_pose = []
		_state_machine.userdata.part_offsetPre = 0.1
		_state_machine.userdata.part_offsetDown = 0.045
		_state_machine.userdata.arm = ''
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.pose = ''
		_state_machine.userdata.arm1 = '/ariac/arm1'
		_state_machine.userdata.arm2 = '/ariac/arm2'
		_state_machine.userdata.bin4_pose = ''
		_state_machine.userdata.offset = 0
		_state_machine.userdata.rotation = 0
		_state_machine.userdata.config_name_bin4PreGrasp = 'bin4PreGrasp'
		_state_machine.userdata.config_name = home

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:298 y:114
			OperatableStateMachine.add('MoveR1Home',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'Cameras2', 'planning_failed': 'WaitRetry1', 'control_failed': 'WaitRetry1', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:303 y:23
			OperatableStateMachine.add('WaitRetry1',
										WaitState(wait_time=1),
										transitions={'done': 'MoveR1Home'},
										autonomy={'done': Autonomy.Off})

			# x:865 y:119
			OperatableStateMachine.add('ComputePick',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'EnableGripper', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'arm1', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offsetPre', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1283 y:121
			OperatableStateMachine.add('MoveR1ToPick1',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'ComputePick2', 'planning_failed': 'WaitRetry3', 'control_failed': 'WaitRetry3'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'arm1', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1683 y:117
			OperatableStateMachine.add('WaitRetry3',
										WaitState(wait_time=1),
										transitions={'done': 'MoveR1ToPick1'},
										autonomy={'done': Autonomy.Off})

			# x:1518 y:291
			OperatableStateMachine.add('WachtEven',
										WaitState(wait_time=2),
										transitions={'done': 'MoveR1PreGrasp2'},
										autonomy={'done': Autonomy.Off})

			# x:1489 y:392
			OperatableStateMachine.add('MoveR1PreGrasp2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'MoveR1PreDrop', 'planning_failed': 'WaitRetry4', 'control_failed': 'WaitRetry4', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_bin6PreGrasp', 'move_group': 'move_group', 'move_group_prefix': 'arm1', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1665 y:391
			OperatableStateMachine.add('WaitRetry4',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1PreGrasp2'},
										autonomy={'done': Autonomy.Off})

			# x:1492 y:476
			OperatableStateMachine.add('MoveR1PreDrop',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'GetAgvPose', 'planning_failed': 'WaitRetry5', 'control_failed': 'WaitRetry5', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_tray1PreDrop', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1671 y:488
			OperatableStateMachine.add('WaitRetry5',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1PreDrop'},
										autonomy={'done': Autonomy.Off})

			# x:1507 y:559
			OperatableStateMachine.add('GetAgvPose',
										GetObjectPoseState(object_frame='kit_tray_1', ref_frame='arm1_linear_arm_actuator'),
										transitions={'continue': 'ComputeDrop', 'failed': 'ComputeDrop'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'pose': 'agv_pose'})

			# x:1299 y:561
			OperatableStateMachine.add('ComputeDrop',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveR1ToDrop', 'failed': 'MoveR1ToDrop'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'arm1', 'tool_link': 'tool_link', 'pose': 'agv_pose', 'offset': 'part_offsetDown', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1282 y:484
			OperatableStateMachine.add('MoveR1ToDrop',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'DisableGripper', 'planning_failed': 'WaitRetry6', 'control_failed': 'WaitRetry6'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'arm1', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1157 y:561
			OperatableStateMachine.add('WaitRetry6',
										WaitState(wait_time=5),
										transitions={'done': 'MoveR1ToDrop'},
										autonomy={'done': Autonomy.Off})

			# x:1071 y:119
			OperatableStateMachine.add('EnableGripper',
										VacuumGripperControlState(enable=True, service_name='/ariac/arm1/gripper/control'),
										transitions={'continue': 'MoveR1ToPick1', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off})

			# x:1476 y:197
			OperatableStateMachine.add('ComputePick2',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveR1ToPick2', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'arm1', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'part_offset', 'rotation': 'part_rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1273 y:269
			OperatableStateMachine.add('MoveR1ToPick2',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'WachtEven', 'planning_failed': 'WaitRetry7', 'control_failed': 'WaitRetry7'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'arm1', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:945 y:562
			OperatableStateMachine.add('DisableGripper',
										VacuumGripperControlState(enable=False, service_name='/ariac/arm1/gripper/control'),
										transitions={'continue': 'RetrunHomeR1', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off})

			# x:1676 y:239
			OperatableStateMachine.add('WaitRetry7',
										WaitState(wait_time=1),
										transitions={'done': 'MoveR1ToPick2'},
										autonomy={'done': Autonomy.Off})

			# x:944 y:634
			OperatableStateMachine.add('RetrunHomeR1',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'finished', 'planning_failed': 'Waitretry8', 'control_failed': 'Waitretry8', 'param_error': 'Waitretry8'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_home', 'move_group': 'move_group', 'move_group_prefix': 'arm1', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1161 y:640
			OperatableStateMachine.add('Waitretry8',
										WaitState(wait_time=1),
										transitions={'done': 'RetrunHomeR1'},
										autonomy={'done': Autonomy.Off})

			# x:499 y:113
			OperatableStateMachine.add('Cameras2',
										self.use_behavior(Cameras2SM, 'Cameras2'),
										transitions={'finished': 'DetectArm', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'part_type': 'part_type', 'arm': 'arm', 'part_pose': 'part_pose'})

			# x:682 y:172
			OperatableStateMachine.add('DetectArm',
										EqualState(),
										transitions={'true': 'ComputePick', 'false': 'ComputePickR2_1'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'arm', 'value_b': 'arm1'})

			# x:688 y:376
			OperatableStateMachine.add('EnableGripper2',
										VacuumGripperControlState(enable=True, service_name='/ariac/arm2gripper/control'),
										transitions={'continue': 'MoveR2ToPick2', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off})

			# x:687 y:267
			OperatableStateMachine.add('ComputePickR2_1',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'EnableGripper2', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'arm2', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:688 y:478
			OperatableStateMachine.add('MoveR2ToPick2',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'ComputePickR2_2', 'planning_failed': 'MoveR2ToPick2', 'control_failed': 'MoveR2ToPick2'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:689 y:609
			OperatableStateMachine.add('ComputePickR2_2',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'WachtEven2', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:530 y:611
			OperatableStateMachine.add('WachtEven2',
										WaitState(wait_time=2),
										transitions={'done': 'MoveR2PreGrasp'},
										autonomy={'done': Autonomy.Off})

			# x:486 y:460
			OperatableStateMachine.add('MoveR2PreGrasp',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'GetBin4Pose', 'planning_failed': 'MoveR2PreGrasp', 'control_failed': 'MoveR2PreGrasp', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_bin4PreGrasp', 'move_group': 'move_group', 'move_group_prefix': 'arm2', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:299 y:488
			OperatableStateMachine.add('GetBin4Pose',
										GetObjectPoseState(object_frame='kit_tray_1', ref_frame='arm2_linear_arm_actuator'),
										transitions={'continue': 'ComputeDropR2', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'pose': 'bin4_pose'})

			# x:116 y:487
			OperatableStateMachine.add('ComputeDropR2',
										ComputeGraspAriacState(joint_names=['linear_arm_actuator_joint', 'shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint', 'wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']),
										transitions={'continue': 'MoveR2ToDrop', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'pose', 'offset': 'offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:115 y:364
			OperatableStateMachine.add('MoveR2ToDrop',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'DisableGripper2', 'planning_failed': 'MoveR2ToDrop', 'control_failed': 'MoveR2ToDrop'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:116 y:256
			OperatableStateMachine.add('DisableGripper2',
										VacuumGripperControlState(enable=True, service_name='/ariac/arm2/gripper/control'),
										transitions={'continue': 'ReturnHomeR2', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off})

			# x:302 y:256
			OperatableStateMachine.add('ReturnHomeR2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'Cameras2', 'planning_failed': 'ReturnHomeR2', 'control_failed': 'ReturnHomeR2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name', 'move_group': 'move_group', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})


		return _state_machine
Пример #29
0
    def create(self):
        # x:894 y:460, x:898 y:340
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=[
                'bin_id', 'camera_topic', 'camera_frame', 'part_type',
                'PreGraspGantry', 'offset'
            ])
        _state_machine.userdata.bin_id = ''
        _state_machine.userdata.home_gantry_id = 'Gantry_Home'
        _state_machine.userdata.home_rightarm_id = 'Right_PreGrasp'
        _state_machine.userdata.home_leftarm_id = 'Left_PreGrasp'
        _state_machine.userdata.move_group_right = 'Right_Arm'
        _state_machine.userdata.move_group_prefix = '/ariac/gantry'
        _state_machine.userdata.action_topic = '/move_group'
        _state_machine.userdata.robot_name = ''
        _state_machine.userdata.move_group_left = 'Left_Arm'
        _state_machine.userdata.move_group_gantry = 'Gantry'
        _state_machine.userdata.ref_frame = 'world'
        _state_machine.userdata.camera_topic = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.PreGraspGantry = ''
        _state_machine.userdata.SafePosition = 'Gantry_ShelfSAFE'
        _state_machine.userdata.tool_link = 'left_ee_link'
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.offset = ''
        _state_machine.userdata.arm_id = 'left_arm'
        _state_machine.userdata.PreGrasp_RightArm = 'Right_Shelf'
        _state_machine.userdata.PreGrasp_LeftArm = 'Left_Shelf'
        _state_machine.userdata.SafePositionConveyor = 'Gantry_Shelf_Conveyor'

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:29 y:124
            OperatableStateMachine.add('HomepositieRightArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'HomepositieLeftArm',
                                           'planning_failed': 'Retry_1',
                                           'control_failed': 'Retry_1',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'home_rightarm_id',
                                           'move_group': 'move_group_right',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:213 y:119
            OperatableStateMachine.add('HomepositieLeftArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'DetectPart',
                                           'planning_failed': 'Retry_2',
                                           'control_failed': 'Retry_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'home_leftarm_id',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:46 y:34
            OperatableStateMachine.add(
                'Retry_1',
                WaitState(wait_time=3),
                transitions={'done': 'HomepositieRightArm'},
                autonomy={'done': Autonomy.Off})

            # x:230 y:33
            OperatableStateMachine.add(
                'Retry_2',
                WaitState(wait_time=3),
                transitions={'done': 'HomepositieLeftArm'},
                autonomy={'done': Autonomy.Off})

            # x:392 y:114
            OperatableStateMachine.add(
                'DetectPart',
                DetectPartCameraAriacState(time_out=0.5),
                transitions={
                    'continue': 'SafePosition_Conveyor',
                    'failed': 'failed',
                    'not_found': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'not_found': Autonomy.Off
                },
                remapping={
                    'ref_frame': 'ref_frame',
                    'camera_topic': 'camera_topic',
                    'camera_frame': 'camera_frame',
                    'part': 'part_type',
                    'pose': 'part_pose'
                })

            # x:1279 y:116
            OperatableStateMachine.add('PreGraspGantry',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'ComputePick',
                                           'planning_failed': 'Retry_6',
                                           'control_failed': 'Retry_6',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGraspGantry',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1304 y:30
            OperatableStateMachine.add('Retry_6',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'PreGraspGantry'},
                                       autonomy={'done': Autonomy.Off})

            # x:736 y:114
            OperatableStateMachine.add('SafePosition',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreGrasp_RightArm',
                                           'planning_failed': 'Retry_3',
                                           'control_failed': 'Retry_3',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'SafePosition',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:763 y:21
            OperatableStateMachine.add('Retry_3',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'SafePosition'},
                                       autonomy={'done': Autonomy.Off})

            # x:1463 y:117
            OperatableStateMachine.add(
                'ComputePick',
                ComputeGraspAriacState(joint_names=[
                    'left_shoulder_pan_joint', 'left_shoulder_lift_joint',
                    'left_elbow_joint', 'left_wrist_1_joint',
                    'left_wrist_2_joint', 'left_wrist_3_joint'
                ]),
                transitions={
                    'continue': 'MoveToPick',
                    'failed': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'move_group': 'move_group_left',
                    'move_group_prefix': 'move_group_prefix',
                    'tool_link': 'tool_link',
                    'pose': 'part_pose',
                    'offset': 'offset',
                    'rotation': 'rotation',
                    'joint_values': 'joint_values',
                    'joint_names': 'joint_names'
                })

            # x:1645 y:117
            OperatableStateMachine.add('MoveToPick',
                                       MoveitToJointsDynAriacState(),
                                       transitions={
                                           'reached': 'GripperOn',
                                           'planning_failed': 'Retry_7',
                                           'control_failed': 'GripperOn'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'move_group': 'move_group_left',
                                           'action_topic': 'action_topic',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1679 y:35
            OperatableStateMachine.add('Retry_7',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'MoveToPick'},
                                       autonomy={'done': Autonomy.Off})

            # x:1465 y:242
            OperatableStateMachine.add('GripperOn',
                                       VacuumGripperControlState(enable=True),
                                       transitions={
                                           'continue': 'PreGraspLeftArm',
                                           'failed': 'ComputePick',
                                           'invalid_arm_id': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off,
                                           'invalid_arm_id': Autonomy.Off
                                       },
                                       remapping={'arm_id': 'arm_id'})

            # x:1480 y:333
            OperatableStateMachine.add('PreGraspLeftArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'SafePosition_2',
                                           'planning_failed': 'Retry_8',
                                           'control_failed': 'Retry_8',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_LeftArm',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1697 y:328
            OperatableStateMachine.add('Retry_8',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'PreGraspLeftArm'},
                                       autonomy={'done': Autonomy.Off})

            # x:1479 y:426
            OperatableStateMachine.add('SafePosition_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached':
                                           'SafePosition_Conveyor_2',
                                           'planning_failed': 'Retry_9',
                                           'control_failed': 'Retry_9',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'SafePosition',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1700 y:427
            OperatableStateMachine.add('Retry_9',
                                       WaitState(wait_time=3),
                                       transitions={'done': 'SafePosition_2'},
                                       autonomy={'done': Autonomy.Off})

            # x:924 y:115
            OperatableStateMachine.add('PreGrasp_RightArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreGrasp_LeftArm',
                                           'planning_failed': 'Retry_4',
                                           'control_failed': 'Retry_4',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_RightArm',
                                           'move_group': 'move_group_right',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1103 y:113
            OperatableStateMachine.add('PreGrasp_LeftArm',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'PreGraspGantry',
                                           'planning_failed': 'Retry_5',
                                           'control_failed': 'Retry_5',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name': 'PreGrasp_LeftArm',
                                           'move_group': 'move_group_left',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:948 y:23
            OperatableStateMachine.add(
                'Retry_4',
                WaitState(wait_time=3),
                transitions={'done': 'PreGrasp_RightArm'},
                autonomy={'done': Autonomy.Off})

            # x:1126 y:21
            OperatableStateMachine.add(
                'Retry_5',
                WaitState(wait_time=3),
                transitions={'done': 'PreGrasp_LeftArm'},
                autonomy={'done': Autonomy.Off})

            # x:1479 y:517
            OperatableStateMachine.add('SafePosition_Conveyor_2',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'finished',
                                           'planning_failed': 'Retry_10',
                                           'control_failed': 'Retry_10',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'SafePositionConveyor',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:1700 y:541
            OperatableStateMachine.add(
                'Retry_10',
                WaitState(wait_time=3),
                transitions={'done': 'SafePosition_Conveyor_2'},
                autonomy={'done': Autonomy.Off})

            # x:576 y:110
            OperatableStateMachine.add('SafePosition_Conveyor',
                                       SrdfStateToMoveitAriac(),
                                       transitions={
                                           'reached': 'SafePosition',
                                           'planning_failed': 'Retry_3_2',
                                           'control_failed': 'Retry_3_2',
                                           'param_error': 'failed'
                                       },
                                       autonomy={
                                           'reached': Autonomy.Off,
                                           'planning_failed': Autonomy.Off,
                                           'control_failed': Autonomy.Off,
                                           'param_error': Autonomy.Off
                                       },
                                       remapping={
                                           'config_name':
                                           'SafePositionConveyor',
                                           'move_group': 'move_group_gantry',
                                           'move_group_prefix':
                                           'move_group_prefix',
                                           'action_topic': 'action_topic',
                                           'robot_name': 'robot_name',
                                           'config_name_out':
                                           'config_name_out',
                                           'move_group_out': 'move_group_out',
                                           'robot_name_out': 'robot_name_out',
                                           'action_topic_out':
                                           'action_topic_out',
                                           'joint_values': 'joint_values',
                                           'joint_names': 'joint_names'
                                       })

            # x:588 y:23
            OperatableStateMachine.add(
                'Retry_3_2',
                WaitState(wait_time=3),
                transitions={'done': 'SafePosition_Conveyor'},
                autonomy={'done': Autonomy.Off})

        return _state_machine
	def create(self):
		# x:894 y:460, x:898 y:340
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['bin_id', 'camera_topic', 'camera_frame', 'part_type', 'PreGraspGantry', 'offset'])
		_state_machine.userdata.bin_id = ''
		_state_machine.userdata.home_gantry_id = 'Gantry_Home'
		_state_machine.userdata.home_rightarm_id = 'Right_PreGrasp'
		_state_machine.userdata.home_leftarm_id = 'Left_PreGrasp'
		_state_machine.userdata.move_group_right = 'Right_Arm'
		_state_machine.userdata.move_group_prefix = '/ariac/gantry'
		_state_machine.userdata.action_topic = '/move_group'
		_state_machine.userdata.robot_name = ''
		_state_machine.userdata.move_group_left = 'Left_Arm'
		_state_machine.userdata.move_group_gantry = 'Gantry'
		_state_machine.userdata.ref_frame = 'world'
		_state_machine.userdata.camera_topic = ''
		_state_machine.userdata.camera_frame = ''
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.PreGraspGantry = ''
		_state_machine.userdata.SafePosition = 'Gantry_SafeHall2'
		_state_machine.userdata.tool_link = 'right_ee_link'
		_state_machine.userdata.rotation = 0
		_state_machine.userdata.offset = ''
		_state_machine.userdata.arm_id = 'right_arm'

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]


		with _state_machine:
			# x:171 y:112
			OperatableStateMachine.add('HomepositieRightArm',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'HomepositieLeftArm', 'planning_failed': 'Retry_1', 'control_failed': 'Retry_1', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'home_rightarm_id', 'move_group': 'move_group_right', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:346 y:112
			OperatableStateMachine.add('HomepositieLeftArm',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'DetectPart', 'planning_failed': 'Retry_2', 'control_failed': 'Retry_2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'home_leftarm_id', 'move_group': 'move_group_left', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:192 y:14
			OperatableStateMachine.add('Retry_1',
										WaitState(wait_time=3),
										transitions={'done': 'HomepositieRightArm'},
										autonomy={'done': Autonomy.Off})

			# x:369 y:20
			OperatableStateMachine.add('Retry_2',
										WaitState(wait_time=3),
										transitions={'done': 'HomepositieLeftArm'},
										autonomy={'done': Autonomy.Off})

			# x:674 y:117
			OperatableStateMachine.add('DetectPart',
										DetectPartCameraAriacState(time_out=0.5),
										transitions={'continue': 'SafePosition', 'failed': 'failed', 'not_found': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ref_frame': 'ref_frame', 'camera_topic': 'camera_topic', 'camera_frame': 'camera_frame', 'part': 'part_type', 'pose': 'part_pose'})

			# x:1040 y:119
			OperatableStateMachine.add('PreGraspGantry',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'ComputePick', 'planning_failed': 'Retry_4', 'control_failed': 'Retry_4', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'PreGraspGantry', 'move_group': 'move_group_gantry', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1059 y:29
			OperatableStateMachine.add('Retry_4',
										WaitState(wait_time=3),
										transitions={'done': 'PreGraspGantry'},
										autonomy={'done': Autonomy.Off})

			# x:865 y:116
			OperatableStateMachine.add('SafePosition',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'PreGraspGantry', 'planning_failed': 'Retry_4_2', 'control_failed': 'Retry_4_2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'SafePosition', 'move_group': 'move_group_gantry', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:888 y:29
			OperatableStateMachine.add('Retry_4_2',
										WaitState(wait_time=3),
										transitions={'done': 'SafePosition'},
										autonomy={'done': Autonomy.Off})

			# x:1222 y:129
			OperatableStateMachine.add('ComputePick',
										ComputeGraspAriacState(joint_names=['right_shoulder_pan_joint', 'right_shoulder_lift_joint', 'right_elbow_joint', 'right_wrist_1_joint', 'right_wrist_2_joint', 'right_wrist_3_joint']),
										transitions={'continue': 'MoveToPick', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_group': 'move_group_right', 'move_group_prefix': 'move_group_prefix', 'tool_link': 'tool_link', 'pose': 'part_pose', 'offset': 'offset', 'rotation': 'rotation', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1403 y:125
			OperatableStateMachine.add('MoveToPick',
										MoveitToJointsDynAriacState(),
										transitions={'reached': 'GripperOn', 'planning_failed': 'Retry_5', 'control_failed': 'GripperOn'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'move_group_prefix': 'move_group_prefix', 'move_group': 'move_group_right', 'action_topic': 'action_topic', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1438 y:29
			OperatableStateMachine.add('Retry_5',
										WaitState(wait_time=3),
										transitions={'done': 'MoveToPick'},
										autonomy={'done': Autonomy.Off})

			# x:1407 y:217
			OperatableStateMachine.add('GripperOn',
										VacuumGripperControlState(enable=True),
										transitions={'continue': 'PreGraspRightArm', 'failed': 'ComputePick', 'invalid_arm_id': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_id'})

			# x:1412 y:298
			OperatableStateMachine.add('PreGraspRightArm',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'SafePosition_2', 'planning_failed': 'Retry_6', 'control_failed': 'Retry_6', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'home_rightarm_id', 'move_group': 'move_group_right', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1619 y:321
			OperatableStateMachine.add('Retry_6',
										WaitState(wait_time=3),
										transitions={'done': 'PreGraspRightArm'},
										autonomy={'done': Autonomy.Off})

			# x:1398 y:392
			OperatableStateMachine.add('SafePosition_2',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'finished', 'planning_failed': 'Retry_6_2', 'control_failed': 'Retry_6_2', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'SafePosition', 'move_group': 'move_group_gantry', 'move_group_prefix': 'move_group_prefix', 'action_topic': 'action_topic', 'robot_name': 'robot_name', 'config_name_out': 'config_name_out', 'move_group_out': 'move_group_out', 'robot_name_out': 'robot_name_out', 'action_topic_out': 'action_topic_out', 'joint_values': 'joint_values', 'joint_names': 'joint_names'})

			# x:1604 y:418
			OperatableStateMachine.add('Retry_6_2',
										WaitState(wait_time=3),
										transitions={'done': 'SafePosition_2'},
										autonomy={'done': Autonomy.Off})


		return _state_machine