-
Notifications
You must be signed in to change notification settings - Fork 1
"Hello, World!" using Python SDK
Author: ancient-sentinel - Last Updated: 11/17/2020
For instructions on connecting to the robot and getting its IP address see Using the Robot Settings Application.
<Instructions Pending>
See also Installing the NAO Python SDK on Linux, Setup PyCharm on Linux
For instructions on connecting to the robot and getting its IP address see Using the Robot Settings Application.
Once you have the IP address of the robot, open Terminal and run the following commands (assuming you followed the installation tutorial).
- Go to your root directory and open a new Python IDLE window:
cd /
./usr/local/bin/python -m idlelib.idle
- In IDLE, import the NAO SDK:
import naoqiIf you don't get any errors from running this command, proceed to the next step. If you get an error saying that the naoqi module cannot be found, run the following commands to see your environment variables:
import os
print(os.environ)If the values for PYTHONPATH, DYLD_LIBRARY_PATH, and QI_SDK_PREFIX don't point to the location of the Python SDK in your file system, close IDLE and redo steps 2-4 from the installation guide to set your environment variables, then start at step 1 again.
- Import the
ALProxymodule:
from naoqi import ALProxy- Connect to the
ALTextToSpeechmodule:
tts = ALProxy("ALTextToSpeech", "<IP of your robot>", 9559)- Make the robot say "Hello world!":
tts.say("Hello, world!")- Connect to the
ALMotionmodule:
motion = ALProxy("ALMotion", "<IP of your robot>", 9559)- Walk forward half a meter:
motion.moveInit()
motion.moveTo(0.5, 0, 0)See also Installing the NAO Python SDK on Mac, Setup PyCharm on Mac
For instructions on connecting to the robot and getting its IP address see Using the Robot Settings Application.
<Instructions Needed>
See also Installing the NAO Python SDK on Windows, Setup PyCharm on Windows