如何检查Pepper目前是否在说话

时间:2017-11-21 09:50:25

标签: python nao-robot pepper

如果当前机器人正在讲话,是否有办法接收信息。 我查看了ALDialog和ALTextToSpeech API,但找不到任何有用的东西。

我正在寻找类似ALDialog.isSpeaking()的东西,如果Pepper目前正在说某些内容,则返回'True',如果他在方法调用时没有说话,则返回'False'。

2 个答案:

答案 0 :(得分:3)

在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

答案 1 :(得分:0)

我也在寻找像你描述的方法,但没有找到任何方法。 我做了一个解决方法,检查扬声器是否正在播放。那就是说,播放音乐等等。

# 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