-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started: NAO Framework
Author: ancient-sentinel - Last Updated: 11/17/2020
- Installing the Python SDK on Linux | Mac | Windows
- Installing Robot Settings for Linux | Mac | Windows
- Key Concepts
- Python API
- Python SDK Installation Guide | Tutorials | Examples
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:
-
Download the latest release of the NAOqi Python SDK for Linux.
-
Extract the folder to the
Downloads
directory. Rename the extracted folder topynaoqi
at this point if you wish (if you do not rename the folder, simply use the default or your own folder name in place ofpynaoqi
in subsequent instructions). -
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
- From your home directory (you can ensure you are there by running
cd ~
) open your.bashrc
for editing:
nano .bashrc
- 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.
-
Restart your machine and log back in.
-
Open a new Terminal and open IDLE by running:
idle
- 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
In order to install the NAOqi Python SDK on a Mac, perform the following steps:
-
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 useusr/local/bin/python
once you've installed it. -
Restart your Mac and hold down the
Command
+R
keys as it reboots to boot into Recovery Mode. -
Login to your user account, then open Terminal by selecting
Utilities > Terminal
from the title bar menu at the top left of the screen. -
Run the following command:
csrutil disable
-
Restart your Mac again, letting it boot normally. Login again once booted.
-
Download the latest release of the NAOqi Python SDK for Mac.
-
Extract the
.tar
file and move it wherever you would like to keep it on your file system. -
Right click on the NAOqi SDK folder, then press the
Option
key. Click theCopy "lib" as Pathname"
option. -
Open Terminal and look at the top of the window to see if you are running a
bash
orzsh
shell. -
Run the following commands if you are using a
zsh
shell. For abash
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
-
Go to
System Preferences > Security and Privacy
on your Mac and select thePrivacy
tab. Scroll down toDeveloper Tools
and make sure the checkbox next toTerminal
in the list on the right is selected. -
Run the following commands in Terminal to start Python:
cd /
./usr/local/bin/python
- 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.
- Exit Python and close your Terminal window. Repeat steps 2-4, but run the following command instead:
csrutil enable
- 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
<Instructions Needed>
Next step: Installing Robot Settings on Windows
See also "Hello, World!" using Python SDK on Windows, Setup PyCharm on Windows
-
Download the latest Robot Settings version for Linux.
-
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
- Follow the installer instructions to finish installing the application.
Next step: Using the Robot Settings Application
-
Download the latest Robot Settings version for Mac.
-
Open the installer from your
Downloads
directory and follow the installer instructions to finish installing the application.
Next step: Using the Robot Settings Application
-
Download the latest Robot Settings version for Windows.
-
Open the installer from your
Downloads
directory and follow the installer instructions to finish installing the application.
Next step: Using the Robot Settings Application