From a731988c6afb146e11c6d2cb48a1d7ffa9b21e07 Mon Sep 17 00:00:00 2001
From: Zhaoliang <zhz03@g.ucla.edu>
Date: Sun, 7 Nov 2021 17:27:26 -0800
Subject: [PATCH] upload the new test function

---
 Code/Control/Laptop_Code/main_keyboard.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/Code/Control/Laptop_Code/main_keyboard.py b/Code/Control/Laptop_Code/main_keyboard.py
index 98281b3..606537b 100644
--- a/Code/Control/Laptop_Code/main_keyboard.py
+++ b/Code/Control/Laptop_Code/main_keyboard.py
@@ -8,7 +8,7 @@ from constants import *
 from ESP32_AT.imageTread_AT import get_AT_6DOF_info
 
 global ml,esp_cam_on,openmv_on
-ml = 0
+ml = 1
 esp_cam_on = 1
 openmv_on = 0
 seekVertDir = 1
@@ -655,19 +655,23 @@ def get_altitude_from_AT(AT_h,ty):
 
 
 def test_function():
-    url = 'http://192.168.0.230/cam-hi.jpg'
-    tid, tx, ty, tz, rx, ry, rz = get_AT_6DOF_info(url)
+    url_AT = 'http://10.0.0.4/cam-hi.jpg'  # 6
+    url_gb = 'http://10.0.0.5/cam-hi.jpg'  # 1
+
+    tid, tx, ty, tz, rx, ry, rz = get_AT_6DOF_info(url_AT)
+    gbx, gby, gb_dist = ball_detection.detectLive(url_gb, model, minDetectionScore, showSight=True)
+
     print("testing new function")
     print("-----------------------")
     print("tid:{}".format(tid))
     print("tx,ty,tz:{},{},{}".format(tx,ty,tz))
     print("rx,ry,rz:{},{},{}".format(rx,ry,rz))
-
-
+    print("gbx,gby,gb_dist:{},{},{}".format(gbx,gby,gb_dist))
 
 def test_function1():
     url = 'http://192.168.0.230/cam-hi.jpg'
     tid, tx, ty, tz, rx, ry, rz = get_AT_6DOF_info(url)
+
     print("testing new function")
     print("-----------------------")
     print("tid:{}".format(tid))
@@ -700,7 +704,7 @@ def manual_ballcapture(bcap_man):
 if __name__ == '__main__':
     # =========== SET UP ============
     # Defining Variables for ESP 32 Serial I/O
-    PORT = "COM9" # for Alienware
+    PORT = "COM4" # for Alienware
     serial_port = serial.Serial(PORT, 115200)
     serial_port.close()
     serial_port.open()
-- 
GitLab