Last active
March 15, 2019 16:02
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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