def main():
    #We need to initalize ROS environment for AICoRE to connect
    ROSEnvironment()
    #Initalize AICoRe client
    client = AICoRE()
    #Set up client name
    client.setUserName('Jacob')

    #Initalize speeech recogniton
    r = sr.Recognizer()
    #Initalize mic
    #TODO set the microphone index
    mic = sr.Microphone(device_index=11)
    print("start talking")
    with mic as source:
        #adjust for noise
        r.adjust_for_ambient_noise(source)
        #listen to source
        audio = r.listen(source)
    #convert audio to text
    text = r.recognize_google(audio)
    #send text to client
    client.send(text)
    #get answer from AICoRe
    answer = client.answer()

    #creates speech from text
    tts = gTTS(answer)
    #saves the answer to mp3 file
    tts.save('answer.mp3')
    #plays the mp3
    playsound.playsound('answer.mp3')
def main():
    #We need to initalize ROS environment for AICoRE to connect
    ROSEnvironment()
    #initalize aicore client
    client = AICoRE()

    # set username
    client.setUserName('Jacob')

    # send text to AICORE
    client.send('What is my favorite food?')

    # get answer from AICORE
    text = client.answer()
def main():
    #We need to initalize ROS environment for AICoRE to connect
    ROSEnvironment()

    # Start robot
    robot = Robot()
    robot.start()

    #Initalize AICoRe client
    client = AICoRE()


    #TODO: Set up client name
    client.setUserName('username')

    #Initalize speeech recogniton
    r = sr.Recognizer()

    #List all the microphone hardware
    for i, item in enumerate(sr.Microphone.list_microphone_names()):
        print( i, item)

    #TODO: Initalize mic and set the device_index
    mic = sr.Microphone(device_index=7)

    print "I'm listening "

    with mic as source:
        r.adjust_for_ambient_noise(source)
        audio = r.listen(source)
    text = r.recognize_google(audio)

    client.send(text)
    answer = client.answer()

    tts = gTTS(answer)
    tts.save('answer.mp3')
    playsound.playsound('answer.mp3')

    #TODO: check if 'yes' in voice input
    if in answer.lower():
        #TODO: robot should nod

    #TODO: check if 'no' in voice input
    elif  in answer.lower():
Example #4
0
def main():
    #We need to initalize ROS environment for AICoRE to connect
    ROSEnvironment()
    #Initalize AICoRe client
    client = AICoRE()

    #TODO: Set up client name
    client.setUserName('username')

    #Initalize speeech recogniton
    r = sr.Recognizer()

    #List all the microphone hardware
    for i, item in enumerate(sr.Microphone.list_microphone_names()):
        print( i, item)

    #TODO: Initalize mic and set the device_index
    mic = sr.Microphone(device_index=1)

    print "I'm listening"

    with mic as source:
        r.adjust_for_ambient_noise(source)
        audio = r.listen(source)
    text = r.recognize_google(audio)

    client.send(text)
    answer = client.answer()

    #TODO:set the keyword to respond to
    keyword = 
    #check if keyword in input
    if keyword.lower() in text.lower():
        #TODO: set a response
        answer = 

    tts = gTTS(answer)
    tts.save('hello.mp3')
    playsound.playsound('hello.mp3')
def main():
    #We need to initalize ROS environment for AICoRE to connect
    ROSEnvironment()
    #Initalize AICoRe client
    client = AICoRE()

    #TODO: Set up client name
    client.setUserName('username')

    #Initalize speeech recogniton
    r = sr.Recognizer()

    #List all the microphone hardware
    for i, item in enumerate(sr.Microphone.list_microphone_names()):
        print( i, item)

    #TODO: Initalize mic and set the device_index
    mic = sr.Microphone(device_index=11)
    with mic as source:
        #TODO: adjust for noise
        r.adjust_for_ambient_noise(source)
        #TODO: listen to source
        audio = r.listen(source)
    #TODO: convert audio to text
    text = r.recognize_google(audio)

    #TODO: send text to client
    client.send(text)
    #TODO: get answer from AICoRe
    answer = client.answer()

    #TODO: Convert text to speech
    tts = gTTS(answer)
    #TODO: Save TTS result
    tts.save('answer.mp3')
    #TODO: Play TTS
    playsound.playsound('answer.mp3')