small tweaks
This commit is contained in:
parent
4eac873412
commit
eb479df122
Binary file not shown.
@ -29,15 +29,15 @@ def goToBin(bin):
|
|||||||
delay = 0.5 + 0.93 * adjustedBin
|
delay = 0.5 + 0.93 * adjustedBin
|
||||||
command = 'G0 X-'
|
command = 'G0 X-'
|
||||||
command += str(distance)
|
command += str(distance)
|
||||||
|
print("[ INFO ] Sending command to Grbl: " + command)
|
||||||
command += '\n'
|
command += '\n'
|
||||||
ser.write(b'$X\n')
|
ser.write(b'$X\n')
|
||||||
time.sleep(1)
|
time.sleep(0.25)
|
||||||
print("[ INFO ] Sending command to Grbl: " + command)
|
|
||||||
ser.write(command.encode('utf-8'))
|
ser.write(command.encode('utf-8'))
|
||||||
# s.write("$C\n")
|
# s.write("$C\n")
|
||||||
while True:
|
while True:
|
||||||
grbl_out = str(ser.readline().strip()) # Wait for grbl response with carriage return
|
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 :
|
if int(grbl_out.find('error')) >= 0 :
|
||||||
print("[ EXIT ] Grbl reported an error.")
|
print("[ EXIT ] Grbl reported an error.")
|
||||||
quit()
|
quit()
|
||||||
|
@ -47,6 +47,7 @@ else :
|
|||||||
host = '' # Symbolic name meaning all available interfaces
|
host = '' # Symbolic name meaning all available interfaces
|
||||||
port = 9001 # Arbitrary non-privileged port
|
port = 9001 # Arbitrary non-privileged port
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
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.setsockopt(s, socket.SOL_SOCKET, socket.SO_REUSEADDR)
|
||||||
s.bind((host, port))
|
s.bind((host, port))
|
||||||
print("[ INFO ] TCP stream initialized. Waiting for client...")
|
print("[ INFO ] TCP stream initialized. Waiting for client...")
|
||||||
@ -80,7 +81,8 @@ else :
|
|||||||
#print('frame')
|
#print('frame')
|
||||||
if x > 1:
|
if x > 1:
|
||||||
ret,frame = capture.retrieve()
|
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)
|
items,output = detect.detect(calibration_width, frame, True, True)
|
||||||
cv2.imshow('Item Sorter', output)
|
cv2.imshow('Item Sorter', output)
|
||||||
x = 0
|
x = 0
|
||||||
@ -90,7 +92,7 @@ else :
|
|||||||
valid = True
|
valid = True
|
||||||
for item in items:
|
for item in items:
|
||||||
if item != itema:
|
if item != itema:
|
||||||
print("[ INFO ] More than one object present.")
|
#print("[ INFO ] More than one object present.")
|
||||||
valid = False
|
valid = False
|
||||||
break
|
break
|
||||||
if valid:
|
if valid:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user