From 5f2b5d46d8f0fb88a1ae46477a966f460439af8e Mon Sep 17 00:00:00 2001
From: Zhiying Li <zhiyingli@g.ucla.edu>
Date: Tue, 2 Nov 2021 10:56:27 -0700
Subject: [PATCH] test both greenball detection and AT

---
 Code/Control/Laptop_Code/imageThread_AT_gb.py | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Code/Control/Laptop_Code/imageThread_AT_gb.py

diff --git a/Code/Control/Laptop_Code/imageThread_AT_gb.py b/Code/Control/Laptop_Code/imageThread_AT_gb.py
new file mode 100644
index 0000000..fde64ac
--- /dev/null
+++ b/Code/Control/Laptop_Code/imageThread_AT_gb.py
@@ -0,0 +1,39 @@
+# import sys
+# sys.path.append("../")
+
+from ESP32_AT.imageTread_AT import get_AT_6DOF_info
+
+from constants import *
+import ball_detection.ball_detection as ball_detection
+import cv2
+
+# detector = apriltag.Detector()
+
+
+if __name__ == "__main__":
+    url1 = 'http://192.168.0.230/cam-hi.jpg'
+    url2 = 'http://192.168.0.204/cam-hi.jpg'
+
+
+    tid,tx,ty,tz,rx,ry,rz = 0,0,0,0,0,0,0
+
+    # GB
+    ball_detection.modifyCore()
+    # modelLoc          = './ball_detection/model_weights/'
+    # modelFile         = 'model_weights-2-20210818_002355-cpu.pth'
+    model = ball_detection.returnModel(device, labelSet, modelLoc, modelFile)
+
+    gbx, gby  = -1, -1   # by default (-1 means no found green ball)
+    gb_dist = -1         # by default (-1 means no found green ball)
+
+
+    while True:
+        tid,tx,ty,tz,rx,ry,rz = get_AT_6DOF_info(url1)
+
+        gbx, gby, gb_dist = ball_detection.detectLive(model, minDetectionScore, showSight = True)
+
+        key=cv2.waitKey(5)
+        if key==ord('q'):
+            break
+
+    cv2.destroyAllWindows()
-- 
GitLab