0845 528 0404

Philip English

Robotics Enthusiast, Director, Investor, Trainer, Author and Vlogger

Python Programming Your NAO Robot Tutorial Video 4

Python Programming Your NAO Robot Tutorial Video 4

Hi everyone! And welcome to how to program your NAO robot with Python tutorial video number 4

On this week’s tutorial we’re looking on how to get your robot to listen and use
its speech recognition function used in Python. So if you want your robot to listen to every word you say, then please stay tuned!

Hi Everyone, and welcome to the how to program your NAO Robot with Python tutorial video number 4.
On this weeks tutorial we are looking in to how to get your Robot to listen and use it’s Speech
Recognition function using Python! So if you want your Robot to listen to ever word you say, then
please stay tuned!

Hi Guys, I’m Philip English from robophil.com, now on this video we are looking to teach you how to
program your NAO Robot to use its speech recognition with Python! So instead of using the drag and
drop box system in Choregraphe, we will implement a Python behaviour.

Hi guys and we are now going to look at another Python tutorial, this is the speech recognition
tutorial. So jumping straight into it, there we go, our NAO, so there he is, he is connected to
Philip and yup! That is brilliant. We can see he is moving around so we can see the robot is there.
Alright! So what we do is first we want to bring into the function box in the speech and recognition
behaviour so it is underneath the Audio then Voice, Select Speech recognition.

* Go to Audio
* Select Voice
* Select Speech and recognition
* Drag it in
* Connect the “Speech and recognition” function box into the noodle

Now, what we want to do is we go into the little spanner and we want to put some wording in here

* Set parameter of Speech Recognition
* On the Word list type “Philip:John:Chris” (Philip, John, and Chris, those are the names that the
robot will be listening for)
* On Threshold, select “10”

* Create New Box
* Right-click the box
* Choose “Add new box”
* General Tab
* Name: type “Python Speech Identify”
* Tooltip: type “Python Speech Identify”

Next, what we want to do is we want to play with the input, so we have the input output parameters.
To do this, we go to round to the middle button, and we hit that.

* Edit Existing Input
* Name: type “onStart”
* Tooltip: type “Box behavior starts when a signal is received on this input.”
* Type: choose “String” (Instead of having “Bang”, we want to change this to string, so this will
basically allows the string to come into the Python box, so obviously he’s going to listen to a name
Philip, John or Chris so that is a string that he is listening).
* Click OK
* Click OK (We OK the box)

Now we’ve done that, So his input is accepting strings, we take a noodle and we attached it to the
Python script.

Now what we want to do, is do a little bit of Python behaviour text words so we can get it working,
so we click into the box that you know that pops up with the script. Now, what we want to do here is
we want to play with the “def onInput_onStart” so again just delete the other text in there and we
want to put

ttsProxy = ALProxy(“ALTextToSpeech”)
ttsProxy.say (“Hello, I am” * P)

How this works is that the robot is going to say, “I am” and then whatever comes in the speech
recognition box, if Philip, “I am Philip”, if John, “I am John”, Chris, “I am Chris”. So the P there
is designed to add the variable that comes into it.

So we have done that, let’s just close that box now, as we did in the main screen before with the boxes, we need to create “say” box, if it doesn’t recognize it then he can tell us. We click in to it, and we just need to put some symbol “I did not understand”. Nice and easy.

Out the box, then we connect it up. So again this is the input if he understands it, and then this is the output if he does not understand anything and so we need to get a loop, don’t forget it guys. We drag the noodles across the back. so the robot is not constantly hearing, otherwise it loop and loop and loops. Get it this way so it will listen to it once. otherwise he start listening to himself and repeat it.

Hopefully we should be all good with that, lets give it a go. He’s connected. So press play.

Don’t forget we got the three names in there that he is going to be listening for
testing of the robot speech recognition

Philip: Philip
NAO : Hello, I am Philip

Brilliant! Let’s see if it is working, run it again

Philip: John
NAO: Hello, I am John

and the last one
Philip: Chris
NAO : Hello, I am Chris

Oops! He says Chris a little bit funny there. Just to make sure it is working, let’s have something else

Philip: Kath
NAO: Hello, I am John

Okay, that’s going to be a play in the threshold to get that, he had Kath as John, it was quite interesting and lets have another one

Philip: Book
NAO : Hello, I am Philip.

Okay, I have to play with these threshold, when he’s listening he didn’t pick up the name. I’ll leave you guys to play with that, to try to refine it so it will work greatly, but as you can see the actual piece is working perfectly. And that is it guy thank you very much.

Hold on guys, you can now get your NAO Robot to listen to every word you say by using you python programming skills. Now have a play with these behaviours to see if you can get you NAO to recognize other words and names. and have a play with the initial worded string. have a play guys and use your imagination.
If you like this and want even more fee video tutorials,news, and information.
then please visit us at robophil.com. You can download the latest free ebooks and get insider information and techniques on how to become a robot expert.

Now if you like this tutorial, and want to see the next one in the collection,
please subscribe and keep up to date with the latest videos that will come out.

Please leave comments below, or put links relating to these videos, as well as other information about the NAO robot. If you have any questions and want to see any other related tutorials, then write your message on the comment section and let me see what I can do.

Thanks guys and see you next time!

Python Programming Your NAO Robot Tutorial Video 4 YouTube: https://youtu.be/QAA6y_IKar8

Philip English: https://philipenglish.com

Sponsor: Robot Center: http://www.robotcenter.co.uk

You might be interested in …