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

34 lines
815 B
Python
Raw Normal View History

2021-10-06 21:43:18 +02:00
from enum import Enum
2021-10-07 01:37:48 +02:00
class Directions(Enum):
INSIDE = "indoor"
OUTSIDE = "outdoor"
2021-10-07 12:39:09 +02:00
def other(direction: 'Direction') -> 'Direction':
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:
2021-10-06 21:43:18 +02:00
"""Configure sensor to pick up the distance in a specific direction.
"""
raise NotImplementedError()
def getDistance(self) -> float:
"""Returns new distance in cm.
"""
raise NotImplementedError()
2021-10-07 01:37:48 +02:00
def close(self) -> None:
2021-10-06 21:43:18 +02:00
raise NotImplementedError()