SoftBank Robotics documentation What's new in NAOqi 2.8?

C++ SDK - Installation Guide

Warning

Do you really need C++ SDK?

If it’s your first coding experience, starting with Choregraphe and/or Python is a much better option to get started.

Supported Operating Systems

OS Version
Linux Ubuntu 16.04 Xenial Xerus - 64bits only
Windows Microsoft Windows 10 64bits
Mac Mac OS X 10.12 Sierra

Windows limitations

  • The C++ cross-compiler (used to compile code to be run on the robot) is not available on Windows.
  • Windows architecture: make sure to compile for 32-bit. 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.

Supported Compiler and IDE

Linux
  • GCC version 4.8.2 or higher.

    Install GCC (among other useful tools) by running:

    $ sudo apt-get install build-essential
    
  • Your favorite IDE or text editor.

    Tips: Don’t know which one to choose?

    • A recent version of QtCreator is recommended.
    • You can also use Eclipse, but only if you are used to it.
Windows
  • Visual Studio 2013.
Mac
  • XCode.

    Use the version corresponding to your Mac OS X.

  • Your favorite IDE or text editor.

    Tips: Don’t know which one to choose?

    • A recent version of QtCreator is recommended.
    • You can also use Eclipse, but only if you are used to it.

Installing qiBuild

Note

Why installing qiBuild?

You are going to compile (on your computer) a code to be run under another Operating System (on the robot), so you need to cross-compile.

qiBuild, is a tool designed to generate cross-platform projects using CMake.

CMake generates makefiles and workspaces for any operating system, making the project able to be compiled simply on Windows, Mac, Linux and NAOqi OS.

Prerequisites

The table below lists the prerequisites to qiBuild installation.

Linux
  • CMake

    Use the cmake package provided by your distribution.

    Make sure to use version 2.8.12 or higher.

    Tips:

    • to check CMake version:

      $ cmake --version
      
    • to install it, you could run:

      $ sudo apt-get install cmake
      
  • Python 2.7

    Tip:

    • to check Python version:

      $ python  --version
      
Windows
  • CMake

    Make sure to use version 3.2 or higher.

    Tips:

  • Python 2.7

    Tips:

    • To use scripts written in Python, you have to put in your PATH:

      C:\Python27 and c:\Python27\Scripts

    • To check Python version:

      $ python  --version
      
Mac
  • CMake

    Make sure to use version 3.2 or higher.

    Tips:

  • Python 2.7

    Tip:

    • To check Python version:

      $ python  --version
      

Installation

Linux

Step Action

Install qibuild with pip.

It is recommended to install qibuild with the --user option, in order to keep your system clean.

$ pip install qibuild --user

Add $HOME/.local/bin to your $PATH.

One way to that is to add the following line at the end of your ~/.bashrc file:

PATH=$PATH:$HOME/.local/bin

Mac

Step Action

Install qibuild with pip.

It is recommended to install qibuild with the --user option, in order to keep your system clean.

pip install qibuild --user
Add $HOME/Library/Python/2.7/bin to your $PATH.

Windows

Step Action

Install qibuild with pip.

pip install qibuild
Add C:\Python27 and c:\Python27\Scripts in your PATH.
If you’d like to have nice colors in your console, you can install the Python readline library: http://pypi.python.org/pypi/pyreadline.

Configuration

Step Action

Run:

$ qibuild config --wizard

You will be prompted to specify:

  • CMake path (if not automatically found),
  • CMake Generator and
  • the IDE you will use.

It is advised to use ‘Unix Makefiles’ on Linux and Mac, and ‘Visual Studio’ on Windows.

Note that you can still re-run the config wizard anytime you want.

Result: a file is generated in ~/.config/qi/qibuild.xml. It is shared by all the worktrees you will create.

Worktree Initialization

Step Action

Create an EMPTY folder which will be your worktree.

Let’s call it: /path/to/myWorktree

Open a Command Prompt and go to that folder.

Type this command in order to initialize your worktree:

$ qibuild init

Final check

Let’s check that everything is ready by creating and compiling a sample. If you want:

Installing and configuring NAOqi SDK

Step Action

Retrieving C++ SDK

Retrieve the C++ SDK archive:

  • naoqi-sdk-x.x.x-[OS].tar.gz or
  • naoqi-sdk-x.x.x-win32-[visualStudioversion].zip

You can download the latest release from Developer Center website. For further details, see: Downloading & Installing SoftBank Robotics Software.

Be careful to select the archive corresponding to your Operating System (Windows, Mac or Linux).

Extract it on your machine.

We’ll assume that the extracted folder is called: naoqi-sdk.

Creating your toolchain

Type this command in order to create a toolchain using the feed from the C++ SDK:

$ qitoolchain create mytoolchain /path/to/naoqi-sdk/toolchain.xml

Where mytoolchain is the name you want to give to this specific toolchain (you could have several).

Go in your worktree:

$ cd /path/to/myWorktree

Creating your configuration

Type this command to create a build configuration associated with this toolchain, and make sure this configuration is the default for this worktree:

$ qibuild add-config myconfig -t mytoolchain --default