import interpreter.interpreter as interp from subprocess import call import sys import IPC from time import sleep is_windows = True if is_windows: # Path for Windows vlc_path = '"C:\Program Files (x86)\VideoLAN\VLC\VLC.exe"' else: # Path for Mac vlc_path = "/Applications/VLC.app/Contents/MacOS/VLC" vm = IPC.process(True, ".\lili-interpreter\LILIExecutor.py") started = False # Changes once it gets start command from master controller r = sr.Recognizer() def runRecognizer(): # Comment out this with block to use standard input instead of speech recognition with sr.Microphone() as source: audio = r.adjust_for_ambient_noise(source, duration=1) r.energy_threshold = 2146 sys.stderr.write("Speak now\n") audio = r.listen(source) sent = "" + r.recognize(audio) # Uncomment this to use standard input instead of speech recognition
import IPC import sys import clr import time sys.path.append("C:\Users\vader\Documents\lssrobotwin32") clr.AddReference('LiliVoiceCommand') import SpeechRecognitionApp as sra commands = ['Lily', 'rightWave', 'leftWave', 'follow', 'stop', 'turnAround', 'quit'] #gesture commands recoged = ['Lily', 'Move right', 'Move left', 'Follow me', 'Stop', 'Turn around', 'Goodbye'] #recognized phrases vm = IPC.process(True, 'VoiceMonitor.py') started = False #changes once it gets start command from master controller Lily = False #user must say Lily before giving a command lilytime = time.time() timeout = time.time() re = sra.Program() engine = re.buildRecognizer() #create Speech Recognition Engine #for now, only used to receive start command def onLineRead(): global started message = vm.line.strip() if message == "start": re.runRecognizer(engine) #start listening started = True #changes to exit first while loop
phrases["unrecognized"] = "I am sorry. I do not know you" phrases["turnAround"] = "I am turning" #set of initial delays delay = {"right": 3} delay["left"] = 3 delay["hello"] = 3 delay["query"] = 3 delay["bye"] = 2 delay["follow"] = 3 delay["stopFollow"] = 3.3 delay["lost"] = 2.5 delay["unrecognized"] = 4 delay["turnAround"] = 3 #set of initial names names = ["Daniel", "Chris", "Cassie"] #initial setup for interprocess communication p = IPC.process(True, "phrasesToSay") p.setOnReadLine(onLineRead) IPC.InitSync() #tell master controller that it is ready to speak p.write('ready\n') #main loop to run and communicate with master controller while True: p.tryReadLine() IPC.Sync()
sys.path.append("C:\Users\chuah\Desktop\Jacob's\LSSRobotWin32") clr.AddReference('LiliVoiceCommand') import SpeechRecognitionApp as sra commands = [ 'Lily', 'rightWave', 'leftWave', 'follow', 'stop', 'turnAround', 'quit', 'storyMode' ] #gesture commands recoged = [ 'Lily', 'Move right', 'Move left', 'Follow me', 'Stop', 'Turn around', 'Goodbye', 'Story mode' ] #recognized phrases vm = IPC.process(True, 'VoiceMonitor.py') started = False #changes once it gets start command from master controller Lily = False #user must say Lily before giving a command lilytime = time.time() timeout = time.time() re = sra.Program() engine = re.buildRecognizer() #create Speech Recognition Engine #for now, only used to receive start command def onLineRead(): global started message = vm.line.strip() if message == "start":
global readyTT global lastMoveTime print "Turn around received" readyTT = False if not r.isbumped(): km.write("sleep\n") sp.write("turnAround\n") r.rotate(np.pi/1.1) #rotate 180 degrees r.setvel(0,0) km.write("wake\n") lastMoveTime = time.time() # How to search for a gesture #open communication to the kinect monitor km = IPC.process(False, 'KinectMonitor.py') #when input from the kinect monitor is received, # add the input to the queue km.setOnReadLine(KinectQueue) # Lily's voice control #open communication to phrasesToSay sp = IPC.process(False, 'phrasesToSay.py') #when input is received from phrasesToSay, #check if the TTS program is ready to receive input sp.setOnReadLine(checkReady) # Open Speech Recognition Control vm = IPC.process(False, 'VoiceMonitor.py') vm.setOnReadLine(VocalQueue)
global readyTT global lastMoveTime print "Turn around received" readyTT = False if not r.isbumped(): km.write("sleep\n") sp.write("turnAround\n") r.rotate(np.pi/1.1) #rotate 180 degrees r.setvel(0,0) km.write("wake\n") lastMoveTime = time.time() ''' # How to search for a gesture #open communication to the kinect monitor km = IPC.process(False, 'KinectMonitor.py') #when input from the kinect monitor is received, # add the input to the queue km.setOnReadLine(KinectQueue) # Lily's voice control #open communication to phrasesToSay sp = IPC.process(False, 'phrasesToSay.py') #when input is received from phrasesToSay, #check if the TTS program is ready to receive input sp.setOnReadLine(checkReady) # Open Speech Recognition Control vm = IPC.process(False, 'VoiceMonitor.py') vm.setOnReadLine(VocalQueue)