我在windowsxp和python2.7上使用NAO机器人。在
我想检测言语中的标记。整个过程都成功了,但不幸的是我现在不得不面对10秒的延迟,我的事件没有被检测到(回调函数没有被调用)。在
首先,我的主要功能:
from naoqi import ALProxy, ALBroker
from speechEventModule import SpeechEventModule
myString = "Put that \\mrk=1\\ there."
NAO_IP = "192.168.0.105"
NAO_PORT = 9559
memory = ALProxy("ALMemory", NAO_IP, NAO_PORT)
tts = ALProxy("ALTextToSpeech", NAO_IP, NAO_PORT)
tts.enableNotifications()
myBroker = ALBroker("myBroker",
"0.0.0.0", # listen to anyone
0, # find a free port and use it
NAO_IP, # parent broker IP
NAO_PORT) # parent broker port
global SpeechEventListener
SpeechEventListener = SpeechEventModule("SpeechEventListener", memory)
memory.subscribeToEvent("ALTextToSpeech/CurrentBookMark", "SpeechEventListener", "onBookmarkDetected")
tts.say(initialString)
这里是我的演讲事件模块:
^{pr2}$拜托,有人有同样的问题吗? 谁能给我个建议吗?在
提前谢谢!在
也许您应该尝试手动绑定回调,方法是:
这是我在一些编排框中使用回调时所做的。在
您正在订阅模块外的事件。如果我没有错,你必须在
__init__
方法中执行它。在不管怎样,检查一下你的主函数是否一直在运行(如果你捕捉到键盘中断的话会更好),否则你的程序会在他捕捉到任何关键字之前结束。在
^{pr2}$看看this tutorial,可能会有帮助。在
下面是一个更新的Naoqi版本的实现方法:
相关问题 更多 >
编程相关推荐