Skip to content

Commit

Permalink
Fixing #20.
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Dec 31, 2023
1 parent 9038fdd commit a61d255
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions leads/controller/controller.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import abstractmethod as _abstractmethod, ABCMeta as _ABCMeta
from typing import TypeVar as _TypeVar, Generic as _Generic
from typing import TypeVar as _TypeVar, Generic as _Generic, Any as _Any

from leads.controller.device import Device

Expand All @@ -19,5 +19,8 @@ def device(self, tag: str) -> [Device]:
return self._devices[tag]

@_abstractmethod
def collect_all(self) -> T:
def read(self) -> T:
raise NotImplementedError

def write(self, payload: _Any) -> None:
raise NotImplementedError
2 changes: 1 addition & 1 deletion leads_dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize(window: Window,
window.runtime_data().frame_counter = 0

def on_refresh(_):
leads.push(main_controller.collect_all())
leads.push(main_controller.read())
leads.update()

window.set_on_refresh(on_refresh)
Expand Down
8 changes: 4 additions & 4 deletions leads_emulation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ def generate_rear_wheel_speed(self, front_wheel_speed: int | float) -> int | flo


class SRWRandom(_EmulatedController):
def collect_all(self) -> _SRWDataContainer:
def read(self) -> _SRWDataContainer:
return _SRWDataContainer(fws := _randint(self.minimum, self.maximum), self.generate_rear_wheel_speed(fws))


class DRWRandom(_EmulatedController):
def collect_all(self) -> _DRWDataContainer:
def read(self) -> _DRWDataContainer:
return _DRWDataContainer(fws := _randint(self.minimum, self.maximum),
rws := self.generate_rear_wheel_speed(fws),
rws)
Expand All @@ -48,7 +48,7 @@ def __init__(self,


class SRWSin(_SinController):
def collect_all(self) -> _SRWDataContainer:
def read(self) -> _SRWDataContainer:
try:
return _SRWDataContainer(fws := (_sin(self.counter) + .5) * self.magnitude + self.offset,
self.generate_rear_wheel_speed(fws))
Expand All @@ -57,7 +57,7 @@ def collect_all(self) -> _SRWDataContainer:


class DRWSin(_SinController):
def collect_all(self) -> _DRWDataContainer:
def read(self) -> _DRWDataContainer:
try:
return _DRWDataContainer(fws := (_sin(self.counter) + .5) * self.magnitude + self.offset,
rws := self.generate_rear_wheel_speed(fws),
Expand Down
2 changes: 1 addition & 1 deletion leads_raspberry_pi/raspberry_pi_4b.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class RaspberryPi4B(_Controller):
def collect_all(self) -> T:
def read(self) -> T:
return None

0 comments on commit a61d255

Please sign in to comment.