NAO installation

OSX 2010. 3. 3. 17:20

Installation

Follow the steps below to install the SDK on your Mac OS X computer:

  1. Download "Mac Leopard nao SDK" from the Aldebaran website.
  2. Extract the contents of the SDK (.tar.gz) file in a directory (for example in "~/naoqi/").
  3. Create an environment variable AL_DIR: export AL_DIR="/home/mylogin/naoqi/" (of course, change 'mylogin' by your login). It can be useful to set it in the .bashrc file for permanent export.
    Note:

    AL_DIR must be set to the directory which contains the README file.

We are now ready to compile nao SDK examples.

Warning:

Remember that the Cross compilation is only available for Linux.


Compilation instructions (HelloWorld sample)

There are two ways to compile a module:

  • As an executable (remote modules): each modules package creates an independent executable stored in "$AL_DIR/modules/bin/". At startup you need to specify the IP and the port of the NaoQi running.
  • As a library: each modules package creates a dynamic library stored in "$AL_DIR/modules/lib/". To make this library loaded by NaoQi, the $AL_DIR/module/lib/autoload.ini file needs to be updated with the name of your modules library.

CMake compilation tools is used to generate make or IDE project (XCode, ...).

Compiling modules as executable

Follow the steps below to compile NaoQi SDK examples as executable:

  1. Be sure that the NaoQi executable and modules packages are not running.
  2. Go to the $AL_DIR/modules/src/examples/ directory.
  3. Create and jump into a temporary build directory (example $AL_DIR/modules/src/examples/build/).
  4. Run cmake ..
  5. Run the configuration command ccmake ..
  6. Be sure that the HELLO_WORLD_IS_REMOTE option is set to ON.
  7. Reconfigure by pressing c.
  8. Quit cmake configuration by pressing g.
  9. Then compile: make. The generated binaries are copied to the modules/bin directory.
  10. Edit the autoload.ini file ($AL_DIR/modules/lib/autoload.ini).

    > The line helloworld must not be present.

    > "Autoload.ini" is used to load dynamic library at startup.

Note:

At anytime, you can reset your project by deleting contents of the build directory and relaunch 'cmake ..'

Note:

You can generate a XCode project with the command cmake -G XCode ..

Note:

Many options are available with cmake, refer to the CMake website for further information.

Now let's start modules packages executable:

  1. Start the main broker by launching NaoQi executable ($AL_DIR/bin/naoqi).
  2. Start helloworld executable ($AL_DIR/modules/bin/helloworld).

    > You will see some log in the mainbroker terminal.

  3. Run the python file to test helloworld:

    a. cd $AL_DIR/modules/src/examples/helloworld/test

    b. python test_mymodule.py

At this point, the log message "Info : MyModule : Hello World!" is printed on the mainbroker (NaoQi) terminal.

Note:

If a module package is compiled as an executable, you can connect it to the robot by editing the IP (and port if needed) of the main broker in the test_helloworld.rb file.

Note:

Once you have launched a broker, you can see the generated API http web page by using the IP and the port of this broker : http://127.0.0.1:9559 . Here you can find modules and methods descriptions.

Warning:

The socket server may not be available when starting NaoQi. Two things can lead to this situation:

- NaoQi crashed: wait few seconds, the operating system is going to free the socket.

- NaoQi is still alive: kill NaoQi and restart.

Compiling modules as dynamic library

Follow the steps below to compile NaoQi SDK examples as library:

  1. Be sure that NaoQi executable and modules packages are not running.
  2. Go to the $AL_DIR/modules/src/examples/ directory.
  3. Create and jump into a temporary build directory (example: $AL_DIR/modules/src/examples/build/).
  4. Run cmake..
  5. Run the configuration command ccmake..
  6. Switch OFF the HELLOWORLD_IS_REMOTE option.
  7. Reconfigure project by pressing c.
  8. Quit cmake configuration by pressing g.
  9. Then compile: make..

    > The generated libraries are copied to the modules/lib directory ($AL_DIR/modules/lib/helloworld.so).

  10. Edit the autoload.ini file ($AL_DIR/modules/lib/autoload.ini) by adding this line: helloworld (before the [remote] line).
  11. Start NaoQi executable ($AL_DIR/bin/naoqi).

    > The mainBroker starts and the module MyModule is loaded (cf log message).

  12. Run the python file to test helloworld:

    a. cd $AL_DIR/modules/src/examples/helloworld/test

    b. python test_mymodule.py

At this point, the log message "Info : MyModule : Hello World!" is printed in the mainbroker (NaoQi) terminal.

Warning:

The socket server may not be available when starting NaoQi. Two things can lead to this situation:

- NaoQi crashed: wait few seconds, the operating system is going to free the socket.

- NaoQi is still alive: kill NaoQi and restart.

: