See also
Overview | C++ | Python | .Net | Java | Matlab | Urbi
C++ SDK | C++ SDK Installation | C++ Tutorials | C++ Examples | C++ Tips and tricks | Debugging C/C++ on the robot
Please make sure to have read the NAOqi Framework section first.
Additionaly, there are a few things that are C++ specific, one key difference is that there are two types of proxies:
Specialized proxies. They correspond to Aldebaran features, such as ALMotion, ALTextToSpeech, ALVideoDevice etc. These proxies are optimized, efficient and easy to use: once created, they give direct access to already existing methods. Always prefer this kind of proxy to generic proxies if it exists for a desired module - in addition to being optimized, they give you compile-time type checking, which helps you see problems earlier.
#include <alproxies/altexttospeechproxy.h>
const std::string phraseToSay = "Hello world";
AL::ALTextToSpeechProxy tts("nao.local" , 9559);
tts.say("Hello world");
Generic proxies. They give access to any module including the ones which also have specialized proxies. The generic proxy has no information about the methods which are bound to these modules, contrary to specialized proxies. This means that the user must specify himself the name and parameters of the methods: if there is a mistake somewhere, it will raise an exception during execution. This kind of proxy is slower and more error-prone, but very flexible since it can adapt to any module. For user-created modules that have no specialized proxy, this is your only choice.
#include <alcommon/alproxy.h>
const std::string phraseToSay = "Hello world";
AL::ALProxy proxy("ALTextToSpeech", "nao.local", 9559);
proxy.callVoid("say", phraseToSay);
// Or, if the method returns something, you
// must use a template parameter
bool ping = proxy.call<bool>("ping");
Please read the C++ SDK Installation section.
The main tutorial can be found in the Extending NAO API - Creating a new module section.
If you still want to use the old method, calling CMake with a toolchain file, you can still do it.
But please read the Porting code to 1.12 tutorial. You should mostly be fine without touching any CMakeLists.txt file, but if you want your code to work in the next release, you should really port your code.
It’s advised you use qiBuild to build your projects. Please follow the Using qiBuild with Aldebaran packages tutorial to get you started with qiBuild.
Please make sure to also read the Local modules section.
To get the list of all samples and tutorials, see the C++ Tutorials section.