Home

Awesome

mc_naoqi_dcm

CI of mc_naoqi_dcm with Dockerpre-commit.ci status

Fast communication module between NAO/PEPPER robot sensors and actuators and mc_rtc control framework. This is a local robot module, which needs to be cross-compiled for the desired platform (NAO or Pepper), and uploaded on the robot. This module provides fast access to the low level Device Communication Manager module of NAOqi OS, it allows to set/get actuator values under 12ms.

Supported versions

This module needs to be cross-compiled and sent to the robot (Pepper/NAO). Unfortunately the cross-compilation toolchains are old and no longer supported, and the robots are almost impossible to upgrade anymore. Thus we have to rely on the few existing toolchains that have not been lost to time. As of now the following toolchains are supported:

If you rely on one of these toolchains, it is highly recommended that you keep a local backup of the toolchain.

Building

This module needs to be cross-compiled and sent to the robot. For this you have three options (choose which one fits you best):

Option 1 (recommended): Build using the provided Dockerfile

You may use the provided Dockerfile that sets up the cross-compilation environment for you. If you already followed Option 1 this is not necessary. Please choose the appropriate Dockerfile depending on your desired cross-compilation toolchain: Dockerfile_2.5.0 or Dockerfile_2.1.4

cd <mc_naoqi_dcm>
./docker/build.sh nao 2.1.4 # arguments here are robot name [nao|pepper] and library version [2.1.4|2.5.0]
# for pepper use
# ./docker/build.sh pepper 2.5.0

If the build suceeds, it will copy the generated library to /tmp/libmc_naoqi_dcm_<robot>_<version>.so. You may then copy this library on the robot (see Installing on the robot section).

If there is any issue with building you may use the following to connect to the docker and investigate

./docker/run.sh nao 2.1.4

Option 2: Build locally using the cross compilation toolchain

1. Installing qiBuild and creating a worktree

  1. Install qiBuild: pip install qibuild --user
  2. Configure qiBuild: qibuild config --wizard
  3. Create a qiBuild worktree: mkdir qibuild_ws
  4. Enter qiBuild worktree: cd qibuild_ws
  5. Initialize your worktree: qibuild init

2. Downloading and configuring cross-compilation toolchain

  1. Download the Cross Compilation Toolchain. Unfortunately the toolchain required for naoqi 2.5 is no longer officially provided, you may download a copy here:
    wget -c https://seafile.lirmm.fr/f/5389d0a64d79481ab49e/?dl=1 -O ctc-naoqi.tar.xz
    
    We advise you to keep a copy of that archive in case the above link becomes unavailable as this archive cannot be found elsewhere online.
  2. Extract this archive
    tar -xf ctc-naoqi.tar.xz .
    
  3. Create toolchain for cross compilation: qitoolchain create ctc-naoqi ctc-naoqi-2.5.0/toolchain.xml
  4. Enter previously created qiBuild worktree: cd qibuild_ws
  5. Create toolchain build configuration and set it as default in your qiBuild worktree: qibuild add-config ctc-naoqi-config -t ctc-naoqi --default

3. Clone and build mc_naoqi_dcm

  1. Clone this project into your qiBuild worktree: git clone https://github.com/jrl-umi3218/mc_naoqi_dcm.git
  2. Enter the project folder: cd mc_naoqi_dcm
  3. Configure the project (to build for either Pepper or NAO): qibuild configure --release -DROBOT_NAME=<pepper|nao>
  4. Build the local robot module: qibuild make
as: loadlocale.c:129: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.

You may now upload qibuild_ws/mc_naoqi_dcm/build-ctc-naoqi-config/sdk/lib/naoqi/libmc_naoqi_dcm.so to the robot.

Option 3: Using the pre-built library

You may find a pre-built version of libmc_naoqi_dcm.so in the Github Artefacts: click on [CI of mc_naoqi_dcm with Docker] then click on the latest successful action and scroll down to the Artefacts section where you can download the pre-compiled libmc_naoqi_dcm.so library.

Installing on the robot

The installation consists of uploading the module to the robot and making it automatically load on startup

  1. Transfer libmc_naoqi_dcm.so file to the robot:
rsync build-ctc-naoqi-config/sdk/lib/naoqi/libmc_naoqi_dcm.so nao@pepper.local:/home/nao/naoqi/ # For Option 1
# Or:
rsync /tmp/libmc_naoqi_dcm.so nao@pepper.local:/home/nao/naoqi/ # For Option 2
  1. Login to robot system:
ssh nao@<robot_ip>
  1. Configure mc_naoqi_dcm module to be auto-loaded when robot starts operating. Modify configuration file:
nano naoqi/preferences/autoload.ini

to contain the following line:

[user]
/home/nao/naoqi/libmc_naoqi_dcm.so
  1. Restart robot system:
nao restart

All done | Next steps

The robot is now running our uploaded local module mc_naoqi_dcm and is ready to be controlled via mc_rtc controller using mc_naoqi interface.

You can refer to the sample Pepper Finite State Machine (FSM) mc_rtc controller project: PepperFSMController for an example (or a starting point) for creating your own mc_rtc controller for Pepper.