def create(self):
		# x:472 y:615, x:38 y:355
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.part_type = part_type
		_state_machine.userdata.agv_id = agv_id
		_state_machine.userdata.pose_on_agv = pose_on_agv

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


		with _state_machine:
			# x:427 y:22
			OperatableStateMachine.add('standby',
										WaitState(wait_time=3),
										transitions={'done': 'Get_order'},
										autonomy={'done': Autonomy.Off})

			# x:399 y:103
			OperatableStateMachine.add('Get_order',
										GetOrderState(),
										transitions={'continue': 'transport_part_form_bin_to_agv_state'},
										autonomy={'continue': Autonomy.Off},
										remapping={'order_id': 'order_id', 'shipments': 'shipments', 'number_of_shipments': 'number_of_shipments'})

			# x:368 y:302
			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': 'finished', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'part_type': 'part_type', 'agv_id': 'agv_id', 'pose_on_agv': 'pose_on_agv'})


		return _state_machine
Пример #2
0
	def create(self):
		# x:867 y:12, x:483 y:355
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.order_id = ''
		_state_machine.userdata.shipments = []
		_state_machine.userdata.number_of_shipments = 0
		_state_machine.userdata.shipment_type = ''
		_state_machine.userdata.shipment_index = 0
		_state_machine.userdata.agv_id = ''
		_state_machine.userdata.number_of_products = 0
		_state_machine.userdata.products = []
		_state_machine.userdata.product_index = 0
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.part_pose = []
		_state_machine.userdata.increment = 1
		_state_machine.userdata.Null = 0
		_state_machine.userdata.pose_on_agv = []
		_state_machine.userdata.old_order_id = ''

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


		with _state_machine:
			# x:49 y:117
			OperatableStateMachine.add('startassignment',
										StartAssignment(),
										transitions={'continue': 'get_order'},
										autonomy={'continue': Autonomy.Off})

			# x:207 y:119
			OperatableStateMachine.add('get_order',
										GetOrderState(),
										transitions={'continue': 'TestLastOrder'},
										autonomy={'continue': Autonomy.Off},
										remapping={'order_id': 'order_id', 'shipments': 'shipments', 'number_of_shipments': 'number_of_shipments'})

			# x:410 y:121
			OperatableStateMachine.add('getProductsfromshipment',
										GetProductsFromShipmentState(),
										transitions={'continue': 'ShipmentID', 'invalid_index': 'failed'},
										autonomy={'continue': Autonomy.Off, 'invalid_index': Autonomy.Off},
										remapping={'shipments': 'shipments', 'index': 'shipment_index', 'shipment_type': 'shipment_type', 'agv_id': 'agv_id', 'products': 'products', 'number_of_products': 'number_of_products'})

			# x:848 y:122
			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': 'IncreaseProductIndex', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'part_type': 'part_type', 'agv_id': 'agv_id', 'part_pose': 'part_pose', 'pose': 'pose'})

			# x:649 y:120
			OperatableStateMachine.add('GetPartinfo',
										GetPartFromProductsState(),
										transitions={'continue': 'transport_part_form_bin_to_agv_state', 'invalid_index': 'failed'},
										autonomy={'continue': Autonomy.Off, 'invalid_index': Autonomy.Off},
										remapping={'products': 'products', 'index': 'product_index', 'type': 'part_type', 'pose': 'part_pose'})

			# x:928 y:241
			OperatableStateMachine.add('IncreaseProductIndex',
										AddNumericState(),
										transitions={'done': 'CheckProduct_index'},
										autonomy={'done': Autonomy.Off},
										remapping={'value_a': 'product_index', 'value_b': 'increment', 'result': 'product_index'})

			# x:934 y:323
			OperatableStateMachine.add('CheckProduct_index',
										EqualState(),
										transitions={'true': 'SETnull', 'false': 'GetPartinfo'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'product_index', 'value_b': 'number_of_products'})

			# x:770 y:514
			OperatableStateMachine.add('IncreaseShipmentIndex',
										AddNumericState(),
										transitions={'done': 'Checkshipmentindex'},
										autonomy={'done': Autonomy.Off},
										remapping={'value_a': 'shipment_index', 'value_b': 'increment', 'result': 'shipment_index'})

			# x:396 y:499
			OperatableStateMachine.add('Checkshipmentindex',
										EqualState(),
										transitions={'true': 'get_order', 'false': 'notify_shipment_ready'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'number_of_shipments', 'value_b': 'shipment_index'})

			# x:990 y:530
			OperatableStateMachine.add('SETnull',
										ReplaceState(),
										transitions={'done': 'IncreaseShipmentIndex'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'Null', 'result': 'product_index'})

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

			# x:388 y:13
			OperatableStateMachine.add('TestLastOrder',
										EqualState(),
										transitions={'true': 'finished', 'false': 'RememberOldOrder'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'order_id', 'value_b': 'old_order_id'})

			# x:632 y:44
			OperatableStateMachine.add('RememberOldOrder',
										ReplaceState(),
										transitions={'done': 'getProductsfromshipment'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'order_id', 'result': 'old_order_id'})

			# x:40 y:265
			OperatableStateMachine.add('ShipmentID',
										MessageState(),
										transitions={'continue': 'GetPartinfo'},
										autonomy={'continue': Autonomy.Off},
										remapping={'message': 'shipment_type'})


		return _state_machine
    def create(self):
        # x:642 y:425, x:506 y:337
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            output_keys=['part_type', 'agv_id', 'pose_on_agv'])
        _state_machine.userdata.order_id = ' '
        _state_machine.userdata.shipments = []
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.shipment_index = 0
        _state_machine.userdata.shipment_type = ''
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.product_index = 0
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.one_value = 1
        _state_machine.userdata.zero_value = 0
        _state_machine.userdata.pose_on_agv = []
        _state_machine.userdata.camera_ref_frame = ''
        _state_machine.userdata.camera_frame = ''
        _state_machine.userdata.tool_link = 'ee_link'
        _state_machine.userdata.camera_topic = ''

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

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:59 y:52
            OperatableStateMachine.add('StartAssignment',
                                       StartAssignment(),
                                       transitions={'continue': 'GetOrder'},
                                       autonomy={'continue': Autonomy.Off})

            # x:225 y:52
            OperatableStateMachine.add(
                'GetOrder',
                GetOrderState(),
                transitions={'continue': 'GetProductsFromShipment'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'order_id',
                    'shipments': 'shipments',
                    'number_of_shipments': 'number_of_shipments'
                })

            # x:442 y:53
            OperatableStateMachine.add('GetProductsFromShipment',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'GetPartFromProduct',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:675 y:55
            OperatableStateMachine.add(
                'GetPartFromProduct',
                GetPartFromProductsState(),
                transitions={
                    'continue': 'transport_part_form_bin_to_agv_state',
                    'invalid_index': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'invalid_index': Autonomy.Off
                },
                remapping={
                    'products': 'products',
                    'index': 'product_index',
                    'type': 'part_type',
                    'pose': 'pose_on_agv'
                })

            # x:958 y:176
            OperatableStateMachine.add(
                'IncrementProductIndex',
                AddNumericState(),
                transitions={'done': 'EindeProductenLijst'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'product_index',
                    'value_b': 'one_value',
                    'result': 'product_index'
                })

            # x:963 y:273
            OperatableStateMachine.add('EindeProductenLijst',
                                       EqualState(),
                                       transitions={
                                           'true': 'IncrementShipmentIndex',
                                           'false': 'GetPartFromProduct'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'number_of_products'
                                       })

            # x:964 y:363
            OperatableStateMachine.add('IncrementShipmentIndex',
                                       AddNumericState(),
                                       transitions={'done': 'EindeShipment'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'one_value',
                                           'result': 'shipment_index'
                                       })

            # x:967 y:449
            OperatableStateMachine.add('EindeShipment',
                                       EqualState(),
                                       transitions={
                                           'true': 'GetOrder',
                                           'false': 'GetProductsFromShipment'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'number_of_shipments'
                                       })

            # x:917 y:45
            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': 'IncrementProductIndex',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={
                    'part_type': 'part_type',
                    'agv_id': 'agv_id',
                    'pose_on_agv': 'pose_on_agv',
                    'camera_ref_frame': 'camera_ref_frame',
                    'camera_frame': 'camera_frame',
                    'camera_topic': 'camera_topic'
                })

        return _state_machine
Пример #4
0
    def create(self):
        # x:509 y:35, x:204 y:373
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.shipments = []
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.shipment_type = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.shipment_index = 0
        _state_machine.userdata.product_index = 0
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.one_value = 1
        _state_machine.userdata.zero_value = 0
        _state_machine.userdata.order_id = ''
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.old_order_id = ''

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

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:65 y:95
            OperatableStateMachine.add('start',
                                       StartAssignment(),
                                       transitions={'continue': 'getorder'},
                                       autonomy={'continue': Autonomy.Off})

            # x:243 y:92
            OperatableStateMachine.add(
                'getorder',
                GetOrderState(),
                transitions={'continue': 'compare_last_order'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'order_id',
                    'shipments': 'shipments',
                    'number_of_shipments': 'number_of_shipments'
                })

            # x:465 y:94
            OperatableStateMachine.add('get_products_from_shipments',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue':
                                           'get_part_from_products',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:689 y:90
            OperatableStateMachine.add(
                'get_part_from_products',
                GetPartFromProductsState(),
                transitions={
                    'continue': 'transport_part_form_bin_to_agv_state',
                    'invalid_index': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'invalid_index': Autonomy.Off
                },
                remapping={
                    'products': 'products',
                    'index': 'product_index',
                    'type': 'part_type',
                    'pose': 'part_pose'
                })

            # x:986 y:193
            OperatableStateMachine.add('increment_product_index',
                                       AddNumericState(),
                                       transitions={'done': 'einde_products'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'one_value',
                                           'result': 'product_index'
                                       })

            # x:978 y:283
            OperatableStateMachine.add('einde_products',
                                       EqualState(),
                                       transitions={
                                           'true': 'reset_product index',
                                           'false': 'get_part_from_products'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'number_of_products'
                                       })

            # x:972 y:480
            OperatableStateMachine.add('increment_shipment_index',
                                       AddNumericState(),
                                       transitions={'done': 'einde_shipments'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'one_value',
                                           'result': 'shipment_index'
                                       })

            # x:971 y:579
            OperatableStateMachine.add('einde_shipments',
                                       EqualState(),
                                       transitions={
                                           'true': 'notify_shipment_ready',
                                           'false':
                                           'get_products_from_shipments'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'number_of_shipments'
                                       })

            # x:978 y:384
            OperatableStateMachine.add(
                'reset_product index',
                ReplaceState(),
                transitions={'done': 'increment_shipment_index'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'zero_value',
                    'result': 'product_index'
                })

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

            # x:959 y:86
            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': 'increment_product_index',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={
                    'part_type': 'part_type',
                    'agv_id': 'agv_id',
                    'pose_on_agv': 'part_pose'
                })

            # x:266 y:2
            OperatableStateMachine.add('compare_last_order',
                                       EqualState(),
                                       transitions={
                                           'true': 'finished',
                                           'false': 'rememberoldorder'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'order_id',
                                           'value_b': 'old_order_id'
                                       })

            # x:584 y:4
            OperatableStateMachine.add(
                'rememberoldorder',
                ReplaceState(),
                transitions={'done': 'get_products_from_shipments'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'order_id',
                    'result': 'old_order_id'
                })

        return _state_machine
Пример #5
0
    def create(self):
        # x:650 y:25, x:929 y:416
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.product_index = 0
        _state_machine.userdata.shipment_index = 0
        _state_machine.userdata.material_locations = []
        _state_machine.userdata.bin_index = 0
        _state_machine.userdata.order_id = ''
        _state_machine.userdata.shipments = []
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.shipment_type = ''
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.bin_id = ''
        _state_machine.userdata.old_order_id = ''
        _state_machine.userdata.one_value = 1
        _state_machine.userdata.zero_value = 0

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

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:45 y:112
            OperatableStateMachine.add('StartAssignment',
                                       StartAssignment(),
                                       transitions={'continue': 'GetOrder'},
                                       autonomy={'continue': Autonomy.Off})

            # x:211 y:112
            OperatableStateMachine.add('GetOrder',
                                       GetOrderState(),
                                       transitions={'continue': 'ConveyorOff'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={
                                           'order_id':
                                           'order_id',
                                           'shipments':
                                           'shipments',
                                           'number_of_shipments':
                                           'number_of_shipments'
                                       })

            # x:424 y:113
            OperatableStateMachine.add('TestLastOrder',
                                       EqualState(),
                                       transitions={
                                           'true': 'EndAssignment',
                                           'false': 'RememberOldOrder'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'order_id',
                                           'value_b': 'old_order_id'
                                       })

            # x:650 y:114
            OperatableStateMachine.add('RememberOldOrder',
                                       ReplaceState(),
                                       transitions={'done': 'GetShipment'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'order_id',
                                           'result': 'old_order_id'
                                       })

            # x:869 y:114
            OperatableStateMachine.add('GetShipment',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'GetPart',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:1122 y:115
            OperatableStateMachine.add('GetPart',
                                       GetPartFromProductsState(),
                                       transitions={
                                           'continue': 'MaterialLocation',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'products': 'products',
                                           'index': 'product_index',
                                           'type': 'part_type',
                                           'pose': 'part_pose'
                                       })

            # x:1361 y:113
            OperatableStateMachine.add('MaterialLocation',
                                       GetMaterialLocationsState(),
                                       transitions={'continue': 'GetBin'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={
                                           'part':
                                           'part_type',
                                           'material_locations':
                                           'material_locations'
                                       })

            # x:1361 y:235
            OperatableStateMachine.add('GetBin',
                                       GetItemFromListState(),
                                       transitions={
                                           'done': 'AGV_id',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'done': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'list': 'material_locations',
                                           'index': 'bin_index',
                                           'item': 'bin_id'
                                       })

            # x:759 y:683
            OperatableStateMachine.add('IncrementShipmentIndex',
                                       AddNumericState(),
                                       transitions={'done': 'EndShipment'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'one_value',
                                           'result': 'shipment_index'
                                       })

            # x:536 y:683
            OperatableStateMachine.add('EndShipment',
                                       EqualState(),
                                       transitions={
                                           'true': 'Notify_shipment_ready',
                                           'false': 'GetShipment'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'number_of_shipments'
                                       })

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

            # x:206 y:680
            OperatableStateMachine.add('Notify_shipment_ready',
                                       self.use_behavior(
                                           Notify_shipment_readySM,
                                           'Notify_shipment_ready'),
                                       transitions={
                                           'finished': 'ResetShipmentIndex',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'shipment_type': 'shipment_type',
                                           'agv_id': 'agv_id'
                                       })

            # x:1357 y:675
            OperatableStateMachine.add(
                'GripperChoice',
                self.use_behavior(GripperChoiceSM, 'GripperChoice'),
                transitions={
                    'finished': 'IncrementShipmentIndex',
                    'failed': 'failed',
                    'false': 'GetPart'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit,
                    'false': Autonomy.Inherit
                },
                remapping={
                    'number_of_products': 'number_of_products',
                    'product_index': 'product_index',
                    'bin_id': 'bin_id',
                    'part_type': 'part_type',
                    'part_pose': 'part_pose',
                    'agv_id': 'agv_id'
                })

            # x:194 y:377
            OperatableStateMachine.add('ResetShipmentIndex',
                                       ReplaceState(),
                                       transitions={'done': 'GetOrder'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero_value',
                                           'result': 'shipment_index'
                                       })

            # x:216 y:19
            OperatableStateMachine.add('ConveyorOff',
                                       SetConveyorbeltPowerState(),
                                       transitions={
                                           'continue': 'TestLastOrder',
                                           'fail': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={'power': 'zero_value'})

            # x:1384 y:446
            OperatableStateMachine.add(
                'AGV_id',
                MessageState(),
                transitions={'continue': 'GripperChoice'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'agv_id'})

        return _state_machine
	def create(self):
		# x:821 y:56, x:1214 y:358
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_state_machine.userdata.order_id = ''
		_state_machine.userdata.shipments = []
		_state_machine.userdata.number_of_shipments = 0
		_state_machine.userdata.old_order_id = ''
		_state_machine.userdata.shipment_index = 0
		_state_machine.userdata.shipment_type = ''
		_state_machine.userdata.agv_id = ''
		_state_machine.userdata.products = []
		_state_machine.userdata.number_of_products = 0
		_state_machine.userdata.product_index = 0
		_state_machine.userdata.part_type = ''
		_state_machine.userdata.material_locations = []
		_state_machine.userdata.bin_index = 0
		_state_machine.userdata.bin_id = ''
		_state_machine.userdata.one_value = 1
		_state_machine.userdata.zero_value = 0
		_state_machine.userdata.arm_right = 'right_arm'
		_state_machine.userdata.arm_left = 'left_arm'
		_state_machine.userdata.product_location1 = ''
		_state_machine.userdata.product_location2 = ''
		_state_machine.userdata.home_rightarm_id = 'Right_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.home_leftarm_id = 'Left_PreGrasp'
		_state_machine.userdata.move_group_left = 'Left_Arm'

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


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

			# x:218 y:48
			OperatableStateMachine.add('GetOrder',
										GetOrderState(),
										transitions={'continue': 'Test_LastOrder'},
										autonomy={'continue': Autonomy.Off},
										remapping={'order_id': 'order_id', 'shipments': 'shipments', 'number_of_shipments': 'number_of_shipments'})

			# x:422 y:47
			OperatableStateMachine.add('Test_LastOrder',
										EqualState(),
										transitions={'true': 'EndAssignment', 'false': 'Remember_OldOrder'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'order_id', 'value_b': 'old_order_id'})

			# x:614 y:124
			OperatableStateMachine.add('Remember_OldOrder',
										ReplaceState(),
										transitions={'done': 'GetShipment'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'order_id', 'result': 'old_order_id'})

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

			# x:801 y:119
			OperatableStateMachine.add('GetShipment',
										GetProductsFromShipmentState(),
										transitions={'continue': 'GetPart', 'invalid_index': 'failed'},
										autonomy={'continue': Autonomy.Off, 'invalid_index': Autonomy.Off},
										remapping={'shipments': 'shipments', 'index': 'shipment_index', 'shipment_type': 'shipment_type', 'agv_id': 'agv_id', 'products': 'products', 'number_of_products': 'number_of_products'})

			# x:1023 y:119
			OperatableStateMachine.add('GetPart',
										GetPartFromProductsState(),
										transitions={'continue': 'MaterialLocation', 'invalid_index': 'failed'},
										autonomy={'continue': Autonomy.Off, 'invalid_index': Autonomy.Off},
										remapping={'products': 'products', 'index': 'product_index', 'type': 'part_type', 'pose': 'part_pose'})

			# x:1217 y:116
			OperatableStateMachine.add('MaterialLocation',
										GetMaterialLocationsState(),
										transitions={'continue': 'GetBin'},
										autonomy={'continue': Autonomy.Off},
										remapping={'part': 'part_type', 'material_locations': 'material_locations'})

			# x:1403 y:114
			OperatableStateMachine.add('GetBin',
										GetItemFromListState(),
										transitions={'done': 'CheckAttachedRight', 'invalid_index': 'failed'},
										autonomy={'done': Autonomy.Off, 'invalid_index': Autonomy.Off},
										remapping={'list': 'material_locations', 'index': 'bin_index', 'item': 'bin_id'})

			# x:1361 y:507
			OperatableStateMachine.add('IncrementProductIndex',
										AddNumericState(),
										transitions={'done': 'EndProduct'},
										autonomy={'done': Autonomy.Off},
										remapping={'value_a': 'product_index', 'value_b': 'one_value', 'result': 'product_index'})

			# x:1360 y:585
			OperatableStateMachine.add('EndProduct',
										EqualState(),
										transitions={'true': 'HomepositieRightArm', 'false': 'CheckAttachedRight2'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'product_index', 'value_b': 'number_of_products'})

			# x:95 y:565
			OperatableStateMachine.add('ResetProductIndex',
										ReplaceState(),
										transitions={'done': 'IncrementShipmentIndex'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'zero_value', 'result': 'product_index'})

			# x:98 y:469
			OperatableStateMachine.add('IncrementShipmentIndex',
										AddNumericState(),
										transitions={'done': 'Notify_Shipment_Ready'},
										autonomy={'done': Autonomy.Off},
										remapping={'value_a': 'shipment_index', 'value_b': 'one_value', 'result': 'shipment_index'})

			# x:89 y:277
			OperatableStateMachine.add('EndShipment',
										EqualState(),
										transitions={'true': 'ResetShipmentIndex', 'false': 'GetShipment'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'shipment_index', 'value_b': 'number_of_shipments'})

			# x:87 y:378
			OperatableStateMachine.add('Notify_Shipment_Ready',
										self.use_behavior(Notify_Shipment_ReadySM, 'Notify_Shipment_Ready'),
										transitions={'finished': 'EndShipment', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'agv_id': 'agv_id', 'shipment_type': 'shipment_type'})

			# x:1605 y:181
			OperatableStateMachine.add('Transport_part_from_bin_to_agv',
										self.use_behavior(Transport_part_from_bin_to_agvSM, 'Transport_part_from_bin_to_agv'),
										transitions={'finished': 'SetVariablePart1', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'agv_id': 'agv_id', 'part_type': 'part_type', 'part_pose': 'part_pose', 'bin_id': 'bin_id'})

			# x:95 y:183
			OperatableStateMachine.add('ResetShipmentIndex',
										ReplaceState(),
										transitions={'done': 'GetOrder'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'zero_value', 'result': 'shipment_index'})

			# x:1354 y:248
			OperatableStateMachine.add('CheckAttachedRight',
										CheckGripperattached(),
										transitions={'True': 'CheckAttachedLeft', 'False': 'Transport_part_from_bin_to_agv', 'invalid_arm_id': 'failed'},
										autonomy={'True': Autonomy.Off, 'False': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_right'})

			# x:1356 y:335
			OperatableStateMachine.add('CheckAttachedLeft',
										CheckGripperattached(),
										transitions={'True': 'IncrementProductIndex', 'False': 'Transport_part_from_bin_to_agv_LeftArm', 'invalid_arm_id': 'failed'},
										autonomy={'True': Autonomy.Off, 'False': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_left'})

			# x:1572 y:418
			OperatableStateMachine.add('Transport_part_from_bin_to_agv_LeftArm',
										self.use_behavior(Transport_part_from_bin_to_agv_LeftArmSM, 'Transport_part_from_bin_to_agv_LeftArm'),
										transitions={'finished': 'SetVariablePart2', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'agv_id': 'agv_id', 'part_type': 'part_type', 'part_pose': 'part_pose', 'bin_id': 'bin_id'})

			# x:1654 y:275
			OperatableStateMachine.add('SetVariablePart1',
										ReplaceState(),
										transitions={'done': 'IncrementProductIndex'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'part_pose', 'result': 'product_location1'})

			# x:1651 y:503
			OperatableStateMachine.add('SetVariablePart2',
										ReplaceState(),
										transitions={'done': 'IncrementProductIndex'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'part_pose', 'result': 'product_location2'})

			# x:997 y:510
			OperatableStateMachine.add('CheckAttachedRight2',
										CheckGripperattached(),
										transitions={'True': 'CheckAttachedLeft2', 'False': 'GetPart', 'invalid_arm_id': 'failed'},
										autonomy={'True': Autonomy.Off, 'False': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_right'})

			# x:803 y:520
			OperatableStateMachine.add('CheckAttachedLeft2',
										CheckGripperattached(),
										transitions={'True': 'PlaceOnAgv', 'False': 'GetPart', 'invalid_arm_id': 'failed'},
										autonomy={'True': Autonomy.Off, 'False': Autonomy.Off, 'invalid_arm_id': Autonomy.Off},
										remapping={'arm_id': 'arm_left'})

			# x:533 y:450
			OperatableStateMachine.add('PlaceOnAgv',
										self.use_behavior(PlaceOnAgvSM, 'PlaceOnAgv'),
										transitions={'finished': 'GetPart', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'agv_id': 'agv_id', 'part_pose_right': 'product_location1', 'part_pose_left': 'product_location2'})

			# x:1371 y:670
			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:1182 y:655
			OperatableStateMachine.add('HomepositieLeftArm',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'PlaceOnAgv_2', '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:1558 y:671
			OperatableStateMachine.add('Retry_1',
										WaitState(wait_time=3),
										transitions={'done': 'HomepositieRightArm'},
										autonomy={'done': Autonomy.Off})

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

			# x:832 y:626
			OperatableStateMachine.add('PlaceOnAgv_2',
										self.use_behavior(PlaceOnAgvSM, 'PlaceOnAgv_2'),
										transitions={'finished': 'ResetProductIndex', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'agv_id': 'agv_id', 'part_pose_right': 'product_location1', 'part_pose_left': 'product_location2'})


		return _state_machine
Пример #7
0
    def create(self):
        # x:667 y:540, x:729 y:205
        _state_machine = OperatableStateMachine(outcomes=['finished', 'fail'])
        _state_machine.userdata.shipments = []
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.material_locations = []
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.order_id = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.shipment_type = ''
        _state_machine.userdata.pose = []
        _state_machine.userdata.product_index = 0
        _state_machine.userdata.shipment_index = 1
        _state_machine.userdata.add_one = 1
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.zero = 0

        # 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': 'GetOrder'},
                                       autonomy={'continue': Autonomy.Off})

            # x:905 y:34
            OperatableStateMachine.add('GetProductPose',
                                       GetPartFromProductsState(),
                                       transitions={
                                           'continue': 'message_3',
                                           'invalid_index': 'fail'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'products': 'products',
                                           'index': 'product_index',
                                           'type': 'part_type',
                                           'pose': 'part_pose'
                                       })

            # x:1091 y:123
            OperatableStateMachine.add('TransportPartToAgv',
                                       self.use_behavior(
                                           TransportPartToAgvSM,
                                           'TransportPartToAgv'),
                                       transitions={
                                           'finished': 'IncrementProductIndex',
                                           'failed': 'fail'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'agv_id': 'agv_id',
                                           'part_type': 'part_type',
                                           'part_pose': 'part_pose'
                                       })

            # x:1095 y:229
            OperatableStateMachine.add('IncrementProductIndex',
                                       AddNumericState(),
                                       transitions={'done': 'ShipmentReady?'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'add_one',
                                           'result': 'product_index'
                                       })

            # x:1092 y:486
            OperatableStateMachine.add(
                'IncrementShipmentIndex',
                AddNumericState(),
                transitions={'done': 'notify_shipment_ready'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'shipment_index',
                    'value_b': 'add_one',
                    'result': 'shipment_index'
                })

            # x:1094 y:329
            OperatableStateMachine.add('ShipmentReady?',
                                       EqualState(),
                                       transitions={
                                           'true': 'ResetProductIndex',
                                           'false': 'GetProductPose'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'number_of_products'
                                       })

            # x:474 y:461
            OperatableStateMachine.add('OrderReady?',
                                       EqualState(),
                                       transitions={
                                           'true': 'ResetShiptIndex',
                                           'false': 'GetProductsShipment'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'number_of_shipments'
                                       })

            # x:857 y:483
            OperatableStateMachine.add('notify_shipment_ready',
                                       self.use_behavior(
                                           notify_shipment_readySM,
                                           'notify_shipment_ready'),
                                       transitions={
                                           'finished': 'OrderReady?',
                                           'failed': 'fail'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:402 y:33
            OperatableStateMachine.add(
                'message',
                MessageLogger(),
                transitions={'continue': 'GetProductsShipment'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'order_id'})

            # x:766 y:40
            OperatableStateMachine.add(
                'message_2',
                MessageLogger(),
                transitions={'continue': 'GetProductPose'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'shipment_type'})

            # x:1090 y:36
            OperatableStateMachine.add(
                'message_3',
                MessageLogger(),
                transitions={'continue': 'TransportPartToAgv'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_type'})

            # x:560 y:34
            OperatableStateMachine.add('GetProductsShipment',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'message_2',
                                           'invalid_index': 'fail'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:203 y:32
            OperatableStateMachine.add('GetOrder',
                                       GetOrderState(),
                                       transitions={'continue': 'message'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={
                                           'order_id':
                                           'order_id',
                                           'shipments':
                                           'shipments',
                                           'number_of_shipments':
                                           'number_of_shipments'
                                       })

            # x:1090 y:407
            OperatableStateMachine.add(
                'ResetProductIndex',
                ReplaceState(),
                transitions={'done': 'IncrementShipmentIndex'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'zero',
                    'result': 'product_index'
                })

            # x:338 y:318
            OperatableStateMachine.add('ResetShiptIndex',
                                       ReplaceState(),
                                       transitions={'done': 'GetOrder'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero',
                                           'result': 'shipment_index'
                                       })

        return _state_machine
Пример #8
0
    def create(self):
        # x:144 y:698, x:147 y:461
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.order_id = ''
        _state_machine.userdata.shipments = []
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.shipment_index = 0
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.product_index = 0
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.one_value = 1
        _state_machine.userdata.zero_value = 0
        _state_machine.userdata.shipment_type = ''

        # 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': 'GetOrder'},
                                       autonomy={'continue': Autonomy.Off})

            # x:190 y:41
            OperatableStateMachine.add(
                'GetOrder',
                GetOrderState(),
                transitions={'continue': 'GetProductsFromShipment'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'order_id',
                    'shipments': 'shipments',
                    'number_of_shipments': 'number_of_shipments'
                })

            # x:409 y:40
            OperatableStateMachine.add('GetProductsFromShipment',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'GetPartFromProduct',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:670 y:38
            OperatableStateMachine.add(
                'GetPartFromProduct',
                GetPartFromProductsState(),
                transitions={
                    'continue': 'transport_part_form_bin_to_agv_state',
                    'invalid_index': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'invalid_index': Autonomy.Off
                },
                remapping={
                    'products': 'products',
                    'index': 'product_index',
                    'type': 'part_type',
                    'pose': 'part_pose'
                })

            # x:1211 y:34
            OperatableStateMachine.add('IncrementProductIndex',
                                       AddNumericState(),
                                       transitions={'done': 'EndProducts'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'one_value',
                                           'result': 'product_index'
                                       })

            # x:1213 y:164
            OperatableStateMachine.add('EndProducts',
                                       EqualState(),
                                       transitions={
                                           'true': 'ResetProductIndex',
                                           'false': 'GetPartFromProduct'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'product_index',
                                           'value_b': 'number_of_products'
                                       })

            # x:1214 y:282
            OperatableStateMachine.add(
                'ResetProductIndex',
                ReplaceState(),
                transitions={'done': 'IncrementShipmentIndex'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'zero_value',
                    'result': 'product_index'
                })

            # x:1214 y:413
            OperatableStateMachine.add('IncrementShipmentIndex',
                                       AddNumericState(),
                                       transitions={'done': 'EindShipments'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'one_value',
                                           'result': 'shipment_index'
                                       })

            # x:1215 y:541
            OperatableStateMachine.add('EindShipments',
                                       EqualState(),
                                       transitions={
                                           'true': 'ResetShipmentIndex',
                                           'false': 'notify_shipment_ready'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'number_of_shipments'
                                       })

            # x:1000 y:541
            OperatableStateMachine.add('ResetShipmentIndex',
                                       ReplaceState(),
                                       transitions={'done': 'GetOrder'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'zero_value',
                                           'result': 'shipment_index'
                                       })

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

            # x:911 y:38
            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': 'IncrementProductIndex',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                })

        return _state_machine
Пример #9
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.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 = ''
        _state_machine.userdata.part_index = 0
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.one = 1
        _state_machine.userdata.product_itt = 0
        _state_machine.userdata.shipments_index = 0

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

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:64 y:31
            OperatableStateMachine.add(
                'Start_assignment',
                StartAssignment(),
                transitions={'continue': 'move_home_belt'},
                autonomy={'continue': Autonomy.Off})

            # x:431 y:28
            OperatableStateMachine.add(
                'get_orders',
                GetOrderState(),
                transitions={'continue': 'Get shipments'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'order_id',
                    'shipments': 'shipments',
                    'number_of_shipments': 'number_of_shipments'
                })

            # x:615 y:25
            OperatableStateMachine.add('Get shipments',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'get part',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipments_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:833 y:35
            OperatableStateMachine.add('get part',
                                       GetPartFromProductsState(),
                                       transitions={
                                           'continue': 'message part main prg',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'products': 'products',
                                           'index': 'part_index',
                                           'type': 'part_type',
                                           'pose': 'pose'
                                       })

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

            # x:1153 y:72
            OperatableStateMachine.add('Order_picking',
                                       self.use_behavior(
                                           Order_pickingSM, 'Order_picking'),
                                       transitions={
                                           'finished': 'add_itterator order',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={'part_type': 'part_type'})

            # x:1038 y:147
            OperatableStateMachine.add(
                'add_itterator order',
                AddNumericState(),
                transitions={'done': 'part index message'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'one',
                    'value_b': 'part_index',
                    'result': 'part_index'
                })

            # x:1034 y:328
            OperatableStateMachine.add('Check_product_amount',
                                       EqualState(),
                                       transitions={
                                           'true': 'move_home_belt',
                                           'false': 'Get shipments'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_products',
                                           'value_b': 'part_index'
                                       })

            # x:1053 y:12
            OperatableStateMachine.add(
                'message part main prg',
                MessageState(),
                transitions={'continue': 'Order_picking'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_type'})

            # x:1141 y:221
            OperatableStateMachine.add(
                'part index message',
                MessageState(),
                transitions={'continue': 'Check_product_amount'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_index'})

        return _state_machine
Пример #10
0
	def create(self):
		# x:1751 y:131, x:910 y:358
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
		_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.power = 0
		_state_machine.userdata.config_name_PreHomeR = 'Rechts_PreDrop_AGV'
		_state_machine.userdata.config_name_PreHomeL = 'Links_PreDrop_AGV'
		_state_machine.userdata.move_group_R = 'Right_Arm'
		_state_machine.userdata.move_group_L = '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.Old_Id = ''

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


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

			# x:958 y:51
			OperatableStateMachine.add('GetOrder',
										GetOrderState(),
										transitions={'continue': 'Id_Check'},
										autonomy={'continue': Autonomy.Off},
										remapping={'order_id': 'OrderId', 'shipments': 'Shipments', 'number_of_shipments': 'NumberOfShipments'})

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

			# x:1317 y:273
			OperatableStateMachine.add('GetShipments',
										self.use_behavior(GetShipmentsSM, 'GetShipments'),
										transitions={'finished': 'GetOrder', 'failed': 'EndAssigment'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'Shipments': 'Shipments', 'NumberOfShipments': 'NumberOfShipments'})

			# x:249 y:56
			OperatableStateMachine.add('TurnOffBelt',
										SetConveyorbeltPowerState(),
										transitions={'continue': 'PreHomeL', 'fail': 'failed'},
										autonomy={'continue': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'power': 'power'})

			# x:514 y:36
			OperatableStateMachine.add('PreHomeL',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'PreHomeR', 'planning_failed': 'failed', 'control_failed': 'PreHomeR', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_PreHomeL', '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:739 y:53
			OperatableStateMachine.add('PreHomeR',
										SrdfStateToMoveitAriac(),
										transitions={'reached': 'GetOrder', 'planning_failed': 'failed', 'control_failed': 'GetOrder', 'param_error': 'failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off, 'param_error': Autonomy.Off},
										remapping={'config_name': 'config_name_PreHomeR', '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:1318 y:161
			OperatableStateMachine.add('Old_Id',
										ReplaceState(),
										transitions={'done': 'GetShipments'},
										autonomy={'done': Autonomy.Off},
										remapping={'value': 'OrderId', 'result': 'Old_Id'})

			# x:1314 y:38
			OperatableStateMachine.add('Id_Check',
										EqualState(),
										transitions={'true': 'EndAssigment', 'false': 'Old_Id'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'value_a': 'OrderId', 'value_b': 'Old_Id'})


		return _state_machine
Пример #11
0
    def create(self):
        # x:1067 y:518, x:672 y:189
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['shipment_index', 'part_index'],
            output_keys=[
                'part_type_L', 'part_type_R', 'agv_id', 'part_pose_L',
                'part_pose_R', 'shipment_index', 'part_index'
            ])
        _state_machine.userdata.order_id = ''
        _state_machine.userdata.shipments = ''
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.shipment_index = 0
        _state_machine.userdata.shipment_type = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.part_index = 0
        _state_machine.userdata.part_type_R = ''
        _state_machine.userdata.part_pose_L = []
        _state_machine.userdata.part_type_L = []
        _state_machine.userdata.part_pose_R = []
        _state_machine.userdata.add_one = 1
        _state_machine.userdata.reset = 0
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.none = 'None'

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

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:253 y:450
            OperatableStateMachine.add('ShipmentReady?',
                                       EqualState(),
                                       transitions={
                                           'true': 'ResetPartIndex',
                                           'false': 'GetRPartPose'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_products',
                                           'value_b': 'part_index'
                                       })

            # x:442 y:38
            OperatableStateMachine.add('GetShipment',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'GetRPartPose',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:658 y:37
            OperatableStateMachine.add('GetRPartPose',
                                       GetPartFromProductsState(),
                                       transitions={
                                           'continue': 'IncrementPartIndex',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'products': 'products',
                                           'index': 'part_index',
                                           'type': 'part_type_R',
                                           'pose': 'part_pose_R'
                                       })

            # x:853 y:181
            OperatableStateMachine.add('GetLPartPose',
                                       GetPartFromProductsState(),
                                       transitions={
                                           'continue': 'IncrementPartIndex_2',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'products': 'products',
                                           'index': 'part_index',
                                           'type': 'part_type_L',
                                           'pose': 'part_pose_L'
                                       })

            # x:1046 y:185
            OperatableStateMachine.add('IncrementShipIndex',
                                       AddNumericState(),
                                       transitions={'done': 'CheckAGV'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'add_one',
                                           'result': 'shipment_index'
                                       })

            # x:262 y:171
            OperatableStateMachine.add('OrderReady?',
                                       EqualState(),
                                       transitions={
                                           'true': 'ResetShipmentIndex',
                                           'false': 'GetShipment'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_shipments',
                                           'value_b': 'shipment_index'
                                       })

            # x:853 y:253
            OperatableStateMachine.add(
                'IncrementPartIndex_2',
                AddNumericState(),
                transitions={'done': 'ShipmentReady2?2'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'part_index',
                    'value_b': 'add_one',
                    'result': 'part_index'
                })

            # x:853 y:111
            OperatableStateMachine.add('ShipmentReady2?',
                                       EqualState(),
                                       transitions={
                                           'true': 'None',
                                           'false': 'GetLPartPose'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_products',
                                           'value_b': 'part_index'
                                       })

            # x:249 y:387
            OperatableStateMachine.add('ResetPartIndex',
                                       ReplaceState(),
                                       transitions={'done': 'ShipIndex0'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'reset',
                                           'result': 'part_index'
                                       })

            # x:260 y:107
            OperatableStateMachine.add('ResetShipmentIndex',
                                       ReplaceState(),
                                       transitions={'done': 'GetOrder'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value': 'reset',
                                           'result': 'shipment_index'
                                       })

            # x:261 y:38
            OperatableStateMachine.add('GetOrder',
                                       GetOrderState(),
                                       transitions={'continue': 'GetShipment'},
                                       autonomy={'continue': Autonomy.Off},
                                       remapping={
                                           'order_id':
                                           'order_id',
                                           'shipments':
                                           'shipments',
                                           'number_of_shipments':
                                           'number_of_shipments'
                                       })

            # x:1044 y:110
            OperatableStateMachine.add(
                'None',
                ReplaceState(),
                transitions={'done': 'IncrementShipIndex'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value': 'none',
                    'result': 'part_type_L'
                })

            # x:850 y:36
            OperatableStateMachine.add('IncrementPartIndex',
                                       AddNumericState(),
                                       transitions={'done': 'ShipmentReady2?'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'value_a': 'part_index',
                                           'value_b': 'add_one',
                                           'result': 'part_index'
                                       })

            # x:1041 y:257
            OperatableStateMachine.add('ShipmentReady2?2',
                                       EqualState(),
                                       transitions={
                                           'true': 'IncrementShipIndex',
                                           'false': 'CheckAGV'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_products',
                                           'value_b': 'part_index'
                                       })

            # x:215 y:313
            OperatableStateMachine.add('ShipIndex0',
                                       EqualState(),
                                       transitions={
                                           'true': 'OrderReady?',
                                           'false': 'SendShipment'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'shipment_index',
                                           'value_b': 'reset'
                                       })

            # x:1159 y:330
            OperatableStateMachine.add('CheckAGV',
                                       self.use_behavior(
                                           CheckAGVSM, 'CheckAGV'),
                                       transitions={
                                           'finished': 'finished',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={'agv_id': 'agv_id'})

            # x:325 y:244
            OperatableStateMachine.add('SendShipment',
                                       NotifyShipmentReadyState(),
                                       transitions={
                                           'continue': 'OrderReady?',
                                           'fail': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={
                                           'agv_id': 'agv_id',
                                           'shipment_type': 'shipment_type',
                                           'success': 'success',
                                           'message': 'message'
                                       })

        return _state_machine
Пример #12
0
    def create(self):
        # x:1132 y:54, x:687 y:211
        _state_machine = OperatableStateMachine(outcomes=['finished', 'fail'])
        _state_machine.userdata.StartText = 'Opdracht gestart'
        _state_machine.userdata.StopText = 'Opdracht gestopt'
        _state_machine.userdata.Shipments = []
        _state_machine.userdata.part = 'gear_part'
        _state_machine.userdata.material_locations = []
        _state_machine.userdata.NumberOfShipments = 0
        _state_machine.userdata.OrderId = ''
        _state_machine.userdata.Products = []
        _state_machine.userdata.NumberOfProducts = 0

        # 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': 'GetOrder'},
                                       autonomy={'continue': Autonomy.Off})

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

            # x:286 y:41
            OperatableStateMachine.add(
                'GetOrder',
                GetOrderState(),
                transitions={'continue': 'get_shipments'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'OrderId',
                    'shipments': 'Shipments',
                    'number_of_shipments': 'NumberOfShipments'
                })

            # x:614 y:40
            OperatableStateMachine.add('get_shipments',
                                       self.use_behavior(
                                           get_shipmentsSM, 'get_shipments'),
                                       transitions={
                                           'finished': 'EndAssigment',
                                           'fail': 'fail'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'fail': Autonomy.Inherit
                                       },
                                       remapping={
                                           'Shipments': 'Shipments',
                                           'NumberOfShipments':
                                           'NumberOfShipments'
                                       })

        return _state_machine
Пример #13
0
    def create(self):
        # x:1253 y:57, x:671 y:211
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.shipments = []
        _state_machine.userdata.order_id = ''
        _state_machine.userdata.number_of_shipments = 0
        _state_machine.userdata.shipment_index = 1
        _state_machine.userdata.shipment_type = ''
        _state_machine.userdata.agv_id = ''
        _state_machine.userdata.products = []
        _state_machine.userdata.number_of_products = 0
        _state_machine.userdata.product_index = 1
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.part_pose = []
        _state_machine.userdata.move_group = 'manipulator'

        # 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': 'GetOrder'},
                                       autonomy={'continue': Autonomy.Off})

            # x:369 y:42
            OperatableStateMachine.add('GetProductsFromShipment',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'GetPartFromProducts',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipment_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:574 y:43
            OperatableStateMachine.add(
                'GetPartFromProducts',
                GetPartFromProductsState(),
                transitions={
                    'continue': 'transport_part_form_bin_to_agv_state',
                    'invalid_index': 'failed'
                },
                autonomy={
                    'continue': Autonomy.Off,
                    'invalid_index': Autonomy.Off
                },
                remapping={
                    'products': 'products',
                    'index': 'product_index',
                    'type': 'part_type',
                    'pose': 'part_pose'
                })

            # x:780 y:44
            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': 'EndAssignment',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={
                    'part_type': 'part_type',
                    'agv_id': 'agv_id',
                    'pose_on_agv': 'part_pose'
                })

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

            # x:181 y:44
            OperatableStateMachine.add(
                'GetOrder',
                GetOrderState(),
                transitions={'continue': 'GetProductsFromShipment'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'order_id',
                    'shipments': 'shipments',
                    'number_of_shipments': 'number_of_shipments'
                })

        return _state_machine
    def create(self):
        # x:27 y:469, x:242 y:360
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            output_keys=['part_type', 'pose_on_agv'])
        _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.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_on_agv = ''
        _state_machine.userdata.rotation = 0
        _state_machine.userdata.move_group = ''
        _state_machine.userdata.arm_id = ''
        _state_machine.userdata.part_index = 0
        _state_machine.userdata.part_type = ''
        _state_machine.userdata.one = 1
        _state_machine.userdata.product_itt = 0
        _state_machine.userdata.shipments_index = 0

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

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:64 y:31
            OperatableStateMachine.add(
                'Start_assignment',
                StartAssignment(),
                transitions={'continue': 'move_home_belt_nvd'},
                autonomy={'continue': Autonomy.Off})

            # x:431 y:28
            OperatableStateMachine.add(
                'get_orders',
                GetOrderState(),
                transitions={'continue': 'Get shipments'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'order_id': 'order_id',
                    'shipments': 'shipments',
                    'number_of_shipments': 'number_of_shipments'
                })

            # x:615 y:25
            OperatableStateMachine.add('Get shipments',
                                       GetProductsFromShipmentState(),
                                       transitions={
                                           'continue': 'get part',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'shipments':
                                           'shipments',
                                           'index':
                                           'shipments_index',
                                           'shipment_type':
                                           'shipment_type',
                                           'agv_id':
                                           'agv_id',
                                           'products':
                                           'products',
                                           'number_of_products':
                                           'number_of_products'
                                       })

            # x:833 y:35
            OperatableStateMachine.add('get part',
                                       GetPartFromProductsState(),
                                       transitions={
                                           'continue': 'message part main prg',
                                           'invalid_index': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'invalid_index': Autonomy.Off
                                       },
                                       remapping={
                                           'products': 'products',
                                           'index': 'part_index',
                                           'type': 'part_type',
                                           'pose': 'pose_on_agv'
                                       })

            # x:1263 y:258
            OperatableStateMachine.add('Order_picking',
                                       self.use_behavior(
                                           Order_pickingSM, 'Order_picking'),
                                       transitions={
                                           'finished': 'add_itterator order',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'part_type': 'part_type',
                                           'pose_on_agv': 'pose_on_agv',
                                           'pose_on_agv_r': 'pose_on_agv_r',
                                           'pose_on_agv_l': 'pose_on_agv_l'
                                       })

            # x:1148 y:353
            OperatableStateMachine.add(
                'add_itterator order',
                AddNumericState(),
                transitions={'done': 'part index message'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'value_a': 'one',
                    'value_b': 'part_index',
                    'result': 'part_index'
                })

            # x:914 y:501
            OperatableStateMachine.add('Check_product_amount',
                                       EqualState(),
                                       transitions={
                                           'true': 'move_to_agv',
                                           'false': 'gripper check'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_products',
                                           'value_b': 'part_index'
                                       })

            # x:1053 y:12
            OperatableStateMachine.add(
                'message part main prg',
                MessageState(),
                transitions={'continue': 'choice point'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_type'})

            # x:1154 y:437
            OperatableStateMachine.add(
                'part index message',
                MessageState(),
                transitions={'continue': 'Check_product_amount'},
                autonomy={'continue': Autonomy.Off},
                remapping={'message': 'part_index'})

            # x:1277 y:24
            OperatableStateMachine.add('choice point',
                                       choiceoflocation(time_out=0.5),
                                       transitions={
                                           'bingr0': 'Order_picking',
                                           'bingr1': 'Order_picking',
                                           'bingr2': 'Order_picking',
                                           'bingr3': 'Order_picking',
                                           'bingr4':
                                           'shelve pick_behavior_nvd',
                                           'bingr5':
                                           'shelve pick_behavior_nvd',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'bingr0': Autonomy.Off,
                                           'bingr1': Autonomy.Off,
                                           'bingr2': Autonomy.Off,
                                           'bingr3': Autonomy.Off,
                                           'bingr4': Autonomy.Off,
                                           'bingr5': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'part_type': 'part_type'})

            # x:999 y:213
            OperatableStateMachine.add('shelve pick_behavior_nvd',
                                       self.use_behavior(
                                           shelvepick_behavior_nvdSM,
                                           'shelve pick_behavior_nvd'),
                                       transitions={
                                           'finished': 'add_itterator order',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'pose_on_agv': 'pose_on_agv',
                                           'part_type': 'part_type',
                                           'pose_on_agv_l': 'pose_on_agv_l',
                                           'pose_on_agv_r': 'pose_on_agv_r'
                                       })

            # x:235 y:9
            OperatableStateMachine.add('move_home_belt_nvd',
                                       self.use_behavior(
                                           move_home_belt_nvdSM,
                                           'move_home_belt_nvd'),
                                       transitions={
                                           'finished': 'get_orders',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       })

            # x:896 y:411
            OperatableStateMachine.add('gripper check',
                                       GripperActiveCheck(),
                                       transitions={
                                           'Left': 'Get shipments',
                                           'Right': 'Get shipments',
                                           'failed': 'failed',
                                           'Full': 'move_to_agv'
                                       },
                                       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:635 y:505
            OperatableStateMachine.add('move_to_agv',
                                       self.use_behavior(
                                           move_to_agvSM, 'move_to_agv'),
                                       transitions={
                                           'finished':
                                           'Check_product_amount_2',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'agv_id': 'agv_id',
                                           'pose_on_agv_l': 'pose_on_agv_l',
                                           'pose_on_agv_r': 'pose_on_agv_r'
                                       })

            # x:438 y:593
            OperatableStateMachine.add('Check_product_amount_2',
                                       EqualState(),
                                       transitions={
                                           'true': 'finished',
                                           'false': 'Get shipments'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'value_a': 'number_of_products',
                                           'value_b': 'part_index'
                                       })

        return _state_machine