def robotInit(self): try: ttl = cfg.current_milli_time() cfg.load("ignore") cfgdly = cfg.current_milli_time() - ttl print("Config Load Time: " + str(cfgdly)) except: sys.exit("Robot initialize did not complete successfully.")
def get_m3u8_by_pay(vid): url = "https://api.renrenjiang.cn/api/v3/activities/{0}/stream_url?user_id={1}×tamp={2}" url = url.format(vid, user_id, current_milli_time()) res = session.get(url, headers=head) res = json.loads(res.content) if "status" in res.keys() and res["status"] == 2: hls_url = res["hls_url"] return hls_url return None
def autonomousInit(self): cfg.logger.info("Autonomous.") cfg.rbmotor.set(0) cfg.rfmotor.set(0) cfg.lbmotor.set(0) cfg.lfmotor.set(0) # Yves' autonomous selection. global choice, tempor choice = cfg.autochoice.getSelected() cfg.dash.putData("Autonomous Mode Select", cfg.autochoice) cfg.dash.putNumber("Selection",choice) tempor = cfg.current_milli_time()
def autonomousPeriodic(self): cfg.dash.putData("Autonomous Mode Select", cfg.autochoice) cfg.dash.putNumber("Selection",choice) if choice == 1: if cfg.current_milli_time() <= tempor+2000: cfg.lbmotor.set(0.6) cfg.lfmotor.set(0.6) cfg.rbmotor.set(-0.6) cfg.rfmotor.set(-0.6) else: cfg.lbmotor.set(0) cfg.lfmotor.set(0) cfg.rbmotor.set(0) cfg.rfmotor.set(0) elif choice == 2: pass elif choice == 0: pass else: pass
def teleopPeriodic(self): ttl = cfg.current_milli_time() dr.eStickDrive() ss.stickctrl() dly = cfg.current_milli_time() - ttl print("Teleop Execution Time: " + str(dly))