def setup(): global R R = Robot.setup() R.init() set_time(R.usbkey) logger = setup_logger(R.usbkey) logger.info('Battery Voltage: %.2f' % R.power.battery.voltage) R.wait_start() try: io = IOInterface(R) except: logger.exception("IOInterface could not initialize") raise return logger, io, R.zone
def setup(): # A bad way to detect whether running in simulator if sys.platform.startswith('win'): ### SIMULATOR ONLY ### SRBot.zone, SRBot.sim = getInfo() # I made this to make simlator work srBot = SRBot.setup() srBot.init() set_time(srBot.usbkey) logger = setup_logger(srBot.usbkey) logger.info('Battery Voltage: %.2f' % (srBot.power.battery.voltage)) srBot.wait_start() try: from main import Robot robot = Robot(srBot) except: logger.exception("Robot could not initialize") raise return robot, srBot.zone