Skip to content

Getting Started: NAO Framework

Bryce George edited this page Nov 20, 2020 · 7 revisions

Author: ancient-sentinel - Last Updated: 11/17/2020

On This Page:

SoftBank Resource Links:

 

Installing the Python SDK on Linux

NOTE: For best results, use a Ubuntu 16.04 Linux distribution.

Before you begin, ensure your system is up to date and that you've installed Python 2.7. If you've already done so, you can move on to step 1, otherwise, open a Terminal (Ctrl+Alt+T) and run the following commands:

Update your system

sudo apt-get update

Install Python

sudo apt-get install python

Install Pip

sudo apt-get install python-pip

Answer Y (yes) when asked whether you wish to continue.

Install IDLE

sudo apt-get install idle

In order to install the NAOqi Python SDK on Linux, perform the following steps:

  1. Download the latest release of the NAOqi Python SDK for Linux.

  2. Extract the folder to the Downloads directory. Rename the extracted folder to pynaoqi at this point if you wish (if you do not rename the folder, simply use the default or your own folder name in place of pynaoqi in subsequent instructions).

  3. Open a new Terminal and move the folder to the /usr/lib directory. You will be prompted for your administrator password after running the following command:

sudo mv ~/Downloads/pynaoqi /usr/lib/pynaoqi
  1. From your home directory (you can ensure you are there by running cd ~ ) open your .bashrc for editing:
nano .bashrc
  1. At the bottom of your .bashrc add the following lines:
export PYTHONPATH=${PYTHONPATH}:/usr/lib/pynaoqi/lib/python2.7/site-packages
export QI_SDK_PREFIX=/usr/lib/pynaoqi

Press Ctrl+X to close the file and answer Y (yes) to save your changes.

  1. Restart your machine and log back in.

  2. Open a new Terminal and open IDLE by running:

idle
  1. Attempt to import the Python SDK to verify that you've succeeded:
import naoqi

If you don't get any error messages, then you have successfully installed the SDK.

If you receive an error message saying that the naoqi module cannot be found, run the following commands in IDLE:

import os
print(os.environ["PYTHONPATH"])
print(os.environ["QI_SDK_PREFIX"])

Check the paths that are printed to ensure they match the paths given in step 5 and fix them in your .bashrc if they do not.

Next step: Installing Robot Settings on Linux

See also "Hello, World!" using Python SDK on Linux, Setup PyCharm on Linux

 

Installing the Python SDK on Mac

In order to install the NAOqi Python SDK on a Mac, perform the following steps:

  1. If you do not already have Python 2.7 installed for your local user, download and install it. DO NOT use the global copy that comes with macOS (usr/bin/python), instead use usr/local/bin/python once you've installed it.

  2. Restart your Mac and hold down the Command + R keys as it reboots to boot into Recovery Mode.

  3. Login to your user account, then open Terminal by selecting Utilities > Terminal from the title bar menu at the top left of the screen.

  4. Run the following command:

csrutil disable
  1. Restart your Mac again, letting it boot normally. Login again once booted.

  2. Download the latest release of the NAOqi Python SDK for Mac.

  3. Extract the .tar file and move it wherever you would like to keep it on your file system.

  4. Right click on the NAOqi SDK folder, then press the Option key. Click the Copy "lib" as Pathname" option.

  5. Open Terminal and look at the top of the window to see if you are running a bash or zsh shell.

  6. Run the following commands if you are using a zsh shell. For a bash shell, run the same commands replacing .zshenv with .bash_profile. Also replace <paste_sdk_path> in each command by pasting (Command + V) the SDK path you copied previously.

echo "export PYTHONPATH=<paste_sdk_path>/lib/python2.7/site-packages" >> ~/.zshenv
echo "export DYLD_LIBRARY_PATH=<paste_sdk_path>/lib" >> ~/.zshenv
echo "export QI_SDK_PREFIX=<paste_sdk_path>" >> ~/.zshenv
  1. Go to System Preferences > Security and Privacy on your Mac and select the Privacy tab. Scroll down to Developer Tools and make sure the checkbox next to Terminal in the list on the right is selected.

  2. Run the following commands in Terminal to start Python:

cd /
./usr/local/bin/python
  1. In Python, run:
import naoqi

If you don't get any error messages, then you have successfully installed the SDK.

If you receive an error message saying that the naoqi module cannot be found, run the following commands:

import os
print(os.environ["PYTHONPATH"])
print(os.environ["DYLD_LIBRARY_PATH"])
print(os.environ["QI_SDK_PREFIX"])

Check the paths that are printed to ensure they match the paths given in step 10 and repeat step 10 to fix them if they do not.

  1. Exit Python and close your Terminal window. Repeat steps 2-4, but run the following command instead:
csrutil enable
  1. Restart your Mac normally and you're all done!

Next step: Installing Robot Settings on Mac

See also "Hello, World!" using Python SDK on Mac, Setup PyCharm on Mac

 

Installing the Python SDK on Windows

<Instructions Needed>

Next step: Installing Robot Settings on Windows

See also "Hello, World!" using Python SDK on Windows, Setup PyCharm on Windows

 

Installing Robot Settings on Linux

  1. Download the latest Robot Settings version for Linux.

  2. Open a new Terminal and run the following commands:

cd ~/Downloads
sudo chmod +x robot-settings-<your-version>-linux64-setup.run

You will be prompted for your administrator password to run this command.

./robot-settings-<your-version>-linux64-setup.run
  1. Follow the installer instructions to finish installing the application.

Next step: Using the Robot Settings Application

 

Installing Robot Settings on Mac

  1. Download the latest Robot Settings version for Mac.

  2. Open the installer from your Downloads directory and follow the installer instructions to finish installing the application.

Next step: Using the Robot Settings Application

 

Installing Robot Settings on Windows

  1. Download the latest Robot Settings version for Windows.

  2. Open the installer from your Downloads directory and follow the installer instructions to finish installing the application.

Next step: Using the Robot Settings Application

 

Clone this wiki locally