def enter_mode(mode): logging.debug('entering mode: %s' % mode) if mode not in _mode_mapping: logging.error('unrecognized mode %s' % mode) mode_command = _mode_mapping[mode] if mode_command: send_command('mode_%s' % mode_command) set_current_controller(mode)
if '--debug' in sys.argv: com.debug = True # TODO set log level to logging.DEBUG # setup server sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(('', 1337)) sock.listen(0) if vr_available and '--no-vr' not in sys.argv: vr = VoiceRecognition() vr.start() # default mode set_current_controller(ObjectController) if '-i' in sys.argv or '--interactive' in sys.argv: t = threading.Thread(target=run_server) t.daemon = True try: t.start() try: exit_cmd = 'exit' print 'Kill server and exit with "%s"' % exit_cmd while True: cmd = raw_input('(speak) ').strip().lower() if not cmd: pass elif cmd == exit_cmd: break