def init_motors(): dagor_motors.init() dagor_motors.require_stopped('ha') dagor_motors.require_stopped('de') dagor_motors.enable('ha') dagor_motors.enable('de') dagor_motors.set_speed('ha', 0) dagor_motors.set_speed('de', 0)
def reset(): global current_speed r.color_mapping.clear() r.vote_count.clear() r.left.clear() r.right.clear() r.state["last-left-count-upon-action"] = 0 r.state["last-right-count-upon-action"] = 0 r.state["current-position"] = position_default r.redis_conn.delete("status-lock") motors.init() motors.barrel_rotation_off() motors.turn_motors_on() current_speed = default_speed motors.set_speed(current_speed) return "reset"
def slow(): global current_speed current_speed = max(SPEED_MIN, current_speed - 1) motors.set_speed(current_speed)
def fast(): global current_speed current_speed = min(SPEED_MAX, current_speed + 1) motors.set_speed(current_speed)
def _loop_apply_speeds(self): if not self.config['tracking']: self.current['ha_speed'] = 0 self.current['de_speed'] = 0 dagor_motors.set_speed('ha', self.current['ha_speed']) dagor_motors.set_speed('de', self.current['de_speed'])