-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMainRobot.py
More file actions
30 lines (24 loc) · 775 Bytes
/
MainRobot.py
File metadata and controls
30 lines (24 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from MotorModule import Motor
from LaneDetectionModule import getLaneCurve
import WebcamModule
##################################################
motor = Motor(2,3,4,17,22,27)
##################################################
def main():
img = WebcamModule.getImg()
curveVal= getLaneCurve(img,1)
sen = 1.3 # SENSITIVITY ie. toggle the impact of curve from here
maxVAl= 0.3 # MAX SPEED of the motor
if curveVal>maxVAl:curveVal = maxVAl
if curveVal<-maxVAl: curveVal =-maxVAl
#print(curveVal)
if curveVal>0:
sen =1.7
if curveVal<0.05: curveVal=0
else:
if curveVal>-0.08: curveVal=0
motor.move(0.20,-curveVal*sen,0.05)
#cv2.waitKey(1)
if __name__ == '__main__':
while True:
main()