我尝试使用http://doc.aldebaran.com/2-5/naoqi/audio/alaudioplayer-api.html的一些方法
但是终端告诉我,它们中的大多数都不起作用。
# -*- encoding: UTF-8 -*-
import sys
import time
from naoqi import *
IP = "127.0.0.1"
PORT = 9559
try:
aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
print "Could not create proxy to ALAudioPlayer"
print "Error was: ",e
sys.exit(1)
#this line works. I can hear the music
fileId = aup.post.playFile("C:\VALIDPATH.wav")
#does not show most of the methods
print(aup.getMethodList())
time.sleep(1)
#this line does not work
currentPos = aup.getCurrentPosition(fileId)
输出 :
['isStatsEnabled','enableStats','stats','clearStats','isTraceEnabled','enableTrace','exit','__pCall','pCall','version','ping',getMethodList','getMethodHelp '、'getModuleHelp'、'wait'、'isRunning'、'stop'、'getBrokerName'、'getUsage'、'playFile'、'playFileInLoop'、'playFileFromPosition'、'pause']
回溯(最后一次调用):文件“fggfgf.py”,第 27 行,在 currentPos = aup.getCurrentPosition(fileId) 文件“C:\Python27\lib\site-packages\naoqi.py”,第 301 行,调用中 回归自我。Wrapped .method_missing(self.method , *args, **kwargs) File "C:\Python27\lib\site-packages\naoqi.py", line 371, in method_missing raise e RuntimeError: ALAudioPlayer::getCurrentPosition Can't find方法:getCurrentPosition(解析为'(i)')