FluentNao and Events

May 17, 2014

I had a great time at the Bay Area Nao Dev's meetup and thought it might be fun to write up a post showing how to handle events like voice recognition with FluentNao. This post assumes you have setup fluent-nao first.

Create a Script

Since you already have FluentNao code on your machine, copy/rename the file to create a very simple script


Fluent Nao

Clear everything out of that file except the following code.

Voice Recognition code

  1. Set a vocabulary to use
  2. Define a callback for voice recognition events
  3. Subscribe to the voice recognition

Using the following code..

# set VR Vocabulary
vocab = ['sit', 'stand', 'hands open']
nao.env.speechRecognition.setVocabulary(vocab, True)

# define VR callback
def speech_callback(dataName, value, message):
    print value

    if value == 'sit'

    if value == 'stand'

    if value == 'hands open'

# subscribe to VR
memory.subscribeToEvent('WordRecognized', speech_callback)

Run Your Script

Run your script and tell nao to "sit"