Aldebaran documentation What's new in NAOqi 2.4.3?

Hello World 2 - using Python in Choregraphe


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.

Before starting

Let’s do it

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 Create a new Box > Python... in the contextual 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:


def __init__(self):


self.tts = ALProxy('ALTextToSpeech')


def onInput_onStart(self):
    #~ self.onStopped() #~ activate output of the box


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.

How it works

This script uses the say method of the ALTextToSpeech module. ALTextToSpeech is the module of NAoqi dedicated to speech. The say method makes the robot pronounce the string given in parameter.
For further details about this module, see ALTextToSpeech.

Let’s explain the 2 lines you wrote:

self.tts = ALProxy('ALTextToSpeech')

This line creates an object, called tts.

  • self is there to make sure tts will be available not only locally, but in all the code blocks of the script.
  • tts is the name we gave to the object instance (could have been myspeechmodule or speakingmodule).
  • ALProxy() is a class of objects, allowing you to have acces to all the methods of a module.
  • ALTextToSpeech is the name of the module of NAOqi we want to use.
self.tts.say("Hello young Padawan")

This line uses the object tts to send an instruction to the NAOqi module.

  • self.tts is the object we use.
  • say() is the method.
  • “Hello young Padawan” is the parameter.

What you have learned

To make the robot do something, you have to:

  1. Create an object giving access to one of the NAOqi modules, then
  2. call one of its available methods.

You can manually start the execution of a box by double-clicking on its on Start input.

To go further

Next step

What about creating your first dialog topic?
Try to create Dialog using Choregraphe editor: Hello World 3 - using Dialog topic in Choregraphe.