aboutsummaryrefslogtreecommitdiff
path: root/nicla/road.py
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2023-06-07 11:21:19 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2023-06-07 11:21:19 +0200
commitb62bcc004fc0dd3d53fbbaf02d3af516b7cb47e0 (patch)
treef084614790096f95d9dce8c30e9b5729dc2e3632 /nicla/road.py
parent051f0284c9895282205632087a2de6d163073cee (diff)
integration
Diffstat (limited to 'nicla/road.py')
-rw-r--r--nicla/road.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/nicla/road.py b/nicla/road.py
index 27101ea..5e5e1de 100644
--- a/nicla/road.py
+++ b/nicla/road.py
@@ -26,7 +26,6 @@ points = [(STRETCH, HORIZON),
(-SQUEEZE, HEIGHT-1)]
def drive(driveImg):
- img = driveImg.copy()
img.to_grayscale()
img.replace(vflip=True, hmirror=True)
img.rotation_corr(corners=points)
@@ -50,23 +49,24 @@ def drive(driveImg):
print(avg)
steerByte = int((avg + 1.0) * (DUI_CMD_STEER_END - DUI_CMD_STEER_START) / 2 + DUI_CMD_STEER_START)
uart.uart_buffer(steerByte)
- sensor.dealloc_extra_fb()
-count = 0
+
+
+speed = signs_detect.init_kpts("speed")
+stop = signs_detect.init_kpts("stop")
+car = signs_detect.init_kpts("image")
while(True):
- if count == 0:
- count = count + 1
- speed = signs_detect.init_kpts("speed")
- #stop = signs_detect.init_kpts("stop")
- #car = signs_detect.init_kpts("image")
- else:
+
img = sensor.snapshot()
data = traffic_light.traf_lights(img)
if data is not None:
uart.uart_buffer(data)
- #data_sign = signs_detect.sign_detection(img)
- #if data_sign is not None:
- #uart.uart_buffer(data_sign)
- drive(img)
+ sign_img = sensor.snapshot()
+ data_sign = signs_detect.sign_detection(sign_img)
+ if data_sign is not None:
+ uart.uart_buffer(data_sign)
+
+ drive_img = sensor.snapshot()
+ drive(drive_img)
#uart.uart_buffer(DUI_CMD_SPEED_END)