fixed some wrong object/variable names
This commit is contained in:
parent
40c5adfa0b
commit
d268198fa4
1 changed files with 7 additions and 7 deletions
14
src/move.py
14
src/move.py
|
@ -6,7 +6,7 @@ from odometry import Odometry
|
||||||
|
|
||||||
|
|
||||||
class Move:
|
class Move:
|
||||||
def __init__(self, planet):
|
def __init__(self):
|
||||||
try:
|
try:
|
||||||
self._wheel_l = Wheel('outB')
|
self._wheel_l = Wheel('outB')
|
||||||
self._wheel_r = Wheel('outC')
|
self._wheel_r = Wheel('outC')
|
||||||
|
@ -29,16 +29,16 @@ class Move:
|
||||||
|
|
||||||
def calibrateBrightness(self):
|
def calibrateBrightness(self):
|
||||||
i = 0
|
i = 0
|
||||||
self.maxbrightness = self._camera.getbrightness()
|
self.maxbrightness = self._sensor.getbrightness()
|
||||||
self.minbrightness = self._camera.getbrightness()
|
self.minbrightness = self._sensor.getbrightness()
|
||||||
self._wheel_l.speed_set(15)
|
self._wheel_l.speed_set(15)
|
||||||
self._wheel_r.speed_set(-15)
|
self._wheel_r.speed_set(-15)
|
||||||
self._wheel_r.run()
|
self._wheel_r.run()
|
||||||
self._wheel_l.run()
|
self._wheel_l.run()
|
||||||
tempvalue = 0
|
tempvalue = 0
|
||||||
while(i < 500):
|
while(i < 500):
|
||||||
self._camera.refresh()
|
self._sensor.refresh()
|
||||||
tempvalue = self._camera.getbrightness()
|
tempvalue = self._sensor.getbrightness()
|
||||||
if(tempvalue > self.maxbrightness):
|
if(tempvalue > self.maxbrightness):
|
||||||
self.maxbrightness = tempvalue
|
self.maxbrightness = tempvalue
|
||||||
if(tempvalue < self.minbrightness):
|
if(tempvalue < self.minbrightness):
|
||||||
|
@ -47,7 +47,7 @@ class Move:
|
||||||
self._wheel_l.stop()
|
self._wheel_l.stop()
|
||||||
self._wheel_r.stop()
|
self._wheel_r.stop()
|
||||||
self.edgebrightness = (self.maxbrightness + self.minbrightness)//2
|
self.edgebrightness = (self.maxbrightness + self.minbrightness)//2
|
||||||
while(not (self._camera.getbrightness() == self.edgebrightness)):
|
while(not (self._sensor.getbrightness() == self.edgebrightness)):
|
||||||
self._wheel_l.speed_set(15)
|
self._wheel_l.speed_set(15)
|
||||||
self._wheel_r.speed_set(-15)
|
self._wheel_r.speed_set(-15)
|
||||||
self._wheel_l.stop()
|
self._wheel_l.stop()
|
||||||
|
@ -77,7 +77,7 @@ class Move:
|
||||||
self._wheel_l.run()
|
self._wheel_l.run()
|
||||||
self._wheel_r.run()
|
self._wheel_r.run()
|
||||||
|
|
||||||
while (not self._sensor.bumperispressed() and self._sensor.lastcolor == None):
|
while (self._sensor.bumperispressed() is not True and self._sensor.lastcolor is None):
|
||||||
self._camera.refresh()
|
self._camera.refresh()
|
||||||
self._wheel_l.speed_set(self.maxbrightness//2 - self._sensor.getbrightness()//2)
|
self._wheel_l.speed_set(self.maxbrightness//2 - self._sensor.getbrightness()//2)
|
||||||
self._wheel_r.speed_set(self._sensor.getbrightness()//2)
|
self._wheel_r.speed_set(self._sensor.getbrightness()//2)
|
||||||
|
|
Loading…
Reference in a new issue