Nao tutorial 2: First module
The first tutorial focused about giving you a painless introduction to Nao's world. You turned the robot on, connected to him through the web interface and SSH, configured some parameters and learnt a bit about the most important files and folders.
Now, it is time for you to delve deeper into the subject, and the best way is to code and test your own example module. Nao has some good default applications that allow you to control his behaviour (like Choregraphe), but this is nothing compared with the freedom that compiling your own applications gives to you. Hence, you will now practice with the official SDK (section "Software/Download")
NOTE: This tutorial is targeted for version 1.10.10 of the SDK and OS. Older versions like 1.8.16 or 1.6.13 are not likely to work.
- 1 Getting everything ready
- 2 Helloworld example in Naoqi
- 3 Troubleshooting
Getting everything ready
I guess that your testing environment is the same as in the previous tutorial, only with your Nao connecting via wifi now. Also, you will need to download some software from Aldebaran's webpage, but if you are reading this wiki, it's because you are connected to the internet (duh!). Remember to turn your robot off if it isn't already.
Downloading the software
The guys from Aldebaran Robotics have an official SDK (Software Development Kit) available for registered users, on their webpage. Navigate to this link, enter your login info (you have it, right?), then click the "Software" and "Download" links.
You must download the last version of the Linux SDK (1.10.10 currently). After clicking on it, you have to scroll down the user license agreement, "I agree", and "Click here to proceed". Wait for the 162 MB file to download (it's called naoqi-sdk-1.10.10-linux.tar.gz). Extract its contents, and it will spawn a folder named naoqi-sdk-1.10.10-linux/. Move it to the location you like most.
A couple of Linux packages are needed to create and build your own applications. Luckily, this can be as easy as entering the following command in a terminal (Debian or Ubuntu only, folks):
sudo apt-get install build-essential cmake python-all libboost-all-dev libmpfr-dev -y
Helloworld example in Naoqi
Open your naoqi-sdk-1.10.10-linux/ folder and take a good look at it. Two text files can be found at the root, README.txt and release-note.txt. Read carefully both. You can also explore the whole content, but there is no need to, as I will now enumerate the most important files and folders of the SDK:
- naoqi : a shell script located at the root of the folder. It will conveniently start Naoqi after setting all needed environment variables.
- toolchain-pc.cmake : this file must be feed to Cmake when you want to compile something for your local Naoqi (not for the robot).
- bin/flash-usbstick : another script, in this case for formatting an USB stick with a given version of Nao's OS.
- doc/index.html : local version of Aldebaran's official documentation. You won't need to go to the website anymore.
- modules/src/module_generator.py : Python application for generating your examples from a template. Very handy!
- preferences/autoload.ini : Configuration file that states which modules should be loaded by Naoqi at startup. Do never mix this autoload.ini with Nao's one!
- bin/ : this is where your Naoqi-compiled executables will be placed.
- lib/naoqi/ : this is where your Naoqi-compiled modules (libraries) will be placed.
- modules/src/examples/ : all pre-made examples can be found here, like Helloworld.
You may run into annoying problems while developing for Nao (I certainly did), some easier to solve than others. I will try to explain how to fix the most common ones. If you have any questions regarding this subject or know of a different bug, feel free to send me an email describing it, and I will add it to this section. Just remember to try Google first!
Python fails to run
Cmake fails to run
Can't compile my module
Nao doesn't load my module
Proxy fails to connect
How to flash Nao
Previous tutorial: Nao tutorial 1: First steps