Skip to content

Instantly share code, notes, and snippets.

@FirefoxMetzger
Last active March 15, 2019 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FirefoxMetzger/629301bd64fa61b59bfa5bb1b1fd137f to your computer and use it in GitHub Desktop.
Save FirefoxMetzger/629301bd64fa61b59bfa5bb1b1fd137f to your computer and use it in GitHub Desktop.
A quick and dirty example on how to use the ALRobotPosture API on a NAO or Pepper robot
from naoqi import ALBroker
from naoqi import ALProxy
# start a local broker that connects to the NAO
robot_ip = "your-ip-here"
myBroker = ALBroker("myBroker", "0.0.0.0", 0, robot_ip, 9559)
# get a handle to the module
posture_proxy = ALProxy("ALRobotPosture")
tts_proxy = ALProxy("ALTextToSpeech")
announcement = "I am in posture {posture}. It is part of {posture_family}."
# list current postures
postures = posture_proxy.getPostureList()
print(postures)
# round-trip through all available postures
for posture in postures:
posture_proxy.goToPosture(posture, 1.0)
posture_family = posture_proxy.getPostureFamily()
# not needed, just for demonstration
posture_name = posture_proxy.getPosture()
tts_proxy.say(announcement.format(posture=posture_name,
posture_family=posture_family))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment