def __init__(self, server_ip, robot, dialogflow_key_file, dialogflow_agent_id): self.sic = BasicSICConnector(server_ip, robot, dialogflow_key_file, dialogflow_agent_id) self.action_runner = ActionRunner(self.sic) self.user_model = {} self.recognition_manager = {'attempt_success': False, 'attempt_number': 0}
def __init__(self, sic: BasicSICConnector): self.sic = sic self.action_runner = ActionRunner(self.sic) self.machine = Machine(model=self, states=ExampleRobot.states, initial='asleep') self.user_model = {} # Define transitions self.machine.add_transition(trigger='start', source='*', dest='awake', before='wake_up', after='introduce') self.machine.add_transition(trigger='introduce', source='awake', dest='introduced', before='introduction', after='get_acquainted') self.machine.add_transition(trigger='get_acquainted', source='introduced', dest='got_acquainted', before='getting_acquainted', after='say_goodbye') self.machine.add_transition(trigger='say_goodbye', source='got_acquainted', dest='goodbye', before='saying_goodbye', after='rest') self.machine.add_transition(trigger='rest', source='*', dest='asleep', before='stop')
def run(self): self.sic.start() action_runner = ActionRunner(self.sic) action_runner.run_waiting_action('set_language', 'en-US') action_runner.run_vision_listener('people', self.i_spy_with_my_little_eye, False) action_runner.run_waiting_action('say', 'Hello, I see you') action_runner.run_vision_listener('face', self.face_recognition, True) time.sleep(10) self.sic.stop()
def __init__(self, sic: BasicSICConnector): self.sic = sic self.action_runner = ActionRunner(self.sic) self.machine = Machine(model=self, states=ExampleRobot.states, initial='asleep') self.user_model = {} self.recognition_manager = { 'attempt_success': False, 'attempt_number': 0 } # Define transitions self.machine.add_transition(trigger='start', source='asleep', dest='awake', before='wake_up', after='introduce') self.machine.add_transition(trigger='introduce', source='awake', dest='introduced', before='introduction', after='get_name') self.machine.add_transition(trigger='get_name', source='introduced', dest='asked_name', before='ask_name', after='get_acquainted') self.machine.add_transition(trigger='get_acquainted', source='asked_name', dest='got_acquainted', conditions='has_name', before='get_acquainted_with', after='rest') self.machine.add_transition(trigger='get_acquainted', source='asked_name', dest='got_acquainted', unless='has_name', before='get_acquainted_without', after='rest') self.machine.add_transition(trigger='rest', source='*', dest='asleep', before='saying_goodbye')
def __init__(self, server_ip, robot, dialogflow_key_file, dialogflow_agent_id): self.sic = BasicSICConnector(server_ip, robot, dialogflow_key_file, dialogflow_agent_id) self.action_runner = ActionRunner(self.sic) self.user_model = { 'move_number': 1, 'continue_move': False, 'complete_dance': True } self.recognition_manager = { 'attempt_success': False, 'attempt_number': 0 } self.show_questions = [ 'Laten we deze stap samen nog een keer herhalen', 'Kun jij die stap nu doen? Ik doe met je mee', 'Nog een keer, nu doe je mee!', 'Probeer jij die nu samen met mij maar na te doen. ', 'Laten we m samen nog een keer doen', 'Deze stap oefenen we ook nog maar even samen' ] self.repeat_questions = [ 'Dat voelt goed! Wil je deze stap nog een keer zien?', 'We zijn lekker bezig, wil je het nog een keer zien?', 'Voelt goed als je meedoet! Zal ik deze stap nog een keer herhalen?', 'Volgens mij kun jij het wel. Wil je het pasje nog een keer zien?' ] self.continue_phrases = [ 'Oke, door naar de volgende stap! Komt ie', 'Yes, dan gaan we door! Ga ik weer', 'Op naar de volgende stap!', 'Alright, hier komt de volgende stap', 'Oke, door naar de volgende danspas!' ] self.repeat_phrases = [ 'Oke, ik doe m nog een keer voor, daarna mag jij m weer herhalen.', 'Ik ga m nog een keer voor je laten zien, daarna doe jij hem weer na toch?', 'Oke, ik zal de stap opnieuw laten zien, Daarna kan jij m weer oefenen.' ] self.action_runner = ActionRunner(self.sic) self.total_nr_moves = 10
def run(self) -> None: self.sic.start() self.sic.set_language('en-US') action_runner = ActionRunner(self.sic) # This might give an SSL-exception on Pepper's tablet the first time; just click OK on the tablet in that case. action_runner.run_waiting_action( 'tablet_open', additional_callback=self.tablet_open_callback) sleep(1) # FIXME: Pepper needs some extra time for some reason text = self.get_text('Hello, world!') button = self.get_button('Done') html = self.get_header() + self.get_body(text + button) + self.get_footer() action_runner.run_action('tablet_show', html)
def __init__(self, server_ip: str): self.sic = BasicSICConnector(server_ip) self.action_runner = ActionRunner(self.sic) self.motion = None
class Example: def __init__(self, server_ip: str): self.sic = BasicSICConnector(server_ip) self.action_runner = ActionRunner(self.sic) self.motion = None def run(self) -> None: self.sic.start() joints = ['RArm'] self.action_runner.load_waiting_action('set_language', 'en-US') self.action_runner.load_waiting_action('wake_up') self.action_runner.run_loaded_actions() self.action_runner.run_waiting_action('set_stiffness', joints, 0) self.action_runner.load_waiting_action( 'say', 'You can now move my right arm.') self.action_runner.load_waiting_action('start_record_motion', joints) self.action_runner.run_loaded_actions() sleep(5) self.action_runner.load_waiting_action( 'stop_record_motion', additional_callback=self.retrieve_recorded_motion) self.action_runner.load_waiting_action('say', 'Finished recording') self.action_runner.run_loaded_actions() self.action_runner.run_waiting_action('set_stiffness', joints, 100) if self.motion: self.action_runner.run_waiting_action( 'say', 'I will now replay your movement') self.action_runner.run_waiting_action('play_motion', self.motion) else: self.action_runner.run_waiting_action('say', 'Something went wrong.') self.action_runner.run_waiting_action('rest') self.sic.stop() def retrieve_recorded_motion(self, motion) -> None: self.motion = motion
class ExampleRobot(object): """Example that shows how to impelement a State Machine with pyTransitions. For more information go to https://socialrobotics.atlassian.net/wiki/spaces/CBSR/pages/616398873/Python+Examples#State-Machines-with-PyTransitions""" states = ['asleep', 'awake', 'introduced', 'got_acquainted', 'goodbye'] def __init__(self, sic: BasicSICConnector): self.sic = sic self.action_runner = ActionRunner(self.sic) self.machine = Machine(model=self, states=ExampleRobot.states, initial='asleep') self.user_model = {} # Define transitions self.machine.add_transition(trigger='start', source='*', dest='awake', before='wake_up', after='introduce') self.machine.add_transition(trigger='introduce', source='awake', dest='introduced', before='introduction', after='get_acquainted') self.machine.add_transition(trigger='get_acquainted', source='introduced', dest='got_acquainted', before='getting_acquainted', after='say_goodbye') self.machine.add_transition(trigger='say_goodbye', source='got_acquainted', dest='goodbye', before='saying_goodbye', after='rest') self.machine.add_transition(trigger='rest', source='*', dest='asleep', before='stop') def wake_up(self): self.action_runner.load_waiting_action('set_language', 'en-US') self.action_runner.load_waiting_action('wake_up') self.action_runner.run_loaded_actions() def introduction(self): self.action_runner.run_waiting_action( 'say_animated', 'Hi I am Nao and I am a social robot.') def getting_acquainted(self): self.action_runner.run_waiting_action('say_animated', 'What is your name?') self.action_runner.run_waiting_action( 'speech_recognition', 'answer_name', 3, additional_callback=self.on_intent) self.action_runner.run_waiting_action( 'say_animated', 'Nice to meet you ' + self.user_model['name']) def on_intent(self, intent_name, *args): if intent_name == 'answer_name' and len(args) > 0: self.user_model['name'] = args[0] def saying_goodbye(self): self.action_runner.run_waiting_action('say_animated', 'Well this was fun.') self.action_runner.run_waiting_action('say_animated', 'I will see you around.') def stop(self): self.action_runner.run_waiting_action('rest')
def run(self): self.sic.start() self.sic.set_language('en-US') ################# # Action # ################# # Create an action that can be executed when needed and reused hello_action = Action(self.sic.say, 'Hello, Action!', callback=self.hello_action_callback, lock=self.hello_action_lock) hello_action.perform().wait() # perform() returns the lock, so you can immediately call wait() on it. hello_action.perform().wait() # you can reuse an action. ################# # Action Factory# ################# # Use the ActionFactory to build actions. You can build actions with a lock build inside of them by # using build_waiting_action(). It saves you from keeping track of your locks. # build_action() and build_waiting_action() use the name of SIC method instead of an explicit reference to it # as input. For example build_action('say', ...) instead of build_action(self.sic.say, ...). action_factory = ActionFactory(self.sic) hello_action_factory = action_factory.build_waiting_action('say', 'Hello, Action Factory!', additional_callback=self.hello_action_factory_callback) hello_action_factory.perform().wait() ################# # Action Runner # ################# # With an ActionRunner you can run regular and waiting actions right away or load them to run them in parallel. # When running the loaded actions, it will wait automatically for all loaded waiting actions to finish. action_runner = ActionRunner(self.sic) action_runner.run_waiting_action('say', 'Hello, Action Runner!', additional_callback=self.hello_action_runner_callback) # run_waiting_action('say', ...) waits to finish talking before continuing # The following actions will run in parallel. #action_runner.load_waiting_action('wake_up') action_runner.load_waiting_action('set_eye_color', 'green') action_runner.load_waiting_action('say', 'I am standing up now') action_runner.run_loaded_actions() # If you want to keep an action sequence for reuse, add False as input. # run_loaded_actions() will wait automatically before all loaded waiting actions (not regular actions) to finish # before continuing action_runner.run_action('say', 'I will start sitting down as I say this. Because I am not a waiting action') action_runner.run_action('set_eye_color', 'white') action_runner.run_waiting_action('rest') self.sic.stop()
def run(self): self.sic.start() action_runner = ActionRunner(self.sic) action_runner.load_waiting_action('set_language', 'en-US') action_runner.load_waiting_action('wake_up') action_runner.run_loaded_actions() action_runner.run_waiting_action('say', 'Hi I am Nao. What is your name?') action_runner.run_waiting_action('speech_recognition', 'answer_name', 3, additional_callback=self.on_intent) action_runner.run_waiting_action( 'say', 'Nice to meet you ' + self.user_model['name']) action_runner.run_waiting_action('rest') self.sic.stop()
class Example: """Example that uses speech recognition. Prerequisites are the availability of a dialogflow_key_file, a dialogflow_agent_id, and a running Dialogflow service. For help meeting these Prerequisites see https://socialrobotics.atlassian.net/wiki/spaces/CBSR/pages/260276225/The+Social+Interaction+Cloud+Manual""" def __init__(self, server_ip: str, dialogflow_key_file: str, dialogflow_agent_id: str): self.sic = BasicSICConnector(server_ip, 'en-US', dialogflow_key_file, dialogflow_agent_id) self.action_runner = ActionRunner(self.sic) self.user_model = {} self.recognition_manager = { 'attempt_success': False, 'attempt_number': 0 } def run(self) -> None: self.sic.start() self.action_runner.load_waiting_action('set_language', 'en-US') self.action_runner.load_waiting_action('wake_up') self.action_runner.run_loaded_actions() while not self.recognition_manager[ 'attempt_success'] and self.recognition_manager[ 'attempt_number'] < 2: self.action_runner.run_waiting_action( 'say', 'Hi I am Nao. What is your name?') self.action_runner.run_waiting_action( 'speech_recognition', 'answer_name', 3, additional_callback=self.on_intent) self.reset_recognition_management() if 'name' in self.user_model: self.action_runner.run_waiting_action( 'say', 'Nice to meet you ' + self.user_model['name']) else: self.action_runner.run_waiting_action('say', 'Nice to meet you') self.action_runner.run_waiting_action('rest') self.sic.stop() def on_intent(self, detection_result: DetectionResult) -> None: if detection_result and detection_result.intent == 'answer_name' and len( detection_result.parameters) > 0: self.user_model['name'] = detection_result.parameters[ 'name'].struct_value['name'] self.recognition_manager['attempt_success'] = True else: self.recognition_manager['attempt_number'] += 1 def reset_recognition_management(self) -> None: self.recognition_manager.update({ 'attempt_success': False, 'attempt_number': 0 })
class Main: def __init__(self, server_ip, robot, dialogflow_key_file, dialogflow_agent_id): self.sic = BasicSICConnector(server_ip, robot, dialogflow_key_file, dialogflow_agent_id) self.action_runner = ActionRunner(self.sic) self.user_model = { 'move_number': 1, 'continue_move': False, 'complete_dance': True } self.recognition_manager = { 'attempt_success': False, 'attempt_number': 0 } self.show_questions = [ 'Laten we deze stap samen nog een keer herhalen', 'Kun jij die stap nu doen? Ik doe met je mee', 'Nog een keer, nu doe je mee!', 'Probeer jij die nu samen met mij maar na te doen. ', 'Laten we m samen nog een keer doen', 'Deze stap oefenen we ook nog maar even samen' ] self.repeat_questions = [ 'Dat voelt goed! Wil je deze stap nog een keer zien?', 'We zijn lekker bezig, wil je het nog een keer zien?', 'Voelt goed als je meedoet! Zal ik deze stap nog een keer herhalen?', 'Volgens mij kun jij het wel. Wil je het pasje nog een keer zien?' ] self.continue_phrases = [ 'Oke, door naar de volgende stap! Komt ie', 'Yes, dan gaan we door! Ga ik weer', 'Op naar de volgende stap!', 'Alright, hier komt de volgende stap', 'Oke, door naar de volgende danspas!' ] self.repeat_phrases = [ 'Oke, ik doe m nog een keer voor, daarna mag jij m weer herhalen.', 'Ik ga m nog een keer voor je laten zien, daarna doe jij hem weer na toch?', 'Oke, ik zal de stap opnieuw laten zien, Daarna kan jij m weer oefenen.' ] self.action_runner = ActionRunner(self.sic) self.total_nr_moves = 10 def run(self): self.sic.start() self.action_runner.load_waiting_action('set_language', 'nl-NL') self.action_runner.load_waiting_action('wake_up') self.action_runner.run_loaded_actions() while not self.recognition_manager[ 'attempt_success'] and self.recognition_manager[ 'attempt_number'] < 2: self.action_runner.run_waiting_action( 'say', 'Hoi Ik ben Nao. Hoe heet jij?') self.action_runner.run_waiting_action( 'speech_recognition', 'answer_name', 3, additional_callback=self.on_name) self.reset_recognition_management() if 'name' in self.user_model: self.action_runner.run_waiting_action( 'say', 'Leuk je te ontmoeten' + self.user_model['name']) else: self.action_runner.run_waiting_action('say', 'Leuk je te ontmoeten!') while not self.recognition_manager[ 'attempt_success'] and self.recognition_manager[ 'attempt_number'] < 2: self.action_runner.run_waiting_action( 'say', 'Heb je zin om een dans spel te spelen?') self.action_runner.run_waiting_action( 'speech_recognition', 'answer_yesno', 3, additional_callback=self.on_play_game) self.reset_recognition_management() if self.user_model['play_game']: self.start_game() else: self.stop_game() self.action_runner.run_waiting_action('rest') self.sic.stop() def on_name(self, intent_name, *args): if intent_name == 'answer_name' and len(args) > 0: self.user_model['name'] = args[0] self.recognition_manager['attempt_success'] = True elif intent_name == 'fail': self.recognition_manager['attempt_number'] += 1 def on_play_game(self, intent_name, *args): if intent_name == 'answer_yes': self.user_model['play_game'] = True self.recognition_manager['attempt_success'] = True elif intent_name == 'answer_no': self.user_model['play_game'] = False self.recognition_manager['attempt_success'] = True elif intent_name == 'fail': self.user_model['play_game'] = True self.recognition_manager['attempt_number'] += 1 def on_continue_move(self, intent_name, *args): if intent_name == 'answer_yes': self.user_model['continue_move'] = False self.recognition_manager['attempt_success'] = True elif intent_name == 'answer_no': self.user_model['continue_move'] = True self.recognition_manager['attempt_success'] = True elif intent_name == 'fail': self.user_model['continue_move'] = True self.recognition_manager['attempt_number'] += 1 def on_complete_dance(self, intent_name, *args): if intent_name == 'answer_yes': self.user_model['complete_dance'] = True self.recognition_manager['attempt_success'] = True elif intent_name == 'answer_no': self.user_model['complete_dance'] = False self.recognition_manager['attempt_success'] = True elif intent_name == 'fail': self.user_model['complete_dance'] = False self.recognition_manager['attempt_number'] += 1 def reset_recognition_management(self): self.recognition_manager.update({ 'attempt_success': False, 'attempt_number': 0 }) def start_game(self): if 'name' in self.user_model: self.action_runner.run_waiting_action( 'say', 'Top, laten we beginnen dan, ' + self.user_model['name']) else: self.action_runner.run_waiting_action( 'say', 'Top, laten we beginnen dan!') self.action_runner.run_waiting_action( 'say', 'Ik ga je een dans leren, aan het einde kunnen we die samen optreden!' ) self.teach_dance() def teach_dance(self): self.action_runner.run_waiting_action( 'say', 'Oke, ik zal beginnen met je de hele dans te laten zien. Daarna leer ik je stap voor stap de pasjes.' ) self.action_runner.run_waiting_action('do_gesture', 'dances/behavior_1') self.action_runner.run_waiting_action( 'say', 'Dat was de complete dans, laten we beginnen met stap 1!') self.action_runner.run_waiting_action( 'say', 'Ik start altijd met een openings move, daarna begint de rest van de dans. Deze gaat zo ' ) self.action_runner.run_waiting_action('do_gesture', 'dances/openingMove') self.action_runner.run_waiting_action( 'say', 'Heb je m? Dan gaan we nu door naar de rest van de dans. Hier komt stap 1.' ) while self.user_model['move_number'] < self.total_nr_moves: self.action_runner.run_waiting_action( 'do_gesture', 'dances/Move' + str(self.user_model['move_number'])) self.action_runner.run_waiting_action('go_to_posture', BasicNaoPosture.STAND) self.action_runner.run_waiting_action( 'say', random.choice(self.show_questions)) self.action_runner.run_waiting_action( 'do_gesture', 'dances/Move' + str(self.user_model['move_number'])) self.action_runner.run_waiting_action( 'say', random.choice(self.repeat_questions)) self.action_runner.run_waiting_action( 'speech_recognition', 'answer_yesno', 3, additional_callback=self.on_continue_move) if self.user_model['continue_move'] == True: self.user_model['move_number'] += 1 if not self.user_model['move_number'] == self.total_nr_moves: self.action_runner.run_waiting_action( 'say', random.choice(self.continue_phrases)) if self.user_model['continue_move'] == False: self.action_runner.run_waiting_action( 'say', random.choice(self.repeat_phrases)) self.action_runner.run_waiting_action( 'say', 'Dat waren ze bijna allemaal. Maar een dans is een performance, dus je eindigt natuurlijk met een buiging' ) self.action_runner.run_waiting_action('do_gesture', 'dances/TakeABow') self.action_runner.run_waiting_action( 'say', 'Nu is ie echt compleet. Laten we de hele dans samen uitvoeren. 1 2 3 4 5 6 7 8' ) while self.user_model['complete_dance'] == True: self.action_runner.run_waiting_action('do_gesture', 'dances/behavior_1') self.action_runner.run_waiting_action( 'say', 'Wil je nog een keer de hele dans doen?') self.action_runner.run_waiting_action( 'speech_recognition', 'answer_yesno', 3, additional_callback=self.on_complete_dance) if self.user_model['complete_dance'] == True: self.action_runner.run_waiting_action( 'say', 'Oke, gaan we nog een keer!') if self.user_model['complete_dance'] == False: self.action_runner.run_waiting_action( 'say', 'Oke, dat was het. Goed gedaan! Tot de volgende keer.')
def run(self) -> None: self.sic.start() action_runner = ActionRunner(self.sic) action_runner.run_waiting_action('wake_up') action_runner.run_waiting_action('set_language', 'en-US') action_runner.load_waiting_action('say', 'I\'m going to crouch now.') action_runner.load_waiting_action( 'go_to_posture', RobotPosture.CROUCH, additional_callback=self.posture_callback) action_runner.run_loaded_actions() action_runner.load_waiting_action('say', 'I\'m going to stand now.') action_runner.load_waiting_action( 'go_to_posture', RobotPosture.STAND, additional_callback=self.posture_callback) action_runner.run_loaded_actions() action_runner.run_waiting_action('rest') self.sic.stop()
class ExampleRobot(object): """Example that shows how to impelement a State Machine with pyTransitions. For more information go to https://socialrobotics.atlassian.net/wiki/spaces/CBSR/pages/616398873/Python+Examples#State-Machines-with-PyTransitions""" states = ['asleep', 'awake', 'introduced', 'asked_name', 'got_acquainted'] def __init__(self, sic: BasicSICConnector): self.sic = sic self.action_runner = ActionRunner(self.sic) self.machine = Machine(model=self, states=ExampleRobot.states, initial='asleep') self.user_model = {} self.recognition_manager = { 'attempt_success': False, 'attempt_number': 0 } # Define transitions self.machine.add_transition(trigger='start', source='asleep', dest='awake', before='wake_up', after='introduce') self.machine.add_transition(trigger='introduce', source='awake', dest='introduced', before='introduction', after='get_name') self.machine.add_transition(trigger='get_name', source='introduced', dest='asked_name', before='ask_name', after='get_acquainted') self.machine.add_transition(trigger='get_acquainted', source='asked_name', dest='got_acquainted', conditions='has_name', before='get_acquainted_with', after='rest') self.machine.add_transition(trigger='get_acquainted', source='asked_name', dest='got_acquainted', unless='has_name', before='get_acquainted_without', after='rest') self.machine.add_transition(trigger='rest', source='*', dest='asleep', before='saying_goodbye') def wake_up(self) -> None: self.action_runner.load_waiting_action('set_language', 'en-US') self.action_runner.load_waiting_action('wake_up') self.action_runner.run_loaded_actions() def introduction(self) -> None: self.action_runner.run_waiting_action( 'say_animated', 'Hi I am Nao and I am a social robot.') def ask_name(self) -> None: while not self.recognition_manager[ 'attempt_success'] and self.recognition_manager[ 'attempt_number'] < 2: self.action_runner.run_waiting_action('say', 'What is your name?') self.action_runner.run_waiting_action( 'speech_recognition', 'answer_name', 3, additional_callback=self.on_intent) self.reset_recognition_management() def on_intent(self, detection_result: DetectionResult) -> None: if detection_result and detection_result.intent == 'answer_name' and len( detection_result.parameters) > 0: self.user_model['name'] = detection_result.parameters[ 'name'].struct_value['name'] self.recognition_manager['attempt_success'] = True else: self.recognition_manager['attempt_number'] += 1 def reset_recognition_management(self) -> None: self.recognition_manager.update({ 'attempt_success': False, 'attempt_number': 0 }) def has_name(self) -> bool: return 'name' in self.user_model def get_acquainted_with(self) -> None: self.action_runner.run_waiting_action( 'say_animated', 'Nice to meet you ' + self.user_model['name']) def get_acquainted_without(self) -> None: self.action_runner.run_waiting_action('say_animated', 'Nice to meet you') def saying_goodbye(self) -> None: self.action_runner.run_waiting_action('say_animated', 'Well this was fun.') self.action_runner.run_waiting_action('say_animated', 'I will see you around.') self.action_runner.run_waiting_action('rest')
class Example: def __init__(self, server_ip, robot, dialogflow_key_file, dialogflow_agent_id): self.sic = BasicSICConnector(server_ip, robot, dialogflow_key_file, dialogflow_agent_id) self.action_runner = ActionRunner(self.sic) self.user_model = {'move_number': 1, 'continue_move' : False, 'complete_dance': True} self.recognition_manager = {'attempt_success': False, 'attempt_number': 0} self.action_runner = ActionRunner(self.sic) def practice(self): self.sic.start() self.action_runner.load_waiting_action('set_language', 'nl-NL') self.action_runner.load_waiting_action('wake_up') self.action_runner.run_loaded_actions() while not self.recognition_manager['attempt_success'] and self.recognition_manager['attempt_number'] < 2: self.action_runner.run_waiting_action('say', 'Hoi Ik ben Nao. Hoe heet jij?') self.action_runner.run_waiting_action('speech_recognition', 'answer_name', 3, additional_callback=self.on_name) self.reset_recognition_management() if 'name' in self.user_model: self.action_runner.run_waiting_action('say', 'Leuk je te ontmoeten' + self.user_model['name']) else: self.action_runner.run_waiting_action('say', 'Leuk je te ontmoeten!') self.action_runner.run_waiting_action('rest') self.sic.stop() def on_name(self, intent_name, *args): if intent_name == 'answer_name' and len(args) > 0: self.user_model['name'] = args[0] self.recognition_manager['attempt_success'] = True elif intent_name == 'fail': self.recognition_manager['attempt_number'] += 1 def reset_recognition_management(self): self.recognition_manager.update({'attempt_success': False, 'attempt_number': 0})