From eb479df1223a85695c262d3aa0b2e14edb974fc2 Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Wed, 18 Mar 2020 17:01:11 -0500 Subject: [PATCH] small tweaks --- __pycache__/detect.cpython-38.pyc | Bin 4881 -> 4850 bytes control_motor.py | 6 +++--- run_detect.py | 6 ++++-- sort.py | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/__pycache__/detect.cpython-38.pyc b/__pycache__/detect.cpython-38.pyc index ad8d2cc47b1b58412bf79802cfc45447f55e1736..2d326fd9732a1f70a1e4f3ec0ce93f6710f99587 100644 GIT binary patch delta 80 zcmbQJ_DPjDl$V!_0SJ1tisJe<@|p`UvTSx0U}l^gBk0b^J$Z?s*W|B)whA&JHH=)0 fTr4b%e2hGd9E@5(tiUM1sKl(msKh=wOlUU%v_KAq delta 88 zcmeyQI#G=`l$V!_0SNrli{g4V@|p`UN^Eu&U}h94;V$8-VQOYu`40hc}$>i_@% diff --git a/control_motor.py b/control_motor.py index 3546d39..fe4a336 100644 --- a/control_motor.py +++ b/control_motor.py @@ -29,15 +29,15 @@ def goToBin(bin): delay = 0.5 + 0.93 * adjustedBin command = 'G0 X-' command += str(distance) + print("[ INFO ] Sending command to Grbl: " + command) command += '\n' ser.write(b'$X\n') - time.sleep(1) - print("[ INFO ] Sending command to Grbl: " + command) + time.sleep(0.25) ser.write(command.encode('utf-8')) # s.write("$C\n") while True: grbl_out = str(ser.readline().strip()) # Wait for grbl response with carriage return - print(grbl_out.find('error')) + #print(grbl_out.find('error')) if int(grbl_out.find('error')) >= 0 : print("[ EXIT ] Grbl reported an error.") quit() diff --git a/run_detect.py b/run_detect.py index 01dda75..b88ed1f 100644 --- a/run_detect.py +++ b/run_detect.py @@ -47,6 +47,7 @@ else : host = '' # Symbolic name meaning all available interfaces port = 9001 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) #s.setsockopt(s, socket.SOL_SOCKET, socket.SO_REUSEADDR) s.bind((host, port)) print("[ INFO ] TCP stream initialized. Waiting for client...") @@ -80,7 +81,8 @@ else : #print('frame') if x > 1: ret,frame = capture.retrieve() - frame = frame[130:1120, 275:1350] + frame = frame[130:1100, 300:1300] + #frame = frame[170:900, 475:1100] items,output = detect.detect(calibration_width, frame, True, True) cv2.imshow('Item Sorter', output) x = 0 @@ -90,7 +92,7 @@ else : valid = True for item in items: if item != itema: - print("[ INFO ] More than one object present.") + #print("[ INFO ] More than one object present.") valid = False break if valid: diff --git a/sort.py b/sort.py index d17eb3d..0819300 100644 --- a/sort.py +++ b/sort.py @@ -21,8 +21,8 @@ def sort(input): if bins.count(input) == 0: bins.append(input) bin = bins.index(input) - print(str(bins)) - print(bin) + #print(str(bins)) + #print(bin) write(bins) return bin