diff --git a/src/move.py b/src/move.py index a79c8c9..a6e006a 100644 --- a/src/move.py +++ b/src/move.py @@ -33,16 +33,17 @@ class Move: Next turn around and detect edges through drops in _sensor.getbrightness() ''' def getstationedges(self): - pass + self._wheel_l.turnbyamount(500, 250) + self._wheel_r.turnbyamount(-500, 250) def traversetonextstation(self, isknownstation): - self._wheel_l.speed_set = 24 - self._wheel_r.speed_set = 24 + self._wheel_l.speed_set(24) + self._wheel_r.speed_set(24) self._wheel_l.run() self._wheel_r.run() while(self._bumper.value() == False): # this does not work... why? -# self._wheel_l.speed_set(newspeed) +# self._wheel_l.speed_set(ne) # self._wheel_r.speed_set(newspeed) self._wheel_l._motor.duty_cycle_sp = 48 - self._sensor.getbrightness() self._wheel_r._motor.duty_cycle_sp = self._sensor.getbrightness() diff --git a/src/planet.py b/src/planet.py index a97985c..ec8f13c 100644 --- a/src/planet.py +++ b/src/planet.py @@ -30,6 +30,7 @@ Node checking: Simplify this for node search: next(x for (x, y), direction in planetmap[0]) next(y for x, y in planetmap[0] if x == (0, 0)) +planetmap[0][next((x, y) for x, y in planetmap[0] if y == 'North')] ''' class Planet: """ diff --git a/src/wheel.py b/src/wheel.py index 90ab41a..1362308 100644 --- a/src/wheel.py +++ b/src/wheel.py @@ -21,7 +21,10 @@ class Wheel: def speed_mod(self, modifier): self._motor.duty_cycle_sp = self._motor.duty_cycle_sp + modifier + def turnbyamount(self, posdif, speed): + self._motor.run_to_rel_pos(position_sp=posdif, speed_sp=speed) + def getmovement(self): self.position = self._motor.position - self._motor.position = 0 + self._motor.position = self._motor.position - self.position return self.position