Skip to content

Commit

Permalink
Updated the process of passing the min speed to the data container be…
Browse files Browse the repository at this point in the history
…cause the older method ignores the potential difference between left and right front wheel speeds.

Signed-off-by: ATATC <[email protected]>
  • Loading branch information
ATATC committed Feb 16, 2024
1 parent 84f9d6b commit ed3186e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions leads/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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

0 comments on commit ed3186e

Please sign in to comment.