如果当前机器人正在说话,是否有办法接收信息。我查看了 ALDialog 和 ALTextToSpeech API,但找不到任何有用的东西。
我正在寻找类似的东西ALDialog.isSpeaking()
,如果 Pepper 当前正在说某事,则返回“True”,如果他在方法调用时没有说话,则返回“False”。
您可以在 ALMemory 中订阅各种信息,为您提供有关说话的信息,甚至更准确地说:当前说的是哪个单词...
JVoyage [0] ~ $ qicli call ALMemory.getDataList ALTextToSpeech
["ALTextToSpeech/CurrentSentence","ALTextToSpeech/PositionOfCurrentWord",
"ALTextToSpeech/CurrentBookMark","ALTextToSpeech/TextStarted","ALTextToSpeech/TextDone",
"ALTextToSpeech/Status","ALTextToSpeech/CurrentWord","ALTextToSpeech/TextInterrupted"]
更多详情:http ://doc.aldebaran.com/2-1/naoqi/audio/altexttospeech-api.html#ALTextToSpeech/Status
我也在寻找您描述的方法,但没有找到。我做了一个解决方法,我检查扬声器是否正在播放。那就是说话,播放音乐等。
# initialize
self.boolSpeakersPlaying = True
self.audioDevice = self.session.service("ALAudioDevice")
self.signalID = self.audioDevice.speakersPlaying.connect(self.signalReceived)
#main
def signalReceived(self, arg):
self.logger.info("signal changed to = " + str(arg))
self.boolSpeakersPlaying = arg
def spam(self):
if not self.boolSpeakersPlaying:
#do something