Compare commits
2 Commits
a56c4621a0
...
04c1f51b88
Author | SHA1 | Date |
---|---|---|
Siwat Sirichai | 04c1f51b88 | |
Siwat Sirichai | 01cb139802 |
|
@ -79,7 +79,7 @@ def getLaneCurve(img, display = 2):
|
|||
|
||||
if __name__ == '__main__':
|
||||
cap = cv2.VideoCapture(0)
|
||||
initialTrackBarVals = [96, 139, 48, 218]
|
||||
initialTrackBarVals = [96, 139, 15, 218]
|
||||
utils.initializeTrackbars(initialTrackBarVals)
|
||||
frameCounter = 0
|
||||
curveList = []
|
||||
|
|
|
@ -88,6 +88,22 @@ class motion:
|
|||
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, lm_speed)
|
||||
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, rm_speed)
|
||||
|
||||
def skt_drive(self, speed: float, turn: float, t=0):
|
||||
speed *=100
|
||||
turn *=100
|
||||
leftSpeed = speed - turn
|
||||
rightSpeed = speed + turn
|
||||
if leftSpeed>100: leftSpeed=100
|
||||
elif leftSpeed<-100: leftSpeed= -100
|
||||
if rightSpeed>100: rightSpeed=100
|
||||
elif rightSpeed<-100: rightSpeed= -100
|
||||
|
||||
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, speed)
|
||||
self.motor_write(MOTOR_FR_F, MOTOR_FR_R, speed)
|
||||
self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
||||
self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
|
||||
|
||||
|
||||
def stop(self):
|
||||
self.leds.set_left_signal_led(False)
|
||||
self.leds.set_right_signal_led(False)
|
||||
|
|
Loading…
Reference in New Issue