From 8766dceb9d133cbb199d36922b69f4e4cafc7b31 Mon Sep 17 00:00:00 2001 From: ATATC Date: Sat, 28 Sep 2024 16:37:28 -0400 Subject: [PATCH] Using linear acceleration. (#403) --- leads_vec/devices.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/leads_vec/devices.py b/leads_vec/devices.py index da2e74b..f35bb79 100644 --- a/leads_vec/devices.py +++ b/leads_vec/devices.py @@ -5,7 +5,7 @@ ConcurrentOdometer, LEFT_INDICATOR, RIGHT_INDICATOR, VOLTAGE_SENSOR, DataContainer, has_device, \ FRONT_VIEW_CAMERA, LEFT_VIEW_CAMERA, RIGHT_VIEW_CAMERA, REAR_VIEW_CAMERA, VisualDataContainer, BRAKE_INDICATOR, \ SFT, read_device_marker, has_controller, POWER_CONTROLLER, WHEEL_SPEED_CONTROLLER, ACCELEROMETER -from leads_arduino import ArduinoMicro, WheelSpeedSensor, VoltageSensor, Accelerometer +from leads_arduino import ArduinoMicro, WheelSpeedSensor, VoltageSensor, Accelerometer, Acceleration from leads_gpio import NMEAGPSReceiver, LEDGroup, LED, LEDGroupCommand, LEDCommand, Entire, Transition from leads_vec.config import Config from leads_video import Base64Camera, get_camera @@ -144,12 +144,16 @@ def initialize(self, *parent_tags: str) -> None: @device(ACCELEROMETER, WHEEL_SPEED_CONTROLLER) -class Accele(Accelerometer): +class LinearAccelerometer(Accelerometer): @override def initialize(self, *parent_tags: str) -> None: mark_device(self, "WSC", "ESC") super().initialize(*parent_tags) + @override + def read(self) -> Acceleration: + return super().read().linear() + @device(GPS_RECEIVER, MAIN_CONTROLLER, (GPS_RECEIVER_PORT,)) class GPS(NMEAGPSReceiver):