|
|
|
@ -29,6 +29,14 @@ def go():
|
|
|
|
|
#selectedBin = sort.sort(itema)
|
|
|
|
|
#control_motor.goToBin(selectedBin)
|
|
|
|
|
|
|
|
|
|
def sendString(string):
|
|
|
|
|
print("Found " + string)
|
|
|
|
|
try:
|
|
|
|
|
conn.sendall(string.encode('utf-8'))
|
|
|
|
|
except socket.error:
|
|
|
|
|
print("Error Occured.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not video:
|
|
|
|
|
elapsed_time = timeit.timeit(go, number=1)/1
|
|
|
|
|
print(elapsed_time)
|
|
|
|
@ -39,17 +47,21 @@ 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(s, socket.SOL_SOCKET, socket.SO_REUSEADDR)
|
|
|
|
|
s.bind((host, port))
|
|
|
|
|
print("waiting for connection")
|
|
|
|
|
s.listen(1)
|
|
|
|
|
conn, addr = s.accept()
|
|
|
|
|
print('Connected to', addr)
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
time.sleep(2)
|
|
|
|
|
waitForPi = True
|
|
|
|
|
while waitForPi is True:
|
|
|
|
|
try:
|
|
|
|
|
print("waiting for data")
|
|
|
|
|
data = conn.recv(1024)
|
|
|
|
|
if not data: break
|
|
|
|
|
print "Client: "+data
|
|
|
|
|
encoding = 'utf-8'
|
|
|
|
|
print ("Client: "+str(data))
|
|
|
|
|
waitForPi = False
|
|
|
|
|
except socket.error:
|
|
|
|
|
print("Error Occured.")
|
|
|
|
@ -68,6 +80,7 @@ else :
|
|
|
|
|
#print('frame')
|
|
|
|
|
if x > 1:
|
|
|
|
|
ret,frame = capture.retrieve()
|
|
|
|
|
frame = frame[130:1000, 450:1475]
|
|
|
|
|
items,output = detect.detect(calibration_width, frame, True, True)
|
|
|
|
|
cv2.imshow('Item Sorter', output)
|
|
|
|
|
x = 0
|
|
|
|
@ -101,12 +114,6 @@ else :
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
if cv2.waitKey(1)&0xFF == ord('q'):
|
|
|
|
|
s.close()
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
def sendString(string):
|
|
|
|
|
print("Found " + string)
|
|
|
|
|
try:
|
|
|
|
|
conn.sendall(string)
|
|
|
|
|
except socket.error:
|
|
|
|
|
print("Error Occured.")
|
|
|
|
|
break
|