I am working with a NAO-robot on a Windows-XP machine and Python 2.7.
I want to detect markers in speech. The whole thing worked, but unfortunately I have to face now a 10 Secounds delay and my events aren't detected (the callback function isnt invoked).
First, my main-function:
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)
And here my 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)
Please, do anybody have the same problem?
Can anybody give me an advice?
Thanks in advance!