mash-sensor-tof-pc/src/sensors/tof_sensor.py

32 lines
804 B
Python
Raw Normal View History

2021-10-06 21:43:18 +02:00
from enum import Enum
class Directions(str, Enum):
2021-10-07 01:37:48 +02:00
INSIDE = "indoor"
OUTSIDE = "outdoor"
2022-09-14 00:15:37 +02:00
def other(direction: "Directions") -> "Directions":
2021-10-07 01:37:48 +02:00
if direction is Directions.INSIDE:
return Directions.OUTSIDE
else:
return Directions.INSIDE
2021-10-07 12:39:09 +02:00
def __iter__():
return [Directions.INSIDE, Directions.OUTSIDE]
2021-10-06 21:43:18 +02:00
class ToFSensor:
2021-10-07 01:37:48 +02:00
def open(self) -> None:
2021-10-06 21:43:18 +02:00
raise NotImplementedError()
2021-10-07 01:37:48 +02:00
def setDirection(self, direction: Directions) -> None:
2022-09-14 00:15:37 +02:00
"""Configure sensor to pick up the distance in a specific direction."""
2021-10-06 21:43:18 +02:00
raise NotImplementedError()
def getDistance(self) -> float:
2022-09-14 00:15:37 +02:00
"""Returns new distance in cm."""
2021-10-06 21:43:18 +02:00
raise NotImplementedError()
2021-10-07 01:37:48 +02:00
def close(self) -> None:
2021-10-06 21:43:18 +02:00
raise NotImplementedError()