From 2ab9c7cf821ede016029a40a77a2c13b1b32c7de Mon Sep 17 00:00:00 2001 From: ATATC Date: Sat, 5 Oct 2024 15:01:25 -0400 Subject: [PATCH] Bug fixed: duplicated `linear()` call. (#440) --- leads_arduino/accelerometer.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/leads_arduino/accelerometer.py b/leads_arduino/accelerometer.py index 5433b5f..e05ad98 100644 --- a/leads_arduino/accelerometer.py +++ b/leads_arduino/accelerometer.py @@ -27,8 +27,14 @@ class Acceleration(_Serializable): def linear(self) -> _Self: fg = rotation_matrix(self.yaw, self.pitch, self.roll).T @ _G - return Acceleration(self.yaw, self.pitch, self.roll, self.forward_acceleration + fg[0], - self.lateral_acceleration + fg[1], self.vertical_acceleration - fg[2]) + return LinearAcceleration(self.yaw, self.pitch, self.roll, float(self.forward_acceleration + fg[0]), + float(self.lateral_acceleration + fg[1]), float(self.vertical_acceleration - fg[2])) + + +class LinearAcceleration(Acceleration): + @_override + def linear(self) -> _Self: + return self class Accelerometer(_Device):