Level | All beginners | Time | 5 min |
OS | Linux - Windows - Mac | Preparation | 15 min |
Preparation time is given for the case you have to install tools prior the tutorial.
Make sure you have a robot ready to use, or read the Out of the box section.
Step | Action |
---|---|
Start Choregraphe. | |
Click the connect to button and connect Choregraphe to your robot. For further details, see How to connect your NAO. Your robot appears in the Robot view. |
|
Right click the grey area and choose Add a new Box in the context menu. |
|
Type a name, for example: My hello world, and click the OK button. |
|
Double click the box. The Script editor appears. |
|
Add the 2 following lines: After: def __init__(self):
GeneratedClass.__init__(self)
Add: self.tts = ALProxy('ALTextToSpeech')
After: def onInput_onStart(self):
#~ self.onStopped() #~ activate output of the box
Add: self.tts.say("Hello young Padawan")
The Script should look like this. |
|
Click the Play button. |
|
Double click the onStart input of your box. |
Your robot says “Hello, young Padawan”. In the meantime, the Robot view displays the message.
Let’s explain the 2 lines you wrote:
self.tts = ALProxy('ALTextToSpeech')
This line creates an object, called tts.
self.tts.say("Hello young Padawan")
This line uses the object tts to send an instruction to the NAOqi module.
To make the robot do something, you have to:
You can manually start the execution of a box by double-clicking on its on Start input.