Exemplo n.º 1
0
    def init(self):
        global conversation
        self.detector = None
        self._interrupted = False
        print('''
********************************************************
*          wukong-robot - 中文语音对话机器人           *
*          (c) 2019 潘伟洲 <*****@*****.**>              *
*     https://github.com/wzpan/wukong-robot.git        *
********************************************************

            如需退出,可以按 Ctrl-4 组合键。

''')

        config.init()
        self._i2c = I2c()
        self._i2c.start()
        self._conversation = Conversation(self._i2c, self._profiling)
        self._conversation.say(
            '{} 你好!试试对我喊唤醒词叫醒我吧'.format(config.get('first_name', '主人')), True)
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
Exemplo n.º 2
0
    def init(self):
        global conversation
        self.detector = None
        self._interrupted = False        
        print('''
********************************************************
*          wukong-robot - 中文语音对话机器人           *
*          (c) 2019 潘伟洲 <*****@*****.**>              *
*     https://github.com/wzpan/wukong-robot.git        *
********************************************************

            后台管理端:http://{}:{}
            如需退出,可以按 Ctrl-4 组合键

'''.format(config.get('/server/host', '0.0.0.0'), config.get('/server/port', '5000')))
        config.init()
        self._conversation = Conversation(self._profiling)
        self._conversation.say('{} 你好!试试对我喊唤醒词叫醒我吧'.format(config.get('first_name', '主人')), True)
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
        if config.get('/muse/enable', False):
            self._wakeup = multiprocessing.Event()
            self.bci = BCI.MuseBCI(self._wakeup)
            self.bci.start()
            thread.start_new_thread(self._loop_event, ())
Exemplo n.º 3
0
 def init(self):
     global conversation
     self._interrupted = False
     config.init()
     self._conversation = Conversation()
     self._conversation.say(
         '{} 你好!试试对我喊唤醒词叫醒我吧'.format(config.get('first_name', '主人')), True)
     self._observer = Observer()
     event_handler = ConfigMonitor(self._conversation)
     self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
     self._observer.schedule(event_handler, constants.DATA_PATH, False)
     self._observer.start()
Exemplo n.º 4
0
    def init(self):
        global conversation
        self.detector = None
        self._interrupted = False
        print('''
********************************************************
*          jarvis- 中文语音对话机器人           *
********************************************************
            如需退出,可以按 Ctrl-4 组合键。

''')

        config.init()
        self._conversation = Conversation(self._profiling, wukong=self)
        self._conversation.say_call_back = server.onSay
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
Exemplo n.º 5
0
 def init(self):
     global conversation
     self.detector = None
     self._thinking = False
     self._interrupted = False        
     config.init()
     self._conversation = Conversation(self._profiling)
     self._conversation.say('你好!我叫小布', True)
     self._observer = Observer()
     event_handler = ConfigMonitor(self._conversation)
     self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
     self._observer.schedule(event_handler, constants.DATA_PATH, False)
     self._observer.start()
     if config.get('/LED/enable', False) and config.get('/LED/type') == 'aiy':
         thread.start_new_thread(self._init_aiy_button_event, ())
     if config.get('/muse/enable', False):
         self._wakeup = multiprocessing.Event()
         self.bci = BCI.MuseBCI(self._wakeup)
         self.bci.start()
         thread.start_new_thread(self._loop_event, ())
Exemplo n.º 6
0
    def init(self):
        global conversation
        self.detector = None
        self._interrupted = False
        print('''
********************************************************
*                   中文语音对话机器人                   *
********************************************************
            如需退出,可以按 Ctrl-\ 组合键。
''')

        config.init()
        self._conversation = Conversation(self._profiling)
        self._conversation.say(
            '{},有事叫{}'.format(config.get('first_name', '主人'),
                              config.get('robot_name_cn', '八戒')), True)
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
Exemplo n.º 7
0
    def init(self):
        global conversation
        self.detector = None
        self._interrupted = False
        print('''
*****************************************
*       <中文语音交互导盲机器人>        *
*             by gql                    *
*****************************************
           Exit: ctrl+4
''')

        config.init()
        self._conversation = Conversation(self._profiling)
        self._conversation.say(
            '{} 你好!我是智能导盲机器人,试试对我喊唤醒词叫醒我吧'.format(
                config.get('first_name', '主人')), True)
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
Exemplo n.º 8
0
    def init(self):
        global conversation
        self.detector = None
        self._thinking = False
        self._interrupted = False
        print(
            """
********************************************************
*          wukong-robot - 中文语音对话机器人           *
*          (c) 2019 潘伟洲 <*****@*****.**>              *
*     https://github.com/wzpan/wukong-robot.git        *
********************************************************

            后台管理端:http://{}:{}
            如需退出,可以按 Ctrl-4 组合键

""".format(
                config.get("/server/host", "0.0.0.0"),
                config.get("/server/port", "5000"),
            )
        )
        config.init()
        self._conversation = Conversation(self._profiling)
        self._conversation.say(
            "{} 你好!试试对我喊唤醒词叫醒我吧".format(config.get("first_name", "主人")), True
        )
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
        if config.get("/LED/enable", False) and config.get("/LED/type") == "aiy":
            thread.start_new_thread(self._init_aiy_button_event, ())
        if config.get("/muse/enable", False):
            self._wakeup = multiprocessing.Event()
            self.bci = BCI.MuseBCI(self._wakeup)
            self.bci.start()
            thread.start_new_thread(self._loop_event, ())
Exemplo n.º 9
0
    def init(self):
        global conversation
        self.detector = None
        self._interrupted = False
        print('''
********************************************************
*          xiaoyi-robot - 私人中医宝机器人             *
*                 计算机设计大赛                       *
*                                                      *
********************************************************

            如需退出,可以按 Ctrl-4 组合键。

''')
        
        config.init()
        self._conversation = Conversation()
        self._conversation.say('{} 你好!试试对我喊唤醒词叫醒我吧'.format(config.get('first_name', '主人')), True)
        self._observer = Observer()
        event_handler = ConfigMonitor(self._conversation)
        self._observer.schedule(event_handler, constants.CONFIG_PATH, False)
        self._observer.schedule(event_handler, constants.DATA_PATH, False)
        self._observer.start()
Exemplo n.º 10
0
import sys

import fire

from robot import config
from robot.Conversation import Conversation
from server import server
from wukong import Wukong

wukong = None
conversation = None

if __name__ == '__main__':
    if len(sys.argv) == 1:
        conversation = Conversation(False)
        wukong = Wukong(conversation)
        config.init()

        server.run(conversation, wukong)
        # wukong.run()
    else:
        fire.Fire(Wukong)
Exemplo n.º 11
0
def detectedCallback():
    global conversation
    if conversation:
        conversation.stop()
    Player.player('static/beep_hi.wav', False)

def signal_handler(signal, frame):
    global interrupted
    interrupted = True


def interrupt_callback():
    global interrupted
    return interrupted

conversation = Conversation()
server.run(conversation)
# 更改唤醒词为配置文件中的值,默认为snowboy文件夹中的
model = config.get('/snowboy/hotword','snowboy/resources/jarvis.pmdl')

# capture SIGINT signal, e.g., Ctrl+C
signal.signal(signal.SIGINT, signal_handler)

detector = snowboydecoder.HotwordDetector(model, sensitivity=config.get('/snowboy/sensitivity', 0.38))
print('""""""""""""""""""""""""""""""'
      'robot'
      '"""""""""""""""""""""""""""""""')
# Player.hello()
logger.info('Listening... Press Ctrl+C to exit')