Fix spidev
This commit is contained in:
parent
eafad7ccdb
commit
ce7094b5cf
2 changed files with 8 additions and 9 deletions
|
@ -21,18 +21,16 @@ Simple Linefollower
|
|||
IRSensor.set(4, True)
|
||||
IRSensor.set(5, True)
|
||||
|
||||
DRIVE_SPEED = 85
|
||||
TURN_SPEED = 50
|
||||
COLOR_BREAK = 750
|
||||
KP = 50.0
|
||||
DRIVE_SPEED = 75
|
||||
COLOR_BREAK = 900
|
||||
KP = 10.0
|
||||
KD = 0.0
|
||||
|
||||
def drive(leftSpeed, rightSpeed):
|
||||
leftSpeed *= -1
|
||||
rightSpeed *= 0.906
|
||||
rightSpeed *= -0.906
|
||||
|
||||
Motor.power(1, min(max(-100, leftSpeed), 100))
|
||||
Motor.power(2, min(max(-100, rightSpeed), 100))
|
||||
Motor.power(1, min(max(-100, rightSpeed), 100))
|
||||
Motor.power(4, min(max(-100, leftSpeed), 100))
|
||||
|
||||
def follow(sleepTime = 0.1):
|
||||
lastError = 0
|
||||
|
@ -58,7 +56,7 @@ Simple Linefollower
|
|||
error = 3
|
||||
elif error == -1.5:
|
||||
error = -3
|
||||
|
||||
|
||||
lastError = error
|
||||
|
||||
adjustment = KP * error + KD * (error - lastError)
|
||||
|
|
Reference in a new issue