Update MainRobotLane.py
Update initailTrackBarVals to MainRobotLane
This commit is contained in:
parent
a4578ed947
commit
30650adec9
|
@ -1,19 +1,25 @@
|
||||||
|
import cv2
|
||||||
from kuukar import kuukar_motion
|
from kuukar.kuukar import kuukar
|
||||||
from LaneDetectionModule import getLaneCurve
|
from LaneDetectionModule import getLaneCurve
|
||||||
|
from utils import initializeTrackbars
|
||||||
import WebcamModule
|
import WebcamModule
|
||||||
|
|
||||||
|
car = kuukar()
|
||||||
|
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
############### MAIN ROBOT LANE ##################
|
############### MAIN ROBOT LANE ##################
|
||||||
##################################################
|
##################################################
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
img = WebcamModule.getImg()
|
img = WebcamModule.getImg()
|
||||||
curveVal= getLaneCurve(img,1)
|
curveVal= getLaneCurve(img,2)
|
||||||
|
|
||||||
sen = 1.3 # SENSITIVITY
|
sen = 1.3 # SENSITIVITY
|
||||||
maxVAl= 0.3 # MAX SPEED
|
maxVAl= 1.0 # MAX SPEED
|
||||||
if curveVal>maxVAl:curveVal = maxVAl
|
if curveVal>maxVAl:curveVal = maxVAl
|
||||||
if curveVal<-maxVAl: curveVal =-maxVAl
|
if curveVal<-maxVAl: curveVal =-maxVAl
|
||||||
#print(curveVal)
|
#print(curveVal)
|
||||||
|
@ -22,10 +28,14 @@ def main():
|
||||||
if curveVal<0.05: curveVal=0
|
if curveVal<0.05: curveVal=0
|
||||||
else:
|
else:
|
||||||
if curveVal>-0.08: curveVal=0
|
if curveVal>-0.08: curveVal=0
|
||||||
motor.move(0.20,-curveVal*sen,0.05)
|
car.motion.skt_drive(0.15,-curveVal*sen,0.05)
|
||||||
|
print(curveVal)
|
||||||
cv2.waitKey(1)
|
cv2.waitKey(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
initialTrackBarVals = [98, 141, 77, 220]
|
||||||
|
initializeTrackbars(initialTrackBarVals)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
main()
|
main()
|
Loading…
Reference in New Issue