In this tutorial, we will explain how to use Python SDK to access Pepper instead of using Choregraphe. Using Python is one of the easiest ways to program with Pepper.
Python SDK (NAOqi for Python) is the SDK that allows you to control Pepper remotely. By using this SDK and run a Python script on your own PC, you can control Pepper as you wish connecting through the network just like Choregraph.
Python SDK Installation
To use NAOqi for Python, you will first need to install Python 2.7 from http://python.org/download/
For Mac users, make sure to install “Mac OS X 64-bit/32-bit installer” version.
2. NAOqi for Python
Windows: extract pynaoqi-python2.7-2.5.x.x-win32-vs2013.zip
Mac: extract pynaoqi-python-2.7-naoqi-x.x-mac64.tar.gz
You can download the latest release of Python SDK from SoftBank Robotics Community website.
Make sure that your robot is registered on your SoftBank Robotics Community user account, and access the software resources: https://community.aldebaran.com/en/resources/software
3. Set environment variables
Go to Control Panel > System and Security > System
Click the Advanced system settings in the left column
In the System Properties window, click on the Advanced tab, then click the Environment Variables button near the bottom of that tab
In the Environment Variables window, add a new User variable:
5. Checking the installation of the Python SDK
If you do not get any error message, congratulations! You are now ready to use the Python SDK.
Running Python Script
In this tutorial, we will make Pepper speak using the ALTextToSpeech API.
Try to run the following code on Python interpreter:
from naoqi import ALProxy
tts = ALProxy(“ALTextToSpeech”, “(your Pepper’s IP Address)”, 9559)
ALProxy is an object that gives you access to all the methods or the module you are going to connect to.
class ALProxy(name, ip, port)
name – the name of the module
ip – the IP of your robot
port – the port on which NAOqi listens (9559 by default)
Every method of the module is directly accessible through the object.