Fixed Error Message output in sensor.py. Added some more Documentation.
This commit is contained in:
parent
0f1b696a20
commit
aca3c3b70f
3 changed files with 28 additions and 24 deletions
|
@ -28,6 +28,9 @@ class Move:
|
||||||
'''
|
'''
|
||||||
uses odometry and the planet object to map edges that are connected to
|
uses odometry and the planet object to map edges that are connected to
|
||||||
current node.
|
current node.
|
||||||
|
|
||||||
|
Use either relative motor pos or timed driving to center on node.
|
||||||
|
Next turn around and detect edges through drops in _sensor.getbrightness()
|
||||||
'''
|
'''
|
||||||
def getstationedges(self):
|
def getstationedges(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -31,6 +31,7 @@ class Planet:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
""" Initializes the data structure """
|
""" Initializes the data structure """
|
||||||
|
self.planetmap = {((0, 0), Direction.NORTH):((0, 1), Direction.SOUTH), "weight":1}
|
||||||
self.target = None
|
self.target = None
|
||||||
|
|
||||||
def add_path(self, start: Tuple[Tuple[int, int], Direction], target: Tuple[Tuple[int, int], Direction], weight: int):
|
def add_path(self, start: Tuple[Tuple[int, int], Direction], target: Tuple[Tuple[int, int], Direction], weight: int):
|
||||||
|
@ -40,7 +41,7 @@ class Planet:
|
||||||
example:
|
example:
|
||||||
add_path(((0, 3), Direction.NORTH), ((0, 3), Direction.WEST), 1)
|
add_path(((0, 3), Direction.NORTH), ((0, 3), Direction.WEST), 1)
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
|
||||||
def get_paths(self) -> Dict[Tuple[int, int], Dict[Direction, Tuple[Tuple[int, int], Direction, Weight]]]:
|
def get_paths(self) -> Dict[Tuple[int, int], Dict[Direction, Tuple[Tuple[int, int], Direction, Weight]]]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -5,8 +5,8 @@ import ev3dev.ev3 as ev3
|
||||||
'''
|
'''
|
||||||
add enum for color definitions (type should be tupel of int's).
|
add enum for color definitions (type should be tupel of int's).
|
||||||
later onwards compare the idividual readouts like this to determine the color:
|
later onwards compare the idividual readouts like this to determine the color:
|
||||||
RED(>90, <40, <25)
|
RED = (>90, <40, <25)
|
||||||
BLUE(<25, >75, >90)
|
BLUE = (<25, >75, >90)
|
||||||
still needs to be tested and implemented
|
still needs to be tested and implemented
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -24,13 +24,13 @@ class Sensor:
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
print("ERROR: incorrect sensor mode:" + self._sensor.mode)
|
print("ERROR: incorrect sensor mode:", self._sensor.mode)
|
||||||
|
|
||||||
def getbrightness(self):
|
def getbrightness(self):
|
||||||
if(self._sensor.mode == 'COL-REFLECT'):
|
if(self._sensor.mode == 'COL-REFLECT'):
|
||||||
return self._sensor.value()
|
return self._sensor.value()
|
||||||
else:
|
else:
|
||||||
print("ERROR: incorrect sensor mode:" + self._sensor.mode)
|
print("ERROR: incorrect sensor mode:", self._sensor.mode)
|
||||||
|
|
||||||
def setmode(self, newmode):
|
def setmode(self, newmode):
|
||||||
self._sensor.mode = newmode
|
self._sensor.mode = newmode
|
||||||
|
|
Loading…
Reference in a new issue