Skip to content

Commit

Permalink
Code reformatted.
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Feb 27, 2024
1 parent 9f05978 commit ad3a24f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions leads/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def to_dict(self) -> dict:


class DataContainer(Serializable, metaclass=_ABCMeta):
def __init__(self, min_speed: float, voltage: float) -> None:
def __init__(self, voltage: float, min_speed: float) -> None:
self._time_stamp: int = int(_time() * 1000)
self.speed: float = min_speed
self.voltage: float = voltage
self.speed: float = min_speed

@_override
def __str__(self) -> str:
Expand Down Expand Up @@ -59,23 +59,23 @@ def encode(self) -> bytes:

class SRWDataContainer(DataContainer):
def __init__(self,
min_speed: float = 0,
voltage: float = 0,
min_speed: float = 0,
front_wheel_speed: float = 0,
rear_wheel_speed: float = 0) -> None:
super().__init__(min_speed, voltage)
super().__init__(voltage, min_speed)
self.front_wheel_speed: float = front_wheel_speed
self.rear_wheel_speed: float = rear_wheel_speed


class DRWDataContainer(DataContainer):
def __init__(self,
min_speed: float = 0,
voltage: float = 0,
min_speed: float = 0,
front_wheel_speed: float = 0,
left_rear_wheel_speed: float = 0,
right_rear_wheel_speed: float = 0) -> None:
super().__init__(min_speed, voltage)
super().__init__(voltage, min_speed)
self.front_wheel_speed: float = front_wheel_speed
self.left_rear_wheel_speed: float = left_rear_wheel_speed
self.right_rear_wheel_speed: float = right_rear_wheel_speed
16 changes: 8 additions & 8 deletions leads_emulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ def generate_rear_wheel_speed(self, front_wheel_speed: float) -> float:
class SRWRandom(_EmulatedController):
@_override
def read(self) -> _SRWDataContainer:
return _SRWDataContainer(fws := _randint(self.minimum, self.maximum),
voltage=48.0,
return _SRWDataContainer(voltage=48.0,
min_speed=(fws := _randint(self.minimum, self.maximum)),
front_wheel_speed=fws,
rear_wheel_speed=self.generate_rear_wheel_speed(fws))


class DRWRandom(_EmulatedController):
@_override
def read(self) -> _DRWDataContainer:
return _DRWDataContainer(fws := _randint(self.minimum, self.maximum),
voltage=48.0,
return _DRWDataContainer(voltage=48.0,
min_speed=(fws := _randint(self.minimum, self.maximum)),
front_wheel_speed=fws,
left_rear_wheel_speed=(rws := self.generate_rear_wheel_speed(fws)),
right_rear_wheel_speed=rws)
Expand All @@ -56,8 +56,8 @@ class SRWSin(_SinController):
@_override
def read(self) -> _SRWDataContainer:
try:
return _SRWDataContainer(fws := (_sin(self.counter) + .5) * self.magnitude + self.offset,
voltage=48.0,
return _SRWDataContainer(voltage=48.0,
min_speed=(fws := (_sin(self.counter) + .5) * self.magnitude + self.offset),
front_wheel_speed=fws,
rear_wheel_speed=self.generate_rear_wheel_speed(fws))
finally:
Expand All @@ -68,8 +68,8 @@ class DRWSin(_SinController):
@_override
def read(self) -> _DRWDataContainer:
try:
return _DRWDataContainer(fws := (_sin(self.counter) + .5) * self.magnitude + self.offset,
voltage=48.0,
return _DRWDataContainer(voltage=48.0,
min_speed=(fws := (_sin(self.counter) + .5) * self.magnitude + self.offset),
front_wheel_speed=fws,
left_rear_wheel_speed=(rws := self.generate_rear_wheel_speed(fws)),
right_rear_wheel_speed=rws)
Expand Down

0 comments on commit ad3a24f

Please sign in to comment.