Practical Nao - northern-bites/nbites GitHub Wiki

Practical Nao

This page has practical information for using a Nao robot.

Interact with a Nao

The primary means of direct interaction with a Nao is through button presses. You can find a full list of commands on the Button Presses page.

Booting a Nao

  • To turn on a Nao: Press the front chest button.
  • To connect from the terminal via ssh:
$> ssh nao@<robot IP>

We use aliases for our robots for convenience. Usually, you can use <robot’s name> (if you are connecting via wireless) or <robot’s name>.local (if you are connecting via ethernet).

Shutting down a Nao

Preferably, you should shut down the Nao via the command line. ssh into the robot and type:

$> done

If this doesn’t work, you can perform a hard shutdown by pressing and holding the front chest button.

IMPORTANT: Make sure that the Nao’s stiffnesses are off or someone is holding it before you shut it down. Otherwise, the Nao will suddenly fall over, and we want to avoid damaging or breaking them. To turn off their stiffnesses, press the chest button twice.

Stopping a Nao

To stop the naoqi program without shutting down the robot, ssh into the robot and type:

$> nao stop

IMPORTANT: Follow the same safety guidelines for turning off the robot. Stopping naoqi will cause stiff robots to fall over and hurt themselves.

Installing our Code on the Nao

This section assumes that you have all of the needed software already on your machine. If you don’t, check out the Linux Setup page.

Once you’re all set up, open a terminal and cd into the nbites/src/man/ directory. Run the following commands:

$> make clean
$> make cross

“make” is the compiling command. “clean” resets everything to defaults, which tends to solve a lot of problems. If you’re having problems compiling, or you’ve just upgrade/updated something (like the SDK), make sure to run “make clean”. “make cross” brings up a setup page for the compiler. At first, there are only a couple fields you need to worry about here.

  • “PYTHON_PLAYER” is the behavior you’re loading onto the robot. These always start with a lowercase p, such as “pBrunswick” (our normal game player), “pSnapshot” (a special behavior for picture taking), and “pNone” (which, unsurprisingly, does nothing).
  • “REMOTE_ADDRESS” is the IP for the robot. Usually, you can either use if you’re installing via wireless, or .local if you’re installing over ethernet.
  • “ROBOT_PLAYER_NUMBER” is the player number. Game controller uses this to penalize the right robots.
  • “ROBOT_TEAM_NUMBER” is the player’s team code. Robots with the same team code will think they are on the same team.
  • “CMAKE_BUILD_TYPE” should always be set to “Release”. (Unless you are purposefully debugging.) Otherwise our code will run very frustratingly slow!
  • “TABLE_TOP” is the color table the robot will use for vision in the top camera. Usually this is correct already.
  • “TABLE_BOTTOM” is the color table the robot will use for vision in the top camera. Usually this is correct already.

Note: If you don’t have the color table files in your data/tables folder, you won’t be able to install. Cd into data/tables and run

$> ./sync down 

to get them from the server.

Unless you have a very good reason to and you know what you’re doing, don’t change any of the other settings. Remember that running “make clean” will reset all the defaults. Once you’ve set your behavior and robot IP, press the ‘c’ key to configure, then the ‘g’ key to generate the files. Finally, make sure the robot is on and run the command:

$> make install -j4

This will install the code onto the robot. It will take a few minutes the first time, but it’s faster the next time, I swear. As long as you didn’t change too much. If you have a multicore computer, make sure you have the “-j4” at the end, as this will make it 4 times faster. If your computer doesn’t have 4 cores, or you don’t know, use it anyway, since it won’t slow you down. Anyway, if you want to know more about how this entire system actually works, check out The Build System.

Running our Code on the Nao

Once you’ve turned on a robot and installed the behavior you want, you’ll want to restart the robot. This ensures that it’s now running the code you just installed. ssh into the robot and run the following command:

$> nao restart && naolog

The first part will restart naoqi, which will take a few minutes. The second part means that all output from the behavior you run will show up in your terminal. This lets you catch compiler errors, behavior crashes, and all sorts of useful debugging information. Once the robot starts up, you’ll see a lot of color coded stuff, part of which should tell you which behavior is loaded. The robot automatically starts in “initial” mode, so use Button Presses to get it in “playing”. Don’t forget to turn the stiffnesses off before shutting the robot down!

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