diff --git a/Code/Control/Laptop_Code/main_keyboard.py b/Code/Control/Laptop_Code/main_keyboard.py index 184a14f7cefcb2ca3ab35cf95d25c00ae608d75d..082339b37fd4611c7786df0961cfb5f7f3644361 100644 --- a/Code/Control/Laptop_Code/main_keyboard.py +++ b/Code/Control/Laptop_Code/main_keyboard.py @@ -1,13 +1,17 @@ import time import serial -import ball_detection.ball_detection as ball_detection + import simple_pid.PID as PID import timeit import pygame from constants import * +from ESP32_AT.imageTread_AT import get_AT_6DOF_info global ml -ml = 1 +ml = 0 +if ml == 1: + import ball_detection.ball_detection as ball_detection + # ========= Serial Port I/O =========== def serial_port_in(serial_port): @@ -480,6 +484,16 @@ def decode_ctl(Ctl_com): dir3 = Ctl_com[6] dir4 = Ctl_com[7] return pwm1, pwm2, pwm3, pwm4, dir1, dir2, dir3, dir4 + +def test_function(): + url = 'http://192.168.1.118/cam-hi.jpg' + tid, tx, ty, tz, rx, ry, rz = get_AT_6DOF_info(url) + 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)) + # ===== Main Function ===== if __name__ == '__main__': # =========== SET UP ============ @@ -550,6 +564,12 @@ if __name__ == '__main__': flag = 0 print_count = 1 + elif get_key('t'): + flag = 4 + while (flag == 4): + test_function() + flag, print_count = keyboard_stop(flag, print_count) + elif get_key('k'): break