Example #1
0
    def create(self):
        # x:1023 y:473, x:791 y:291, x:797 y:103
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed', 'critical_fail'],
            input_keys=['Action'])
        _state_machine.userdata.Action = ["Guide", 'table', 'kitchen']
        _state_machine.userdata.relative = False

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

        # [/MANUAL_CREATE]

        # x:30 y:458
        _sm_groupwait_0 = OperatableStateMachine(outcomes=['end'])

        with _sm_groupwait_0:
            # x:30 y:40
            OperatableStateMachine.add('waitwait',
                                       WaitState(wait_time=20),
                                       transitions={'done': 'end'},
                                       autonomy={'done': Autonomy.Off})

        # x:534 y:319
        _sm_move_head_and_base_at_the_end_1 = OperatableStateMachine(
            outcomes=['failed'])

        with _sm_move_head_and_base_at_the_end_1:
            # x:52 y:31
            OperatableStateMachine.add('setkeyorientation',
                                       SetKey(Value=1.5),
                                       transitions={'done': 'action_turn'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'rotation'})

            # x:51 y:114
            OperatableStateMachine.add(
                'action_turn',
                self.use_behavior(
                    action_turnSM,
                    'operator is still there/Move head and base end /move head and base at the end/action_turn'
                ),
                transitions={
                    'finished': 'turn right head',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'rotation': 'rotation'})

            # x:48 y:272
            OperatableStateMachine.add('wait while head turn',
                                       WaitState(wait_time=4),
                                       transitions={'done': 'action_turn_2'},
                                       autonomy={'done': Autonomy.Off})

            # x:47 y:199
            OperatableStateMachine.add(
                'turn right head',
                SaraSetHeadAngle(pitch=0, yaw=1.57),
                transitions={'done': 'wait while head turn'},
                autonomy={'done': Autonomy.Off})

            # x:45 y:348
            OperatableStateMachine.add(
                'action_turn_2',
                self.use_behavior(
                    action_turnSM,
                    'operator is still there/Move head and base end /move head and base at the end/action_turn_2'
                ),
                transitions={
                    'finished': 'left to rigth',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'rotation': 'rotation'})

            # x:43 y:592
            OperatableStateMachine.add('left to rigth',
                                       SaraSetHeadAngle(pitch=0, yaw=-1.57),
                                       transitions={'done': 'waitwait1'},
                                       autonomy={'done': Autonomy.Off})

            # x:420 y:602
            OperatableStateMachine.add('right to left',
                                       SaraSetHeadAngle(pitch=0, yaw=1.57),
                                       transitions={'done': 'waitwait2'},
                                       autonomy={'done': Autonomy.Off})

            # x:266 y:541
            OperatableStateMachine.add('waitwait1',
                                       WaitState(wait_time=8),
                                       transitions={'done': 'right to left'},
                                       autonomy={'done': Autonomy.Off})

            # x:236 y:674
            OperatableStateMachine.add('waitwait2',
                                       WaitState(wait_time=8),
                                       transitions={'done': 'left to rigth'},
                                       autonomy={'done': Autonomy.Off})

        # x:231 y:538
        _sm_find_a_human_2 = OperatableStateMachine(outcomes=['finished'],
                                                    input_keys=['ID'])

        with _sm_find_a_human_2:
            # x:78 y:275
            OperatableStateMachine.add('find the human',
                                       GetEntityByID(),
                                       transitions={
                                           'found': 'finished',
                                           'not_found': 'find the human'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'ID': 'ID',
                                           'Entity': 'Entity'
                                       })

        # x:415 y:99, x:318 y:246, x:442 y:295
        _sm_move_head_and_base_end__3 = ConcurrencyContainer(
            outcomes=['failed'],
            conditions=[('failed', [('move head and base at the end', 'failed')
                                    ]), ('failed', [('Groupwait', 'end')])])

        with _sm_move_head_and_base_end__3:
            # x:132 y:57
            OperatableStateMachine.add('move head and base at the end',
                                       _sm_move_head_and_base_at_the_end_1,
                                       transitions={'failed': 'failed'},
                                       autonomy={'failed': Autonomy.Inherit})

            # x:121 y:218
            OperatableStateMachine.add('Groupwait',
                                       _sm_groupwait_0,
                                       transitions={'end': 'failed'},
                                       autonomy={'end': Autonomy.Inherit})

        # x:67 y:227
        _sm_export_no_waypoint_4 = OperatableStateMachine(
            outcomes=['done'], output_keys=['waipoint', 'area_name'])

        with _sm_export_no_waypoint_4:
            # x:30 y:40
            OperatableStateMachine.add('noWaypoint',
                                       SetKey(Value=None),
                                       transitions={'done': 'NoName'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'waipoint'})

            # x:43 y:129
            OperatableStateMachine.add('NoName',
                                       SetKey(Value=None),
                                       transitions={'done': 'done'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'area_name'})

        # x:30 y:458
        _sm_export_waypoint_5 = OperatableStateMachine(
            outcomes=['done'],
            input_keys=['entity'],
            output_keys=['waipoint', 'area_name'])

        with _sm_export_waypoint_5:
            # x:58 y:107
            OperatableStateMachine.add(
                'Extract Wayppoint',
                CalculationState(calculation=lambda x: x.waypoint),
                transitions={'done': 'Extract Name'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'entity',
                    'output_value': 'waipoint'
                })

            # x:67 y:257
            OperatableStateMachine.add(
                'Extract Name',
                CalculationState(calculation=lambda x: x.name),
                transitions={'done': 'done'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'entity',
                    'output_value': 'area_name'
                })

        # x:379 y:221
        _sm_wait_to_compte_6 = OperatableStateMachine(outcomes=['finished'])

        with _sm_wait_to_compte_6:
            # x:77 y:195
            OperatableStateMachine.add('one more wait',
                                       WaitState(wait_time=60),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off})

        # x:535 y:314
        _sm_turn_around_7 = OperatableStateMachine(outcomes=['failed'])

        with _sm_turn_around_7:
            # x:47 y:45
            OperatableStateMachine.add('set orientation',
                                       SetKey(Value=1.57),
                                       transitions={'done': 'action_turn'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'rotation'})

            # x:42 y:213
            OperatableStateMachine.add('move head',
                                       SaraSetHeadAngle(pitch=0, yaw=1.57),
                                       transitions={'done': 'waitwait'},
                                       autonomy={'done': Autonomy.Off})

            # x:53 y:294
            OperatableStateMachine.add('waitwait',
                                       WaitState(wait_time=10),
                                       transitions={'done': 'action_turn_2'},
                                       autonomy={'done': Autonomy.Off})

            # x:33 y:122
            OperatableStateMachine.add(
                'action_turn',
                self.use_behavior(
                    action_turnSM,
                    'Try to reach/check person behind/move head and base/turn around/action_turn'
                ),
                transitions={
                    'finished': 'move head',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'rotation': 'rotation'})

            # x:31 y:434
            OperatableStateMachine.add(
                'action_turn_2',
                self.use_behavior(
                    action_turnSM,
                    'Try to reach/check person behind/move head and base/turn around/action_turn_2'
                ),
                transitions={
                    'finished': 'head left right',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'rotation': 'rotation'})

            # x:35 y:595
            OperatableStateMachine.add('head left right',
                                       SaraSetHeadAngle(pitch=0, yaw=1.57),
                                       transitions={'done': 'wait turn head'},
                                       autonomy={'done': Autonomy.Off})

            # x:308 y:537
            OperatableStateMachine.add('wait turn head',
                                       WaitState(wait_time=10),
                                       transitions={'done': 'head right left'},
                                       autonomy={'done': Autonomy.Off})

            # x:495 y:604
            OperatableStateMachine.add('head right left',
                                       SaraSetHeadAngle(pitch=0, yaw=-1.57),
                                       transitions={'done': 'wait wait wait'},
                                       autonomy={'done': Autonomy.Off})

            # x:271 y:711
            OperatableStateMachine.add('wait wait wait',
                                       WaitState(wait_time=10),
                                       transitions={'done': 'head left right'},
                                       autonomy={'done': Autonomy.Off})

        # x:845 y:395
        _sm_find_human_8 = OperatableStateMachine(outcomes=['finished'],
                                                  input_keys=['ID'])

        with _sm_find_human_8:
            # x:223 y:137
            OperatableStateMachine.add('find person',
                                       GetEntityByID(),
                                       transitions={
                                           'found': 'finished',
                                           'not_found': 'find person'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'ID': 'ID',
                                           'Entity': 'Entity'
                                       })

        # x:549 y:135, x:555 y:269, x:230 y:458
        _sm_move_head_and_base_9 = ConcurrencyContainer(
            outcomes=['failed'],
            conditions=[('failed', [('turn around', 'failed')]),
                        ('failed', [('wait to compte', 'finished')])])

        with _sm_move_head_and_base_9:
            # x:268 y:77
            OperatableStateMachine.add('turn around',
                                       _sm_turn_around_7,
                                       transitions={'failed': 'failed'},
                                       autonomy={'failed': Autonomy.Inherit})

            # x:263 y:246
            OperatableStateMachine.add('wait to compte',
                                       _sm_wait_to_compte_6,
                                       transitions={'finished': 'failed'},
                                       autonomy={'finished': Autonomy.Inherit})

        # x:493 y:206
        _sm_container_10 = OperatableStateMachine(outcomes=['check'])

        with _sm_container_10:
            # x:230 y:160
            OperatableStateMachine.add('wait long',
                                       WaitState(wait_time=40),
                                       transitions={'done': 'check'},
                                       autonomy={'done': Autonomy.Off})

        # x:30 y:458, x:706 y:447
        _sm_navigate_to_the_point_11 = OperatableStateMachine(
            outcomes=['finished', 'failed'], input_keys=['pose'])

        with _sm_navigate_to_the_point_11:
            # x:174 y:122
            OperatableStateMachine.add('set relative',
                                       SetKey(Value=False),
                                       transitions={'done': 'Action_Move'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'relative'})

            # x:347 y:191
            OperatableStateMachine.add(
                'Action_Move',
                self.use_behavior(
                    Action_MoveSM,
                    'Try to reach/Container/navigate to the point/Action_Move'
                ),
                transitions={
                    'finished': 'finished',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'pose': 'pose'})

        # x:728 y:335, x:792 y:103, x:738 y:249, x:724 y:448
        _sm_check_person_behind_12 = ConcurrencyContainer(
            outcomes=['finished', 'failed'],
            input_keys=['ID'],
            conditions=[('failed', [('move head and base', 'failed')]),
                        ('finished', [('find human', 'finished')])])

        with _sm_check_person_behind_12:
            # x:250 y:72
            OperatableStateMachine.add('move head and base',
                                       _sm_move_head_and_base_9,
                                       transitions={'failed': 'failed'},
                                       autonomy={'failed': Autonomy.Inherit})

            # x:261 y:238
            OperatableStateMachine.add('find human',
                                       _sm_find_human_8,
                                       transitions={'finished': 'finished'},
                                       autonomy={'finished': Autonomy.Inherit},
                                       remapping={'ID': 'ID'})

        # x:635 y:61, x:634 y:159, x:597 y:300, x:330 y:458, x:430 y:458, x:530 y:458
        _sm_container_13 = ConcurrencyContainer(
            outcomes=['finished', 'failed', 'check'],
            input_keys=['waypoint'],
            conditions=[('check', [('Container', 'check')]),
                        ('finished', [('navigate to the point', 'finished')]),
                        ('failed', [('navigate to the point', 'failed')])])

        with _sm_container_13:
            # x:315 y:51
            OperatableStateMachine.add('navigate to the point',
                                       _sm_navigate_to_the_point_11,
                                       transitions={
                                           'finished': 'finished',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={'pose': 'waypoint'})

            # x:322 y:257
            OperatableStateMachine.add('Container',
                                       _sm_container_10,
                                       transitions={'check': 'check'},
                                       autonomy={'check': Autonomy.Inherit})

        # x:98 y:451
        _sm_get_area_containers_14 = OperatableStateMachine(
            outcomes=['done'],
            input_keys=['command'],
            output_keys=['containers'])

        with _sm_get_area_containers_14:
            # x:46 y:31
            OperatableStateMachine.add(
                'Set Empty Array',
                SetKey(Value=[]),
                transitions={'done': 'Set initial index'},
                autonomy={'done': Autonomy.Off},
                remapping={'Key': 'containers'})

            # x:50 y:110
            OperatableStateMachine.add('Set initial index',
                                       SetKey(Value=2),
                                       transitions={'done': 'Set Loop Max'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'iLoop'})

            # x:49 y:192
            OperatableStateMachine.add(
                'Set Loop Max',
                CalculationState(calculation=lambda x: len(x)),
                transitions={'done': 'Check Loop End'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'command',
                    'output_value': 'iLoopMax'
                })

            # x:514 y:278
            OperatableStateMachine.add(
                'Increment',
                CalculationState(calculation=lambda x: x + 1),
                transitions={'done': 'Print container array'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'iLoop',
                    'output_value': 'iLoop'
                })

            # x:271 y:154
            OperatableStateMachine.add(
                'Add Container to Array',
                FlexibleCalculationState(
                    calculation=lambda x: x[2] + [x[0][x[1]]],
                    input_keys=['command', 'iLoop', 'containers']),
                transitions={'done': 'Increment'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'command': 'command',
                    'iLoop': 'iLoop',
                    'containers': 'containers',
                    'output_value': 'containers'
                })

            # x:42 y:287
            OperatableStateMachine.add('Check Loop End',
                                       FlexibleCheckConditionState(
                                           predicate=lambda x: x[0] < x[1],
                                           input_keys=['iLoop', 'iLoopMax']),
                                       transitions={
                                           'true': 'Add Container to Array',
                                           'false': 'done'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       },
                                       remapping={
                                           'iLoop': 'iLoop',
                                           'iLoopMax': 'iLoopMax'
                                       })

            # x:279 y:401
            OperatableStateMachine.add('Print container array',
                                       LogKeyState(
                                           text="Containers: \n {}",
                                           severity=Logger.REPORT_HINT),
                                       transitions={'done': 'Check Loop End'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'data': 'containers'})

        # x:626 y:228, x:607 y:71, x:230 y:458, x:330 y:458
        _sm_operator_is_still_there_15 = ConcurrencyContainer(
            outcomes=['finished', 'failed'],
            input_keys=['ID'],
            conditions=[('finished', [('find a human', 'finished')]),
                        ('failed', [('Move head and base end ', 'failed')])])

        with _sm_operator_is_still_there_15:
            # x:207 y:54
            OperatableStateMachine.add('Move head and base end ',
                                       _sm_move_head_and_base_end__3,
                                       transitions={'failed': 'failed'},
                                       autonomy={'failed': Autonomy.Inherit})

            # x:222 y:190
            OperatableStateMachine.add('find a human',
                                       _sm_find_a_human_2,
                                       transitions={'finished': 'finished'},
                                       autonomy={'finished': Autonomy.Inherit},
                                       remapping={'ID': 'ID'})

        # x:1620 y:109, x:1648 y:375
        _sm_try_to_find_area_16 = OperatableStateMachine(
            outcomes=['found', 'not_found'],
            input_keys=['area_to_search', 'containers'],
            output_keys=['area_name', 'waypoint'])

        with _sm_try_to_find_area_16:
            # x:517 y:67
            OperatableStateMachine.add(
                'WonderlandUniqueEnity',
                self.use_behavior(WonderlandUniqueEnitySM,
                                  'Try to find area/WonderlandUniqueEnity'),
                transitions={
                    'found': 'Export Waypoint',
                    'not_found': 'Export No Waypoint'
                },
                autonomy={
                    'found': Autonomy.Inherit,
                    'not_found': Autonomy.Inherit
                },
                remapping={
                    'name': 'area_to_search',
                    'containers': 'containers',
                    'entity': 'entity'
                })

            # x:966 y:71
            OperatableStateMachine.add('Export Waypoint',
                                       _sm_export_waypoint_5,
                                       transitions={'done': 'say_going'},
                                       autonomy={'done': Autonomy.Inherit},
                                       remapping={
                                           'entity': 'entity',
                                           'waipoint': 'waypoint',
                                           'area_name': 'area_name'
                                       })

            # x:1247 y:295
            OperatableStateMachine.add('Export No Waypoint',
                                       _sm_export_no_waypoint_4,
                                       transitions={'done': 'not_found'},
                                       autonomy={'done': Autonomy.Inherit},
                                       remapping={
                                           'waipoint': 'waypoint',
                                           'area_name': 'area_name'
                                       })

            # x:1273 y:106
            OperatableStateMachine.add(
                'say_going',
                SaraSay(sentence=lambda x: "I'm going to the " + x,
                        input_keys=[],
                        emotion=0,
                        block=True),
                transitions={'done': 'found'},
                autonomy={'done': Autonomy.Off})

        # x:323 y:632, x:638 y:631
        _sm_try_to_reach_17 = OperatableStateMachine(
            outcomes=['finished', 'failed'],
            input_keys=['waypoint', 'relative', 'areaName', 'ID'])

        with _sm_try_to_reach_17:
            # x:252 y:161
            OperatableStateMachine.add('Container',
                                       _sm_container_13,
                                       transitions={
                                           'finished': 'say_reached',
                                           'failed': 'Say_not_reached',
                                           'check': 'say check'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit,
                                           'check': Autonomy.Inherit
                                       },
                                       remapping={'waypoint': 'waypoint'})

            # x:581 y:163
            OperatableStateMachine.add('check person behind',
                                       _sm_check_person_behind_12,
                                       transitions={
                                           'finished': 'say found',
                                           'failed': 'say lost'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={'ID': 'ID'})

            # x:706 y:484
            OperatableStateMachine.add(
                'say lost',
                SaraSay(sentence="Oh no! I lost my operator!",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'failed'},
                autonomy={'done': Autonomy.Off})

            # x:445 y:69
            OperatableStateMachine.add(
                'say check',
                SaraSay(sentence="I check if my operator is still there",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'check person behind'},
                autonomy={'done': Autonomy.Off})

            # x:443 y:187
            OperatableStateMachine.add(
                'say found',
                SaraSay(sentence="Great. You are still there.",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'Container'},
                autonomy={'done': Autonomy.Off})

            # x:463 y:398
            OperatableStateMachine.add(
                'Say_not_reached',
                SaraSay(sentence=lambda x: "I have not reach the " + x + "!",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'failed'},
                autonomy={'done': Autonomy.Off})

            # x:61 y:366
            OperatableStateMachine.add(
                'say_reached',
                SaraSay(sentence=lambda x: "I have reach the " + x + "!",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'finished'},
                autonomy={'done': Autonomy.Off})

        # x:871 y:59
        _sm_decompose_command_18 = OperatableStateMachine(
            outcomes=['done'],
            input_keys=['command'],
            output_keys=['containers', 'area'])

        with _sm_decompose_command_18:
            # x:163 y:34
            OperatableStateMachine.add('Set State Command',
                                       Set_a_step(step=0),
                                       transitions={'done': 'Get area name'},
                                       autonomy={'done': Autonomy.Off})

            # x:387 y:58
            OperatableStateMachine.add(
                'Get area name',
                CalculationState(calculation=lambda x: x[1]),
                transitions={'done': 'Get area containers'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'command',
                    'output_value': 'area'
                })

            # x:597 y:94
            OperatableStateMachine.add('Get area containers',
                                       _sm_get_area_containers_14,
                                       transitions={'done': 'done'},
                                       autonomy={'done': Autonomy.Inherit},
                                       remapping={
                                           'command': 'command',
                                           'containers': 'containers'
                                       })

        with _state_machine:
            # x:54 y:24
            OperatableStateMachine.add(
                'Get Person Id',
                GetRosParam(ParamName="behavior/FoundPerson/Id"),
                transitions={
                    'done': 'GetPerson',
                    'failed': 'Cant Find Person'
                },
                autonomy={
                    'done': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'Value': 'ID'})

            # x:19 y:152
            OperatableStateMachine.add(
                'Decompose Command',
                _sm_decompose_command_18,
                transitions={'done': 'Try to find area'},
                autonomy={'done': Autonomy.Inherit},
                remapping={
                    'command': 'Action',
                    'containers': 'containers',
                    'area': 'area'
                })

            # x:43 y:358
            OperatableStateMachine.add('Try to reach',
                                       _sm_try_to_reach_17,
                                       transitions={
                                           'finished':
                                           'operator is still there',
                                           'failed': 'cause2'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={
                                           'waypoint': 'waypoint',
                                           'relative': 'relative',
                                           'areaName': 'area_name',
                                           'ID': 'ID'
                                       })

            # x:360 y:109
            OperatableStateMachine.add('Cant Find Person',
                                       SaraSay(
                                           sentence="I can't find a person.",
                                           input_keys=[],
                                           emotion=1,
                                           block=True),
                                       transitions={'done': 'cause1'},
                                       autonomy={'done': Autonomy.Off})

            # x:52 y:82
            OperatableStateMachine.add('GetPerson',
                                       GetEntityByID(),
                                       transitions={
                                           'found': 'Decompose Command',
                                           'not_found': 'Cant Find Person'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'ID': 'ID',
                                           'Entity': 'Entity'
                                       })

            # x:36 y:219
            OperatableStateMachine.add('Try to find area',
                                       _sm_try_to_find_area_16,
                                       transitions={
                                           'found': 'sayfollowme',
                                           'not_found': 'Cant Find Person'
                                       },
                                       autonomy={
                                           'found': Autonomy.Inherit,
                                           'not_found': Autonomy.Inherit
                                       },
                                       remapping={
                                           'area_to_search': 'area',
                                           'containers': 'containers',
                                           'area_name': 'area_name',
                                           'waypoint': 'waypoint'
                                       })

            # x:27 y:438
            OperatableStateMachine.add('operator is still there',
                                       _sm_operator_is_still_there_15,
                                       transitions={
                                           'finished': 'getentitybyID',
                                           'failed': 'say lost operator'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit
                                       },
                                       remapping={'ID': 'ID'})

            # x:347 y:370
            OperatableStateMachine.add(
                'say lost operator',
                SaraSay(
                    sentence=
                    "I have reach my goal but I lost the person I was guiding.",
                    input_keys=[],
                    emotion=1,
                    block=True),
                transitions={'done': 'cause3'},
                autonomy={'done': Autonomy.Off})

            # x:49 y:291
            OperatableStateMachine.add('sayfollowme',
                                       SaraSay(sentence="Follow me please.",
                                               input_keys=[],
                                               emotion=1,
                                               block=True),
                                       transitions={'done': 'Try to reach'},
                                       autonomy={'done': Autonomy.Off})

            # x:808 y:451
            OperatableStateMachine.add('head to middle',
                                       SaraSetHeadAngle(pitch=0, yaw=0),
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Off})

            # x:48 y:525
            OperatableStateMachine.add('getentitybyID',
                                       GetEntityByID(),
                                       transitions={
                                           'found': 'get entity to point',
                                           'not_found': 'say_reach_the_entity'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'not_found': Autonomy.Off
                                       },
                                       remapping={
                                           'ID': 'ID',
                                           'Entity': 'Entity'
                                       })

            # x:249 y:562
            OperatableStateMachine.add('get entity to point',
                                       WonderlandGetEntityVerbal(),
                                       transitions={
                                           'one': 'find the point',
                                           'multiple': 'say_reach_the_entity',
                                           'none': 'say_reach_the_entity',
                                           'error': 'say_reach_the_entity'
                                       },
                                       autonomy={
                                           'one': Autonomy.Off,
                                           'multiple': Autonomy.Off,
                                           'none': Autonomy.Off,
                                           'error': Autonomy.Off
                                       },
                                       remapping={
                                           'name': 'area_name',
                                           'containers': 'containers',
                                           'entities': 'entities',
                                           'firstEntity': 'firstEntity'
                                       })

            # x:708 y:529
            OperatableStateMachine.add(
                'Action_point_at',
                self.use_behavior(Action_point_atSM, 'Action_point_at'),
                transitions={
                    'finished': 'say_reach_the_entity',
                    'failed': 'say_reach_the_entity'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'targetPoint': 'targetPoint'})

            # x:539 y:558
            OperatableStateMachine.add(
                'find the point',
                CalculationState(calculation=lambda x: x.position),
                transitions={'done': 'Action_point_at'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'entities',
                    'output_value': 'targetPoint'
                })

            # x:547 y:121
            OperatableStateMachine.add(
                'cause1',
                SetKey(Value="I didn't find any persone"),
                transitions={'done': 'setrosparamfail'},
                autonomy={'done': Autonomy.Off},
                remapping={'Key': 'Key'})

            # x:507 y:220
            OperatableStateMachine.add(
                'cause2',
                SetKey(Value="I did not reach the area"),
                transitions={'done': 'setrosparamfail'},
                autonomy={'done': Autonomy.Off},
                remapping={'Key': 'Key'})

            # x:559 y:337
            OperatableStateMachine.add(
                'cause3',
                SetKey(Value="I lost the person I was guiding."),
                transitions={'done': 'setrosparamfail'},
                autonomy={'done': Autonomy.Off},
                remapping={'Key': 'Key'})

            # x:656 y:250
            OperatableStateMachine.add(
                'setrosparamfail',
                SetRosParam(ParamName="behavior/GPSR/CauseOfFailure"),
                transitions={'done': 'failed'},
                autonomy={'done': Autonomy.Off},
                remapping={'Value': 'Key'})

            # x:523 y:462
            OperatableStateMachine.add(
                'say_reach_the_entity',
                SaraSay(sentence=lambda x: "Here is the " + x,
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'head to middle'},
                autonomy={'done': Autonomy.Off})

        return _state_machine
	def create(self):
		# x:976 y:173, x:618 y:48
		_state_machine = OperatableStateMachine(outcomes=['done', 'failed'])
		_state_machine.userdata.nameFilter = ""
		_state_machine.userdata.roomQuestion = "what room shall i clean, master ?"
		_state_machine.userdata.waypointGenerationDistance = 0.5
		_state_machine.userdata.placeholder = ""
		_state_machine.userdata.doorName = "crowd"
		_state_machine.userdata.firstTimeInRoom = "yes"
		_state_machine.userdata.waypointToCheckDict = {"bedroom": ["bedroomWP1","bedroomWP2"]}
		_state_machine.userdata.placedObjects = 0
		_state_machine.userdata.misplacedObject = ""
		_state_machine.userdata.skipDoorEntrance = True

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

		# x:153 y:437
		_sm_deusexplacerecovery_0 = OperatableStateMachine(outcomes=['finished'], input_keys=['misplacedObject'])

		with _sm_deusexplacerecovery_0:
			# x:85 y:72
			OperatableStateMachine.add('getContainerId',
										CalculationState(calculation=lambda x: x[1].containerId),
										transitions={'done': 'getContainerEntity'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'misplacedObject', 'output_value': 'containerId'})

			# x:234 y:149
			OperatableStateMachine.add('getContainerEntity',
										WonderlandGetEntityByID(),
										transitions={'found': 'ItGoesThere', 'not_found': 'finished', 'error': 'finished'},
										autonomy={'found': Autonomy.Off, 'not_found': Autonomy.Off, 'error': Autonomy.Off},
										remapping={'id': 'containerId', 'entity': 'containerEntity', 'depth_position': 'depth_position', 'depth_waypoint': 'depth_waypoint'})

			# x:366 y:284
			OperatableStateMachine.add('ItGoesThere',
										SaraSay(sentence=lambda x: "Looks like I dropped "+str(x[0][0].name)+". Can you put it in the "+ x[1].name+"?", input_keys=["misplacedObject","containerEntity"], emotion=0, block=True),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off},
										remapping={'misplacedObject': 'misplacedObject', 'containerEntity': 'containerEntity'})


		# x:717 y:285
		_sm_cantgotodestination_1 = OperatableStateMachine(outcomes=['finished'], input_keys=['misplacedObject'])

		with _sm_cantgotodestination_1:
			# x:48 y:60
			OperatableStateMachine.add('getContainerId',
										CalculationState(calculation=lambda x: x[1].containerId),
										transitions={'done': 'getContainerEntity'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'misplacedObject', 'output_value': 'containerId'})

			# x:463 y:245
			OperatableStateMachine.add('Action_place',
										self.use_behavior(sara_flexbe_behaviors__Action_placeSM, 'PutObjectInDesiredContainer/CantGoToDestination/Action_place'),
										transitions={'finished': 'finished', 'failed': 'finished'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pos': 'droppingPose'})

			# x:26 y:149
			OperatableStateMachine.add('getContainerEntity',
										WonderlandGetEntityByID(),
										transitions={'found': 'ICantGetThere', 'not_found': 'ICantGetThereNCONT', 'error': 'ICantGetThereNCONT'},
										autonomy={'found': Autonomy.Off, 'not_found': Autonomy.Off, 'error': Autonomy.Off},
										remapping={'id': 'containerId', 'entity': 'containerEntity', 'depth_position': 'depth_position', 'depth_waypoint': 'depth_waypoint'})

			# x:249 y:176
			OperatableStateMachine.add('ICantGetThere',
										SaraSay(sentence=lambda x:"I can't find a way to "+str(x[0].name), input_keys=["containerEntity"], emotion=0, block=True),
										transitions={'done': 'GetDroppingPose'},
										autonomy={'done': Autonomy.Off},
										remapping={'containerEntity': 'containerEntity'})

			# x:247 y:114
			OperatableStateMachine.add('ICantGetThereNCONT',
										SaraSay(sentence="I can't find a way to the container", input_keys=[], emotion=0, block=True),
										transitions={'done': 'GetDroppingPose'},
										autonomy={'done': Autonomy.Off})

			# x:475 y:148
			OperatableStateMachine.add('GetDroppingPose',
										GenPoseEuler(x=0.4, y=0, z=0.3, roll=0.0, pitch=0.0, yaw=0.0),
										transitions={'done': 'Action_place'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose': 'droppingPose'})


		# x:632 y:527
		_sm_putdownobject_2 = OperatableStateMachine(outcomes=['done'], input_keys=['misplacedObject'])

		with _sm_putdownobject_2:
			# x:70 y:215
			OperatableStateMachine.add('GetDroppingPose',
										GenPoseEuler(x=0.3, y=0, z=1.2, roll=0.0, pitch=0.0, yaw=0.0),
										transitions={'done': 'Action_place'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose': 'droppingPose'})

			# x:269 y:215
			OperatableStateMachine.add('Action_place',
										self.use_behavior(sara_flexbe_behaviors__Action_placeSM, 'PutObjectInDesiredContainer/PutDownObject/Action_place'),
										transitions={'finished': 'done', 'failed': 'DeusExPlaceRecovery'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pos': 'droppingPose'})

			# x:592 y:127
			OperatableStateMachine.add('DeusExPlaceRecovery',
										_sm_deusexplacerecovery_0,
										transitions={'finished': 'done'},
										autonomy={'finished': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject'})


		# x:518 y:44, x:531 y:152
		_sm_gotodesiredcontainer_3 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['misplacedObject'])

		with _sm_gotodesiredcontainer_3:
			# x:86 y:79
			OperatableStateMachine.add('GetContainerWaypoint',
										CalculationState(calculation=lambda x:x[1].waypoint),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'misplacedObject', 'output_value': 'targetWaypoint'})

			# x:275 y:79
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(sara_flexbe_behaviors__Action_MoveSM, 'PutObjectInDesiredContainer/GotoDesiredContainer/Action_Move'),
										transitions={'finished': 'done', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'targetWaypoint'})


		# x:300 y:141, x:893 y:63
		_sm_receiveitem_4 = OperatableStateMachine(outcomes=['failed', 'success'])

		with _sm_receiveitem_4:
			# x:69 y:47
			OperatableStateMachine.add('opengripper',
										SetGripperState(width=0.25, effort=1),
										transitions={'object': 'setTarget1', 'no_object': 'setTarget1'},
										autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off},
										remapping={'object_size': 'object_size'})

			# x:280 y:263
			OperatableStateMachine.add('Torque_Reader',
										ReadTorque(watchdog=10, Joint="right_elbow_pitch_joint", Threshold=1, min_time=1),
										transitions={'threshold': 'close_gripper', 'watchdog': 'Torque_Reader', 'fail': 'failed'},
										autonomy={'threshold': Autonomy.Off, 'watchdog': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'torque': 'torque'})

			# x:668 y:149
			OperatableStateMachine.add('setTarget2',
										SetKey(Value="PostGripPose"),
										transitions={'done': 'Go_to_Pose'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'target'})

			# x:51 y:261
			OperatableStateMachine.add('Go_to_receive_bag_pose',
										MoveitMove(move=True, waitForExecution=True, group="RightArm"),
										transitions={'done': 'Torque_Reader', 'failed': 'failed'},
										autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'target': 'target'})

			# x:450 y:274
			OperatableStateMachine.add('close_gripper',
										SetGripperState(width=0, effort=1),
										transitions={'object': 'thank you', 'no_object': 'failed'},
										autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off},
										remapping={'object_size': 'object_size'})

			# x:640 y:273
			OperatableStateMachine.add('thank you',
										SaraSay(sentence="Thank you", input_keys=[], emotion=1, block=True),
										transitions={'done': 'setTarget2'},
										autonomy={'done': Autonomy.Off})

			# x:50 y:141
			OperatableStateMachine.add('setTarget1',
										SetKey(Value="Help_me_carry"),
										transitions={'done': 'Go_to_receive_bag_pose'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'target'})

			# x:660 y:57
			OperatableStateMachine.add('Go_to_Pose',
										MoveitMove(move=True, waitForExecution=True, group="RightArm"),
										transitions={'done': 'success', 'failed': 'failed'},
										autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'target': 'target'})


		# x:169 y:514, x:508 y:495
		_sm_deusexpickrecovery_5 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['misplacedObject'])

		with _sm_deusexpickrecovery_5:
			# x:81 y:50
			OperatableStateMachine.add('GimmeTheObjict',
										SaraSay(sentence=lambda x: "Could you give me the "+x[0][0].name+", please ?", input_keys=["misplacedObject"], emotion=0, block=True),
										transitions={'done': 'ReceiveItem'},
										autonomy={'done': Autonomy.Off},
										remapping={'misplacedObject': 'misplacedObject'})

			# x:213 y:130
			OperatableStateMachine.add('ReceiveItem',
										_sm_receiveitem_4,
										transitions={'failed': 'Oh f**k', 'success': 'finished'},
										autonomy={'failed': Autonomy.Inherit, 'success': Autonomy.Inherit})

			# x:355 y:262
			OperatableStateMachine.add('Oh f**k',
										SaraSay(sentence="Oh. Nevermind then.", input_keys=[], emotion=2, block=True),
										transitions={'done': 'failed'},
										autonomy={'done': Autonomy.Off})


		# x:676 y:610, x:1158 y:270
		_sm_grabmisplacedobject_6 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['misplacedObject'])

		with _sm_grabmisplacedobject_6:
			# x:72 y:35
			OperatableStateMachine.add('GetObjectId',
										CalculationState(calculation=lambda x: x[0].ID),
										transitions={'done': 'Action_pick'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'misplacedObject', 'output_value': 'misplacedObjectID'})

			# x:307 y:89
			OperatableStateMachine.add('oops',
										SaraSay(sentence="Oops. I dropped the object!", input_keys=[], emotion=5, block=True),
										transitions={'done': 'DeusExPickRecovery'},
										autonomy={'done': Autonomy.Off})

			# x:344 y:157
			OperatableStateMachine.add('oops_2',
										SaraSay(sentence="Oops. Seems I can't reach the object!", input_keys=[], emotion=3, block=True),
										transitions={'done': 'DeusExPickRecovery'},
										autonomy={'done': Autonomy.Off})

			# x:362 y:239
			OperatableStateMachine.add('oops_3',
										SaraSay(sentence="Oops. I can't see the object!", input_keys=[], emotion=3, block=True),
										transitions={'done': 'DeusExPickRecovery'},
										autonomy={'done': Autonomy.Off})

			# x:42 y:275
			OperatableStateMachine.add('Action_pick',
										self.use_behavior(sara_flexbe_behaviors__Action_pickSM, 'PickMisplacedObject/GrabMisplacedObject/Action_pick', default_keys=['Entity']),
										transitions={'success': 'done', 'unreachable': 'oops_2', 'not found': 'oops_3', 'dropped': 'oops'},
										autonomy={'success': Autonomy.Inherit, 'unreachable': Autonomy.Inherit, 'not found': Autonomy.Inherit, 'dropped': Autonomy.Inherit},
										remapping={'objectID': 'misplacedObjectID', 'Entity': 'Entity'})

			# x:600 y:177
			OperatableStateMachine.add('DeusExPickRecovery',
										_sm_deusexpickrecovery_5,
										transitions={'finished': 'done', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject'})


		# x:30 y:426
		_sm_scanaround_7 = OperatableStateMachine(outcomes=['done'])

		with _sm_scanaround_7:
			# x:172 y:46
			OperatableStateMachine.add('center',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w2'},
										autonomy={'done': Autonomy.Off})

			# x:304 y:122
			OperatableStateMachine.add('right',
										SaraSetHeadAngle(pitch=0.1, yaw=-1.5),
										transitions={'done': 'w3'},
										autonomy={'done': Autonomy.Off})

			# x:165 y:187
			OperatableStateMachine.add('center2',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w4'},
										autonomy={'done': Autonomy.Off})

			# x:195 y:276
			OperatableStateMachine.add('w1',
										WaitState(wait_time=1),
										transitions={'done': 'center3'},
										autonomy={'done': Autonomy.Off})

			# x:309 y:49
			OperatableStateMachine.add('w2',
										WaitState(wait_time=4),
										transitions={'done': 'right'},
										autonomy={'done': Autonomy.Off})

			# x:308 y:187
			OperatableStateMachine.add('w3',
										WaitState(wait_time=4),
										transitions={'done': 'center2'},
										autonomy={'done': Autonomy.Off})

			# x:56 y:191
			OperatableStateMachine.add('w4',
										WaitState(wait_time=4),
										transitions={'done': 'left'},
										autonomy={'done': Autonomy.Off})

			# x:40 y:270
			OperatableStateMachine.add('left',
										SaraSetHeadAngle(pitch=0.1, yaw=1.5),
										transitions={'done': 'w1'},
										autonomy={'done': Autonomy.Off})

			# x:317 y:277
			OperatableStateMachine.add('center3',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'done'},
										autonomy={'done': Autonomy.Off})


		# x:289 y:803, x:694 y:198, x:4 y:400
		_sm_checkatwaypoints_8 = OperatableStateMachine(outcomes=['found', 'noneFound', 'failed'], input_keys=['waypointToCheckDict', 'cleaningRoom', 'nameFilter'], output_keys=['misplacedObject'])

		with _sm_checkatwaypoints_8:
			# x:60 y:44
			OperatableStateMachine.add('GetNbOfWaypoints',
										FlexibleCalculationState(calculation=lambda x: len(x[1][x[0]]), input_keys=["cleaningRoom","waypointToCheckDict"]),
										transitions={'done': 'StartLoop'},
										autonomy={'done': Autonomy.Off},
										remapping={'cleaningRoom': 'cleaningRoom', 'waypointToCheckDict': 'waypointToCheckDict', 'output_value': 'lenWaypointDict'})

			# x:137 y:471
			OperatableStateMachine.add('ScanAround',
										_sm_scanaround_7,
										transitions={'done': 'StopCheckingForUnknownObj'},
										autonomy={'done': Autonomy.Inherit})

			# x:163 y:729
			OperatableStateMachine.add('GetFirstElement',
										CalculationState(calculation=lambda x:x[0]),
										transitions={'done': 'found'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'entity_list', 'output_value': 'misplacedObject'})

			# x:354 y:538
			OperatableStateMachine.add('ListEntities',
										list_entities_by_name(frontality_level=0.5, distance_max=10),
										transitions={'found': 'CheckMisplacedObjects', 'none_found': 'CheckAtEachLocation'},
										autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off},
										remapping={'name': 'nameFilter', 'entity_list': 'entity_list', 'number': 'number'})

			# x:23 y:198
			OperatableStateMachine.add('EverythingsFine',
										SaraSay(sentence="I'll check at another location.", input_keys=[], emotion=1, block=True),
										transitions={'done': 'GetLocation'},
										autonomy={'done': Autonomy.Off})

			# x:184 y:289
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(sara_flexbe_behaviors__Action_MoveSM, 'CheckForMisplacedObjects/CheckAtWaypoints/Action_Move'),
										transitions={'finished': 'CheckForUnknownObjs', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'waypointToGo'})

			# x:511 y:338
			OperatableStateMachine.add('CheckAtEachLocation',
										ForLoopWithInput(repeat=10),
										transitions={'do': 'CheckIfLastLocationOfList', 'end': 'noneFound'},
										autonomy={'do': Autonomy.Off, 'end': Autonomy.Off},
										remapping={'index_in': 'index_in', 'index_out': 'locationToGet'})

			# x:318 y:58
			OperatableStateMachine.add('StartLoop',
										SetKey(Value=-1),
										transitions={'done': 'CheckAtEachLocation'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'index_in'})

			# x:9 y:262
			OperatableStateMachine.add('GetLocation',
										FlexibleCalculationState(calculation=lambda x: x[1][x[2]][x[0]], input_keys=["index_out","waypointToCheckDict","cleaningRoom"]),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off},
										remapping={'index_out': 'locationToGet', 'waypointToCheckDict': 'waypointToCheckDict', 'cleaningRoom': 'cleaningRoom', 'output_value': 'waypointToGo'})

			# x:173 y:195
			OperatableStateMachine.add('CheckIfLastLocationOfList',
										FlexibleCheckConditionState(predicate=lambda x: x[0]-1 >= x[1], input_keys=["lenWaypointDict","locationToGet"]),
										transitions={'true': 'noneFound', 'false': 'EverythingsFine'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'lenWaypointDict': 'lenWaypointDict', 'locationToGet': 'locationToGet'})

			# x:418 y:665
			OperatableStateMachine.add('CheckMisplacedObjects',
										CheckMisplacedObjects(position_tolerance=0.1, default_destination="bin"),
										transitions={'all_expected': 'CheckAtEachLocation', 'unexpected': 'GetFirstElement'},
										autonomy={'all_expected': Autonomy.Off, 'unexpected': Autonomy.Off},
										remapping={'entities': 'entity_list', 'expected_objects': 'expected_objects', 'unexpected_objects': 'unexpected_objects'})

			# x:119 y:402
			OperatableStateMachine.add('CheckForUnknownObjs',
										SetSegmentationRosParam(ValueTableSegmentation=True, ValueObjectSegmentation=True),
										transitions={'done': 'ScanAround'},
										autonomy={'done': Autonomy.Off})

			# x:114 y:561
			OperatableStateMachine.add('StopCheckingForUnknownObj',
										SetSegmentationRosParam(ValueTableSegmentation=False, ValueObjectSegmentation=False),
										transitions={'done': 'ListEntities'},
										autonomy={'done': Autonomy.Off})


		# x:547 y:290
		_sm_scanaround_9 = OperatableStateMachine(outcomes=['done'], input_keys=['input_value'])

		with _sm_scanaround_9:
			# x:172 y:46
			OperatableStateMachine.add('center',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w2'},
										autonomy={'done': Autonomy.Off})

			# x:304 y:122
			OperatableStateMachine.add('right',
										SaraSetHeadAngle(pitch=0.1, yaw=-1.5),
										transitions={'done': 'w3'},
										autonomy={'done': Autonomy.Off})

			# x:165 y:187
			OperatableStateMachine.add('center2',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w4'},
										autonomy={'done': Autonomy.Off})

			# x:195 y:276
			OperatableStateMachine.add('w1',
										WaitState(wait_time=1),
										transitions={'done': 'center3'},
										autonomy={'done': Autonomy.Off})

			# x:367 y:47
			OperatableStateMachine.add('w2',
										WaitState(wait_time=4),
										transitions={'done': 'right'},
										autonomy={'done': Autonomy.Off})

			# x:308 y:187
			OperatableStateMachine.add('w3',
										WaitState(wait_time=4),
										transitions={'done': 'center2'},
										autonomy={'done': Autonomy.Off})

			# x:56 y:191
			OperatableStateMachine.add('w4',
										WaitState(wait_time=4),
										transitions={'done': 'left'},
										autonomy={'done': Autonomy.Off})

			# x:40 y:270
			OperatableStateMachine.add('left',
										SaraSetHeadAngle(pitch=0.1, yaw=1.5),
										transitions={'done': 'w1'},
										autonomy={'done': Autonomy.Off})

			# x:317 y:277
			OperatableStateMachine.add('center3',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'done'},
										autonomy={'done': Autonomy.Off})


		# x:293 y:350, x:857 y:186
		_sm_ask_10 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['roomQuestion'], output_keys=['roomAnswer'])

		with _sm_ask_10:
			# x:79 y:95
			OperatableStateMachine.add('say question',
										SaraSay(sentence=lambda x: x[0], input_keys=["question"], emotion=0, block=True),
										transitions={'done': 'get answer'},
										autonomy={'done': Autonomy.Off},
										remapping={'question': 'roomQuestion'})

			# x:92 y:304
			OperatableStateMachine.add('get answer',
										GetSpeech(watchdog=10),
										transitions={'done': 'finished', 'nothing': 'retry ask', 'fail': 'retry ask'},
										autonomy={'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'words': 'roomAnswer'})

			# x:345 y:202
			OperatableStateMachine.add('retry ask',
										ForLoop(repeat=2),
										transitions={'do': 'say not understand', 'end': 'say failed'},
										autonomy={'do': Autonomy.Off, 'end': Autonomy.Off},
										remapping={'index': 'index'})

			# x:232 y:90
			OperatableStateMachine.add('say not understand',
										SaraSay(sentence="Sorry, I did not understand your answer.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'say question'},
										autonomy={'done': Autonomy.Off})

			# x:604 y:151
			OperatableStateMachine.add('say failed',
										SaraSay(sentence="Sorry, I can't understand your answer.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'failed'},
										autonomy={'done': Autonomy.Off})


		# x:30 y:365, x:424 y:392
		_sm_nlu_11 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['roomAnswer'], output_keys=['cleanupRoom'])

		with _sm_nlu_11:
			# x:212 y:89
			OperatableStateMachine.add('NLU',
										SaraNLUgetRoom(),
										transitions={'understood': 'done', 'not_understood': 'failed', 'fail': 'failed'},
										autonomy={'understood': Autonomy.Off, 'not_understood': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'sentence': 'roomAnswer', 'answer': 'cleanupRoom'})


		# x:736 y:312
		_sm_putobjectindesiredcontainer_12 = OperatableStateMachine(outcomes=['finished'], input_keys=['misplacedObject', 'placedObjects'], output_keys=['placedObjects'])

		with _sm_putobjectindesiredcontainer_12:
			# x:138 y:153
			OperatableStateMachine.add('GotoDesiredContainer',
										_sm_gotodesiredcontainer_3,
										transitions={'done': 'PutDownObject', 'failed': 'CantGoToDestination'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject'})

			# x:277 y:313
			OperatableStateMachine.add('PutDownObject',
										_sm_putdownobject_2,
										transitions={'done': 'OneMoreObjectPlaced'},
										autonomy={'done': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject'})

			# x:339 y:80
			OperatableStateMachine.add('CantGoToDestination',
										_sm_cantgotodestination_1,
										transitions={'finished': 'finished'},
										autonomy={'finished': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject'})

			# x:468 y:381
			OperatableStateMachine.add('OneMoreObjectPlaced',
										CalculationState(calculation=lambda x: x+1),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'placedObjects', 'output_value': 'placedObjects'})


		# x:609 y:528, x:593 y:240
		_sm_pickmisplacedobject_13 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['misplacedObject', 'waypointGenerationDistance'])

		with _sm_pickmisplacedobject_13:
			# x:82 y:71
			OperatableStateMachine.add('GetObjectPosition',
										CalculationState(calculation=lambda x: x[0].position),
										transitions={'done': 'FindAWay'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'misplacedObject', 'output_value': 'misplacedObjectPosition'})

			# x:67 y:304
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(sara_flexbe_behaviors__Action_MoveSM, 'PickMisplacedObject/Action_Move'),
										transitions={'finished': 'GrabMisplacedObject', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'misplacedObjectWaypoint'})

			# x:82 y:202
			OperatableStateMachine.add('FindAWay',
										Get_Reacheable_Waypoint(),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose_in': 'misplacedObjectPosition', 'distance': 'waypointGenerationDistance', 'pose_out': 'misplacedObjectWaypoint'})

			# x:58 y:514
			OperatableStateMachine.add('GrabMisplacedObject',
										_sm_grabmisplacedobject_6,
										transitions={'done': 'finished', 'failed': 'failed'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject'})


		# x:957 y:154, x:535 y:369, x:800 y:304
		_sm_checkformisplacedobjects_14 = OperatableStateMachine(outcomes=['noneLeft', 'found', 'failed'], input_keys=['nameFilter', 'waypointToCheckDict', 'cleaningRoom', 'placedObjects'], output_keys=['misplacedObject'])

		with _sm_checkformisplacedobjects_14:
			# x:241 y:59
			OperatableStateMachine.add('CheckIf5Placed',
										CheckConditionState(predicate=lambda x: x >= 5),
										transitions={'true': 'OkItsClean', 'false': 'RetryOnce'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'input_value': 'placedObjects'})

			# x:115 y:477
			OperatableStateMachine.add('CheckMisplacedObjects',
										CheckMisplacedObjects(position_tolerance=0.1, default_destination="bin"),
										transitions={'all_expected': 'EverythingsFine', 'unexpected': 'GetFirstElement'},
										autonomy={'all_expected': Autonomy.Off, 'unexpected': Autonomy.Off},
										remapping={'entities': 'entity_list', 'expected_objects': 'expected_objects', 'unexpected_objects': 'unexpected_objects'})

			# x:76 y:251
			OperatableStateMachine.add('ScanAround',
										_sm_scanaround_9,
										transitions={'done': 'ListEntities'},
										autonomy={'done': Autonomy.Inherit},
										remapping={'input_value': 'nameFilter'})

			# x:300 y:486
			OperatableStateMachine.add('GetFirstElement',
										CalculationState(calculation=lambda x:x[0]),
										transitions={'done': 'found'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'entity_list', 'output_value': 'misplacedObject'})

			# x:77 y:360
			OperatableStateMachine.add('ListEntities',
										list_entities_by_name(frontality_level=0.5, distance_max=10),
										transitions={'found': 'CheckMisplacedObjects', 'none_found': 'RetryOnce'},
										autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off},
										remapping={'name': 'nameFilter', 'entity_list': 'entity_list', 'number': 'number'})

			# x:305 y:355
			OperatableStateMachine.add('EverythingsFine',
										SaraSay(sentence="Everything seems in order. I'll check again.", input_keys=[], emotion=1, block=True),
										transitions={'done': 'RetryOnce'},
										autonomy={'done': Autonomy.Off})

			# x:738 y:175
			OperatableStateMachine.add('OkItsClean',
										SaraSay(sentence="I cleaned the room!", input_keys=[], emotion=1, block=True),
										transitions={'done': 'noneLeft'},
										autonomy={'done': Autonomy.Off})

			# x:488 y:226
			OperatableStateMachine.add('CheckAtWaypoints',
										_sm_checkatwaypoints_8,
										transitions={'found': 'found', 'noneFound': 'OkItsClean', 'failed': 'failed'},
										autonomy={'found': Autonomy.Inherit, 'noneFound': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'waypointToCheckDict': 'waypointToCheckDict', 'cleaningRoom': 'cleaningRoom', 'nameFilter': 'nameFilter', 'misplacedObject': 'misplacedObject'})

			# x:268 y:226
			OperatableStateMachine.add('RetryOnce',
										ForLoop(repeat=1),
										transitions={'do': 'ScanAround', 'end': 'CheckAtWaypoints'},
										autonomy={'do': Autonomy.Off, 'end': Autonomy.Off},
										remapping={'index': 'index'})


		# x:644 y:459, x:651 y:336
		_sm_gotoroom_15 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['cleanupRoom', 'firstTimeInRoom'], output_keys=['firstTimeInRoom'])

		with _sm_gotoroom_15:
			# x:141 y:121
			OperatableStateMachine.add('IsItMyFirstTime',
										DecisionState(outcomes=["no", "yes"], conditions=lambda x: x),
										transitions={'no': 'GoingBackToTheRoom', 'yes': 'OkImGoingToTheRoom'},
										autonomy={'no': Autonomy.Off, 'yes': Autonomy.Off},
										remapping={'input_value': 'firstTimeInRoom'})

			# x:130 y:220
			OperatableStateMachine.add('GoingBackToTheRoom',
										SaraSay(sentence=lambda x: "I'm going back to the "+str(x[0])+".", input_keys=["cleanupRoom"], emotion=0, block=True),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off},
										remapping={'cleanupRoom': 'cleanupRoom'})

			# x:342 y:171
			OperatableStateMachine.add('OkImGoingToTheRoom',
										SaraSay(sentence=lambda x: "Okay, I'm going to the "+str(x[0])+".", input_keys=["cleanupRoom"], emotion=0, block=True),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off},
										remapping={'cleanupRoom': 'cleanupRoom'})

			# x:330 y:448
			OperatableStateMachine.add('IWentThere',
										SetKey(Value="no"),
										transitions={'done': 'done'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'firstTimeInRoom'})

			# x:320 y:326
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(sara_flexbe_behaviors__Action_MoveSM, 'GoToRoom/Action_Move'),
										transitions={'finished': 'IWentThere', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'cleanupRoom'})


		# x:709 y:520, x:850 y:66
		_sm_enterarena_16 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['roomQuestion', 'doorName', 'skipDoorEntrance'], output_keys=['cleanupRoom'])

		with _sm_enterarena_16:
			# x:77 y:28
			OperatableStateMachine.add('Init_Sequence',
										self.use_behavior(sara_flexbe_behaviors__Init_SequenceSM, 'EnterArena/Init_Sequence'),
										transitions={'finished': 'SkipEntrance', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit})

			# x:278 y:473
			OperatableStateMachine.add('NLU',
										_sm_nlu_11,
										transitions={'done': 'done', 'failed': 'Sorry'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'roomAnswer': 'roomAnswer', 'cleanupRoom': 'cleanupRoom'})

			# x:467 y:87
			OperatableStateMachine.add('Action_Pass_Door',
										self.use_behavior(sara_flexbe_behaviors__Action_Pass_DoorSM, 'EnterArena/Action_Pass_Door'),
										transitions={'Done': 'RetryOnce', 'Fail': 'failed'},
										autonomy={'Done': Autonomy.Inherit, 'Fail': Autonomy.Inherit},
										remapping={'DoorName': 'doorName'})

			# x:234 y:259
			OperatableStateMachine.add('RetryOnce',
										ForLoop(repeat=2),
										transitions={'do': 'Ask', 'end': 'failed'},
										autonomy={'do': Autonomy.Off, 'end': Autonomy.Off},
										remapping={'index': 'index'})

			# x:295 y:354
			OperatableStateMachine.add('Sorry',
										SaraSay(sentence="Sorry, I misunderstood.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'RetryOnce'},
										autonomy={'done': Autonomy.Off})

			# x:213 y:119
			OperatableStateMachine.add('SkipEntrance',
										CheckConditionState(predicate=lambda x: x),
										transitions={'true': 'RetryOnce', 'false': 'Action_Pass_Door'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'input_value': 'skipDoorEntrance'})

			# x:51 y:354
			OperatableStateMachine.add('Ask',
										_sm_ask_10,
										transitions={'finished': 'NLU', 'failed': 'RetryOnce'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'roomQuestion': 'roomQuestion', 'roomAnswer': 'roomAnswer'})



		with _state_machine:
			# x:131 y:130
			OperatableStateMachine.add('EnterArena',
										_sm_enterarena_16,
										transitions={'done': 'GoToRoom', 'failed': 'failed'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'roomQuestion': 'roomQuestion', 'doorName': 'doorName', 'skipDoorEntrance': 'skipDoorEntrance', 'cleanupRoom': 'cleanupRoom'})

			# x:286 y:217
			OperatableStateMachine.add('GoToRoom',
										_sm_gotoroom_15,
										transitions={'done': 'CheckForMisplacedObjects', 'failed': 'failed'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'cleanupRoom': 'cleanupRoom', 'firstTimeInRoom': 'firstTimeInRoom'})

			# x:652 y:203
			OperatableStateMachine.add('CheckForMisplacedObjects',
										_sm_checkformisplacedobjects_14,
										transitions={'noneLeft': 'done', 'found': 'PickMisplacedObject', 'failed': 'failed'},
										autonomy={'noneLeft': Autonomy.Inherit, 'found': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'nameFilter': 'nameFilter', 'waypointToCheckDict': 'waypointToCheckDict', 'cleaningRoom': 'cleanupRoom', 'placedObjects': 'placedObjects', 'misplacedObject': 'misplacedObject'})

			# x:557 y:403
			OperatableStateMachine.add('PickMisplacedObject',
										_sm_pickmisplacedobject_13,
										transitions={'finished': 'PutObjectInDesiredContainer', 'failed': 'GoToRoom'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject', 'waypointGenerationDistance': 'waypointGenerationDistance'})

			# x:234 y:476
			OperatableStateMachine.add('PutObjectInDesiredContainer',
										_sm_putobjectindesiredcontainer_12,
										transitions={'finished': 'GoToRoom'},
										autonomy={'finished': Autonomy.Inherit},
										remapping={'misplacedObject': 'misplacedObject', 'placedObjects': 'placedObjects'})


		return _state_machine
    def create(self):
        # x:391 y:586, x:438 y:304
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])
        _state_machine.userdata.StartPosition = "Operator"
        _state_machine.userdata.PositionBras = "IdlePose"
        _state_machine.userdata.title = "GPSR"
        _state_machine.userdata.EntryName = "door1/enter"
        _state_machine.userdata.ExitName = "door2/exit"

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

        # [/MANUAL_CREATE]

        # x:135 y:542, x:527 y:395
        _sm_validate_0 = OperatableStateMachine(outcomes=['done', 'bad'],
                                                input_keys=['sentence'])

        with _sm_validate_0:
            # x:56 y:62
            OperatableStateMachine.add(
                'Say_Command',
                SaraSay(
                    sentence=lambda x: "I heard. " + x + ". Is that correct?",
                    input_keys=[],
                    emotion=0,
                    block=True),
                transitions={'done': 'get speech'},
                autonomy={'done': Autonomy.Off})

            # x:44 y:165
            OperatableStateMachine.add('get speech',
                                       GetSpeech(watchdog=10),
                                       transitions={
                                           'done': 'is yes',
                                           'nothing': 'say repeate',
                                           'fail': 'say repeate'
                                       },
                                       autonomy={
                                           'done': Autonomy.Off,
                                           'nothing': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={'words': 'words'})

            # x:91 y:307
            OperatableStateMachine.add(
                'is yes',
                CheckConditionState(predicate=lambda x: "yes" in x or "right"
                                    in x or "sure" in x),
                transitions={
                    'true': 'done',
                    'false': 'say repeate'
                },
                autonomy={
                    'true': Autonomy.Off,
                    'false': Autonomy.Off
                },
                remapping={'input_value': 'words'})

            # x:423 y:332
            OperatableStateMachine.add(
                'say repeate',
                SaraSay(sentence="Please, repeat your command.",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'bad'},
                autonomy={'done': Autonomy.Off})

        # x:30 y:324
        _sm_look_at_op_1 = OperatableStateMachine(outcomes=['fail'])

        with _sm_look_at_op_1:
            # x:61 y:31
            OperatableStateMachine.add('set name',
                                       SetKey(Value="person"),
                                       transitions={'done': 'list persons'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'name'})

            # x:44 y:110
            OperatableStateMachine.add('list persons',
                                       list_entities_by_name(
                                           frontality_level=0.5,
                                           distance_max=10),
                                       transitions={
                                           'found': 'get closest',
                                           'none_found': 'list persons'
                                       },
                                       autonomy={
                                           'found': Autonomy.Off,
                                           'none_found': Autonomy.Off
                                       },
                                       remapping={
                                           'name': 'name',
                                           'entity_list': 'entity_list',
                                           'number': 'number'
                                       })

            # x:43 y:211
            OperatableStateMachine.add(
                'get closest',
                CalculationState(calculation=lambda x: x[0].ID),
                transitions={'done': 'look at'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'entity_list',
                    'output_value': 'ID'
                })

            # x:210 y:198
            OperatableStateMachine.add('look at',
                                       KeepLookingAt(),
                                       transitions={'failed': 'list persons'},
                                       autonomy={'failed': Autonomy.Off},
                                       remapping={'ID': 'ID'})

        # x:307 y:35, x:335 y:491
        _sm_get_commands_2 = OperatableStateMachine(
            outcomes=['fail', 'understood'],
            output_keys=['ActionForms', 'sentence'])

        with _sm_get_commands_2:
            # x:50 y:48
            OperatableStateMachine.add(
                'say ready',
                SaraSay(sentence="I'm ready for your commands.",
                        input_keys=[],
                        emotion=1,
                        block=False),
                transitions={'done': 'GetSpeech'},
                autonomy={'done': Autonomy.Off})

            # x:32 y:408
            OperatableStateMachine.add('SaraNLUgpsr',
                                       SaraNLUgpsr(),
                                       transitions={
                                           'understood': 'say understood',
                                           'not_understood': 'say sorry',
                                           'fail': 'say sorry'
                                       },
                                       autonomy={
                                           'understood': Autonomy.Off,
                                           'not_understood': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={
                                           'sentence': 'sentence',
                                           'ActionForms': 'ActionForms'
                                       })

            # x:597 y:223
            OperatableStateMachine.add(
                'say sorry',
                SaraSay(
                    sentence="Sorry, I could not understand what you said.",
                    input_keys=[],
                    emotion=1,
                    block=True),
                transitions={'done': 'GetSpeech'},
                autonomy={'done': Autonomy.Off})

            # x:30 y:491
            OperatableStateMachine.add('say understood',
                                       SaraSay(sentence="Ok",
                                               input_keys=[],
                                               emotion=1,
                                               block=True),
                                       transitions={'done': 'understood'},
                                       autonomy={'done': Autonomy.Off})

            # x:44 y:131
            OperatableStateMachine.add('GetSpeech',
                                       GetSpeech(watchdog=5),
                                       transitions={
                                           'done': 'validate',
                                           'nothing': 'GetSpeech',
                                           'fail': 'fail'
                                       },
                                       autonomy={
                                           'done': Autonomy.Off,
                                           'nothing': Autonomy.Off,
                                           'fail': Autonomy.Off
                                       },
                                       remapping={'words': 'sentence'})

            # x:29 y:259
            OperatableStateMachine.add('validate',
                                       _sm_validate_0,
                                       transitions={
                                           'done': 'SaraNLUgpsr',
                                           'bad': 'GetSpeech'
                                       },
                                       autonomy={
                                           'done': Autonomy.Inherit,
                                           'bad': Autonomy.Inherit
                                       },
                                       remapping={'sentence': 'sentence'})

        # x:122 y:413
        _sm_end_3 = OperatableStateMachine(outcomes=['done'],
                                           input_keys=['ExitName'])

        with _sm_end_3:
            # x:30 y:40
            OperatableStateMachine.add(
                'win',
                SaraSay(sentence="Thank you. I'm going now.",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'Action_Pass_Door'},
                autonomy={'done': Autonomy.Off})

            # x:33 y:163
            OperatableStateMachine.add(
                'Action_Pass_Door',
                self.use_behavior(sara_flexbe_behaviors__Action_Pass_DoorSM,
                                  'End/Action_Pass_Door'),
                transitions={
                    'Done': 'say yay',
                    'Fail': 'done'
                },
                autonomy={
                    'Done': Autonomy.Inherit,
                    'Fail': Autonomy.Inherit
                },
                remapping={'DoorName': 'ExitName'})

            # x:210 y:262
            OperatableStateMachine.add(
                'say yay',
                SaraSay(sentence="I did it. I'm the best robot.",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'done'},
                autonomy={'done': Autonomy.Off})

        # x:320 y:82, x:322 y:143, x:265 y:407, x:306 y:225, x:430 y:324
        _sm_interact_operator_4 = ConcurrencyContainer(
            outcomes=['fail', 'understood'],
            output_keys=['ActionForms', 'sentence'],
            conditions=[('understood', [('Get Commands', 'understood')]),
                        ('fail', [('Get Commands', 'fail')]),
                        ('fail', [('look at op', 'fail')])])

        with _sm_interact_operator_4:
            # x:95 y:45
            OperatableStateMachine.add('Get Commands',
                                       _sm_get_commands_2,
                                       transitions={
                                           'fail': 'fail',
                                           'understood': 'understood'
                                       },
                                       autonomy={
                                           'fail': Autonomy.Inherit,
                                           'understood': Autonomy.Inherit
                                       },
                                       remapping={
                                           'ActionForms': 'ActionForms',
                                           'sentence': 'sentence'
                                       })

            # x:99 y:198
            OperatableStateMachine.add('look at op',
                                       _sm_look_at_op_1,
                                       transitions={'fail': 'fail'},
                                       autonomy={'fail': Autonomy.Inherit})

        # x:325 y:387, x:314 y:190
        _sm_fail_state_5 = OperatableStateMachine(
            outcomes=['finished', 'failed'], input_keys=['StartPosition'])

        with _sm_fail_state_5:
            # x:36 y:29
            OperatableStateMachine.add(
                'say failed',
                SaraSay(sentence="I failed. I'm going back to tell my master.",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'Action_Move'},
                autonomy={'done': Autonomy.Off})

            # x:42 y:301
            OperatableStateMachine.add(
                'get error',
                GetRosParam(ParamName="behavior/GPSR/CauseOfFailure"),
                transitions={
                    'done': 'Say_Error',
                    'failed': 'finished'
                },
                autonomy={
                    'done': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'Value': 'Error'})

            # x:48 y:414
            OperatableStateMachine.add(
                'Say_Error',
                SaraSay(sentence=lambda x: "Sorry, I failed because " + x,
                        input_keys=[],
                        emotion=0,
                        block=True),
                transitions={'done': 'finished'},
                autonomy={'done': Autonomy.Off})

            # x:25 y:172
            OperatableStateMachine.add(
                'Action_Move',
                self.use_behavior(sara_flexbe_behaviors__Action_MoveSM,
                                  'Fail state/Action_Move'),
                transitions={
                    'finished': 'get error',
                    'failed': 'failed'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'pose': 'StartPosition'})

        # x:588 y:141, x:590 y:545, x:642 y:410
        _sm_do_the_actions_6 = OperatableStateMachine(
            outcomes=['finished', 'failed', 'critical fail'],
            input_keys=['ActionForms', 'OriginalPose'])

        with _sm_do_the_actions_6:
            # x:85 y:33
            OperatableStateMachine.add('set i',
                                       SetKey(Value=0),
                                       transitions={'done': 'is form?'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'Key': 'index'})

            # x:48 y:339
            OperatableStateMachine.add(
                'GetForm',
                FlexibleCalculationState(calculation=lambda x: x[0][x[1]],
                                         input_keys=["ActionForms", "index"]),
                transitions={'done': 'Action_Executor'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'ActionForms': 'ActionForms',
                    'index': 'index',
                    'output_value': 'ActionForm'
                })

            # x:57 y:131
            OperatableStateMachine.add(
                'is form?',
                FlexibleCheckConditionState(
                    predicate=lambda x: x[1] < len(x[0]),
                    input_keys=["ActionForms", "index"]),
                transitions={
                    'true': 'set setp',
                    'false': 'finished'
                },
                autonomy={
                    'true': Autonomy.Off,
                    'false': Autonomy.Off
                },
                remapping={
                    'ActionForms': 'ActionForms',
                    'index': 'index'
                })

            # x:204 y:237
            OperatableStateMachine.add(
                '++i',
                CalculationState(calculation=lambda x: x + 1),
                transitions={'done': 'is form?'},
                autonomy={'done': Autonomy.Off},
                remapping={
                    'input_value': 'index',
                    'output_value': 'index'
                })

            # x:72 y:479
            OperatableStateMachine.add(
                'Action_Executor',
                self.use_behavior(sara_flexbe_behaviors__Action_ExecutorSM,
                                  'Do the actions/Action_Executor'),
                transitions={
                    'finished': '++i',
                    'failed': 'failed',
                    'critical_fail': 'critical fail'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit,
                    'critical_fail': Autonomy.Inherit
                },
                remapping={'Action': 'ActionForm'})

            # x:45 y:241
            OperatableStateMachine.add('set setp',
                                       StoryboardSetStepKey(),
                                       transitions={'done': 'GetForm'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={'step': 'index'})

        # x:424 y:175
        _sm_initialisation_7 = OperatableStateMachine(
            outcomes=['done'], input_keys=['PositionBras', 'EntryName'])

        with _sm_initialisation_7:
            # x:62 y:79
            OperatableStateMachine.add(
                'Action_Pass_Door',
                self.use_behavior(sara_flexbe_behaviors__Action_Pass_DoorSM,
                                  'Initialisation/Action_Pass_Door'),
                transitions={
                    'Done': 'set step',
                    'Fail': 'done'
                },
                autonomy={
                    'Done': Autonomy.Inherit,
                    'Fail': Autonomy.Inherit
                },
                remapping={'DoorName': 'EntryName'})

            # x:70 y:306
            OperatableStateMachine.add('set story',
                                       Set_Story(titre="GPSR", storyline=[]),
                                       transitions={'done': 'bras en lair'},
                                       autonomy={'done': Autonomy.Off})

            # x:288 y:375
            OperatableStateMachine.add(
                'say start',
                SaraSay(sentence="I'm ready to start the GPSR scenario.",
                        input_keys=[],
                        emotion=1,
                        block=True),
                transitions={'done': 'done'},
                autonomy={'done': Autonomy.Off})

            # x:78 y:205
            OperatableStateMachine.add('set step',
                                       Set_a_step(step=0),
                                       transitions={'done': 'set story'},
                                       autonomy={'done': Autonomy.Off})

            # x:101 y:395
            OperatableStateMachine.add('bras en lair',
                                       MoveitMove(move=True,
                                                  waitForExecution=False,
                                                  group="RightArm"),
                                       transitions={
                                           'done': 'say start',
                                           'failed': 'say start'
                                       },
                                       autonomy={
                                           'done': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'target': 'PositionBras'})

        with _state_machine:
            # x:33 y:103
            OperatableStateMachine.add('Initialisation',
                                       _sm_initialisation_7,
                                       transitions={'done': 'Action_Move'},
                                       autonomy={'done': Autonomy.Inherit},
                                       remapping={
                                           'PositionBras': 'PositionBras',
                                           'EntryName': 'EntryName'
                                       })

            # x:767 y:196
            OperatableStateMachine.add('Do the actions',
                                       _sm_do_the_actions_6,
                                       transitions={
                                           'finished': 'say succseed',
                                           'failed': 'Fail state',
                                           'critical fail': 'critical'
                                       },
                                       autonomy={
                                           'finished': Autonomy.Inherit,
                                           'failed': Autonomy.Inherit,
                                           'critical fail': Autonomy.Inherit
                                       },
                                       remapping={
                                           'ActionForms': 'ActionForms',
                                           'OriginalPose': 'OriginalPose'
                                       })

            # x:250 y:126
            OperatableStateMachine.add(
                'Fail state',
                _sm_fail_state_5,
                transitions={
                    'finished': 'lift head',
                    'failed': 'critical'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'StartPosition': 'StartPosition'})

            # x:250 y:257
            OperatableStateMachine.add(
                'critical',
                SaraSay(
                    sentence="Critical failure! I require medical assistance.",
                    input_keys=[],
                    emotion=1,
                    block=True),
                transitions={'done': 'failed'},
                autonomy={'done': Autonomy.Off})

            # x:52 y:468
            OperatableStateMachine.add('for 3',
                                       ForLoop(repeat=3),
                                       transitions={
                                           'do': 'GetOriginalPose',
                                           'end': 'End'
                                       },
                                       autonomy={
                                           'do': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={'index': 'index'})

            # x:747 y:475
            OperatableStateMachine.add('say succseed',
                                       SaraSay(
                                           sentence="I succeed my mission.",
                                           input_keys=[],
                                           emotion=1,
                                           block=True),
                                       transitions={'done': 'for 3'},
                                       autonomy={'done': Autonomy.Off})

            # x:204 y:368
            OperatableStateMachine.add('Interact operator',
                                       _sm_interact_operator_4,
                                       transitions={
                                           'fail': 'critical',
                                           'understood': 'set step'
                                       },
                                       autonomy={
                                           'fail': Autonomy.Inherit,
                                           'understood': Autonomy.Inherit
                                       },
                                       remapping={
                                           'ActionForms': 'ActionForms',
                                           'sentence': 'sentence'
                                       })

            # x:553 y:316
            OperatableStateMachine.add('set story',
                                       StoryboardSetStoryFromAction(),
                                       transitions={'done': 'Do the actions'},
                                       autonomy={'done': Autonomy.Off},
                                       remapping={
                                           'titre': 'title',
                                           'actionList': 'ActionForms'
                                       })

            # x:404 y:377
            OperatableStateMachine.add('set step',
                                       Set_a_step(step=0),
                                       transitions={'done': 'set story'},
                                       autonomy={'done': Autonomy.Off})

            # x:41 y:375
            OperatableStateMachine.add(
                'GetOriginalPose',
                Get_Robot_Pose(),
                transitions={'done': 'Interact operator'},
                autonomy={'done': Autonomy.Off},
                remapping={'pose': 'OriginalPose'})

            # x:37 y:564
            OperatableStateMachine.add('End',
                                       _sm_end_3,
                                       transitions={'done': 'finished'},
                                       autonomy={'done': Autonomy.Inherit},
                                       remapping={'ExitName': 'ExitName'})

            # x:30 y:288
            OperatableStateMachine.add('lift head',
                                       SaraSetHeadAngle(pitch=-0.3, yaw=0),
                                       transitions={'done': 'GetOriginalPose'},
                                       autonomy={'done': Autonomy.Off})

            # x:48 y:23
            OperatableStateMachine.add('ContinueButton',
                                       ContinueButton(),
                                       transitions={
                                           'true': 'Initialisation',
                                           'false': 'Initialisation'
                                       },
                                       autonomy={
                                           'true': Autonomy.Off,
                                           'false': Autonomy.Off
                                       })

            # x:21 y:185
            OperatableStateMachine.add(
                'Action_Move',
                self.use_behavior(sara_flexbe_behaviors__Action_MoveSM,
                                  'Action_Move'),
                transitions={
                    'finished': 'lift head',
                    'failed': 'critical'
                },
                autonomy={
                    'finished': Autonomy.Inherit,
                    'failed': Autonomy.Inherit
                },
                remapping={'pose': 'StartPosition'})

        return _state_machine
Example #4
0
	def create(self):
		# x:902 y:757, x:882 y:161
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])

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

		# [/MANUAL_CREATE]

		# x:1232 y:907, x:1267 y:613, x:1271 y:566
		_sm_find_table_and_place_0 = OperatableStateMachine(outcomes=['finished', 'failed', 'no_table'])

		with _sm_find_table_and_place_0:
			# x:877 y:673
			OperatableStateMachine.add('run traj',
										RunTrajectory(file="receive_object", duration=0),
										transitions={'done': 'say release'},
										autonomy={'done': Autonomy.Off})

			# x:532 y:572
			OperatableStateMachine.add('Action_find_2',
										self.use_behavior(Action_findSM, 'take objects and bring the order to customer/find table and place/Action_find_2'),
										transitions={'done': 'get table position', 'failed': 'say do not find table'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'className': 'tableKey', 'entity': 'tableEntity'})

			# x:576 y:514
			OperatableStateMachine.add('set tableKey',
										SetKey(Value="table"),
										transitions={'done': 'Action_find_2'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'tableKey'})

			# x:538 y:638
			OperatableStateMachine.add('get table position',
										CalculationState(calculation=lambda x: x.position),
										transitions={'done': 'Action_place'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'tableEntity', 'output_value': 'pose'})

			# x:736 y:677
			OperatableStateMachine.add('say do not find table',
										SaraSay(sentence="I can not find the table. Please be ready to grab the object.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'run traj'},
										autonomy={'done': Autonomy.Off})

			# x:41 y:231
			OperatableStateMachine.add('find a table and a free spot',
										GetPositionToPlaceOnTable(),
										transitions={'done': 'Action_place', 'not_found': 'look down_left'},
										autonomy={'done': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'distanceFromEdge': 'distanceFromEdge', 'position': 'pose'})

			# x:291 y:805
			OperatableStateMachine.add('Action_place',
										self.use_behavior(Action_placeSM, 'take objects and bring the order to customer/find table and place/Action_place'),
										transitions={'finished': 'finished', 'failed': 'say do not find table'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pos': 'pose'})

			# x:50 y:102
			OperatableStateMachine.add('look down',
										SaraSetHeadAngle(pitch=0, yaw=0.7),
										transitions={'done': 'wait'},
										autonomy={'done': Autonomy.Off})

			# x:214 y:378
			OperatableStateMachine.add('find a table and a free spot_2',
										GetPositionToPlaceOnTable(),
										transitions={'done': 'Action_place', 'not_found': 'look down_right'},
										autonomy={'done': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'distanceFromEdge': 'distanceFromEdge', 'position': 'pose'})

			# x:240 y:232
			OperatableStateMachine.add('look down_left',
										SaraSetHeadAngle(pitch=0.7, yaw=0.6),
										transitions={'done': 'wait_2'},
										autonomy={'done': Autonomy.Off})

			# x:387 y:513
			OperatableStateMachine.add('find a table and a free spot_2_2',
										GetPositionToPlaceOnTable(),
										transitions={'done': 'Action_place', 'not_found': 'set tableKey'},
										autonomy={'done': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'distanceFromEdge': 'distanceFromEdge', 'position': 'pose'})

			# x:402 y:378
			OperatableStateMachine.add('look down_right',
										SaraSetHeadAngle(pitch=-0.7, yaw=0.6),
										transitions={'done': 'wait_3'},
										autonomy={'done': Autonomy.Off})

			# x:66 y:169
			OperatableStateMachine.add('wait',
										WaitState(wait_time=3),
										transitions={'done': 'find a table and a free spot'},
										autonomy={'done': Autonomy.Off})

			# x:242 y:294
			OperatableStateMachine.add('wait_2',
										WaitState(wait_time=3),
										transitions={'done': 'find a table and a free spot_2'},
										autonomy={'done': Autonomy.Off})

			# x:411 y:444
			OperatableStateMachine.add('wait_3',
										WaitState(wait_time=3),
										transitions={'done': 'find a table and a free spot_2_2'},
										autonomy={'done': Autonomy.Off})

			# x:1000 y:670
			OperatableStateMachine.add('say release',
										SaraSay(sentence="Here is your order. I will open my gripper in 3, 2, 1, now.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'open gripper'},
										autonomy={'done': Autonomy.Off})

			# x:1122 y:666
			OperatableStateMachine.add('open gripper',
										SetGripperState(width=0.1, effort=1),
										transitions={'object': 'say good day', 'no_object': 'say good day'},
										autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off},
										remapping={'object_size': 'object_size'})

			# x:1170 y:771
			OperatableStateMachine.add('say good day',
										SaraSay(sentence="Thank you. Have a good day.", input_keys=[], emotion=6, block=True),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off})

			# x:62 y:29
			OperatableStateMachine.add('set distance',
										SetKey(Value=0.3),
										transitions={'done': 'look down'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'distanceFromEdge'})


		# x:30 y:458, x:130 y:458
		_sm_keep_looking_1 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['personID'])

		with _sm_keep_looking_1:
			# x:30 y:40
			OperatableStateMachine.add('keep',
										KeepLookingAt(),
										transitions={'failed': 'keep'},
										autonomy={'failed': Autonomy.Off},
										remapping={'ID': 'personID'})


		# x:30 y:458, x:130 y:458
		_sm_ask_2 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['question'], output_keys=['answer'])

		with _sm_ask_2:
			# x:30 y:40
			OperatableStateMachine.add('Action_Ask',
										self.use_behavior(Action_AskSM, 'ask and save order/ask AND look person/ask/Action_Ask'),
										transitions={'finished': 'finished', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'question': 'question', 'answer': 'answer'})


		# x:30 y:458, x:130 y:458
		_sm_confirm_order_3 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['orderList'])

		with _sm_confirm_order_3:
			# x:114 y:67
			OperatableStateMachine.add('produce question',
										CalculationState(calculation=lambda x: "Did you order :" + str(x[0].data)),
										transitions={'done': 'Action_Ask'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'orderList', 'output_value': 'question'})

			# x:423 y:171
			OperatableStateMachine.add('Action_Ask',
										self.use_behavior(Action_AskSM, 'ask and save order/confirm order/Action_Ask'),
										transitions={'finished': 'finished', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'question': 'question', 'answer': 'answer'})


		# x:348 y:66, x:351 y:97, x:339 y:159, x:336 y:195, x:518 y:89, x:515 y:175
		_sm_ask_and_look_person_4 = ConcurrencyContainer(outcomes=['finished', 'failed'], input_keys=['personID', 'question'], output_keys=['answer'], conditions=[
										('finished', [('ask', 'finished')]),
										('failed', [('ask', 'failed')]),
										('finished', [('keep looking', 'finished')]),
										('failed', [('keep looking', 'failed')])
										])

		with _sm_ask_and_look_person_4:
			# x:30 y:40
			OperatableStateMachine.add('ask',
										_sm_ask_2,
										transitions={'finished': 'finished', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'question': 'question', 'answer': 'answer'})

			# x:30 y:138
			OperatableStateMachine.add('keep looking',
										_sm_keep_looking_1,
										transitions={'finished': 'finished', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'personID': 'personID'})


		# x:30 y:458
		_sm_look_around_2_5 = OperatableStateMachine(outcomes=['finished'])

		with _sm_look_around_2_5:
			# x:215 y:156
			OperatableStateMachine.add('center',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w2'},
										autonomy={'done': Autonomy.Off})

			# x:394 y:262
			OperatableStateMachine.add('right',
										SaraSetHeadAngle(pitch=0.1, yaw=-1.5),
										transitions={'done': 'w3'},
										autonomy={'done': Autonomy.Off})

			# x:206 y:372
			OperatableStateMachine.add('center2',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w4'},
										autonomy={'done': Autonomy.Off})

			# x:38 y:596
			OperatableStateMachine.add('w1',
										WaitState(wait_time=4),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off})

			# x:413 y:159
			OperatableStateMachine.add('w2',
										WaitState(wait_time=4),
										transitions={'done': 'right'},
										autonomy={'done': Autonomy.Off})

			# x:415 y:370
			OperatableStateMachine.add('w3',
										WaitState(wait_time=4),
										transitions={'done': 'center2'},
										autonomy={'done': Autonomy.Off})

			# x:39 y:371
			OperatableStateMachine.add('w4',
										WaitState(wait_time=4),
										transitions={'done': 'left'},
										autonomy={'done': Autonomy.Off})

			# x:25 y:482
			OperatableStateMachine.add('left',
										SaraSetHeadAngle(pitch=0.1, yaw=1.5),
										transitions={'done': 'w1'},
										autonomy={'done': Autonomy.Off})


		# x:30 y:458
		_sm_look_around_6 = OperatableStateMachine(outcomes=['finished'])

		with _sm_look_around_6:
			# x:215 y:156
			OperatableStateMachine.add('center',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w2'},
										autonomy={'done': Autonomy.Off})

			# x:394 y:262
			OperatableStateMachine.add('right',
										SaraSetHeadAngle(pitch=0.1, yaw=-1.5),
										transitions={'done': 'w3'},
										autonomy={'done': Autonomy.Off})

			# x:206 y:372
			OperatableStateMachine.add('center2',
										SaraSetHeadAngle(pitch=0.1, yaw=0),
										transitions={'done': 'w4'},
										autonomy={'done': Autonomy.Off})

			# x:38 y:596
			OperatableStateMachine.add('w1',
										WaitState(wait_time=4),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off})

			# x:413 y:159
			OperatableStateMachine.add('w2',
										WaitState(wait_time=4),
										transitions={'done': 'right'},
										autonomy={'done': Autonomy.Off})

			# x:415 y:370
			OperatableStateMachine.add('w3',
										WaitState(wait_time=4),
										transitions={'done': 'center2'},
										autonomy={'done': Autonomy.Off})

			# x:39 y:371
			OperatableStateMachine.add('w4',
										WaitState(wait_time=4),
										transitions={'done': 'left'},
										autonomy={'done': Autonomy.Off})

			# x:25 y:482
			OperatableStateMachine.add('left',
										SaraSetHeadAngle(pitch=0.1, yaw=1.5),
										transitions={'done': 'w1'},
										autonomy={'done': Autonomy.Off})


		# x:30 y:458, x:130 y:458
		_sm_turn_around_7 = OperatableStateMachine(outcomes=['finished', 'failed'])

		with _sm_turn_around_7:
			# x:80 y:26
			OperatableStateMachine.add('look around',
										_sm_look_around_6,
										transitions={'finished': 'pose with 180 rotation'},
										autonomy={'finished': Autonomy.Inherit})

			# x:66 y:286
			OperatableStateMachine.add('rotation',
										SaraMoveBase(reference="base_link"),
										transitions={'arrived': 'look around_2', 'failed': 'failed'},
										autonomy={'arrived': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'pose': 'pose'})

			# x:56 y:388
			OperatableStateMachine.add('look around_2',
										_sm_look_around_2_5,
										transitions={'finished': 'finished'},
										autonomy={'finished': Autonomy.Inherit})

			# x:63 y:133
			OperatableStateMachine.add('pose with 180 rotation',
										GenPoseEuler(x=0, y=0, z=0, roll=0, pitch=0, yaw=3.14),
										transitions={'done': 'rotation'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose': 'pose'})


		# x:30 y:458
		_sm_get_waving_people_8 = OperatableStateMachine(outcomes=['finished'], output_keys=['waving_person'])

		with _sm_get_waving_people_8:
			# x:47 y:45
			OperatableStateMachine.add('set name',
										SetKey(Value="person"),
										transitions={'done': 'list people'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'name'})

			# x:40 y:236
			OperatableStateMachine.add('filter waving',
										FilterKey(filter_function=lambda x: x[0].pose.right_arm_up or x[0].pose.left_arm_up, input_keys=["input_list"]),
										transitions={'not_empty': 'get first', 'empty': 'list people'},
										autonomy={'not_empty': Autonomy.Off, 'empty': Autonomy.Off},
										remapping={'input_list': 'entity_list', 'output_list': 'waving_peoples'})

			# x:53 y:326
			OperatableStateMachine.add('get first',
										CalculationState(calculation=lambda x: x[0]),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'waving_peoples', 'output_value': 'waving_person'})

			# x:40 y:133
			OperatableStateMachine.add('list people',
										list_entities_by_name(frontality_level=0.5, distance_max=5),
										transitions={'found': 'filter waving', 'none_found': 'list people'},
										autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off},
										remapping={'name': 'name', 'entity_list': 'entity_list', 'number': 'number'})


		# x:30 y:458, x:130 y:458, x:230 y:458, x:330 y:458, x:430 y:458
		_sm_look_for_waving_people_9 = ConcurrencyContainer(outcomes=['finished', 'failed'], output_keys=['waving_person'], conditions=[
										('failed', [('turn around', 'failed')]),
										('failed', [('turn around', 'finished')]),
										('finished', [('get waving people', 'finished')])
										])

		with _sm_look_for_waving_people_9:
			# x:268 y:118
			OperatableStateMachine.add('get waving people',
										_sm_get_waving_people_8,
										transitions={'finished': 'finished'},
										autonomy={'finished': Autonomy.Inherit},
										remapping={'waving_person': 'waving_person'})

			# x:60 y:126
			OperatableStateMachine.add('turn around',
										_sm_turn_around_7,
										transitions={'finished': 'failed', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit})


		# x:441 y:583, x:93 y:568
		_sm_repeate_if_first_commande_10 = OperatableStateMachine(outcomes=['finished', 'repeate'], input_keys=['commandNumber'], output_keys=['commandNumber'])

		with _sm_repeate_if_first_commande_10:
			# x:242 y:97
			OperatableStateMachine.add('if first command',
										CheckConditionState(predicate=lambda x: x == 1),
										transitions={'true': 'set second command', 'false': 'finished'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'input_value': 'commandNumber'})

			# x:73 y:329
			OperatableStateMachine.add('set second command',
										SetKey(Value=2),
										transitions={'done': 'repeate'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'commandNumber'})


		# x:1053 y:687, x:1068 y:149
		_sm_take_objects_and_bring_the_order_to_customer_11 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['barPosition', 'orderList', 'robotPositionToCustomer'])

		with _sm_take_objects_and_bring_the_order_to_customer_11:
			# x:73 y:26
			OperatableStateMachine.add('set indexkey',
										SetKey(Value=0),
										transitions={'done': 'one element by one element from the list'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'indexKey'})

			# x:591 y:684
			OperatableStateMachine.add('increment indexKey',
										CalculationState(calculation=lambda x: x+1),
										transitions={'done': 'check if end of the list'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'indexKey', 'output_value': 'indexKey'})

			# x:796 y:679
			OperatableStateMachine.add('check if end of the list',
										FlexibleCheckConditionState(predicate=lambda x: len(x[0]) <= x[1], input_keys=["orderList", "indexKey"]),
										transitions={'true': 'finished', 'false': 'Action_Move_2'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'orderList': 'orderList', 'indexKey': 'indexKey'})

			# x:31 y:243
			OperatableStateMachine.add('Action_find',
										self.use_behavior(Action_findSM, 'take objects and bring the order to customer/Action_find'),
										transitions={'done': 'get entity ID', 'failed': 'say cannot find'},
										autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'className': 'item', 'entity': 'entity'})

			# x:76 y:183
			OperatableStateMachine.add('say search and grip',
										SaraSay(sentence=lambda x: "I am now searching for the "+x[0]+".", input_keys=["item"], emotion=0, block=True),
										transitions={'done': 'Action_find'},
										autonomy={'done': Autonomy.Off},
										remapping={'item': 'item'})

			# x:258 y:261
			OperatableStateMachine.add('say cannot find',
										SaraSay(sentence="I cannot find the item.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'place arm'},
										autonomy={'done': Autonomy.Off})

			# x:63 y:393
			OperatableStateMachine.add('Action_pick',
										self.use_behavior(Action_pickSM, 'take objects and bring the order to customer/Action_pick'),
										transitions={'success': 'say go to the customer', 'unreachable': 'say cannot pick', 'not found': 'say cannot pick', 'dropped': 'say cannot pick'},
										autonomy={'success': Autonomy.Inherit, 'unreachable': Autonomy.Inherit, 'not found': Autonomy.Inherit, 'dropped': Autonomy.Inherit},
										remapping={'objectID': 'entityID'})

			# x:61 y:548
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(Action_MoveSM, 'take objects and bring the order to customer/Action_Move'),
										transitions={'finished': 'find table and place', 'failed': 'say cant get back to customer'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'robotPositionToCustomer'})

			# x:83 y:326
			OperatableStateMachine.add('get entity ID',
										CalculationState(calculation=lambda x: x.ID),
										transitions={'done': 'Action_pick'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'entity', 'output_value': 'entityID'})

			# x:568 y:407
			OperatableStateMachine.add('say put in the gripper',
										SaraSay(sentence=lambda x: "Please, put the "+x[0]+" in my gripper. I will close it in 3, 2, 1, now.", input_keys=["item"], emotion=0, block=True),
										transitions={'done': 'close gripper'},
										autonomy={'done': Autonomy.Off},
										remapping={'item': 'item'})

			# x:243 y:387
			OperatableStateMachine.add('say cannot pick',
										SaraSay(sentence="I can not pick the item.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'place arm'},
										autonomy={'done': Autonomy.Off})

			# x:388 y:502
			OperatableStateMachine.add('say thank you',
										SaraSay(sentence="Thank you.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'place arm 2'},
										autonomy={'done': Autonomy.Off})

			# x:72 y:465
			OperatableStateMachine.add('say go to the customer',
										SaraSay(sentence="I will serve it to the customer.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off})

			# x:522 y:505
			OperatableStateMachine.add('close gripper',
										SetGripperState(width=0, effort=1),
										transitions={'object': 'say thank you', 'no_object': 'open gripper'},
										autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off},
										remapping={'object_size': 'object_size'})

			# x:357 y:569
			OperatableStateMachine.add('say cant get back to customer',
										SaraSay(sentence="I am not able to go back to the customer.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'increment indexKey'},
										autonomy={'done': Autonomy.Off})

			# x:541 y:317
			OperatableStateMachine.add('open gripper',
										SetGripperState(width=0.10, effort=1),
										transitions={'object': 'say put in the gripper', 'no_object': 'say put in the gripper'},
										autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off},
										remapping={'object_size': 'object_size'})

			# x:63 y:110
			OperatableStateMachine.add('one element by one element from the list',
										FlexibleCalculationState(calculation=lambda x: x[0][x[1]].data, input_keys=["orderList", "indexKey"]),
										transitions={'done': 'say search and grip'},
										autonomy={'done': Autonomy.Off},
										remapping={'orderList': 'orderList', 'indexKey': 'indexKey', 'output_value': 'item'})

			# x:376 y:324
			OperatableStateMachine.add('place arm',
										RunTrajectory(file="receive_object", duration=0),
										transitions={'done': 'open gripper'},
										autonomy={'done': Autonomy.Off})

			# x:638 y:184
			OperatableStateMachine.add('Action_Move_2',
										self.use_behavior(Action_MoveSM, 'take objects and bring the order to customer/Action_Move_2'),
										transitions={'finished': 'increment indexKey', 'failed': 'say cannot go back to bar'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'barPosition'})

			# x:817 y:178
			OperatableStateMachine.add('say cannot go back to bar',
										SaraSay(sentence="I am not able to go back to the barman. I will try a new command.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'failed'},
										autonomy={'done': Autonomy.Off})

			# x:85 y:740
			OperatableStateMachine.add('find table and place',
										_sm_find_table_and_place_0,
										transitions={'finished': 'retour repos', 'failed': 'retour repos', 'no_table': 'retour repos'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'no_table': Autonomy.Inherit})

			# x:248 y:505
			OperatableStateMachine.add('place arm 2',
										RunTrajectory(file="transport", duration=0),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off})

			# x:362 y:679
			OperatableStateMachine.add('retour repos',
										RunTrajectory(file="repos", duration=0),
										transitions={'done': 'increment indexKey'},
										autonomy={'done': Autonomy.Off})


		# x:242 y:352, x:1086 y:243
		_sm_get_the_order_12 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['orderList'])

		with _sm_get_the_order_12:
			# x:68 y:39
			OperatableStateMachine.add('length 1',
										CheckConditionState(predicate=lambda x: len(x) == 1),
										transitions={'true': 'say order', 'false': 'length 2'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'input_value': 'orderList'})

			# x:236 y:41
			OperatableStateMachine.add('length 2',
										CheckConditionState(predicate=lambda x: len(x) ==2),
										transitions={'true': 'say order_2', 'false': 'say order_3'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'input_value': 'orderList'})

			# x:228 y:111
			OperatableStateMachine.add('say order_2',
										SaraSay(sentence=lambda x: "For this order, I would like to have one "+x[0][0].data+" and one "+x[0][1].data+", please.", input_keys=["orderList"], emotion=0, block=True),
										transitions={'done': 'wait 5'},
										autonomy={'done': Autonomy.Off},
										remapping={'orderList': 'orderList'})

			# x:374 y:109
			OperatableStateMachine.add('say order_3',
										SaraSay(sentence=lambda x: "For this order, I would like to have one "+x[0][0].data+", one "+x[0][1].data+" and one "+x[0][2].data+", please.", input_keys=["orderList"], emotion=0, block=True),
										transitions={'done': 'wait 5'},
										autonomy={'done': Autonomy.Off},
										remapping={'orderList': 'orderList'})

			# x:67 y:117
			OperatableStateMachine.add('say order',
										SaraSay(sentence=lambda x: "For this order, I would like to have one "+x[0][0].data+", please.", input_keys=["orderList"], emotion=0, block=True),
										transitions={'done': 'wait 5'},
										autonomy={'done': Autonomy.Off},
										remapping={'orderList': 'orderList'})

			# x:224 y:256
			OperatableStateMachine.add('wait 5',
										WaitState(wait_time=0),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off})


		# x:216 y:528, x:572 y:238
		_sm_go_to_the_barman_13 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['barPosition', 'barmanID'])

		with _sm_go_to_the_barman_13:
			# x:30 y:102
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(Action_MoveSM, 'go to the barman/Action_Move'),
										transitions={'finished': 'if barman id is 0', 'failed': 'say cannot'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'barPosition'})

			# x:365 y:99
			OperatableStateMachine.add('say cannot',
										SaraSay(sentence="I can not reach my destination. I will take another order. If you have one, please raise your hand.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'failed'},
										autonomy={'done': Autonomy.Off})

			# x:30 y:320
			OperatableStateMachine.add('Action_findPersonByID',
										self.use_behavior(Action_findPersonByIDSM, 'go to the barman/Action_findPersonByID',
											default_keys=['className']),
										transitions={'found': 'finished', 'not_found': 'finished'},
										autonomy={'found': Autonomy.Inherit, 'not_found': Autonomy.Inherit},
										remapping={'personID': 'barmanID', 'personEntity': 'personEntity'})

			# x:115 y:230
			OperatableStateMachine.add('if barman id is 0',
										CheckConditionState(predicate=lambda x: x == 0),
										transitions={'true': 'finished', 'false': 'Action_findPersonByID'},
										autonomy={'true': Autonomy.Off, 'false': Autonomy.Off},
										remapping={'input_value': 'barmanID'})


		# x:898 y:561, x:871 y:123
		_sm_ask_and_save_order_14 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['customerID'], output_keys=['orderList'])

		with _sm_ask_and_save_order_14:
			# x:70 y:112
			OperatableStateMachine.add('say ready',
										SaraSay(sentence="Hello.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'set question'},
										autonomy={'done': Autonomy.Off})

			# x:69 y:187
			OperatableStateMachine.add('set question',
										SetKey(Value="What do you want to order?"),
										transitions={'done': 'ask AND look person'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'question'})

			# x:411 y:138
			OperatableStateMachine.add('say cannot',
										SaraSay(sentence="I am not able to understand your order. I will take another order.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'set question'},
										autonomy={'done': Autonomy.Off})

			# x:59 y:272
			OperatableStateMachine.add('ask AND look person',
										_sm_ask_and_look_person_4,
										transitions={'finished': 'nlu restaurant', 'failed': 'say cannot'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'personID': 'customerID', 'question': 'question', 'answer': 'answer'})

			# x:411 y:453
			OperatableStateMachine.add('nlu restaurant',
										SaraNLUrestaurant(),
										transitions={'understood': 'confirm order', 'fail': 'say cannot'},
										autonomy={'understood': Autonomy.Off, 'fail': Autonomy.Off},
										remapping={'sentence': 'answer', 'orderList': 'orderList'})

			# x:657 y:417
			OperatableStateMachine.add('confirm order',
										_sm_confirm_order_3,
										transitions={'finished': 'say bring', 'failed': 'set question'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'orderList': 'orderList'})

			# x:852 y:402
			OperatableStateMachine.add('say bring',
										SaraSay(sentence=lambda x: "understood. I will bring you the "+str(x[0][0].data), input_keys=["orderList"], emotion=0, block=False),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off},
										remapping={'orderList': 'orderList'})


		# x:677 y:318, x:735 y:160
		_sm_move_to_table_and_save_position_15 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['customerPosition'], output_keys=['robotPositionToCustomer'])

		with _sm_move_to_table_and_save_position_15:
			# x:69 y:24
			OperatableStateMachine.add('set distance to person',
										SetKey(Value=0.7),
										transitions={'done': 'compute robot pose to customer'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'distanceToPerson'})

			# x:344 y:115
			OperatableStateMachine.add('say cannot',
										SaraSay(sentence="I can not reach my destination. I will take another order. If you have one, please raise your hand.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'save pose to not get flexbe problems'},
										autonomy={'done': Autonomy.Off})

			# x:497 y:129
			OperatableStateMachine.add('save pose to not get flexbe problems',
										Get_Robot_Pose(),
										transitions={'done': 'failed'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose': 'pose'})

			# x:47 y:98
			OperatableStateMachine.add('compute robot pose to customer',
										Get_Reacheable_Waypoint(),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose_in': 'customerPosition', 'distance': 'distanceToPerson', 'pose_out': 'robotPositionToCustomer'})

			# x:78 y:199
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(Action_MoveSM, 'move to table and save position/Action_Move'),
										transitions={'finished': 'finished', 'failed': 'say cannot'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'robotPositionToCustomer'})


		# x:112 y:525, x:363 y:46
		_sm_detect_people_waving_16 = OperatableStateMachine(outcomes=['finished', 'failed'], output_keys=['customerPosition', 'customerID'])

		with _sm_detect_people_waving_16:
			# x:84 y:25
			OperatableStateMachine.add('say looking',
										SaraSay(sentence="I am now looking for customers. If you want to order something, please raise your hand.", input_keys=[], emotion=0, block=False),
										transitions={'done': 'Look for waving people'},
										autonomy={'done': Autonomy.Off})

			# x:73 y:375
			OperatableStateMachine.add('reachable position_2',
										Get_Reacheable_Waypoint(),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose_in': 'customerPosition', 'distance': 'distance', 'pose_out': 'customerPosition'})

			# x:71 y:291
			OperatableStateMachine.add('set distance to customer_2',
										SetKey(Value=0.5),
										transitions={'done': 'reachable position_2'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'distance'})

			# x:94 y:216
			OperatableStateMachine.add('get attributes',
										GetAttribute(attributes=["ID", "position"]),
										transitions={'done': 'set distance to customer_2'},
										autonomy={'done': Autonomy.Off},
										remapping={'object': 'waving_person', 'ID': 'customerID', 'position': 'customerPosition'})

			# x:63 y:120
			OperatableStateMachine.add('Look for waving people',
										_sm_look_for_waving_people_9,
										transitions={'finished': 'get attributes', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'waving_person': 'waving_person'})


		# x:874 y:499, x:747 y:100
		_sm_save_bar_position_and_initiation_17 = OperatableStateMachine(outcomes=['finished', 'failed'], output_keys=['barPosition', 'commandNumber', 'barmanID'])

		with _sm_save_bar_position_and_initiation_17:
			# x:66 y:96
			OperatableStateMachine.add('set question barman',
										SetKey(Value="Are you the bartender?"),
										transitions={'done': 'Action_FindPersonByQuestion'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'questionBarman'})

			# x:488 y:85
			OperatableStateMachine.add('say failed to find the barman',
										SaraSay(sentence="I am not able to find the barman. I will get the order and come back here to get the items.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'barman ID to 0'},
										autonomy={'done': Autonomy.Off})

			# x:83 y:406
			OperatableStateMachine.add('save barman ID',
										CalculationState(calculation=lambda x: x.ID),
										transitions={'done': 'get current pose'},
										autonomy={'done': Autonomy.Off},
										remapping={'input_value': 'personFound', 'output_value': 'barmanID'})

			# x:512 y:183
			OperatableStateMachine.add('barman ID to 0',
										SetKey(Value=0),
										transitions={'done': 'get current pose'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'barmanID'})

			# x:488 y:391
			OperatableStateMachine.add('get current pose',
										Get_Robot_Pose(),
										transitions={'done': 'set first command'},
										autonomy={'done': Autonomy.Off},
										remapping={'pose': 'barPosition'})

			# x:55 y:214
			OperatableStateMachine.add('Action_FindPersonByQuestion',
										self.use_behavior(Action_FindPersonByQuestionSM, 'save bar position and initiation/Action_FindPersonByQuestion'),
										transitions={'found': 'save barman ID', 'failed': 'say failed to find the barman', 'not_found': 'say failed to find the barman'},
										autonomy={'found': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'not_found': Autonomy.Inherit},
										remapping={'question': 'questionBarman', 'entityFound': 'personFound'})

			# x:489 y:478
			OperatableStateMachine.add('set first command',
										SetKey(Value=1),
										transitions={'done': 'say instructions'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'commandNumber'})

			# x:689 y:477
			OperatableStateMachine.add('say instructions',
										SaraSay(sentence="Good! I wil now start to serve people.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Off})



		with _state_machine:
			# x:30 y:40
			OperatableStateMachine.add('save bar position and initiation',
										_sm_save_bar_position_and_initiation_17,
										transitions={'finished': 'detect people waving', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'barPosition': 'barPosition', 'commandNumber': 'commandNumber', 'barmanID': 'barmanID'})

			# x:131 y:141
			OperatableStateMachine.add('detect people waving',
										_sm_detect_people_waving_16,
										transitions={'finished': 'move to table and save position', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'customerPosition': 'customerPosition', 'customerID': 'customerID'})

			# x:233 y:250
			OperatableStateMachine.add('move to table and save position',
										_sm_move_to_table_and_save_position_15,
										transitions={'finished': 'ask and save order', 'failed': 'detect people waving'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'customerPosition': 'customerPosition', 'robotPositionToCustomer': 'robotPositionToCustomer'})

			# x:286 y:337
			OperatableStateMachine.add('ask and save order',
										_sm_ask_and_save_order_14,
										transitions={'finished': 'go to the barman', 'failed': 'detect people waving'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'customerID': 'customerID', 'orderList': 'orderList'})

			# x:264 y:434
			OperatableStateMachine.add('go to the barman',
										_sm_go_to_the_barman_13,
										transitions={'finished': 'get the order', 'failed': 'detect people waving'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'barPosition': 'barPosition', 'barmanID': 'barmanID'})

			# x:278 y:526
			OperatableStateMachine.add('get the order',
										_sm_get_the_order_12,
										transitions={'finished': 'take objects and bring the order to customer', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'orderList': 'orderList'})

			# x:260 y:626
			OperatableStateMachine.add('take objects and bring the order to customer',
										_sm_take_objects_and_bring_the_order_to_customer_11,
										transitions={'finished': 'repeate if first commande', 'failed': 'repeate if first commande'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'barPosition': 'barPosition', 'orderList': 'orderList', 'robotPositionToCustomer': 'robotPositionToCustomer'})

			# x:118 y:735
			OperatableStateMachine.add('repeate if first commande',
										_sm_repeate_if_first_commande_10,
										transitions={'finished': 'say finish', 'repeate': 'detect people waving'},
										autonomy={'finished': Autonomy.Inherit, 'repeate': Autonomy.Inherit},
										remapping={'commandNumber': 'commandNumber'})

			# x:431 y:743
			OperatableStateMachine.add('say finish',
										SaraSay(sentence="I reach the end of my scenario. I will go back to the bar.", input_keys=[], emotion=0, block=True),
										transitions={'done': 'Action_Move'},
										autonomy={'done': Autonomy.Off})

			# x:616 y:735
			OperatableStateMachine.add('Action_Move',
										self.use_behavior(Action_MoveSM, 'Action_Move'),
										transitions={'finished': 'finished', 'failed': 'finished'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'pose': 'barPosition'})


		return _state_machine