Exemplo n.º 1
0
def main():
    '''main'''
    driver = driver_ins1000.RoverDriver()
    rover_log = RoverLogApp()
    driver.set_app(rover_log)
    while True:
        try:
            driver.reinit()
            if not driver.find_device():
                break # exit when user trigger KeyboardInterrupt.
        except KeyboardInterrupt:  # response for KeyboardInterrupt such as Ctrl+C
            print('User stop this program by KeyboardInterrupt! File:[{0}], Line:[{1}]'.format(__file__, sys._getframe().f_lineno))
            break
        if not driver.start_collection():
            break
Exemplo n.º 2
0
    except KeyboardInterrupt:  # response for KeyboardInterrupt such as Ctrl+C
        print(
            'User stop this program by KeyboardInterrupt! File:[{0}], Line:[{1}]'
            .format(__file__,
                    sys._getframe().f_lineno))
        os._exit(1)
    except Exception as e:
        print(e)


if __name__ == '__main__':
    '''main'''
    callback_rate = 1000

    try:
        driver = driver_ins1000.RoverDriver()
        data_receiver = RoverLogApp()
        driver.set_app(data_receiver)
        threading.Thread(target=driver_thread, args=(driver, )).start()
        threading.Thread(target=start_websocket_server, args=()).start()
        while (True):
            time.sleep(1)
    except KeyboardInterrupt:  # response for KeyboardInterrupt such as Ctrl+C
        print(
            'User stop this program by KeyboardInterrupt! File:[{0}], Line:[{1}]'
            .format(__file__,
                    sys._getframe().f_lineno))
        os._exit(1)
    except Exception as e:
        print(e)