我正在使用Windows XP机器和Python 2.7上的NAO机器人。Naoqi事件处理10秒延迟
我想检测语音中的标记。整个事情的工作,但不幸的是,我不得不面对现在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)
在这里,我speechEventModule:
from naoqi import ALModule
from naoqi import ALProxy
NAO_IP = "192.168.0.105"
NAO_PORT = 9559
SpeechEventListener = None
leds = None
memory = None
class SpeechEventModule(ALModule):
def __init__(self, name, ext_memory):
ALModule.__init__(self, name)
global memory
memory = ext_memory
global leds
leds = ALProxy("ALLeds",NAO_IP, NAO_PORT)
def onBookmarkDetected(self, key, value, message):
print "Event detected!"
print "Key: ", key
print "Value: " , value
print "Message: " , message
if(value == 1):
global leds
leds.fadeRGB("FaceLeds", 0x00FF0000, 0.2)
if(value == 2):
global leds
leds.fadeRGB("FaceLeds", 0x000000FF, 0.2)
请,不要任何人有同样的问题? 有人可以给我一个建议吗?
在此先感谢!
我可以排除问题,过热 – Ste
你说,它的工作...你有什么修改?可能你所编程的模块需要大量的CPU(在这里,只有你可以知道原因)。开始思考你在开始失败时引入的改变。你可以看到是否是使用ssh连接到机器人并执行'top'命令的CPU问题 – Manuel
Hello Manuel,非常感谢您的回复!是的,它在上周工作,我正在调试,将事件从整个项目中分离出来,以确保解决该问题。这对CPU来说是个好主意,我通过ssh连接到了我的nao,但是没有导致超过10%cpu的进程 - 所以你的建议不是解决方案:(但是thx。你有更多的建议吗? Thx提前我的朋友! – Ste