Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Image and SDK

Harold edited this page Jan 20, 2023 · 4 revisions

In order to make full use of the framework code, you need the NAO robot to be flashed with a custom image that is optimized for running the framework and your computer to be equipped with the correct SDK. The robot might run hardware that is different to that of your computer, therefore we need a Software Development Kit (SDK) that helps us compile the code for the specific computer architecture and OS the NAO is using.

Luckily, as a new member you should not have to think about these.

  • On the whiteboard you can see which robot is using which image, so you can just pick one with DNT-HULKs already installed
  • The pepsi tool automagically installs the SDK if it cannot find on your computer

There are still some reasons you might want to check this page out:

  • There might be no robots with DNT-HULKs installed
  • You might want to manually install the SDK
  • You might want to make changes to the OS/SDK (a new dependency for example)
  • You come from a future where the Delta Works failed us, a major flood corrupted all our data, and you now need to recompile everything
    • I'm sorry for your loss.

Setting up the build

Note: If you are still not sure if you need to build these yourself, the answer is probably no. The building might take many hours and will take up about 200GB of space on your computer. If you are sure, we have a dedicated build server in the Robolab (ws1) where this is done, that will probably have a cached build to speed things up significantly. In this case you should ask someone working on the framework to help you.

Make a folder dnt-hulks/

$ mkdir dnt-hulks
$ cd dnt-hulks

Clone hulk, meta-hulks and meta-nao repositories:

$ git clone https://github.com/IntelligentRoboticsLab/hulk/
$ git clone https://github.com/IntelligentRoboticsLab/meta-hulks/
$ git clone https://github.com/IntelligentRoboticsLab/meta-nao/

Install kas, the easy setup tool for bitbake based projects:

$ python3 -m pip install kas

Checkout repositories needed and setup the build in directory:

$ python3 -m kas checkout meta-hulks/kas-project.yml

The NAO V6 uses LoLA and HAL for communication with the chestboard. These programs necessary to operate the robot properly are shipped with the RoboCup image (nao-2.8.5.11_ROBOCUP_ONLY_with_root.opn) which can be found in the shared DNT Google Drive. To extract the necessary binaries the extract_binaries.sh shell script is used. This script fetches everything we need from RoboCup image and collects them in an archive for the upcoming build.

Move the RoboCup image to meta-nao/recipes-support/aldebaran/, then run:

$ cd meta-nao/recipes-support/aldebaran
$ mkdir -p aldebaran-binaries
$ ./extract_binaries.sh -o aldebaran-binaries/aldebaran_binaries.tar.gz 

Enter the kas shell:

$ cd dnt-hulks
$ python3 -m kas shell meta-hulks/kas-project.yml

Build the image (this can take a couple hours):

$ bitbake nao-image

After completion, the image should now be located in dnt-hulks/build/tmp/deploy/images/nao-v6/nao-image-[...].ext3.gz.opn.

Build the SDK (this can take a couple hours):

$ bitbake -c populate_sdk nao-image

After completion, the SDK should now be located in dnt-hulks/build/tmp/deploy/sdk/[...]-toolchain-[...].sh.

The initial builds can take a while, but because everything is being cached, any follow-up builds should take up considerably less time.

Installation

Image

To get our OS onto the robot, we first need to put it on a flash drive.

Connect a flash drive to the PC and find out which device name the drive is assigned to (often sdb or sdc):

$ lsblk -So NAME,SIZE,TRAN
# Sample output:
NAME   SIZE  TRAN
sda    400G  sata
sdb    16G   usb  # It seems the USB it at `sdb`!
sr0    1024M sata

Using the device name, copy the image to the device:

# make sure you are in the same folder as the `nao-image-[...].ext3.gz.opn` file
# device name is `sdb`, so we want to write the image to `/dev/sdb`
$ dd if=nao-image-[...].ext3.gz.opn of=/dev/sdb status=progress
$ sync

The image is now on the flash drive. You can safely remove it from the PC.

To flash the NAO robot:

  • Make sure the robot is turned off and in a charged (or charging) state to prevent any power loss failures
  • Place the prepared flash drive in the back of the head of the NAO robot.
  • Hold the chest button for about 5 seconds until it lights up, then release it. It should be rapidly be flashing blue, this indicates the flashing process is started.
  • Wait a couple minutes until the flashing process is finished
  • Reward yourself with a refreshing Dr. Pepper, because the new image should now be installed!

SDK

Installing the SDK is as easy as running the shell script and following the instructions:

# make sure you are in the same folder as the `[...]-toolchain-[...].sh` file
# you might get prompted for an installation location, it is recommended to change it to somewhere in your home directory, for example `~/.naosdk/`
./[...]-toolchain-[...].sh

Migrating from HULKs

This information might get out of date as HULKs makes changes their framework, therefore a timestamp is left from when it was guaranteed to be correct. (Written: 2022-12-01)

There are some extra steps if you are adapting the code from the https://github.com/HULKs/*/ repos instead of the https://github.com/IntelligentRoboticsLab/*/ repos, in order to make everything compatible with our team. In particular, the team number needs to be changed (we are number 8) and the correct hardware IDs need to be filled in.

dnt-hulks/meta-hulks/recipes-hulks/network-config/network-config/configure_network: Change all IPs to correct team number from 24 to 8 (ex. 10.1.24.x to 10.1.8.x)

dnt-hulks/meta-hulks/recipes-hulks/network-config/network-config/id_map.json: Change all hardware IDs and names to match with our robots and robot numbers (current IDs can be found here). Make sure to have the robot number start from the 8th character in the name (ex. dntnao#22 for robot 22).

dnt-hulks/meta-nao/recipes-conf/nao-wifi-conf/nao-wifi-conf/*.psk: Optionally change wifi settings. Default should be fine because our field router is called SPL_A with password Nao?!Nao?!, but you might want to set autoconnect to true so you don't need to use a wired connection to enable a wifi network.

dnt-hulks/meta-hulks/conf/distro/HULKs-OS.conf: Optionally change the image/sdk version and distro name. If the DISTRO variable is changed this must be reflected by changing the file name from HULKs-OS.conf to <new distro name>.conf and changing the distro name in meta-hulks/kas-project.yml.

dnt-hulks/hulk/crates/spl_network/src/lib.rs: Set HULKS_TEAM_NUMBER from 24 to 8.

dnt-hulks/hulk/tools/pepsi/src/parsers.rs: A couple places where we need to change a hardcoded 24 to 8.

dnt-hulks/hulk/tools/twix/src/completion_edit.rs: A couple places where we need to change a hardcoded 24 to 8.

dnt-hulks/hulk/etc/configuration/hardware_ids.json: Replace the robot numbers & hardware IDs with ours (current IDs can be found here).

Clone this wiki locally