From ed3186e001b764fa47bf54e7cf2af9b58b76329f Mon Sep 17 00:00:00 2001 From: ATATC Date: Fri, 16 Feb 2024 02:51:00 -0500 Subject: [PATCH] Updated the process of passing the min speed to the data container because the older method ignores the potential difference between left and right front wheel speeds. Signed-off-by: ATATC --- leads/data.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/leads/data.py b/leads/data.py index 2f56d927..db373f84 100644 --- a/leads/data.py +++ b/leads/data.py @@ -4,9 +4,9 @@ class DataContainer(object, metaclass=_ABCMeta): - def __init__(self, *speeds: int | float) -> None: + def __init__(self, min_speed: int | float) -> None: self._time_stamp: int = int(_time() * 1000) - self.speed: int | float = min(speeds) + self.speed: int | float = min_speed def __str__(self) -> str: return _dumps(self.to_dict()) @@ -49,21 +49,23 @@ def encode(self) -> bytes: class SRWDataContainer(DataContainer): def __init__(self, + min_speed: int | float = 0, front_wheel_speed: int | float = 0, rear_wheel_speed: int | float = 0, ) -> None: - super().__init__(front_wheel_speed, rear_wheel_speed) + super().__init__(min_speed) self.front_wheel_speed: int | float = front_wheel_speed self.rear_wheel_speed: int | float = rear_wheel_speed class DRWDataContainer(DataContainer): def __init__(self, + min_speed: int | float = 0, front_wheel_speed: int | float = 0, left_rear_wheel_speed: int | float = 0, right_rear_wheel_speed: int | float = 0, ) -> None: - super().__init__(front_wheel_speed, left_rear_wheel_speed, left_rear_wheel_speed) + super().__init__(min_speed) self.front_wheel_speed: int | float = front_wheel_speed self.left_rear_wheel_speed: int | float = left_rear_wheel_speed self.right_rear_wheel_speed: int | float = right_rear_wheel_speed