small tweaks

video
Cole Deck 4 years ago
parent 4eac873412
commit eb479df122

Binary file not shown.

@ -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()

@ -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:

@ -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

Loading…
Cancel
Save