SDKs

See also

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


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).

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.

#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;
}

For further details, see: C++ SDK.

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.

Python is also used inside Choregraphe boxes.

from naoqi import ALProxy

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

For further details, see: Python SDK.

.NET

All major .NET languages are supported.

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("<IP of your robot>", 9559)
  tts.say("Hello World from f sharp")

main ()

For further details, see: .Net SDK.

Java

The NAOqi’s java binding is called JNaoQi.

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");
  }
}

For further details, see: Java SDK.

Matlab

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

For further details, see: Matlab SDK.

Urbi

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

tts.say("Hello World from urbi")

For further details, see: Urbi.

Compiling code for NAO on Windows

While both architectures (32-bit and 64-bit) are supported to run your favorite IDE, it is mandatory to compile exclusively for 32-bit. The resulting code will run as well on 32-bit or 64-bit environment.

For further details about SDKs requirements, see: