Compare commits
No commits in common. "a9f099b8cad5b4e03658de7abc15289fc62b6642" and "3154e334e3342d218775e260bf685527d094dbc5" have entirely different histories.
a9f099b8ca
...
3154e334e3
|
@ -1,27 +0,0 @@
|
|||
import pygame
|
||||
|
||||
def init():
|
||||
pygame.init()
|
||||
win = pygame.display.set_mode((100,100))
|
||||
|
||||
def getKey(keyName):
|
||||
ans = False
|
||||
for eve in pygame.event.get():pass
|
||||
keyInput = pygame.key.get_pressed()
|
||||
myKey = getattr(pygame,'K_{}'.format(keyName))
|
||||
if keyInput [myKey]:
|
||||
ans = True
|
||||
pygame.display.update()
|
||||
|
||||
return ans
|
||||
|
||||
def main():
|
||||
if getKey('LEFT'):
|
||||
print('Key Left was pressed')
|
||||
if getKey('RIGHT'):
|
||||
print('Key Right was pressed')
|
||||
|
||||
if __name__ == '__main__':
|
||||
init()
|
||||
while True:
|
||||
main()
|
|
@ -30,7 +30,7 @@ def main():
|
|||
if curveVal>-0.08: curveVal=0
|
||||
car.motion.skt_drive(0.4,-curveVal*sen,0.05)
|
||||
turn_value = -curveVal*sen
|
||||
print("Curve Value : " + str(curveVal) + " Turn Value : "+ str(round(turn_value,2))
|
||||
print("Curve Value : " + str(curveVal) + "Turn Value : "+ str(turn_value))
|
||||
cv2.waitKey(1)
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
from kuukar.kuukar import kuukar
|
||||
import KeyPressModule as kp
|
||||
|
||||
car = kuukar()
|
||||
kp.init()
|
||||
|
||||
def main(self):
|
||||
|
||||
if kp.getKey('UP'):
|
||||
car.motion.skt_drive(0.4,0.0,0.05)
|
||||
elif kp.getKey('DOWN'):
|
||||
car.motion.skt_drive(-0.4,0.0,0.05)
|
||||
elif kp.getKey('LEFT'):
|
||||
car.motion.skt_drive(0.5,0.3,0.05)
|
||||
elif kp.getKey('RIGHT'):
|
||||
car.motion.skt_drive(0.5,-0.3,0.05)
|
||||
else:
|
||||
car.motion.stop()
|
||||
|
||||
if __name__ == '__main__':
|
||||
while True:
|
||||
main()
|
|
@ -16,7 +16,7 @@ class cv:
|
|||
def _cv_loop(self):
|
||||
while True:
|
||||
img = self.capture_image()
|
||||
##stop_sign = self.detect_sign(img)
|
||||
stop_sign = self.detect_sign(img)
|
||||
|
||||
def get_road_curve(self, frame):
|
||||
pass
|
||||
|
|
|
@ -132,8 +132,8 @@ class motion:
|
|||
|
||||
self.motor_write(MOTOR_FL_F, MOTOR_FL_R, abs(leftSpeed))
|
||||
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_RR_F, MOTOR_RR_R, speed)
|
||||
##self.motor_write(MOTOR_RL_F, MOTOR_RL_R, speed)
|
||||
##self.motor_write(MOTOR_RR_F, MOTOR_RR_R, speed)
|
||||
time.sleep(t)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue