Skip to content

Commit

Permalink
Bug fixed: duplicated linear() call. (#440)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Oct 5, 2024
1 parent 2ab9c7c commit 8b67f79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions leads_arduino/accelerometer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ class Acceleration(_Serializable):
lateral_acceleration: float
vertical_acceleration: float

def is_linear(self) -> bool:
return isinstance(self, _LinearAcceleration)

def linear(self) -> _Self:
fg = rotation_matrix(self.yaw, self.pitch, self.roll).T @ _G
return LinearAcceleration(self.yaw, self.pitch, self.roll, float(self.forward_acceleration + fg[0]),
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):
class _LinearAcceleration(Acceleration):
@_override
def linear(self) -> _Self:
return self
Expand Down

0 comments on commit 8b67f79

Please sign in to comment.