Compare commits
3 Commits
93f09ecbf7
...
f0fed976cf
Author | SHA1 | Date |
---|---|---|
Siwat Sirichai | f0fed976cf | |
Siwat Sirichai | 0fe992396d | |
Siwat Sirichai | 150399d63d |
|
@ -18,7 +18,7 @@ def main():
|
||||||
img = WebcamModule.getImg()
|
img = WebcamModule.getImg()
|
||||||
curveVal= getLaneCurve(img,2)
|
curveVal= getLaneCurve(img,2)
|
||||||
|
|
||||||
sen = 1.3 # SENSITIVITY
|
sen = 0.8 # SENSITIVITY
|
||||||
maxVAl= 1.0 # 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
|
||||||
|
@ -28,13 +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
|
||||||
car.motion.skt_drive(0.15,-curveVal*sen,0.05)
|
car.motion.skt_drive(0.3,-curveVal*sen)
|
||||||
print(curveVal)
|
turn_value = -curveVal*sen
|
||||||
|
print("Curve Value : " + curveVal + "Turn Value : "+ turn_value)
|
||||||
cv2.waitKey(1)
|
cv2.waitKey(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
initialTrackBarVals = [98, 141, 77, 220]
|
initialTrackBarVals = [70, 124, 4, 195]
|
||||||
initializeTrackbars(initialTrackBarVals)
|
initializeTrackbars(initialTrackBarVals)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -134,7 +134,7 @@ class motion:
|
||||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
|
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, abs(rightSpeed))
|
||||||
##self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
##self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
||||||
##self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
|
##self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
|
||||||
|
time.sleep(t)
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
|
|
Loading…
Reference in New Issue