Personal tools
You are here: Home → Comp 388 / 488 Robotics → Course Materials → Example NAO Software Projects → Python Program to Run on NAO
Document Actions

Python Program to Run on NAO

by Dr. William L. Honig — last modified 2013-02-22 04:17 PM

Create a standalone Python program without using Choregraphe. Runs as Python 2.7 code. You must install the Python SDK.

Click here to get the file

Size 1 kB - File type text/python-source

File 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" )))


    
    


    


« October 2027
Su Mo Tu We Th Fr Sa
12
3456789
10111213141516
17181920212223
24252627282930
31
 

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: