diff --git a/leads_gui/config.py b/leads_gui/config.py index ae45beed..b3488448 100644 --- a/leads_gui/config.py +++ b/leads_gui/config.py @@ -1,7 +1,6 @@ from typing import Any as _Any from leads.config import ConfigTemplate as _ConfigTemplate -from leads_gui.system import get_system_platform class Config(_ConfigTemplate): diff --git a/leads_gui/prototype.py b/leads_gui/prototype.py index 292326a7..dab43fb7 100644 --- a/leads_gui/prototype.py +++ b/leads_gui/prototype.py @@ -1,8 +1,7 @@ from math import lcm as _lcm -from time import sleep as _sleep from typing import Callable as _Callable, Self as _Self, TypeVar as _TypeVar, Generic as _Generic -from customtkinter import CTk as _CTk, CTkBaseClass as _CTkBaseClass, CTkLabel as _CTkLabel +from customtkinter import CTk as _CTk, CTkBaseClass as _CTkBaseClass from leads_gui.runtime import RuntimeData from leads_gui.system import get_system_platform diff --git a/leads_vec/controller.py b/leads_vec/controller.py index 393732f7..ad2cb70e 100644 --- a/leads_vec/controller.py +++ b/leads_vec/controller.py @@ -1,10 +1,10 @@ -from leads import L, device, controller, MAIN_CONTROLLER, get_controller, WHEEL_SPEED_CONTROLLER, THROTTLE_PEDAL, \ - SRWDataContainer, DRWDataContainer, BRAKE_PEDAL, DC_MOTOR_CONTROLLER_A -from leads.config import get_config -from leads_gui import Config +from leads import L, controller, MAIN_CONTROLLER, get_controller, WHEEL_SPEED_CONTROLLER, SRWDataContainer, \ + DRWDataContainer from leads.comm import Callback, Service, ConnectionBase +from leads.config import get_config from leads_arduino import ArduinoMicro -from leads_raspberry_pi import RaspberryPi4B, Pedal, DCMotorController +from leads_gui import Config +from leads_raspberry_pi import RaspberryPi4B config = get_config(Config) BAUD_RATE: int = config.get("baud_rate", 9600) @@ -17,11 +17,8 @@ @controller(MAIN_CONTROLLER) class VeCController(RaspberryPi4B): def read(self) -> SRWDataContainer | DRWDataContainer: - return SRWDataContainer( - *get_controller(WHEEL_SPEED_CONTROLLER).read() - ) if config.srw_mode else DRWDataContainer( - *get_controller(WHEEL_SPEED_CONTROLLER).read() - ) + r = get_controller(WHEEL_SPEED_CONTROLLER).read() + return SRWDataContainer(*r) if config.srw_mode else DRWDataContainer(*r) class WheelSpeedControllerCallback(Callback): @@ -48,16 +45,16 @@ def read(self) -> [float, float]: return self._wheel_speed, self._wheel_speed -@device((THROTTLE_PEDAL, BRAKE_PEDAL), MAIN_CONTROLLER, [(THROTTLE_PEDAL_PIN, False), (BRAKE_PEDAL_PIN, True)]) -class Pedals(Pedal): - def __init__(self, pin: int, brake: bool) -> None: - super().__init__(pin) - self._brake: bool = brake +# @device((THROTTLE_PEDAL, BRAKE_PEDAL), MAIN_CONTROLLER, [(THROTTLE_PEDAL_PIN, False), (BRAKE_PEDAL_PIN, True)]) +# class Pedals(Pedal): +# def __init__(self, pin: int, brake: bool) -> None: +# super().__init__(pin) +# self._brake: bool = brake -@device(DC_MOTOR_CONTROLLER_A, MAIN_CONTROLLER) -class DriverMotorController(DCMotorController): - pass +# @device(DC_MOTOR_CONTROLLER_A, MAIN_CONTROLLER) +# class DriverMotorController(DCMotorController): +# pass _ = None # null export diff --git a/leads_vec_rc/cli.py b/leads_vec_rc/cli.py index 6321a295..55c4bae1 100644 --- a/leads_vec_rc/cli.py +++ b/leads_vec_rc/cli.py @@ -6,9 +6,8 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware -from leads import L -from leads.config import * from leads.comm import * +from leads.config import * from leads.data_persistence import * from leads_gui import *