SDK

Overview | C++ | Python | .Net | Java | Matlab | Urbi

Before starting

Whatever language you choose, there are common concepts to master and practical information to know.

Writing code for NAO

The NAOqi API is currently available in at least 8 languages. Apart from some minor language-specific differences, the API is mostly the same across all languages, allowing you to bring knowledge from one language to another.

You can only write NAOqi’s module in C++ and Python, but you have access to the full client API in all languages. Only C++ and Python are supported on the robot, other languages are only supported on computer to remotely access NAO.

C++

The C++ framework is the most complete framework. It is the only framework that lets you write real-time code, running at high speed on the robot (with loops of less that 10 ms, for instance). You can read more about it in the C++ SDK section.

To be able to easily compile your code, it is recommended that you use CMake with the qiBuild framework. You can read more about it in the qiBuild documentation, or follow the qiBuild Programming guide. If you really cannot wait, please follow the Using qiBuild with Aldebaran packages tutorial to get you started with qiBuild.

See C++ SDK

#include <alproxies/altexttospeechproxy.h>

int main(int argc, char* argv[])
{
  AL::ALTextToSpeechProxy tts("<IP of your robot>", 9559);
  tts.say("Hello world from c plus plus");
  return 0;
}

Python

This is the second most complete framework. This framework also lets you run embedded code, but of course you cannot achieve the same performance as with C++. You can also create NAOqi modules in Python, and use the notifications from other modules.

You can read more about it in the Python SDK tutorial.

Python is also used inside Choregraphe boxes.

See Python SDK

from naoqi import ALProxy

tts = ALProxy("ALTextToSpeech", "<IP of your robot>", 9559)
tts.say("Hello world from python")

.NET

All major .NET languages are supported. See .Net SDK for more informations.

C#

using Aldebaran.Proxies;

class Program
{
  static void Main(string[] args)
  {
    TextToSpeechProxy tts = new TextToSpeechProxy("<IP of your robot>", 9559);
    tts.say("Hello World from c sharp");
  }
}

Visual Basic

Imports Aldebaran.Proxies

Module Program
  Sub Main()
  Dim tts As TextToSpeechProxy = New TextToSpeechProxy("<IP of your robot>", 9559)
  tts.say("Hello World from visual basic")
  End Sub
End Module

F#

open Aldebaran.Proxies

let main () =
  let tts = new TextToSpeechProxy("10.0.252.218", 9559)
  tts.say("Hello World from f sharp")

main ()

Java

The NAOqi’s java binding is called JNaoQi. See Java SDK for more information.

public class TestTTS
{
  static
  {
    System.loadLibrary("JNaoQi");
  }

  public static void main(String[] args)
  {
    ALTextToSpeechProxy ttsProxy = new ALTextToSpeechProxy("<IP of your robot>", 9559);
    tts.say("Hello World from java");
  }
}

Matlab

See Matlab SDK for more information.

tts = ALTextToSpeechProxy('<IP of your robot>', 9559);
tts.insertData('Hello World from matlab');

Urbi

Executed on a specific robot with an existing NAOqi Urbi context:

tts.say("Hello World from urbi")