Started working on planets.py, fixed and imroved functions in wheel.py

This commit is contained in:
d3rped 2018-03-19 10:14:42 +01:00
parent 284edb9e0a
commit 068208bed8
3 changed files with 10 additions and 5 deletions

View File

@ -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()

View File

@ -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:
"""

View File

@ -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