def create(self): # x:609 y:365, x:602 y:89 _state_machine = OperatableStateMachine(outcomes=['ok', 'too_far'], input_keys=['pose']) _state_machine.userdata.pose = 0 # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] with _state_machine: # x:42 y:56 OperatableStateMachine.add('gen', GenGripperPose(l=0, z=0, planar=false), transitions={'done': 'kinematic test', 'fail': 'too_far'}, autonomy={'done': Autonomy.Off, 'fail': Autonomy.Off}, remapping={'pose_in': 'pose', 'pose_out': 'pose_out'}) # x:195 y:347 OperatableStateMachine.add('third check', CheckConditionState(predicate=lambda x: (x.position.x**2+x.position.y**2+(x.position.z-1))**0.5 < 1.5), transitions={'true': 'kinematic test', 'false': 'too_far'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'input_value': 'pose_out'}) # x:190 y:147 OperatableStateMachine.add('first check', CheckConditionState(predicate=lambda x: x.position.x<0.8), transitions={'true': 'second check', 'false': 'too_far'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'input_value': 'pose_out'}) # x:196 y:253 OperatableStateMachine.add('second check', CheckConditionState(predicate=lambda x: x.position.z>0.5), transitions={'true': 'third check', 'false': 'too_far'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'input_value': 'pose_out'}) # x:99 y:520 OperatableStateMachine.add('kinematic test', MoveitMove(move=False, waitForExecution=True, group="RightArm"), transitions={'done': 'ok', 'failed': 'too_far'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'target': 'pose_out'}) return _state_machine
def create(self): # x:123 y:357, x:288 y:339 _state_machine = OperatableStateMachine( outcomes=['finished', 'failed']) _state_machine.userdata.Pose_Init = "IdlePose" # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] with _state_machine: # x:42 y:58 OperatableStateMachine.add( 'Hi', SaraSay(sentence="Hi, my name is Sara and I will start", input_keys=[], emotion=0, block=True), transitions={'done': 'setHead'}, autonomy={'done': Autonomy.Off}) # x:77 y:210 OperatableStateMachine.add('SetArm', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'finished', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'Pose_Init'}) # x:72 y:130 OperatableStateMachine.add('setHead', SaraSetHeadAngle(pitch=0, yaw=0), transitions={'done': 'SetArm'}, autonomy={'done': Autonomy.Off}) return _state_machine
def create(self): # x:1474 y:331, x:56 y:575 _state_machine = OperatableStateMachine( outcomes=['finished', 'failed']) _state_machine.userdata.half_turn = 3.1416 _state_machine.userdata.person = "person" _state_machine.userdata.operator_param = "behavior/Operaror/Id" _state_machine.userdata.join = ["Move", "spr/initialpose"] _state_machine.userdata.leave = ["Move", "door2/exit"] # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:1182 y:163 _sm_rotate_0 = OperatableStateMachine(outcomes=['finished']) with _sm_rotate_0: # x:103 y:61 OperatableStateMachine.add('Look Left', SaraSetHeadAngle(pitch=-0.35, yaw=0.5), transitions={'done': 'Rotate Left'}, autonomy={'done': Autonomy.Off}) # x:794 y:54 OperatableStateMachine.add('Look Right', SaraSetHeadAngle(pitch=-0.35, yaw=-0.5), transitions={'done': 'Rotate Right'}, autonomy={'done': Autonomy.Off}) # x:325 y:61 OperatableStateMachine.add('Rotate Left', WaitState(wait_time=8), transitions={'done': 'Look Center'}, autonomy={'done': Autonomy.Off}) # x:961 y:65 OperatableStateMachine.add('Rotate Right', WaitState(wait_time=4), transitions={'done': 'Look Center 2'}, autonomy={'done': Autonomy.Off}) # x:1115 y:62 OperatableStateMachine.add('Look Center 2', SaraSetHeadAngle(pitch=0.1, yaw=0), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:484 y:54 OperatableStateMachine.add('Look Center', SaraSetHeadAngle(pitch=-0.35, yaw=0), transitions={'done': 'Rotate Center'}, autonomy={'done': Autonomy.Off}) # x:657 y:49 OperatableStateMachine.add('Rotate Center', WaitState(wait_time=4), transitions={'done': 'Look Right'}, autonomy={'done': Autonomy.Off}) # x:30 y:458 _sm_follow_head_1 = OperatableStateMachine(outcomes=['end'], input_keys=['person']) with _sm_follow_head_1: # x:214 y:48 OperatableStateMachine.add('list all entities', list_entities_by_name( frontality_level=0.5, distance_max=10), transitions={ 'found': 'Get Nearest', 'none_found': 'list all entities' }, autonomy={ 'found': Autonomy.Off, 'none_found': Autonomy.Off }, remapping={ 'name': 'person', 'entity_list': 'entity_list', 'number': 'number' }) # x:456 y:51 OperatableStateMachine.add( 'Get Nearest', CalculationState(calculation=lambda x: x[0].ID), transitions={'done': 'look'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'entity_list', 'output_value': 'ID' }) # x:291 y:177 OperatableStateMachine.add( 'look', KeepLookingAt(), transitions={'failed': 'list all entities'}, autonomy={'failed': Autonomy.Off}, remapping={'ID': 'ID'}) # x:12 y:125, x:1130 y:515 _sm_nlu_2 = OperatableStateMachine(outcomes=['finished', 'failed']) with _sm_nlu_2: # x:156 y:37 OperatableStateMachine.add( 'say ask', SaraSay(sentence="You can ask me your questions.", input_keys=[], emotion=1, block=True), transitions={'done': 'Loop Questions'}, autonomy={'done': Autonomy.Off}) # x:1091 y:84 OperatableStateMachine.add('Listen', GetSpeech(watchdog=10), transitions={ 'done': 'Engine', 'nothing': 'Listen', 'fail': 'Listen' }, autonomy={ 'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off }, remapping={'words': 'sentence'}) # x:1324 y:110 OperatableStateMachine.add('Engine', SaraNLUspr(), transitions={ 'understood': 'Say_Answer', 'not_understood': 'Listen', 'fail': 'Listen' }, autonomy={ 'understood': Autonomy.Off, 'not_understood': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'sentence': 'sentence', 'answer': 'answer' }) # x:632 y:77 OperatableStateMachine.add( 'Select Story', CalculationState(calculation=lambda x: x + 6), transitions={'done': 'Set_a_step'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'index', 'output_value': 'story' }) # x:874 y:78 OperatableStateMachine.add('Set_a_step', Set_a_step(step=1), transitions={'done': 'Listen'}, autonomy={'done': Autonomy.Off}) # x:398 y:81 OperatableStateMachine.add('Loop Questions', ForLoop(repeat=5), transitions={ 'do': 'Select Story', 'end': 'loop step' }, autonomy={ 'do': Autonomy.Off, 'end': Autonomy.Off }, remapping={'index': 'index'}) # x:439 y:252 OperatableStateMachine.add( 'Say Blind Game', SaraSay(sentence="Let's play the blind game !", input_keys=[], emotion=1, block=True), transitions={'done': 'Loop Questions'}, autonomy={'done': Autonomy.Off}) # x:189 y:193 OperatableStateMachine.add('loop step', ForLoop(repeat=1), transitions={ 'do': 'Say Blind Game', 'end': 'finished' }, autonomy={ 'do': Autonomy.Off, 'end': Autonomy.Off }, remapping={'index': 'index'}) # x:721 y:205 OperatableStateMachine.add('Say_Answer', SaraSay(sentence=lambda x: str(x), input_keys=[], emotion=0, block=True), transitions={'done': 'Loop Questions'}, autonomy={'done': Autonomy.Off}) # x:817 y:123, x:130 y:458 _sm_analyse_crowd_3 = OperatableStateMachine( outcomes=['finished', 'error']) with _sm_analyse_crowd_3: # x:87 y:97 OperatableStateMachine.add('clear database', WonderlandClearPeoples(), transitions={ 'done': 'Rotate', 'error': 'error' }, autonomy={ 'done': Autonomy.Off, 'error': Autonomy.Off }) # x:531 y:112 OperatableStateMachine.add('Add Update Persons', WonderlandAddUpdatePeople(), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:311 y:97 OperatableStateMachine.add( 'Rotate', _sm_rotate_0, transitions={'finished': 'Add Update Persons'}, autonomy={'finished': Autonomy.Inherit}) # x:1203 y:11, x:1006 y:366 _sm_init_scenario_4 = OperatableStateMachine( outcomes=['done', 'error']) with _sm_init_scenario_4: # x:30 y:42 OperatableStateMachine.add( 'Generate Vizbox Story', Set_Story(titre="Speech and Person Recognition", storyline=[ "Waiting Begining", "Join Game Room", "Waiting Crowd Placement", "Analysing Crowd", "Begin Game", "Find Operator", "Question 1", "Question 2", "Question 3", "Question 4", "Question 5", "Leave Arena" ]), transitions={'done': 'Set Story Step'}, autonomy={'done': Autonomy.Off}) # x:559 y:44 OperatableStateMachine.add('WaitForBegining', ContinueButton(), transitions={ 'true': 'Reset Persons', 'false': 'Reset Persons' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }) # x:807 y:61 OperatableStateMachine.add('Reset Persons', WonderlandClearPeoples(), transitions={ 'done': 'done', 'error': 'error' }, autonomy={ 'done': Autonomy.Off, 'error': Autonomy.Off }) # x:247 y:49 OperatableStateMachine.add('Set Story Step', Set_a_step(step=0), transitions={'done': 'setIDLE'}, autonomy={'done': Autonomy.Off}) # x:388 y:208 OperatableStateMachine.add('Reset Arm', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'Reset Persons', 'failed': 'error' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'target'}) # x:427 y:40 OperatableStateMachine.add('setIDLE', SetKey(Value="IdlePose"), transitions={'done': 'Reset Arm'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'target'}) # x:30 y:458, x:230 y:458 _sm_join_area_5 = OperatableStateMachine( outcomes=['failed', 'finished'], input_keys=['join']) with _sm_join_area_5: # x:95 y:40 OperatableStateMachine.add( 'Say Join Area', SaraSay(sentence="I will join the playing room !", input_keys=[], emotion=1, block=True), transitions={'done': 'Join Arena'}, autonomy={'done': Autonomy.Off}) # x:92 y:134 OperatableStateMachine.add( 'Join Arena', self.use_behavior(sara_flexbe_behaviors__ActionWrapper_MoveSM, 'Join Area/Join Arena'), transitions={ 'finished': 'finished', 'failed': 'failed', 'critical_fail': 'failed' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'critical_fail': Autonomy.Inherit }, remapping={'Action': 'join'}) # x:489 y:56, x:604 y:278 _sm_waiting_and_turn_6 = OperatableStateMachine( outcomes=['finished', 'failed'], input_keys=['half_turn']) with _sm_waiting_and_turn_6: # x:50 y:51 OperatableStateMachine.add( 'Want Play', SaraSay(sentence="Hum, I want to play riddles !", input_keys=[], emotion=1, block=True), transitions={'done': 'Wait 10s'}, autonomy={'done': Autonomy.Off}) # x:272 y:121 OperatableStateMachine.add( 'action_turn', self.use_behavior(sara_flexbe_behaviors__action_turnSM, 'Waiting And Turn/action_turn'), transitions={ 'finished': 'finished', 'failed': 'Cant turn' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'rotation': 'half_turn'}) # x:437 y:240 OperatableStateMachine.add('Cant turn', SaraSay(sentence="I can't turn !", input_keys=[], emotion=1, block=True), transitions={'done': 'failed'}, autonomy={'done': Autonomy.Off}) # x:63 y:178 OperatableStateMachine.add( 'Wait 10s', WaitState(wait_time=10), transitions={'done': 'Look In Front Of'}, autonomy={'done': Autonomy.Off}) # x:61 y:260 OperatableStateMachine.add('Look In Front Of', SaraSetHeadAngle(pitch=0, yaw=0), transitions={'done': 'action_turn'}, autonomy={'done': Autonomy.Off}) # x:472 y:69, x:476 y:113, x:470 y:196, x:330 y:458, x:430 y:458 _sm_questions_7 = ConcurrencyContainer( outcomes=['finished', 'failed'], input_keys=['person'], conditions=[('finished', [('NLU', 'finished')]), ('failed', [('NLU', 'failed')]), ('finished', [('Follow Head', 'end')])]) with _sm_questions_7: # x:85 y:58 OperatableStateMachine.add('NLU', _sm_nlu_2, transitions={ 'finished': 'finished', 'failed': 'failed' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }) # x:84 y:185 OperatableStateMachine.add('Follow Head', _sm_follow_head_1, transitions={'end': 'finished'}, autonomy={'end': Autonomy.Inherit}, remapping={'person': 'person'}) # x:283 y:294, x:60 y:571 _sm_find_operator_8 = OperatableStateMachine( outcomes=['not_found', 'done'], input_keys=['person', 'operator_param']) with _sm_find_operator_8: # x:51 y:40 OperatableStateMachine.add( 'Ask Player', SaraSay(sentence="Who wan't to play with me ?", input_keys=[], emotion=1, block=True), transitions={'done': 'Wait Operator'}, autonomy={'done': Autonomy.Off}) # x:39 y:297 OperatableStateMachine.add( 'Get operator id', CalculationState(calculation=lambda x: x.entities[0].face.id), transitions={'done': 'Set Operator Id'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'entity_list', 'output_value': 'operator' }) # x:33 y:384 OperatableStateMachine.add('Set Operator Id', SetRosParamKey(), transitions={'done': 'Operator Id'}, autonomy={'done': Autonomy.Off}, remapping={ 'Value': 'operator_param', 'ParamName': 'operator' }) # x:46 y:117 OperatableStateMachine.add('Wait Operator', WaitState(wait_time=6), transitions={'done': 'Find Operator'}, autonomy={'done': Autonomy.Off}) # x:35 y:495 OperatableStateMachine.add('Operator Id', LogKeyState( text="Operator find. Id: {}", severity=Logger.REPORT_HINT), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}, remapping={'data': 'operator'}) # x:30 y:205 OperatableStateMachine.add('Find Operator', list_entities_by_name( frontality_level=0.5, distance_max=10), transitions={ 'found': 'Get operator id', 'none_found': 'Find Operator' }, autonomy={ 'found': Autonomy.Off, 'none_found': Autonomy.Off }, remapping={ 'name': 'person', 'entity_list': 'entity_list', 'number': 'number' }) # x:703 y:198, x:88 y:199 _sm_tell_basic_stats_9 = OperatableStateMachine( outcomes=['finished', 'failed']) with _sm_tell_basic_stats_9: # x:50 y:40 OperatableStateMachine.add('wait', WaitState(wait_time=0), transitions={'done': 'GetPeopleStats'}, autonomy={'done': Autonomy.Off}) # x:218 y:43 OperatableStateMachine.add('GetPeopleStats', WonderlandGetPersonStat(), transitions={ 'done': 'GenerateSentence', 'none': 'Nobody', 'error': 'failed' }, autonomy={ 'done': Autonomy.Off, 'none': Autonomy.Off, 'error': Autonomy.Off }, remapping={ 'women': 'women', 'men': 'men', 'others': 'others' }) # x:466 y:46 OperatableStateMachine.add('Nobody', SaraSay( sentence="There is nobody here !", input_keys=[], emotion=1, block=True), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:162 y:243 OperatableStateMachine.add( 'GenerateSentence', FlexibleCalculationState(calculation=lambda x: "There is " + str(x[0] + x[1] + x[2]) + " persons.", input_keys=['men', 'women', 'others']), transitions={'done': 'Tell_Stats'}, autonomy={'done': Autonomy.Off}, remapping={ 'men': 'men', 'women': 'women', 'others': 'others', 'output_value': 'sentence' }) # x:151 y:345 OperatableStateMachine.add( 'Generate Sentence 2', FlexibleCalculationState( calculation=lambda x: "I recognize " + str(x[ 1]) + " women and " + str(x[0]) + " men.", input_keys=['men', 'women', 'others']), transitions={'done': 'Tell_Stats 2'}, autonomy={'done': Autonomy.Off}, remapping={ 'men': 'men', 'women': 'women', 'others': 'others', 'output_value': 'sentence' }) # x:380 y:172 OperatableStateMachine.add( 'Tell_Stats', SaraSay(sentence=lambda x: x, input_keys=[], emotion=0, block=True), transitions={'done': 'Generate Sentence 2'}, autonomy={'done': Autonomy.Off}) # x:409 y:276 OperatableStateMachine.add('Tell_Stats 2', SaraSay(sentence=lambda x: x, input_keys=[], emotion=0, block=True), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) with _state_machine: # x:30 y:40 OperatableStateMachine.add('continue', ContinueButton(), transitions={ 'true': 'Init Scenario', 'false': 'Init Scenario' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }) # x:715 y:127 OperatableStateMachine.add('Tell basic stats', _sm_tell_basic_stats_9, transitions={ 'finished': 'Set Find Operator', 'failed': 'failed' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }) # x:899 y:126 OperatableStateMachine.add('Find Operator', _sm_find_operator_8, transitions={ 'not_found': 'Find Operator', 'done': 'Questions' }, autonomy={ 'not_found': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={ 'person': 'person', 'operator_param': 'operator_param' }) # x:1120 y:126 OperatableStateMachine.add('Questions', _sm_questions_7, transitions={ 'finished': 'set head', 'failed': 'failed' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'person': 'person'}) # x:343 y:49 OperatableStateMachine.add( 'Set Story Waiting', Set_a_step(step=2), transitions={'done': 'Waiting And Turn'}, autonomy={'done': Autonomy.Off}) # x:532 y:48 OperatableStateMachine.add('Set Analyse', Set_a_step(step=3), transitions={'done': 'Analyse Crowd'}, autonomy={'done': Autonomy.Off}) # x:696 y:47 OperatableStateMachine.add( 'Set Begin Game', Set_a_step(step=4), transitions={'done': 'Tell basic stats'}, autonomy={'done': Autonomy.Off}) # x:899 y:49 OperatableStateMachine.add('Set Find Operator', Set_a_step(step=5), transitions={'done': 'Find Operator'}, autonomy={'done': Autonomy.Off}) # x:332 y:127 OperatableStateMachine.add('Waiting And Turn', _sm_waiting_and_turn_6, transitions={ 'finished': 'Set Analyse', 'failed': 'failed' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'half_turn': 'half_turn'}) # x:1333 y:232 OperatableStateMachine.add('Set Go Out', Set_a_step(step=11), transitions={'done': 'Say And Of Game'}, autonomy={'done': Autonomy.Off}) # x:1517 y:148 OperatableStateMachine.add( 'Leave Arena', self.use_behavior(sara_flexbe_behaviors__ActionWrapper_MoveSM, 'Leave Arena'), transitions={ 'finished': 'finished', 'failed': 'finished', 'critical_fail': 'finished' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'critical_fail': Autonomy.Inherit }, remapping={'Action': 'leave'}) # x:176 y:42 OperatableStateMachine.add( 'Set Join', Set_a_step(step=1), transitions={'done': 'Set Story Waiting'}, autonomy={'done': Autonomy.Off}) # x:177 y:120 OperatableStateMachine.add('Join Area', _sm_join_area_5, transitions={ 'failed': 'failed', 'finished': 'Set Story Waiting' }, autonomy={ 'failed': Autonomy.Inherit, 'finished': Autonomy.Inherit }, remapping={'join': 'join'}) # x:1302 y:140 OperatableStateMachine.add( 'Say And Of Game', SaraSay( sentence= "The game is finished. I will leave the arena. Thank you for playing with me.", input_keys=[], emotion=1, block=True), transitions={'done': 'Leave Arena'}, autonomy={'done': Autonomy.Off}) # x:1120 y:237 OperatableStateMachine.add('set head', SaraSetHeadAngle(pitch=-0.2, yaw=0), transitions={'done': 'Set Go Out'}, autonomy={'done': Autonomy.Off}) # x:34 y:130 OperatableStateMachine.add('Init Scenario', _sm_init_scenario_4, transitions={ 'done': 'Set Join', 'error': 'failed' }, autonomy={ 'done': Autonomy.Inherit, 'error': Autonomy.Inherit }) # x:517 y:124 OperatableStateMachine.add('Analyse Crowd', _sm_analyse_crowd_3, transitions={ 'finished': 'Set Begin Game', 'error': 'failed' }, autonomy={ 'finished': Autonomy.Inherit, 'error': Autonomy.Inherit }) return _state_machine
def create(self): # x:660 y:509, x:880 y:203, x:715 y:440 _state_machine = OperatableStateMachine( outcomes=['finished', 'failed', 'critical_fail'], input_keys=['Action']) _state_machine.userdata.Action = ["Pick", "bottle"] # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:30 y:365, x:130 y:365, x:230 y:365, x:330 y:365 _sm_group_0 = ConcurrencyContainer(outcomes=['done'], input_keys=['pose_out'], conditions=[ ('done', [('move', 'arrived')]), ('done', [('move', 'failed')]), ('done', [('3', 'done')]) ]) with _sm_group_0: # x:30 y:40 OperatableStateMachine.add('move', SaraMoveBase(reference="map"), transitions={ 'arrived': 'done', 'failed': 'done' }, autonomy={ 'arrived': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'pose': 'pose_out'}) # x:179 y:91 OperatableStateMachine.add('3', WaitState(wait_time=2), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:40 y:700 _sm_get_closer_1 = OperatableStateMachine(outcomes=['done'], input_keys=['Object']) with _sm_get_closer_1: # x:59 y:36 OperatableStateMachine.add('set targetpose', SetKey(Value="PreGripPose"), transitions={'done': 'say closer'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'target'}) # x:88 y:374 OperatableStateMachine.add('set dist', SetKey(Value=0.8), transitions={'done': 'get close pos'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'distance'}) # x:26 y:448 OperatableStateMachine.add('get close pos', Get_Reacheable_Waypoint(), transitions={'done': 'Group'}, autonomy={'done': Autonomy.Off}, remapping={ 'pose_in': 'Pos', 'distance': 'distance', 'pose_out': 'pose_out' }) # x:47 y:213 OperatableStateMachine.add( 'get pos', CalculationState(calculation=lambda x: x.position), transitions={'done': 'move head'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'Object', 'output_value': 'Pos' }) # x:88 y:290 OperatableStateMachine.add('move head', SaraSetHeadAngle(pitch=0.7, yaw=0), transitions={'done': 'set dist'}, autonomy={'done': Autonomy.Off}) # x:201 y:156 OperatableStateMachine.add('move arm', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'get pos', 'failed': 'get pos' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'target'}) # x:60 y:106 OperatableStateMachine.add( 'say closer', SaraSay(sentence="I need to get a bit closer.", input_keys=[], emotion=1, block=False), transitions={'done': 'move arm'}, autonomy={'done': Autonomy.Off}) # x:26 y:541 OperatableStateMachine.add('Group', _sm_group_0, transitions={'done': 'wait'}, autonomy={'done': Autonomy.Inherit}, remapping={'pose_out': 'pose_out'}) # x:33 y:625 OperatableStateMachine.add('wait', WaitState(wait_time=2), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:59 y:308, x:447 y:59, x:384 y:162 _sm_check_form_2 = OperatableStateMachine( outcomes=['done', 'fail_full', 'full_no_object'], input_keys=['Action']) with _sm_check_form_2: # x:31 y:40 OperatableStateMachine.add( 'check if gripper full', GetRosParam(ParamName="behavior/Gripper_Content"), transitions={ 'done': 'Say_Full', 'failed': 'cond' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'Value': 'ObjectInGripper'}) # x:30 y:121 OperatableStateMachine.add( 'cond', CheckConditionState(predicate=lambda x: x[1] == ''), transitions={ 'true': 'not told', 'false': 'done' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }, remapping={'input_value': 'Action'}) # x:222 y:119 OperatableStateMachine.add( 'not told', SaraSay(sentence="Hum! They didn't told me what to pick", input_keys=[], emotion=1, block=True), transitions={'done': 'full_no_object'}, autonomy={'done': Autonomy.Off}) # x:242 y:31 OperatableStateMachine.add( 'Say_Full', SaraSay(sentence=lambda x: "Wait. There is already a " + x + "in my gripper.", input_keys=[], emotion=0, block=True), transitions={'done': 'fail_full'}, autonomy={'done': Autonomy.Off}) with _state_machine: # x:84 y:30 OperatableStateMachine.add('Check Form', _sm_check_form_2, transitions={ 'done': 'get name', 'fail_full': 'cause1', 'full_no_object': 'cause2' }, autonomy={ 'done': Autonomy.Inherit, 'fail_full': Autonomy.Inherit, 'full_no_object': Autonomy.Inherit }, remapping={'Action': 'Action'}) # x:28 y:452 OperatableStateMachine.add('Action_pick', self.use_behavior( Action_pickSM, 'Action_pick'), transitions={ 'success': 'Got_It', 'unreachable': 'for 1', 'not found': 'Say_lost', 'dropped': 'say missed' }, autonomy={ 'success': Autonomy.Inherit, 'unreachable': Autonomy.Inherit, 'not found': Autonomy.Inherit, 'dropped': Autonomy.Inherit }, remapping={'objectID': 'ID'}) # x:261 y:239 OperatableStateMachine.add('Get closer', _sm_get_closer_1, transitions={'done': 'Action_find'}, autonomy={'done': Autonomy.Inherit}, remapping={'Object': 'Object'}) # x:275 y:333 OperatableStateMachine.add('for 1', ForLoop(repeat=1), transitions={ 'do': 'Get closer', 'end': 'say giveup' }, autonomy={ 'do': Autonomy.Off, 'end': Autonomy.Off }, remapping={'index': 'index'}) # x:416 y:264 OperatableStateMachine.add('say giveup', SaraSay(sentence="I give up", input_keys=[], emotion=1, block=True), transitions={'done': 'cause4'}, autonomy={'done': Autonomy.Off}) # x:284 y:496 OperatableStateMachine.add('say missed', SaraSay(sentence="Oops! I missed.", input_keys=[], emotion=1, block=True), transitions={'done': 'cause4'}, autonomy={'done': Autonomy.Off}) # x:469 y:495 OperatableStateMachine.add( 'set param', SetRosParam(ParamName="behavior/GripperContent"), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}, remapping={'Value': 'ObjectName'}) # x:82 y:115 OperatableStateMachine.add( 'get name', CalculationState(calculation=lambda x: x[1]), transitions={'done': 'Action_find'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'Action', 'output_value': 'ObjectName' }) # x:511 y:20 OperatableStateMachine.add( 'cause1', SetKey(Value="My gripper was already full."), transitions={'done': 'setrosparam'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:512 y:81 OperatableStateMachine.add( 'cause2', SetKey(Value="I didn't know what to pick."), transitions={'done': 'setrosparam'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:511 y:143 OperatableStateMachine.add( 'cause3', SetKey(Value="I didn't found the object."), transitions={'done': 'setrosparam'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:690 y:197 OperatableStateMachine.add( 'setrosparam', SetRosParam(ParamName="behavior/GPSR/CauseOfFailure"), transitions={'done': 'failed'}, autonomy={'done': Autonomy.Off}, remapping={'Value': 'Key'}) # x:605 y:312 OperatableStateMachine.add( 'cause4', SetKey(Value="I was unable to pick the object."), transitions={'done': 'setrosparam'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:30 y:188 OperatableStateMachine.add('Action_find', self.use_behavior( Action_findSM, 'Action_find'), transitions={ 'done': 'getID', 'failed': 'cause3' }, autonomy={ 'done': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={ 'className': 'ObjectName', 'entity': 'Object' }) # x:49 y:322 OperatableStateMachine.add( 'getID', CalculationState(calculation=lambda x: x.ID), transitions={'done': 'Action_pick'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'Object', 'output_value': 'ID' }) # x:284 y:422 OperatableStateMachine.add( 'Say_lost', SaraSay(sentence=lambda x: "Hum! I lost sight of the " + x, input_keys=[], emotion=0, block=True), transitions={'done': 'cause4'}, autonomy={'done': Autonomy.Off}) # x:281 y:572 OperatableStateMachine.add( 'Got_It', SaraSay(sentence=lambda x: "I have the " + x, input_keys=[], emotion=0, block=True), transitions={'done': 'set param'}, autonomy={'done': Autonomy.Off}) return _state_machine
def create(self): # x:1195 y:433, x:132 y:431, x:750 y:42, x:991 y:471 _state_machine = OperatableStateMachine(outcomes=['Given', 'Person_not_found', 'No_object_in_hand', 'fail']) # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:130 y:365 _sm_lookat_0 = OperatableStateMachine(outcomes=['failed'], input_keys=['ID']) with _sm_lookat_0: # x:114 y:127 OperatableStateMachine.add('look', KeepLookingAt(), transitions={'failed': 'look'}, autonomy={'failed': Autonomy.Off}, remapping={'ID': 'ID'}) # x:299 y:300, x:263 y:535 _sm_give_1 = OperatableStateMachine(outcomes=['failed', 'given'], input_keys=['Object']) with _sm_give_1: # x:67 y:27 OperatableStateMachine.add('SetPose', SetKey(Value="ShowGripper"), transitions={'done': 'say_give'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'target'}) # x:53 y:413 OperatableStateMachine.add('read torque', ReadTorque(watchdog=5, Joint="right_elbow_pitch_joint", Threshold=2, min_time=1), transitions={'threshold': 'open gripper', 'watchdog': 'read torque', 'fail': 'failed'}, autonomy={'threshold': Autonomy.Off, 'watchdog': Autonomy.Off, 'fail': Autonomy.Off}, remapping={'torque': 'torque'}) # x:52 y:500 OperatableStateMachine.add('open gripper', SetGripperState(width=0.15, effort=1), transitions={'object': 'given', 'no_object': 'given'}, autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off}, remapping={'object_size': 'object_size'}) # x:64 y:248 OperatableStateMachine.add('say pull', SaraSay(sentence="You can pull on it", input_keys=[], emotion=1, block=False), transitions={'done': 'wait 1'}, autonomy={'done': Autonomy.Off}) # x:64 y:325 OperatableStateMachine.add('wait 1', WaitState(wait_time=1), transitions={'done': 'read torque'}, autonomy={'done': Autonomy.Off}) # x:57 y:175 OperatableStateMachine.add('moveArm', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={'done': 'say pull', 'failed': 'failed'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'target': 'target'}) # x:60 y:88 OperatableStateMachine.add('say_give', SaraSay(sentence=lambda x: "Hi. I'm giving you this "+str(x), input_keys=[], emotion=0, block=True), transitions={'done': 'moveArm'}, autonomy={'done': Autonomy.Off}) # x:596 y:480 _sm_follow_2 = OperatableStateMachine(outcomes=['finished'], input_keys=['ID']) with _sm_follow_2: # x:180 y:123 OperatableStateMachine.add('follow', SaraFollow(distance=1.5, ReplanPeriod=0.5), transitions={'failed': 'follow'}, autonomy={'failed': Autonomy.Off}, remapping={'ID': 'ID'}) # x:313 y:247, x:301 y:177, x:103 y:293, x:343 y:113, x:397 y:411, x:311 y:27, x:630 y:365 _sm_give_3 = ConcurrencyContainer(outcomes=['failed', 'given', 'continue'], input_keys=['ID', 'Object'], conditions=[ ('failed', [('Give', 'failed')]), ('given', [('Give', 'given')]), ('given', [('Follow', 'finished')]), ('failed', [('LookAt', 'failed')]) ]) with _sm_give_3: # x:91 y:50 OperatableStateMachine.add('Follow', _sm_follow_2, transitions={'finished': 'given'}, autonomy={'finished': Autonomy.Inherit}, remapping={'ID': 'ID'}) # x:84 y:164 OperatableStateMachine.add('Give', _sm_give_1, transitions={'failed': 'failed', 'given': 'given'}, autonomy={'failed': Autonomy.Inherit, 'given': Autonomy.Inherit}, remapping={'Object': 'Object'}) # x:175 y:371 OperatableStateMachine.add('LookAt', _sm_lookat_0, transitions={'failed': 'failed'}, autonomy={'failed': Autonomy.Inherit}, remapping={'ID': 'ID'}) with _state_machine: # x:77 y:29 OperatableStateMachine.add('Get hand content', GetRosParam(ParamName="behavior/GripperContent"), transitions={'done': 'is object in hand?', 'failed': 'fail'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'Value': 'Object'}) # x:58 y:108 OperatableStateMachine.add('is object in hand?', CheckConditionState(predicate=lambda x: x), transitions={'true': 'name', 'false': 'log empty hand'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'input_value': 'Object'}) # x:70 y:277 OperatableStateMachine.add('list persons', list_entities_by_name(frontality_level=0.5, distance_max=10), transitions={'found': 'get id', 'none_found': 'Person_not_found'}, autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off}, remapping={'name': 'name', 'entity_list': 'People_list', 'number': 'number'}) # x:414 y:37 OperatableStateMachine.add('log empty hand', LogState(text="The hand is empty. Set the GripperContent rosParam", severity=Logger.REPORT_HINT), transitions={'done': 'No_object_in_hand'}, autonomy={'done': Autonomy.Off}) # x:754 y:223 OperatableStateMachine.add('log moveitfail', LogState(text="moveit failed", severity=Logger.REPORT_HINT), transitions={'done': 'fail'}, autonomy={'done': Autonomy.Off}) # x:606 y:371 OperatableStateMachine.add('log movebase fail', LogState(text="giving Failed", severity=Logger.REPORT_HINT), transitions={'done': 'fail'}, autonomy={'done': Autonomy.Off}) # x:402 y:133 OperatableStateMachine.add('set idle pose', SetKey(Value="IdlePose"), transitions={'done': 'say_good'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'target'}) # x:751 y:108 OperatableStateMachine.add('moveArm2', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={'done': 'set none', 'failed': 'log moveitfail'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'target': 'target'}) # x:920 y:278 OperatableStateMachine.add('close gripper', SetGripperState(width=0, effort=1), transitions={'object': 'Given', 'no_object': 'Given'}, autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off}, remapping={'object_size': 'object_size'}) # x:1048 y:236 OperatableStateMachine.add('remove gripper content', SetRosParam(ParamName="GripperContent"), transitions={'done': 'close gripper'}, autonomy={'done': Autonomy.Off}, remapping={'Value': 'none'}) # x:910 y:182 OperatableStateMachine.add('set none', SetKey(Value=None), transitions={'done': 'close gripper'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'none'}) # x:408 y:333 OperatableStateMachine.add('give', _sm_give_3, transitions={'failed': 'log movebase fail', 'given': 'set idle pose', 'continue': 'give'}, autonomy={'failed': Autonomy.Inherit, 'given': Autonomy.Inherit, 'continue': Autonomy.Inherit}, remapping={'ID': 'ID', 'Object': 'Object'}) # x:256 y:278 OperatableStateMachine.add('get id', CalculationState(calculation=lambda x: x[0].ID), transitions={'done': 'give'}, autonomy={'done': Autonomy.Off}, remapping={'input_value': 'People_list', 'output_value': 'ID'}) # x:68 y:192 OperatableStateMachine.add('name', SetKey(Value="person"), transitions={'done': 'list persons'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'name'}) # x:591 y:138 OperatableStateMachine.add('say_good', SaraSay(sentence=lambda x: "Good, enjoy your "+str(x), input_keys=[], emotion=0, block=True), transitions={'done': 'moveArm2'}, autonomy={'done': Autonomy.Off}) return _state_machine
def create(self): # x:682 y:306, x:452 y:252 _state_machine = OperatableStateMachine( outcomes=['finished', 'failed'], input_keys=['pos']) _state_machine.userdata.pos = {"x": 0.8, "y": -0.2, "z": 1} # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:30 y:458, x:130 y:458, x:230 y:458, x:330 y:458, x:430 y:458, x:530 y:458, x:630 y:458, x:59 y:533, x:830 y:458 _sm_group_0 = ConcurrencyContainer( outcomes=['threshold', 'watchdog', 'fail'], conditions=[('threshold', [('read', 'threshold')]), ('watchdog', [('read', 'watchdog')]), ('fail', [('read', 'fail')]), ('threshold', [('read yaw', 'threshold')]), ('fail', [('read yaw', 'fail')]), ('watchdog', [('read yaw', 'watchdog')])]) with _sm_group_0: # x:86 y:125 OperatableStateMachine.add('read', ReadTorque( watchdog=1, Joint="right_elbow_pitch_joint", Threshold=0.7, min_time=0.4), transitions={ 'threshold': 'threshold', 'watchdog': 'watchdog', 'fail': 'fail' }, autonomy={ 'threshold': Autonomy.Off, 'watchdog': Autonomy.Off, 'fail': Autonomy.Off }, remapping={'torque': 'torque'}) # x:252 y:135 OperatableStateMachine.add('read yaw', ReadTorque( watchdog=1, Joint="right_elbow_pitch_joint", Threshold=0.5, min_time=0.4), transitions={ 'threshold': 'threshold', 'watchdog': 'watchdog', 'fail': 'fail' }, autonomy={ 'threshold': Autonomy.Off, 'watchdog': Autonomy.Off, 'fail': Autonomy.Off }, remapping={'torque': 'torque'}) # x:30 y:458 _sm_read_torque_1 = OperatableStateMachine(outcomes=['done']) with _sm_read_torque_1: # x:142 y:61 OperatableStateMachine.add('log', LogState(text="going down", severity=Logger.REPORT_HINT), transitions={'done': 'Group'}, autonomy={'done': Autonomy.Off}) # x:131 y:164 OperatableStateMachine.add('Group', _sm_group_0, transitions={ 'threshold': 'done', 'watchdog': 'log', 'fail': 'done' }, autonomy={ 'threshold': Autonomy.Inherit, 'watchdog': Autonomy.Inherit, 'fail': Autonomy.Inherit }) # x:30 y:458 _sm_go_down_2 = OperatableStateMachine(outcomes=['done'], input_keys=['GripPose']) with _sm_go_down_2: # x:126 y:194 OperatableStateMachine.add('movePlace', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'done', 'failed': 'done' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'GripPose'}) # x:30 y:324, x:130 y:324 _sm_retreate_arm_3 = OperatableStateMachine( outcomes=['failed', 'done'], input_keys=['approach_pose', 'PreGripPose']) with _sm_retreate_arm_3: # x:30 y:40 OperatableStateMachine.add('ReturnApproachPose', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'ReturnPreGrip', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'approach_pose'}) # x:202 y:41 OperatableStateMachine.add('ReturnPreGrip', MoveitMove(move=True, waitForExecution=False, group="RightArm", watchdog=15), transitions={ 'done': 'done', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'PreGripPose'}) # x:30 y:324, x:130 y:324 _sm_releasing_4 = OperatableStateMachine( outcomes=['object', 'no_object']) with _sm_releasing_4: # x:30 y:40 OperatableStateMachine.add('say touchdown', SaraSay(sentence="Touchdown!", input_keys=[], emotion=1, block=False), transitions={'done': 'open gripper'}, autonomy={'done': Autonomy.Off}) # x:139 y:176 OperatableStateMachine.add( 'open gripper', SetGripperState(width=0.14, effort=1), transitions={ 'object': 'object', 'no_object': 'no_object' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:30 y:324, x:130 y:324 _sm_moveback_5 = OperatableStateMachine(outcomes=['arrived', 'failed']) with _sm_moveback_5: # x:30 y:40 OperatableStateMachine.add('genpose', GenPoseEuler(x=-0.3, y=-0.3, z=0, roll=0, pitch=0, yaw=0), transitions={'done': 'move back'}, autonomy={'done': Autonomy.Off}, remapping={'pose': 'backPose'}) # x:40 y:163 OperatableStateMachine.add('move back', SaraMoveBase(reference="base_link"), transitions={ 'arrived': 'arrived', 'failed': 'failed' }, autonomy={ 'arrived': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'pose': 'backPose'}) # x:536 y:72, x:231 y:292 _sm_prepare_grip_6 = OperatableStateMachine( outcomes=['failed', 'done'], input_keys=['pos'], output_keys=['approach_pose', 'grip_pose']) with _sm_prepare_grip_6: # x:50 y:40 OperatableStateMachine.add('Gen place_pos', GenGripperPose(l=0, z=-0.05, planar=True), transitions={ 'done': 'Gen approach_pos', 'fail': 'failed' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'pos', 'pose_out': 'grip_pose' }) # x:30 y:176 OperatableStateMachine.add('MoveIt_isReachable', MoveitMove(move=False, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'log app', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'grip_pose'}) # x:37 y:108 OperatableStateMachine.add('Gen approach_pos', GenGripperPose(l=0.0, z=0.20, planar=True), transitions={ 'done': 'log place pos', 'fail': 'failed' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'pos', 'pose_out': 'approach_pose' }) # x:41 y:269 OperatableStateMachine.add('log app', LogKeyState( text="{}", severity=Logger.REPORT_HINT), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}, remapping={'data': 'approach_pose'}) # x:360 y:180 OperatableStateMachine.add( 'log place pos', LogKeyState(text="place pose is {}", severity=Logger.REPORT_HINT), transitions={'done': 'MoveIt_isReachable'}, autonomy={'done': Autonomy.Off}, remapping={'data': 'grip_pose'}) # x:30 y:324, x:130 y:324 _sm_pregrippose_7 = OperatableStateMachine(outcomes=['done', 'failed'], output_keys=['PreGripPose']) with _sm_pregrippose_7: # x:30 y:40 OperatableStateMachine.add('setPreGripPose', SetKey(Value="PrePlacePose"), transitions={'done': 'gotoPreGrip'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'PreGripPose'}) # x:32 y:106 OperatableStateMachine.add('gotoPreGrip', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'done', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'PreGripPose'}) # x:30 y:458, x:130 y:458, x:230 y:458 _sm_get_down_8 = ConcurrencyContainer( outcomes=['done'], input_keys=['GripPose'], conditions=[('done', [('Go down', 'done')]), ('done', [('read torque', 'done')])]) with _sm_get_down_8: # x:178 y:127 OperatableStateMachine.add('Go down', _sm_go_down_2, transitions={'done': 'done'}, autonomy={'done': Autonomy.Inherit}, remapping={'GripPose': 'GripPose'}) # x:405 y:150 OperatableStateMachine.add('read torque', _sm_read_torque_1, transitions={'done': 'done'}, autonomy={'done': Autonomy.Inherit}) # x:30 y:324, x:130 y:324 _sm_pretraitement_9 = OperatableStateMachine(outcomes=['fail', 'done'], input_keys=['pos'], output_keys=['pos']) with _sm_pretraitement_9: # x:30 y:40 OperatableStateMachine.add('TF_transformation', TF_transformation(in_ref="map", out_ref="base_link"), transitions={ 'done': 'LOG POSE', 'fail': 'fail' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'in_pos': 'pos', 'out_pos': 'pos' }) # x:33 y:107 OperatableStateMachine.add('LOG POSE', LogKeyState( text="{}", severity=Logger.REPORT_HINT), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}, remapping={'data': 'pos'}) with _state_machine: # x:148 y:34 OperatableStateMachine.add('Pretraitement', _sm_pretraitement_9, transitions={ 'fail': 'failed', 'done': 'PreGripPose' }, autonomy={ 'fail': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={'pos': 'pos'}) # x:634 y:410 OperatableStateMachine.add( 'close gripper', SetGripperState(width=0, effort=1), transitions={ 'object': 'finished', 'no_object': 'finished' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:141 y:522 OperatableStateMachine.add('Get_down', _sm_get_down_8, transitions={'done': 'releasing'}, autonomy={'done': Autonomy.Inherit}, remapping={'GripPose': 'grip_pose'}) # x:159 y:352 OperatableStateMachine.add('look down', SaraSetHeadAngle(pitch=0.6, yaw=-0.3), transitions={'done': 'Move_approach'}, autonomy={'done': Autonomy.Off}) # x:160 y:127 OperatableStateMachine.add( 'PreGripPose', _sm_pregrippose_7, transitions={ 'done': 'Prepare grip', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'PreGripPose': 'PreGripPose'}) # x:156 y:238 OperatableStateMachine.add('Prepare grip', _sm_prepare_grip_6, transitions={ 'failed': 'failed', 'done': 'look down' }, autonomy={ 'failed': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={ 'pos': 'pos', 'approach_pose': 'approach_pose', 'grip_pose': 'grip_pose' }) # x:139 y:444 OperatableStateMachine.add('Move_approach', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'Get_down', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'approach_pose'}) # x:623 y:525 OperatableStateMachine.add('Moveback', _sm_moveback_5, transitions={ 'arrived': 'close gripper', 'failed': 'failed' }, autonomy={ 'arrived': Autonomy.Inherit, 'failed': Autonomy.Inherit }) # x:298 y:520 OperatableStateMachine.add('releasing', _sm_releasing_4, transitions={ 'object': 'retreate arm', 'no_object': 'retreate arm' }, autonomy={ 'object': Autonomy.Inherit, 'no_object': Autonomy.Inherit }) # x:459 y:522 OperatableStateMachine.add('retreate arm', _sm_retreate_arm_3, transitions={ 'failed': 'failed', 'done': 'Moveback' }, autonomy={ 'failed': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={ 'approach_pose': 'approach_pose', 'PreGripPose': 'PreGripPose' }) return _state_machine
def create(self): # x:960 y:715, x:912 y:318, x:904 y:185, x:941 y:610 _state_machine = OperatableStateMachine( outcomes=['success', 'unreachable', 'not found', 'dropped'], input_keys=['objectID']) _state_machine.userdata.objectID = 539 _state_machine.userdata.PreGripPose = "pre_grip_pose" _state_machine.userdata.entity = 0 _state_machine.userdata.grasp_pose = 0 _state_machine.userdata.approach_pose = 0 # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:30 y:365, x:130 y:365, x:230 y:365 _sm_look_at_it_for_3s_0 = ConcurrencyContainer( outcomes=['done'], input_keys=['ID'], conditions=[('done', [('look', 'failed')]), ('done', [('wait', 'done')])]) with _sm_look_at_it_for_3s_0: # x:30 y:54 OperatableStateMachine.add('look', KeepLookingAt(), transitions={'failed': 'done'}, autonomy={'failed': Autonomy.Off}, remapping={'ID': 'ID'}) # x:187 y:111 OperatableStateMachine.add('wait', WaitState(wait_time=6), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:334 y:336, x:96 y:627 _sm_get_object_1 = OperatableStateMachine( outcomes=['not_found', 'finished'], input_keys=['objectID'], output_keys=['entity']) with _sm_get_object_1: # x:67 y:27 OperatableStateMachine.add( 'start segmentation', SetSegmentationRosParam(ValueTableSegmentation=True, ValueObjectSegmentation=True), transitions={'done': 'Look at it for 3s'}, autonomy={'done': Autonomy.Off}) # x:61 y:410 OperatableStateMachine.add( 'Say_See_It', SaraSay(sentence=lambda x: "I see the " + x[0].name, input_keys=["Entity"], emotion=0, block=True), transitions={'done': 'pregrip'}, autonomy={'done': Autonomy.Off}, remapping={'Entity': 'entity'}) # x:72 y:322 OperatableStateMachine.add('getobject', GetEntityByID(), transitions={ 'found': 'Say_See_It', 'not_found': 'not_found' }, autonomy={ 'found': Autonomy.Off, 'not_found': Autonomy.Off }, remapping={ 'ID': 'objectID', 'Entity': 'entity' }) # x:62 y:224 OperatableStateMachine.add('stop segmentation', SetSegmentationRosParam( ValueTableSegmentation=False, ValueObjectSegmentation=False), transitions={'done': 'getobject'}, autonomy={'done': Autonomy.Off}) # x:70 y:122 OperatableStateMachine.add( 'Look at it for 3s', _sm_look_at_it_for_3s_0, transitions={'done': 'stop segmentation'}, autonomy={'done': Autonomy.Inherit}, remapping={'ID': 'objectID'}) # x:57 y:513 OperatableStateMachine.add('pregrip', RunTrajectory(file="pre_grip_pose", duration=5), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:153 y:506, x:350 y:396 _sm_get_closer_2 = OperatableStateMachine( outcomes=['finished', 'failed'], input_keys=['entity']) with _sm_get_closer_2: # x:120 y:61 OperatableStateMachine.add('set distance', SetKey(Value=0.6), transitions={'done': 'get att'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'distance'}) # x:113 y:172 OperatableStateMachine.add('get att', GetAttribute(attributes=["position"]), transitions={'done': 'get waypoint'}, autonomy={'done': Autonomy.Off}, remapping={ 'object': 'entity', 'position': 'position' }) # x:116 y:390 OperatableStateMachine.add('move to waypoint', SaraMoveBase(reference="map"), transitions={ 'arrived': 'finished', 'failed': 'failed' }, autonomy={ 'arrived': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'pose': 'pose'}) # x:107 y:272 OperatableStateMachine.add( 'get waypoint', Get_Reacheable_Waypoint(), transitions={'done': 'move to waypoint'}, autonomy={'done': Autonomy.Off}, remapping={ 'pose_in': 'position', 'distance': 'distance', 'pose_out': 'pose' }) # x:280 y:183, x:92 y:289 _sm_get_on_it_3 = OperatableStateMachine(outcomes=['failed', 'done'], input_keys=['grasp_pose']) with _sm_get_on_it_3: # x:76 y:26 OperatableStateMachine.add( 'open gripper', SetGripperState(width=0.1, effort=0), transitions={ 'object': 'move forward', 'no_object': 'move forward' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:64 y:158 OperatableStateMachine.add('move forward', MoveitMoveCartesian( move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'done', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'targetPose': 'grasp_pose'}) # x:30 y:324, x:130 y:324 _sm_get_away_from_failure_4 = OperatableStateMachine( outcomes=['done', 'failed']) with _sm_get_away_from_failure_4: # x:30 y:40 OperatableStateMachine.add( 'open 2', SetGripperState(width=0.1, effort=1), transitions={ 'object': 'go back', 'no_object': 'go back' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:44 y:167 OperatableStateMachine.add('go back', RunTrajectory(file="pre_grip_pose", duration=0), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:68 y:579, x:349 y:211 _sm_lift_object_5 = OperatableStateMachine( outcomes=['done', 'failed'], input_keys=['approach_pose', 'up_pose']) with _sm_lift_object_5: # x:45 y:34 OperatableStateMachine.add('move up', MoveitMoveCartesian( move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'genpose', 'failed': 'genpose' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'targetPose': 'up_pose'}) # x:39 y:480 OperatableStateMachine.add('place arm', RunTrajectory(file="transport", duration=0), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:40 y:144 OperatableStateMachine.add('genpose', GenPoseEuler(x=-0.2, y=0, z=0, roll=0, pitch=0, yaw=0), transitions={'done': 'move_back'}, autonomy={'done': Autonomy.Off}, remapping={'pose': 'backPose'}) # x:42 y:382 OperatableStateMachine.add('move_back', SaraMoveBase(reference="base_link"), transitions={ 'arrived': 'place arm', 'failed': 'place arm' }, autonomy={ 'arrived': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'pose': 'backPose'}) # x:263 y:214, x:271 y:492 _sm_validation_and_approach_6 = OperatableStateMachine( outcomes=['failed', 'done'], input_keys=['grasp_pose', 'approach_pose']) with _sm_validation_and_approach_6: # x:85 y:30 OperatableStateMachine.add('checkifposeaccess', MoveitMove(move=False, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'say can reach', 'failed': 'sayapp' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'grasp_pose'}) # x:48 y:236 OperatableStateMachine.add('move approach', MoveitMove(move=True, waitForExecution=True, group="RightArm", watchdog=15), transitions={ 'done': 'done', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'approach_pose'}) # x:71 y:115 OperatableStateMachine.add('say can reach', SaraSay(sentence="I will grab it", input_keys=[], emotion=1, block=False), transitions={'done': 'move approach'}, autonomy={'done': Autonomy.Off}) # x:342 y:93 OperatableStateMachine.add('sayapp', SaraSay(sentence="unreachable", input_keys=[], emotion=0, block=True), transitions={'done': 'failed'}, autonomy={'done': Autonomy.Off}) with _state_machine: # x:40 y:26 OperatableStateMachine.add('start loop', SetKey(Value=0), transitions={'done': 'Get object'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'i'}) # x:256 y:616 OperatableStateMachine.add( 'gripclose', SetGripperState(width=0, effort=250), transitions={ 'object': 'say picked', 'no_object': 'get away from failure' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:255 y:507 OperatableStateMachine.add('cant reach', SaraSay( sentence="Hum! I can't reach it.", input_keys=[], emotion=1, block=True), transitions={'done': 'for 2 try'}, autonomy={'done': Autonomy.Off}) # x:261 y:732 OperatableStateMachine.add('say picked', SaraSay(sentence="I think I got it", input_keys=[], emotion=1, block=False), transitions={'done': 'Lift object'}, autonomy={'done': Autonomy.Off}) # x:751 y:715 OperatableStateMachine.add('welcome', SaraSay(sentence="you are welcome", input_keys=[], emotion=1, block=True), transitions={'done': 'success'}, autonomy={'done': Autonomy.Off}) # x:9 y:403 OperatableStateMachine.add('validation and approach', _sm_validation_and_approach_6, transitions={ 'failed': 'say plan', 'done': 'gen up pose' }, autonomy={ 'failed': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={ 'grasp_pose': 'grasp_pose', 'approach_pose': 'approach_pose' }) # x:516 y:717 OperatableStateMachine.add('Lift object', _sm_lift_object_5, transitions={ 'done': 'welcome', 'failed': 'welcome' }, autonomy={ 'done': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={ 'approach_pose': 'approach_pose', 'up_pose': 'up_pose' }) # x:480 y:609 OperatableStateMachine.add('get away from failure', _sm_get_away_from_failure_4, transitions={ 'done': 'say missed', 'failed': 'say missed' }, autonomy={ 'done': Autonomy.Inherit, 'failed': Autonomy.Inherit }) # x:25 y:311 OperatableStateMachine.add('get grasps', GetGraspFromEntity( approachDistance=0.2, distanceScoringMultiplier=1, orientationScoringMultiplier=2, graspScoringMultiplier=1), transitions={ 'done': 'validation and approach', 'failed': 'say cant handle' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={ 'Entity': 'entity', 'ApproachPose': 'approach_pose', 'GraspingPose': 'grasp_pose' }) # x:738 y:602 OperatableStateMachine.add('say missed', SaraSay(sentence="Oops! I missed.", input_keys=[], emotion=2, block=True), transitions={'done': 'dropped'}, autonomy={'done': Autonomy.Off}) # x:257 y:279 OperatableStateMachine.add( 'say cant handle', SaraSay(sentence="I don't understand how to grab it.", input_keys=[], emotion=3, block=True), transitions={'done': 'for 2 try'}, autonomy={'done': Autonomy.Off}) # x:18 y:605 OperatableStateMachine.add('get on it', _sm_get_on_it_3, transitions={ 'failed': 'cant reach', 'done': 'gripclose' }, autonomy={ 'failed': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={'grasp_pose': 'grasp_pose'}) # x:261 y:387 OperatableStateMachine.add('say plan', SaraSay(sentence="Planing failed", input_keys=[], emotion=0, block=True), transitions={'done': 'for 2 try'}, autonomy={'done': Autonomy.Off}) # x:20 y:496 OperatableStateMachine.add('gen up pose', GenGripperPose(l=0, z=0.1, planar=False), transitions={ 'done': 'get on it', 'fail': 'cant reach' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'grasp_pose', 'pose_out': 'up_pose' }) # x:558 y:231 OperatableStateMachine.add('get closer', _sm_get_closer_2, transitions={ 'finished': 'Get object', 'failed': 'unreachable' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'entity': 'entity'}) # x:553 y:390 OperatableStateMachine.add('for 2 try', ForLoopWithInput(repeat=1), transitions={ 'do': 'get closer', 'end': 'unreachable' }, autonomy={ 'do': Autonomy.Off, 'end': Autonomy.Off }, remapping={ 'index_in': 'i', 'index_out': 'i' }) # x:28 y:217 OperatableStateMachine.add('Get object', _sm_get_object_1, transitions={ 'not_found': 'not found', 'finished': 'get grasps' }, autonomy={ 'not_found': Autonomy.Inherit, 'finished': Autonomy.Inherit }, remapping={ 'objectID': 'objectID', 'entity': 'entity' }) 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
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:702 y:576, x:764 y:158, x:766 y:33 _state_machine = OperatableStateMachine( outcomes=['finished', 'failed', 'critical_fail'], input_keys=['Action']) _state_machine.userdata.Action = ["Place", "table"] _state_machine.userdata.Empty = None _state_machine.userdata.IdlePos = "IdlePose" # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] with _state_machine: # x:44 y:28 OperatableStateMachine.add( 'gripper contain', GetRosParam(ParamName="behavior/GripperContent"), transitions={ 'done': 'if contain something', 'failed': 'cause1' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'Value': 'content'}) # x:222 y:497 OperatableStateMachine.add('Action_place', self.use_behavior( Action_placeSM, 'Action_place'), transitions={ 'finished': 'idlearm', 'failed': 'cause3' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'pos': 'MapPosition'}) # x:39 y:367 OperatableStateMachine.add( 'genPoseArm', GenPoseEuler(x=0.75, y=-0.25, z=0.85, roll=0, pitch=0, yaw=0), transitions={'done': 'referential from robot to map'}, autonomy={'done': Autonomy.Off}, remapping={'pose': 'position'}) # x:8 y:433 OperatableStateMachine.add('referential from robot to map', TF_transformation(in_ref="base_link", out_ref="map"), transitions={ 'done': 'log pose', 'fail': 'log tf error' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'in_pos': 'position', 'out_pos': 'MapPosition' }) # x:25 y:98 OperatableStateMachine.add( 'if contain something', CheckConditionState(predicate=lambda x: x != ''), transitions={ 'true': 'cond', 'false': 'say nothing in gripper' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }, remapping={'input_value': 'content'}) # x:209 y:98 OperatableStateMachine.add( 'say nothing in gripper', SaraSay(sentence="It seems I have nothing in my gripper", input_keys=[], emotion=1, block=True), transitions={'done': 'cause1'}, autonomy={'done': Autonomy.Off}) # x:28 y:236 OperatableStateMachine.add( 'construction phrase', FlexibleCalculationState( calculation=lambda x: "I will place this " + str(x[ 0]) + " on the " + str(x[1][1]), input_keys=["content", "Action"]), transitions={'done': 'Say_Place_object'}, autonomy={'done': Autonomy.Off}, remapping={ 'content': 'content', 'Action': 'Action', 'output_value': 'sentence' }) # x:33 y:167 OperatableStateMachine.add( 'cond', CheckConditionState(predicate=lambda x: x[1] != ''), transitions={ 'true': 'construction phrase', 'false': 'cause2' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }, remapping={'input_value': 'Action'}) # x:257 y:413 OperatableStateMachine.add('log tf error', LogState(text="tf error", severity=Logger.REPORT_HINT), transitions={'done': 'cause3'}, autonomy={'done': Autonomy.Off}) # x:42 y:502 OperatableStateMachine.add( 'log pose', LogKeyState(text="the placement pose will be: {}", severity=Logger.REPORT_HINT), transitions={'done': 'Action_place'}, autonomy={'done': Autonomy.Off}, remapping={'data': 'MapPosition'}) # x:493 y:535 OperatableStateMachine.add( 'empty hand', SetRosParam(ParamName="behavior/GripperContent"), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}, remapping={'Value': 'Empty'}) # x:448 y:54 OperatableStateMachine.add( 'cause1', SetKey(Value="I didn't have any object in my gripper"), transitions={'done': 'setrosparamcause'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:422 y:149 OperatableStateMachine.add( 'cause2', SetKey(Value="I didn't know where to place the object."), transitions={'done': 'setrosparamcause'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:575 y:158 OperatableStateMachine.add( 'setrosparamcause', SetRosParam(ParamName="behavior/GPSR/CauseOfFailure"), transitions={'done': 'failed'}, autonomy={'done': Autonomy.Off}, remapping={'Value': 'Key'}) # x:449 y:325 OperatableStateMachine.add( 'cause3', SetKey( Value="I was unable to calculate how to place the object." ), transitions={'done': 'setrosparamcause'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Key'}) # x:342 y:583 OperatableStateMachine.add('idlearm', MoveitMove(move=True, waitForExecution=False, group="RightArm", watchdog=15), transitions={ 'done': 'empty hand', 'failed': 'empty hand' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'IdlePos'}) # x:706 y:460 OperatableStateMachine.add( 'Say_Place_It_This_Place', SaraSay(sentence=lambda x: "I will place this " + x + " right there.", input_keys=[], emotion=0, block=True), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:35 y:301 OperatableStateMachine.add('Say_Place_object', SaraSay(sentence=lambda x: x, input_keys=[], emotion=0, block=True), transitions={'done': 'genPoseArm'}, autonomy={'done': Autonomy.Off}) return _state_machine
def create(self): # x:283 y:267 _state_machine = OperatableStateMachine(outcomes=['Shutdown']) _state_machine.userdata.Command = "no nothing" _state_machine.userdata.End = False # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:887 y:420 _sm_sara_brain_0 = OperatableStateMachine( outcomes=['error'], input_keys=['HighFIFO', 'LowFIFO', 'MedFIFO', 'DoNow', 'End']) with _sm_sara_brain_0: # x:270 y:346 OperatableStateMachine.add( 'sara_command_manager', self.use_behavior( sara_command_managerSM, 'Sara parallel Runtime/Sara brain/sara_command_manager'), transitions={ 'finished': 'if stop', 'failed': 'set end' }, autonomy={ 'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={ 'HighFIFO': 'HighFIFO', 'MedFIFO': 'MedFIFO', 'LowFIFO': 'LowFIFO', 'DoNow': 'DoNow' }) # x:725 y:388 OperatableStateMachine.add( 'set end', CalculationState(calculation=lambda x: True), transitions={'done': 'error'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'End', 'output_value': 'End' }) # x:516 y:448 OperatableStateMachine.add( 'if stop', CheckConditionState(predicate=lambda x: x[0][0] == "Stop"), transitions={ 'true': 'set end', 'false': 'sara_command_manager' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }, remapping={'input_value': 'DoNow'}) # x:841 y:231 _sm_sara_action_executor_1 = OperatableStateMachine( outcomes=['shutdown'], input_keys=['HighFIFO', 'MedFIFO', 'LowFIFO', 'DoNow', 'End']) with _sm_sara_action_executor_1: # x:128 y:134 OperatableStateMachine.add( 'log', LogState(text="Start action executor", severity=Logger.REPORT_HINT), transitions={'done': 'Sara action executor'}, autonomy={'done': Autonomy.Off}) # x:636 y:111 OperatableStateMachine.add( 'Critical failure', LogState(text="Critical fail in action executer!", severity=Logger.REPORT_HINT), transitions={'done': 'shutdown'}, autonomy={'done': Autonomy.Off}) # x:366 y:149 OperatableStateMachine.add( 'Sara action executor', self.use_behavior( SaraactionexecutorSM, 'Sara parallel Runtime/Sara action executor/Sara action executor' ), transitions={ 'CriticalFail': 'Critical failure', 'Shutdown': 'shutdown' }, autonomy={ 'CriticalFail': Autonomy.Inherit, 'Shutdown': Autonomy.Inherit }, remapping={ 'HighFIFO': 'HighFIFO', 'MedFIFO': 'MedFIFO', 'LowFIFO': 'LowFIFO', 'End': 'End' }) # x:30 y:365 _sm_sara_init_2 = OperatableStateMachine(outcomes=['done']) with _sm_sara_init_2: # x:30 y:40 OperatableStateMachine.add('set head', SaraSetHeadAngle(angle=0.1), transitions={'done': 'set face'}, autonomy={'done': Autonomy.Off}) # x:47 y:119 OperatableStateMachine.add('set arm', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'hello', 'failed': 'hello' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'target'}) # x:242 y:288 OperatableStateMachine.add( 'hello', SaraSay( sentence= "Good morning. I am Sara the robot. Please give me orders.", emotion=1, block=True), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:239 y:21 OperatableStateMachine.add('set face', SetExpression(emotion=0, brightness=200), transitions={'done': 'www'}, autonomy={'done': Autonomy.Off}) # x:339 y:116 OperatableStateMachine.add('on face', SetExpression(emotion=1, brightness=-1), transitions={'done': 'setTarget'}, autonomy={'done': Autonomy.Off}) # x:484 y:41 OperatableStateMachine.add('www', WaitState(wait_time=2), transitions={'done': 'on face'}, autonomy={'done': Autonomy.Off}) # x:197 y:113 OperatableStateMachine.add('setTarget', SetKey(Value="IdlePose"), transitions={'done': 'set arm'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'target'}) # x:55 y:366 _sm_create_fifos_3 = OperatableStateMachine( outcomes=['done'], output_keys=['HighFIFO', 'MedFIFO', 'LowFIFO', 'DoNow']) with _sm_create_fifos_3: # x:33 y:40 OperatableStateMachine.add('Create HighFIFO', FIFO_New(), transitions={'done': 'Create MedFIFO'}, autonomy={'done': Autonomy.Off}, remapping={'FIFO': 'HighFIFO'}) # x:30 y:114 OperatableStateMachine.add('Create MedFIFO', FIFO_New(), transitions={'done': 'Create LowFIFO'}, autonomy={'done': Autonomy.Off}, remapping={'FIFO': 'MedFIFO'}) # x:30 y:189 OperatableStateMachine.add('Create LowFIFO', FIFO_New(), transitions={'done': 'Create DoNow'}, autonomy={'done': Autonomy.Off}, remapping={'FIFO': 'LowFIFO'}) # x:34 y:260 OperatableStateMachine.add('Create DoNow', FIFO_New(), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}, remapping={'FIFO': 'DoNow'}) # x:30 y:322 _sm_sara_shutdown_4 = OperatableStateMachine(outcomes=['finished']) with _sm_sara_shutdown_4: # x:57 y:86 OperatableStateMachine.add('log', LogState(text="shutdown", severity=Logger.REPORT_HINT), transitions={'done': 'say'}, autonomy={'done': Autonomy.Off}) # x:122 y:228 OperatableStateMachine.add( 'say', SaraSay(sentence="I'm goint to shutdown for safety reasons", emotion=1, block=True), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:336 y:314, x:315 y:433, x:276 y:271 _sm_sara_parallel_runtime_5 = ConcurrencyContainer( outcomes=['Shutdown'], input_keys=['HighFIFO', 'MedFIFO', 'LowFIFO', 'DoNow', 'End'], conditions=[('Shutdown', [('Sara brain', 'error')]), ('Shutdown', [('Sara action executor', 'shutdown')])]) with _sm_sara_parallel_runtime_5: # x:52 y:416 OperatableStateMachine.add('Sara action executor', _sm_sara_action_executor_1, transitions={'shutdown': 'Shutdown'}, autonomy={'shutdown': Autonomy.Inherit}, remapping={ 'HighFIFO': 'HighFIFO', 'MedFIFO': 'MedFIFO', 'LowFIFO': 'LowFIFO', 'DoNow': 'DoNow', 'End': 'End' }) # x:57 y:333 OperatableStateMachine.add('Sara brain', _sm_sara_brain_0, transitions={'error': 'Shutdown'}, autonomy={'error': Autonomy.Inherit}, remapping={ 'HighFIFO': 'HighFIFO', 'LowFIFO': 'LowFIFO', 'MedFIFO': 'MedFIFO', 'DoNow': 'DoNow', 'End': 'End' }) with _state_machine: # x:43 y:60 OperatableStateMachine.add('log', LogState(text="Start Sara", severity=Logger.REPORT_HINT), transitions={'done': 'low head'}, autonomy={'done': Autonomy.Off}) # x:306 y:365 OperatableStateMachine.add( 'Sara parallel Runtime', _sm_sara_parallel_runtime_5, transitions={'Shutdown': 'Sara shutdown'}, autonomy={'Shutdown': Autonomy.Inherit}, remapping={ 'HighFIFO': 'HighFIFO', 'MedFIFO': 'MedFIFO', 'LowFIFO': 'LowFIFO', 'DoNow': 'DoNow', 'End': 'End' }) # x:315 y:462 OperatableStateMachine.add('Sara shutdown', _sm_sara_shutdown_4, transitions={'finished': 'low head'}, autonomy={'finished': Autonomy.Inherit}) # x:328 y:284 OperatableStateMachine.add( 'Create_FIFOs', _sm_create_fifos_3, transitions={'done': 'Sara parallel Runtime'}, autonomy={'done': Autonomy.Inherit}, remapping={ 'HighFIFO': 'HighFIFO', 'MedFIFO': 'MedFIFO', 'LowFIFO': 'LowFIFO', 'DoNow': 'DoNow' }) # x:150 y:207 OperatableStateMachine.add('listen', GetSpeech(watchdog=10), transitions={ 'done': 'check hello', 'nothing': 'listen', 'fail': 'Shutdown' }, autonomy={ 'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off }, remapping={'words': 'words'}) # x:345 y:195 OperatableStateMachine.add('Sara init', _sm_sara_init_2, transitions={'done': 'Create_FIFOs'}, autonomy={'done': Autonomy.Inherit}) # x:355 y:96 OperatableStateMachine.add( 'check hello', RegexTester( regex= ".*((wake up)|(sarah?)|(shut up)|(hello)(robot)|(hi)|(morning)|(greet)).*" ), transitions={ 'true': 'Sara init', 'false': 'listen' }, autonomy={ 'true': Autonomy.Off, 'false': Autonomy.Off }, remapping={ 'text': 'words', 'result': 'result' }) # x:15 y:220 OperatableStateMachine.add('close face', SetExpression(emotion=0, brightness=20), transitions={'done': 'listen'}, autonomy={'done': Autonomy.Off}) # x:102 y:115 OperatableStateMachine.add('low head', SaraSetHeadAngle(angle=0.8), transitions={'done': 'close face'}, autonomy={'done': Autonomy.Off}) return _state_machine
def create(self): # x:736 y:384, x:79 y:422 _state_machine = OperatableStateMachine( outcomes=['finished', 'failed'], input_keys=['targetPoint']) _state_machine.userdata.targetPoint = 0 # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] with _state_machine: # x:86 y:32 OperatableStateMachine.add( 'gripper', SetGripperState(width=0, effort=1), transitions={ 'object': 'direction', 'no_object': 'direction' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:503 y:276 OperatableStateMachine.add('move', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'finished', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'pose'}) # x:114 y:312 OperatableStateMachine.add( 'invert', CalculationState(calculation=lambda x: -x), transitions={'done': 'point'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'pitch', 'output_value': 'pitch' }) # x:269 y:267 OperatableStateMachine.add('point', point_at_gen_pose(offsetx=0.16, offsety=-0.2, offsetz=1.2, l=0.75), transitions={'pose': 'move'}, autonomy={'pose': Autonomy.Off}, remapping={ 'yaw': 'yaw', 'pitch': 'pitch', 'pose': 'pose' }) # x:99 y:199 OperatableStateMachine.add('print pitch', LogKeyState( text="pitch = {}", severity=Logger.REPORT_HINT), transitions={'done': 'invert'}, autonomy={'done': Autonomy.Off}, remapping={'data': 'pitch'}) # x:235 y:103 OperatableStateMachine.add( 'direction', Get_direction_to_point( frame_origin="base_link", frame_reference="right_upper_arm_upper_link"), transitions={ 'done': 'print pitch', 'fail': 'failed' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'targetPoint': 'targetPoint', 'yaw': 'yaw', 'pitch': 'pitch' }) return _state_machine
def create(self): # x:832 y:260, x:728 y:256 _state_machine = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['ID']) _state_machine.userdata.ID = 0 _state_machine.userdata.Closed_Gripper_Width = 1 _state_machine.userdata.Open_Gripper_Width = 255 _state_machine.userdata.Relative = False _state_machine.userdata.Pose_Init = "IdlePose" _state_machine.userdata.dropPose = "DropBagPose" _state_machine.userdata.EntryDoor = "door1/enter" _state_machine.userdata.ExitDoor = "door1/exit" # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:700 y:231, x:418 y:463 _sm_ecoute_getpose_0 = OperatableStateMachine(outcomes=['arrete', 'fail']) with _sm_ecoute_getpose_0: # x:53 y:35 OperatableStateMachine.add('Ecoute', GetSpeech(watchdog=5), transitions={'done': 'stop', 'nothing': 'Ecoute', 'fail': 'fail'}, autonomy={'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off}, remapping={'words': 'words'}) # x:373 y:215 OperatableStateMachine.add('stop', RegexTester(regex=".*stop.*"), transitions={'true': 'arrete', 'false': 'Ecoute'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'text': 'words', 'result': 'result'}) # x:350 y:105, x:261 y:311 _sm_get_operator_id_1 = OperatableStateMachine(outcomes=['not_found', 'done'], output_keys=['ID']) with _sm_get_operator_id_1: # x:42 y:30 OperatableStateMachine.add('nom', SetKey(Value="person"), transitions={'done': 'FindId'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'name'}) # x:37 y:347 OperatableStateMachine.add('setID', SetRosParam(ParamName="OperatorID"), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}, remapping={'Value': 'ID'}) # x:30 y:112 OperatableStateMachine.add('FindId', list_entities_by_name(frontality_level=0.5, distance_max=10), transitions={'found': 'GetID', 'none_found': 'not_found'}, autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off}, remapping={'name': 'name', 'entity_list': 'Entities_list', 'number': 'number'}) # x:38 y:238 OperatableStateMachine.add('GetID', CalculationState(calculation=lambda x: x[0].ID), transitions={'done': 'setID'}, autonomy={'done': Autonomy.Off}, remapping={'input_value': 'Entities_list', 'output_value': 'ID'}) # x:346 y:367, x:610 y:472, x:230 y:365, x:628 y:425, x:619 y:318, x:54 y:367 _sm_follow_2 = ConcurrencyContainer(outcomes=['done', 'failed', 'not_found'], input_keys=['ID', 'distance'], output_keys=['Position'], conditions=[ ('not_found', [('Action_follow', 'failed')]), ('done', [('Ecoute_getPose', 'arrete')]), ('failed', [('Ecoute_getPose', 'fail')]) ]) with _sm_follow_2: # x:107 y:103 OperatableStateMachine.add('Action_follow', self.use_behavior(sara_flexbe_behaviors__Action_followSM, 'Getting ID Operator and follow /Follow/Action_follow'), transitions={'failed': 'not_found'}, autonomy={'failed': Autonomy.Inherit}, remapping={'ID': 'ID'}) # x:294 y:146 OperatableStateMachine.add('Ecoute_getPose', _sm_ecoute_getpose_0, transitions={'arrete': 'done', 'fail': 'failed'}, autonomy={'arrete': Autonomy.Inherit, 'fail': Autonomy.Inherit}) # x:57 y:371, x:419 y:55 _sm_waiting_for_operator_3 = OperatableStateMachine(outcomes=['done', 'failed']) with _sm_waiting_for_operator_3: # x:57 y:67 OperatableStateMachine.add('getSpeech', GetSpeech(watchdog=15), transitions={'done': 'UnderstandingOpe', 'nothing': 'failed', 'fail': 'failed'}, autonomy={'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off}, remapping={'words': 'words'}) # x:53 y:249 OperatableStateMachine.add('start', SaraSay(sentence="I will follow you. Tell me when to stop.", input_keys=[], emotion=1, block=True), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:203 y:180 OperatableStateMachine.add('UnderstandingOpe', RegexTester(regex=".*follow.*"), transitions={'true': 'start', 'false': 'failed'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'text': 'words', 'result': 'result'}) # x:130 y:365 _sm_look_at_4 = OperatableStateMachine(outcomes=['failed']) with _sm_look_at_4: # x:105 y:160 OperatableStateMachine.add('LookAtClosest', self.use_behavior(sara_flexbe_behaviors__LookAtClosestSM, 'Recevoir sac/Look at/LookAtClosest'), transitions={'failed': 'failed'}, autonomy={'failed': Autonomy.Inherit}) # x:280 y:296, x:248 y:549 _sm_receive_bag_5 = OperatableStateMachine(outcomes=['failed', 'done'], input_keys=['Closed_Gripper_Width', 'Open_Gripper_Width']) with _sm_receive_bag_5: # x:42 y:326 OperatableStateMachine.add('PutBAg', SaraSay(sentence="Please put the grocery bag in my hand", input_keys=[], emotion=1, block=False), transitions={'done': 'Action_Receive_Bag'}, autonomy={'done': Autonomy.Off}) # x:18 y:427 OperatableStateMachine.add('Action_Receive_Bag', self.use_behavior(sara_flexbe_behaviors__Action_Receive_BagSM, 'Recevoir sac/Receive bag/Action_Receive_Bag'), transitions={'finished': 'bringit', 'failed': 'failed'}, autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'Closed_Gripper_Width': 'Closed_Gripper_Width', 'Open_Gripper_Width': 'Open_Gripper_Width', 'Closed_Gripper_Width': 'Closed_Gripper_Width'}) # x:66 y:125 OperatableStateMachine.add('getspeech2', GetSpeech(watchdog=5), transitions={'done': 'takebag', 'nothing': 'getspeech2', 'fail': 'failed'}, autonomy={'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off}, remapping={'words': 'words'}) # x:64 y:218 OperatableStateMachine.add('takebag', RegexTester(regex=".*((take)|(bag)|(ready)).*"), transitions={'true': 'PutBAg', 'false': 'getspeech2'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'text': 'words', 'result': 'result'}) # x:42 y:531 OperatableStateMachine.add('bringit', SaraSay(sentence="I will bring it inside", input_keys=[], emotion=1, block=True), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:77 y:40 OperatableStateMachine.add('sac', SaraSay(sentence="Ok. Tell me, when you are ready", input_keys=[], emotion=1, block=True), transitions={'done': 'getspeech2'}, autonomy={'done': Autonomy.Off}) # x:147 y:579 _sm_look_at_closest_6 = OperatableStateMachine(outcomes=['failed'], output_keys=['Entity']) with _sm_look_at_closest_6: # x:40 y:39 OperatableStateMachine.add('set person', SetKey(Value="person"), transitions={'done': 'head angle'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'Person'}) # x:36 y:119 OperatableStateMachine.add('head angle', SaraSetHeadAngle(pitch=-0.3, yaw=0), transitions={'done': 'get persons'}, autonomy={'done': Autonomy.Off}) # x:271 y:149 OperatableStateMachine.add('get persons', list_entities_by_name(frontality_level=0.5, distance_max=2), transitions={'found': 'set person', 'none_found': 'get persons'}, autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off}, remapping={'name': 'Person', 'entity_list': 'entity_list', 'number': 'number'}) # x:30 y:365 _sm_get_op_7 = OperatableStateMachine(outcomes=['true']) with _sm_get_op_7: # x:76 y:40 OperatableStateMachine.add('Say Joke', SaraSay(sentence="Can someone come help me, I only have one arm.", input_keys=[], emotion=1, block=True), transitions={'done': 'ecouteNewPerson'}, autonomy={'done': Autonomy.Off}) # x:208 y:255 OperatableStateMachine.add('listen', RegexTester(regex=".*((i)|(come)|(help)).*"), transitions={'true': 'true', 'false': 'ecouteNewPerson'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}, remapping={'text': 'words', 'result': 'result'}) # x:32 y:106 OperatableStateMachine.add('ecouteNewPerson', GetSpeech(watchdog=5), transitions={'done': 'listen', 'nothing': 'ecouteNewPerson', 'fail': 'ecouteNewPerson'}, autonomy={'done': Autonomy.Off, 'nothing': Autonomy.Off, 'fail': Autonomy.Off}, remapping={'words': 'words'}) # x:65 y:357, x:130 y:365, x:230 y:365 _sm_get_ope_8 = ConcurrencyContainer(outcomes=['true'], output_keys=['Entity'], conditions=[ ('true', [('get op', 'true')]), ('true', [('look at closest', 'failed')]) ]) with _sm_get_ope_8: # x:37 y:35 OperatableStateMachine.add('get op', _sm_get_op_7, transitions={'true': 'true'}, autonomy={'true': Autonomy.Inherit}) # x:238 y:109 OperatableStateMachine.add('look at closest', _sm_look_at_closest_6, transitions={'failed': 'true'}, autonomy={'failed': Autonomy.Inherit}, remapping={'Entity': 'Entity'}) # x:37 y:417, x:236 y:263 _sm_init_sara_9 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['Pose_Init'], output_keys=['Origin']) with _sm_init_sara_9: # x:30 y:40 OperatableStateMachine.add('get_pose', Get_Robot_Pose(), transitions={'done': 'SETHEAD'}, autonomy={'done': Autonomy.Off}, remapping={'pose': 'Origin'}) # x:24 y:259 OperatableStateMachine.add('Init Arm', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={'done': 'done', 'failed': 'failed'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'target': 'Pose_Init'}) # x:23 y:183 OperatableStateMachine.add('SETHEAD', SaraSetHeadAngle(pitch=0, yaw=0), transitions={'done': 'Init Arm'}, autonomy={'done': Autonomy.Off}) # x:92 y:291, x:242 y:133 _sm_exitarena_10 = OperatableStateMachine(outcomes=['finished', 'failed'], input_keys=['ExitDoor']) with _sm_exitarena_10: # x:38 y:119 OperatableStateMachine.add('Action_Pass_Door', self.use_behavior(sara_flexbe_behaviors__Action_Pass_DoorSM, 'ExitArena/Action_Pass_Door'), transitions={'Done': 'finished', 'Fail': 'failed'}, autonomy={'Done': Autonomy.Inherit, 'Fail': Autonomy.Inherit}, remapping={'DoorName': 'ExitDoor'}) # x:353 y:529, x:369 y:296 _sm_enter_arena_11 = OperatableStateMachine(outcomes=['done', 'fail'], input_keys=['EntryDoor']) with _sm_enter_arena_11: # x:132 y:147 OperatableStateMachine.add('Action_Pass_Door', self.use_behavior(sara_flexbe_behaviors__Action_Pass_DoorSM, 'Enter arena/Action_Pass_Door'), transitions={'Done': 'say start', 'Fail': 'fail'}, autonomy={'Done': Autonomy.Inherit, 'Fail': Autonomy.Inherit}, remapping={'DoorName': 'EntryDoor'}) # x:124 y:501 OperatableStateMachine.add('say help', SaraSay(sentence="Hi, i will help you carry some bags. LEt me know when you need me", input_keys=[], emotion=1, block=True), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:146 y:256 OperatableStateMachine.add('say start', SaraSay(sentence="", input_keys=[], emotion=1, block=True), transitions={'done': 'Action_Move'}, autonomy={'done': Autonomy.Off}) # x:121 y:375 OperatableStateMachine.add('Action_Move', self.use_behavior(sara_flexbe_behaviors__Action_MoveSM, 'Enter arena/Action_Move'), transitions={'finished': 'say help', 'failed': 'fail'}, autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'pose': 'EntryDoor'}) # x:372 y:428, x:389 y:477 _sm_getting_id_operator_and_follow__12 = OperatableStateMachine(outcomes=['failed', 'done'], output_keys=['Position']) with _sm_getting_id_operator_and_follow__12: # x:70 y:115 OperatableStateMachine.add('Waiting for operator', _sm_waiting_for_operator_3, transitions={'done': 'Get operator ID', 'failed': 'Waiting for operator'}, autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit}) # x:71 y:504 OperatableStateMachine.add('get pose', Get_Robot_Pose(), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}, remapping={'pose': 'Position'}) # x:69 y:415 OperatableStateMachine.add('Follow', _sm_follow_2, transitions={'done': 'get pose', 'failed': 'failed', 'not_found': 'initial'}, autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'not_found': Autonomy.Inherit}, remapping={'ID': 'ID', 'distance': 'distance', 'Position': 'Position'}) # x:60 y:222 OperatableStateMachine.add('Get operator ID', _sm_get_operator_id_1, transitions={'not_found': 'Get operator ID', 'done': 'set follow distance'}, autonomy={'not_found': Autonomy.Inherit, 'done': Autonomy.Inherit}, remapping={'ID': 'ID'}) # x:60 y:324 OperatableStateMachine.add('set follow distance', SetKey(Value="0.5"), transitions={'done': 'Follow'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'distance'}) # x:286 y:327 OperatableStateMachine.add('initial', SaraSetHeadAngle(pitch=0, yaw=0), transitions={'done': 'Get operator ID'}, autonomy={'done': Autonomy.Off}) # x:247 y:123, x:282 y:200, x:230 y:365 _sm_drop_le_sac_13 = OperatableStateMachine(outcomes=['failed', 'no_object', 'done'], input_keys=['Idle', 'dropPose']) with _sm_drop_le_sac_13: # x:22 y:114 OperatableStateMachine.add('dropbag', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={'done': 'Open', 'failed': 'failed'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'target': 'dropPose'}) # x:5 y:344 OperatableStateMachine.add('close', SetGripperState(width=0, effort=1), transitions={'object': 'returnIdl', 'no_object': 'returnIdl'}, autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off}, remapping={'object_size': 'object_size'}) # x:19 y:268 OperatableStateMachine.add('wait', WaitState(wait_time=2), transitions={'done': 'close'}, autonomy={'done': Autonomy.Off}) # x:8 y:433 OperatableStateMachine.add('returnIdl', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={'done': 'done', 'failed': 'failed'}, autonomy={'done': Autonomy.Off, 'failed': Autonomy.Off}, remapping={'target': 'Idle'}) # x:10 y:190 OperatableStateMachine.add('Open', SetGripperState(width=0.1, effort=1), transitions={'object': 'wait', 'no_object': 'no_object'}, autonomy={'object': Autonomy.Off, 'no_object': Autonomy.Off}, remapping={'object_size': 'object_size'}) # x:555 y:54, x:568 y:190 _sm_retour_maison_14 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['PoseOrigin', 'Relative']) with _sm_retour_maison_14: # x:54 y:63 OperatableStateMachine.add('keydistance', SetKey(Value=0), transitions={'done': 'adapt the end pose'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'distance'}) # x:258 y:51 OperatableStateMachine.add('Arrived', SaraSay(sentence="I have food, people. I will drop the bags on the floor.", input_keys=[], emotion=1, block=True), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:43 y:141 OperatableStateMachine.add('adapt the end pose', Get_Reacheable_Waypoint(), transitions={'done': 'Action_Move'}, autonomy={'done': Autonomy.Off}, remapping={'pose_in': 'PoseOrigin', 'distance': 'distance', 'pose_out': 'pose_out'}) # x:236 y:182 OperatableStateMachine.add('Action_Move', self.use_behavior(sara_flexbe_behaviors__Action_MoveSM, 'Retour maison/Action_Move'), transitions={'finished': 'Arrived', 'failed': 'failed'}, autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'pose': 'pose_out'}) # x:30 y:365, x:130 y:365, x:230 y:365, x:330 y:365, x:430 y:365 _sm_recevoir_sac_15 = ConcurrencyContainer(outcomes=['failed', 'done'], input_keys=['Closed_Gripper_Width', 'Open_Gripper_Width'], conditions=[ ('failed', [('Receive bag', 'failed')]), ('done', [('Receive bag', 'done')]), ('failed', [('Look at', 'failed')]) ]) with _sm_recevoir_sac_15: # x:84 y:156 OperatableStateMachine.add('Receive bag', _sm_receive_bag_5, transitions={'failed': 'failed', 'done': 'done'}, autonomy={'failed': Autonomy.Inherit, 'done': Autonomy.Inherit}, remapping={'Closed_Gripper_Width': 'Closed_Gripper_Width', 'Open_Gripper_Width': 'Open_Gripper_Width'}) # x:262 y:154 OperatableStateMachine.add('Look at', _sm_look_at_4, transitions={'failed': 'failed'}, autonomy={'failed': Autonomy.Inherit}) # x:728 y:533, x:722 y:468 _sm_getnewperson_16 = OperatableStateMachine(outcomes=['done', 'failed'], input_keys=['Position']) with _sm_getnewperson_16: # x:52 y:77 OperatableStateMachine.add('Get ope', _sm_get_ope_8, transitions={'true': 'set name'}, autonomy={'true': Autonomy.Inherit}, remapping={'Entity': 'Entity'}) # x:46 y:508 OperatableStateMachine.add('SET HEAD', SaraSetHeadAngle(pitch=-0.2, yaw=0), transitions={'done': 'Action_Guide2'}, autonomy={'done': Autonomy.Off}) # x:39 y:297 OperatableStateMachine.add('list', list_entities_by_name(frontality_level=0.5, distance_max=2), transitions={'found': 'get closest ID', 'none_found': 'list'}, autonomy={'found': Autonomy.Off, 'none_found': Autonomy.Off}, remapping={'name': 'name', 'entity_list': 'entity_list', 'number': 'number'}) # x:70 y:194 OperatableStateMachine.add('set name', SetKey(Value="person"), transitions={'done': 'list'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'name'}) # x:151 y:413 OperatableStateMachine.add('get closest ID', CalculationState(calculation=lambda x: x[0].ID), transitions={'done': 'SET HEAD'}, autonomy={'done': Autonomy.Off}, remapping={'input_value': 'entity_list', 'output_value': 'ID'}) # x:293 y:534 OperatableStateMachine.add('Action_Guide2', self.use_behavior(sara_flexbe_behaviors__Action_Guide2SM, 'GetNewPerson/Action_Guide2'), transitions={'finished': 'done', 'failed': 'failed', 'critical_fail': 'failed'}, autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'critical_fail': Autonomy.Inherit}, remapping={'Position': 'Position', 'ID': 'ID'}) # x:57 y:399 OperatableStateMachine.add('set 0', SetKey(Value=0), transitions={'done': 'SET HEAD'}, autonomy={'done': Autonomy.Off}, remapping={'Key': 'ID'}) with _state_machine: # x:188 y:35 OperatableStateMachine.add('say ready', SaraSay(sentence="I'm ready for the help me carry scenario. I will follow when you ask me.", input_keys=[], emotion=1, block=True), transitions={'done': 'INIT SARA'}, autonomy={'done': Autonomy.Off}) # x:827 y:439 OperatableStateMachine.add('finish', SaraSay(sentence="I am done for the day", input_keys=[], emotion=2, block=True), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}) # x:53 y:641 OperatableStateMachine.add('GetNewPerson', _sm_getnewperson_16, transitions={'done': 'say leave', 'failed': 'failed'}, autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'Position': 'Position'}) # x:48 y:349 OperatableStateMachine.add('Recevoir sac', _sm_recevoir_sac_15, transitions={'failed': 'failed', 'done': 'Retour maison'}, autonomy={'failed': Autonomy.Inherit, 'done': Autonomy.Inherit}, remapping={'Closed_Gripper_Width': 'Closed_Gripper_Width', 'Open_Gripper_Width': 'Open_Gripper_Width'}) # x:36 y:448 OperatableStateMachine.add('Retour maison', _sm_retour_maison_14, transitions={'done': 'drop le sac', 'failed': 'failed'}, autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'PoseOrigin': 'Origin', 'Relative': 'Relative'}) # x:49 y:556 OperatableStateMachine.add('drop le sac', _sm_drop_le_sac_13, transitions={'failed': 'failed', 'no_object': 'failed', 'done': 'GetNewPerson'}, autonomy={'failed': Autonomy.Inherit, 'no_object': Autonomy.Inherit, 'done': Autonomy.Inherit}, remapping={'Idle': 'Pose_Init', 'dropPose': 'dropPose'}) # x:150 y:260 OperatableStateMachine.add('Getting ID Operator and follow ', _sm_getting_id_operator_and_follow__12, transitions={'failed': 'failed', 'done': 'Recevoir sac'}, autonomy={'failed': Autonomy.Inherit, 'done': Autonomy.Inherit}, remapping={'Position': 'Position'}) # x:148 y:177 OperatableStateMachine.add('Enter arena', _sm_enter_arena_11, transitions={'done': 'Getting ID Operator and follow ', 'fail': 'failed'}, autonomy={'done': Autonomy.Inherit, 'fail': Autonomy.Inherit}, remapping={'EntryDoor': 'EntryDoor'}) # x:498 y:617 OperatableStateMachine.add('ExitArena', _sm_exitarena_10, transitions={'finished': 'finish', 'failed': 'failed'}, autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'ExitDoor': 'ExitDoor'}) # x:389 y:14 OperatableStateMachine.add('ContinueButton', ContinueButton(), transitions={'true': 'say ready', 'false': 'say ready'}, autonomy={'true': Autonomy.Off, 'false': Autonomy.Off}) # x:329 y:645 OperatableStateMachine.add('say leave', SaraSay(sentence="I will leave now. Goodbye", input_keys=[], emotion=1, block=True), transitions={'done': 'ExitArena'}, autonomy={'done': Autonomy.Off}) # x:319 y:101 OperatableStateMachine.add('wait1', WaitState(wait_time=5), transitions={'done': 'say ready'}, autonomy={'done': Autonomy.Off}) # x:35 y:78 OperatableStateMachine.add('INIT SARA', _sm_init_sara_9, transitions={'done': 'Getting ID Operator and follow ', 'failed': 'failed'}, autonomy={'done': Autonomy.Inherit, 'failed': Autonomy.Inherit}, remapping={'Pose_Init': 'Pose_Init', 'Origin': 'Origin'}) return _state_machine
def create(self): # x:831 y:173, x:520 y:222, x:335 y:32, x:701 y:385 _state_machine = OperatableStateMachine( outcomes=['success', 'unreachable', 'not found', 'dropped'], input_keys=['objectID', 'Entity']) _state_machine.userdata.objectID = 1585 _state_machine.userdata.PreGripPose = "PreGripPose" _state_machine.userdata.PostGripPose = "PostGripPose" _state_machine.userdata.Entity = 0 # Additional creation code can be added inside the following tags # [MANUAL_CREATE] # [/MANUAL_CREATE] # x:30 y:365, x:130 y:365, x:230 y:365 _sm_look_at_it_for_3s_0 = ConcurrencyContainer( outcomes=['done'], input_keys=['ID'], conditions=[('done', [('look', 'failed')]), ('done', [('wait', 'done')])]) with _sm_look_at_it_for_3s_0: # x:30 y:54 OperatableStateMachine.add('look', KeepLookingAt(), transitions={'failed': 'done'}, autonomy={'failed': Autonomy.Off}, remapping={'ID': 'ID'}) # x:187 y:111 OperatableStateMachine.add('wait', WaitState(wait_time=3), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:30 y:324 _sm_getting_close_1 = OperatableStateMachine(outcomes=['done'], input_keys=['pose_app']) with _sm_getting_close_1: # x:36 y:40 OperatableStateMachine.add( 'gripperopen', SetGripperState(width=0.15, effort=1), transitions={ 'object': 'move_approach', 'no_object': 'move_approach' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:30 y:129 OperatableStateMachine.add('move_approach', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'almost have it', 'failed': 'almost have it' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'pose_app'}) # x:39 y:204 OperatableStateMachine.add('almost have it', SaraSay(sentence="I am close", input_keys=[], emotion=1, block=True), transitions={'done': 'done'}, autonomy={'done': Autonomy.Off}) # x:30 y:324, x:130 y:324 _sm_get_away_from_failure_2 = OperatableStateMachine( outcomes=['done', 'failed'], input_keys=['PostGripPose']) with _sm_get_away_from_failure_2: # x:30 y:40 OperatableStateMachine.add( 'open 2', SetGripperState(width=0.1, effort=1), transitions={ 'object': 'move back', 'no_object': 'move back' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:235 y:50 OperatableStateMachine.add('move back', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'done', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'PostGripPose'}) # x:30 y:324, x:130 y:324 _sm_lift_object_3 = OperatableStateMachine( outcomes=['done', 'failed'], input_keys=['pose_lift', 'pose_ret']) with _sm_lift_object_3: # x:30 y:176 OperatableStateMachine.add('move_lift_object', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'genpose', 'failed': 'genpose' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'pose_lift'}) # x:228 y:176 OperatableStateMachine.add('move_Return', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'done', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'pose_ret'}) # x:38 y:45 OperatableStateMachine.add('genpose', GenPoseEuler(x=-0.2, y=0, z=0, roll=0, pitch=0, yaw=0), transitions={'done': 'move_back'}, autonomy={'done': Autonomy.Off}, remapping={'pose': 'backPose'}) # x:211 y:40 OperatableStateMachine.add('move_back', SaraMoveBase(reference="base_link"), transitions={ 'arrived': 'move_Return', 'failed': 'move_Return' }, autonomy={ 'arrived': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'pose': 'backPose'}) # x:499 y:227, x:263 y:214, x:271 y:492 _sm_pregrip_4 = OperatableStateMachine( outcomes=['fail', 'failed', 'done'], input_keys=['PreGripPose', 'posobjet'], output_keys=['pose_app', 'grippose', 'pose_lift', 'pose_ret']) with _sm_pregrip_4: # x:70 y:40 OperatableStateMachine.add('gen_gripPose', GenGripperPose(l=0.0, z=0, planar=True), transitions={ 'done': 'checkifposeaccess', 'fail': 'fail' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'posobjet', 'pose_out': 'grippose' }) # x:56 y:256 OperatableStateMachine.add('move_PreGrip', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'gen_returnPose', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'PreGripPose'}) # x:30 y:398 OperatableStateMachine.add('gen_approachPose', GenGripperPose(l=0.15, z=0, planar=True), transitions={ 'done': 'gen_liftPose', 'fail': 'fail' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'posobjet', 'pose_out': 'pose_app' }) # x:40 y:469 OperatableStateMachine.add('gen_liftPose', GenGripperPose(l=0, z=0.1, planar=True), transitions={ 'done': 'done', 'fail': 'fail' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'posobjet', 'pose_out': 'pose_lift' }) # x:43 y:326 OperatableStateMachine.add('gen_returnPose', GenGripperPose(l=0.2, z=0.1, planar=True), transitions={ 'done': 'gen_approachPose', 'fail': 'fail' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'pose_in': 'posobjet', 'pose_out': 'pose_ret' }) # x:63 y:184 OperatableStateMachine.add('say can reach', SaraSay(sentence="I will grab it", input_keys=[], emotion=1, block=False), transitions={'done': 'move_PreGrip'}, autonomy={'done': Autonomy.Off}) # x:58 y:114 OperatableStateMachine.add('checkifposeaccess', MoveitMove(move=False, waitForExecution=True, group="RightArm"), transitions={ 'done': 'say can reach', 'failed': 'failed' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'grippose'}) # x:315 y:40, x:130 y:465 _sm_get_object_5 = OperatableStateMachine( outcomes=['not_found', 'finished'], input_keys=['objectID'], output_keys=['posobjet']) with _sm_get_object_5: # x:55 y:40 OperatableStateMachine.add('getobject', GetEntityByID(), transitions={ 'found': 'Say_See_It', 'not_found': 'not_found' }, autonomy={ 'found': Autonomy.Off, 'not_found': Autonomy.Off }, remapping={ 'ID': 'objectID', 'Entity': 'Entity' }) # x:77 y:370 OperatableStateMachine.add( 'getpose', CalculationState(calculation=lambda x: x.position), transitions={'done': 'finished'}, autonomy={'done': Autonomy.Off}, remapping={ 'input_value': 'Entity', 'output_value': 'posobjet' }) # x:71 y:262 OperatableStateMachine.add('Look at it for 3s', _sm_look_at_it_for_3s_0, transitions={'done': 'getpose'}, autonomy={'done': Autonomy.Inherit}, remapping={'ID': 'objectID'}) # x:31 y:133 OperatableStateMachine.add( 'Say_See_It', SaraSay(sentence=lambda x: "I see the " + x.name, input_keys=["Entity"], emotion=0, block=True), transitions={'done': 'Look at it for 3s'}, autonomy={'done': Autonomy.Off}, remapping={'Entity': 'Entity'}) with _state_machine: # x:77 y:23 OperatableStateMachine.add('Get object', _sm_get_object_5, transitions={ 'not_found': 'not found', 'finished': 'transform point' }, autonomy={ 'not_found': Autonomy.Inherit, 'finished': Autonomy.Inherit }, remapping={ 'objectID': 'objectID', 'posobjet': 'posobjet' }) # x:258 y:385 OperatableStateMachine.add( 'gripclose', SetGripperState(width=0, effort=250), transitions={ 'object': 'say picked', 'no_object': 'get away from failure' }, autonomy={ 'object': Autonomy.Off, 'no_object': Autonomy.Off }, remapping={'object_size': 'object_size'}) # x:53 y:374 OperatableStateMachine.add('move_on_object', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'gripclose', 'failed': 'cant reach' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'grippose'}) # x:650 y:290 OperatableStateMachine.add('move_PostGrip', MoveitMove(move=True, waitForExecution=True, group="RightArm"), transitions={ 'done': 'welcome', 'failed': 'unreachable' }, autonomy={ 'done': Autonomy.Off, 'failed': Autonomy.Off }, remapping={'target': 'PostGripPose'}) # x:277 y:200 OperatableStateMachine.add('cant reach', SaraSay( sentence="Hum. I can't reach it.", input_keys=[], emotion=1, block=True), transitions={'done': 'unreachable'}, autonomy={'done': Autonomy.Off}) # x:265 y:291 OperatableStateMachine.add('say picked', SaraSay(sentence="I think I got it", input_keys=[], emotion=1, block=False), transitions={'done': 'Lift object'}, autonomy={'done': Autonomy.Off}) # x:837 y:291 OperatableStateMachine.add('welcome', SaraSay(sentence="you are welcome", input_keys=[], emotion=1, block=True), transitions={'done': 'success'}, autonomy={'done': Autonomy.Off}) # x:62 y:190 OperatableStateMachine.add('PreGrip', _sm_pregrip_4, transitions={ 'fail': 'cant reach', 'failed': 'cant reach', 'done': 'Getting close' }, autonomy={ 'fail': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'done': Autonomy.Inherit }, remapping={ 'PreGripPose': 'PreGripPose', 'posobjet': 'posobjet', 'pose_app': 'pose_app', 'grippose': 'grippose', 'pose_lift': 'pose_lift', 'pose_ret': 'pose_ret' }) # x:67 y:114 OperatableStateMachine.add('transform point', TF_transformation(in_ref="map", out_ref="base_link"), transitions={ 'done': 'PreGrip', 'fail': 'Get object' }, autonomy={ 'done': Autonomy.Off, 'fail': Autonomy.Off }, remapping={ 'in_pos': 'posobjet', 'out_pos': 'posobjet' }) # x:439 y:287 OperatableStateMachine.add('Lift object', _sm_lift_object_3, transitions={ 'done': 'move_PostGrip', 'failed': 'move_PostGrip' }, autonomy={ 'done': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={ 'pose_lift': 'pose_lift', 'pose_ret': 'pose_ret' }) # x:441 y:391 OperatableStateMachine.add( 'get away from failure', _sm_get_away_from_failure_2, transitions={ 'done': 'dropped', 'failed': 'dropped' }, autonomy={ 'done': Autonomy.Inherit, 'failed': Autonomy.Inherit }, remapping={'PostGripPose': 'PostGripPose'}) # x:47 y:279 OperatableStateMachine.add('Getting close', _sm_getting_close_1, transitions={'done': 'move_on_object'}, autonomy={'done': Autonomy.Inherit}, remapping={'pose_app': 'pose_app'}) return _state_machine