Flash and configure a nao - northern-bites/nbites GitHub Wiki

1. Flash USB Key

Download the nao-flasher from Aldebaran's site. Extract it; it doesn't matter where you put it.

Choose the latest version of Naoqi and download the correct system image from that version's folder. DO NOT extract this file; leave it archived.

Insert the USB stick, then go to the folder containing the flasher and run:

$> sudo ./flasher

Provide the path to the system image you downloaded (opennao-atom-system-image... ) and to the USB stick (probably Kingmax 2GB...). Select "Factory reset."

Click "Write" to run the flasher.

Note: You need to have a (its free) developer account to get the system image (just make one)

Note: The USB key won't mount if you've flashed a Nao image to it. It will look empty... this is ok.

Note: I have run into issues flashing with one of the sticks. Best experience has been with the 2.1 stick with the black label and the stick with a green dot.

Note: If you are having issues finding the flasher, the [email protected] account should have copies of both the flasher and system image in the google drive associated with it. (Password is the usual, is also in the lab.)

IMPORTANT NOTE: USE THE MAC VERSION OF THE FLASHER!!! I have suffered so you do not have to. Linux version is a no-go. Otherwise, take Aldebaran's advice and rustle up a computer with a Windows 7 OS to use.

Helpful link: http://doc.aldebaran.com/2-1/software/naoflasher/naoflasher.html

2. Boot Robot WITH USB KEY

Place the USB key in the robot's head. GOLD PRONGS ON THE STICK GO UP.

Hold the chest button down for 5 seconds (it will turn blue) rather than the usual one push to turn the robot on. This signals that it should update. The update will occur during the boot. See here for an explanation of the ear lights.

Make sure to have the Nao plugged into the ethernet so that it will come up on the wired interface. Its IP should be nao.local.

You can take the USB stick out after the robot has booted and says that the update was completed successfully.

3. Run copy-files

Cd into the nbites/util/scripts directory and run:

$> ./copy-files.sh <robot IP> <username>

This script will download a bunch of important files from the Robocup server then copy them into the home folder on the robot. If you're setting up a brand-new Nao or doing a factory reset: remember that the robot has just been flashed so its IP is nao.local (if it is plugged into ethernet). If you're just updating, then the hostname does not get overridden, so the IP will be <robot-name>.local. The username and password are the default at this point (nao for both).

4. Run setup-robot

SSH into the robot (still using the link-local only connection). Run su to become root (check the docs, ask about the password, or look on the password sheet in the lab) and then run:

$> ./setup-robot.sh <new hostname>

This will move all of the files to their correct places, set up nbites system config, set the hostname, and give you a chance to set the password for the nao user. Please use the usual. It will tell you that you're providing a BAD PASSWORD, but this is ok. Ignore it.

5. Reboot

Reboot the robot just to make sure everything looks good--the new driver won't go into effect until after a reboot. You should now be able to log in as usual, ie ssh nao@<robot-name> .local, using the normal password.

6. Install Man and Boss

First make cross and make install to the robot. This will set up lib, etc. on the robot.

Install Boss on the robot by making boss locally (in src/boss) and scping it over to the robot (from the /build directory)

In src/boss build boss with the defaults (make cross, configure, then make). Change into the build/boss directory and scp boss to the robot with the command:

scp libboss.so nao@<ROBOT ADDRESS>:/home/nao/nbites/lib/

Once that completes successfully, ssh into the robot and use nano to alter the autoload file so that the robot uses boss! Use the command:

nano naoqi/preferences/autoload.ini 

And then, edit the autoload.ini to:

[user]

/home/nao/nbites/lib/libboss.so

What This Accomplishes (Northern Bites Customizations)

The copy-files.sh script just copies all of the necessary robot files into the home folder.

setup-robot.sh does all of the real work. It needs to be run as root on the robot so that it can get into the robot's system files and also access the nao user's files... these are on separate partitions.

First it makes an ~/nbites directory, with subdirectories audio and log, which will hold our C++ library and Python code (when installed), audio files, and logs. When we do make install, the code is configured to copy files into nbites/lib on the robot, so we need the nbites folder set up and ready.

Audio files go into the nbites/audio directory.

Some libraries that we need are not included on the robot; these include boost python and protobufs. We copy these into /usr/lib. These were manually cross-compiled for the robot by hardworking team members. Note that if the Boost or protobuf version is ever changed, you will need to keep these up to date!

We also use B-Human's version of the mt9m114 camera driver, and this gets put into the Nao's video drivers folder. This .ko file was obtained by compiling the Nao's kernel based on tips from here, with the mt9m114.c file replaced with B-Human's new version.

After moving these files, the script updates the hostname (saved in /etc/hostname) and adds some lines to the /etc/profile. These lines alias naolog to tail -f /home/nao/nbites/log/nblog so that the output of our log file is displayed as the robot runs and done to sudo shutdown -h now && exit for simplicity. We also unlimit the maximum size of core files here.

We have our own versions of naoqi's service script, so that gets copied into /etc/init.d. It simply replaces Aldebaran's start command with one that pipes output into our nblog. Look at this file and you will see the lines that got commented out and replaced.

The autoload.ini files specify which modules are loaded by naoqi; we replace the given system one (/etc/naoqi/autoload.ini) and user one (~/naoqi/preferences/autoload.ini) so that Aldebaran modules that aren't needed or that interfere with our code aren't loaded and our own module is. See this. Aldebaran says not to do this, but they run a lot of useless code by default. The only Aldebaran modules we leave running are albase and alconnectionmanager, so that the Wifi lists on the Nao's web pages get populated correctly.

Finally, the script gives the user a chance to set the password for the robot.

⚠️ **GitHub.com Fallback** ⚠️