I would like to know how I can add vocabulary to a script. Do I have to create a library? I do have all the mp3 files necessary.

For example: In existing scripts I see

ear.addCommand("open hand", "python", "handopen")

where does he get the information in the bracket from? I would like to have this here for example:

ear.addCommand("shake hand", "???", "shakehand")

I was searching for information but I did not find the right one. Thanks for any help

Alessandruino

9 years 8 months ago

hey mastablasta, if you want to add new voice commands you have to use for example this :

ear.addCommand("open hand", "python", "handopen")

i'll explain how is this composed :

"open hand" is the voice command you want to add, so after adding it MyRobotLab will "Listen" for that command too

then you need to add an action to do when that command is heard :

"hand open" : you are saying you want to execute "handopen" function when the "open hand" command is heard and "python" means that the "hand open" function is in python...

In fact the action you want to do, will look in this way in python :

def handopen():      

         put here what you want to do

Alessandruino

9 years 8 months ago

In your case you did it in the right way !

Now you just have to create the "shakehand" function in python

ear.addCommand("shake hand", "python", "shakehand")

def shakehand():

       print 'hey i'm using a new function !'

Mastablasta

9 years 8 months ago

Hello Allesandruino.

First of all thank you.
I did not expect it to be that simple. It´s working already (modified minimal.py), next I will try to make him answer new phrases.
So this way I just need to feed the script with whatever I want to say to him and what I want him to do/answer.

I enjoy MRL more and more!

Update: Listens and speaks as well!

wvantoorn

9 years 8 months ago

markus got a very good script, when you say something too many times, it react on that, might be usefull for U, gael put it in his inmoov2full3 script

 

Mastablasta

9 years 8 months ago

I guess you mean the part with the "howdoyoudo" for example. Yeah really great! One day I will attach the paintball gun so he can start shooting around if I drive him nuts ;-)

Now things make more sense to me. I will try to do a small script myself these days. Just purchased a webcam so I will try the tracking today.