Python Program to Run on NAO
Create a standalone Python program without using Choregraphe. Runs as Python 2.7 code. You must install the Python SDK.
Size 1 kB - File type text/python-sourceFile contents
from naoqi import ALProxy
IP = "10.33.6.52" #our real Nao
#IP = "nao.local"
#IP = "HP-3.nao.local"
#IP = "127.0.0.1" #nao.local via loopback it seems
PORT = 9559
def hello():
tts = ALProxy("ALTextToSpeech",IP, PORT)
tts.say("Hello, world!")
def areYouNao():
loggerProxy = ALProxy("ALLogger", IP, PORT)
loggerProxy.info("Python", "it works")
def readALM():
loggerProxy = ALProxy("ALLogger", IP, PORT)
alMemoryProxy = ALProxy("ALMemory", IP, PORT)
loggerProxy.info("Python>readALM", str(alMemoryProxy.getData( "FrontTactilTouched" )) )
#print means to IDLE window, not to log
print( "Value is: " + str(alMemoryProxy.getData( "FrontTactilTouched" )))
loggerProxy.info("Python>readALM", str(alMemoryProxy.getData( "RightBumperPressed" )) )
print( "Value is: " + str(alMemoryProxy.getData( "RightBumperPressed" )))
Click here to get the file