Merge remote-tracking branch 'origin/master'

This commit is contained in:
cdeyw
2024-12-17 22:50:28 +08:00
5 changed files with 20 additions and 5 deletions

View File

@ -20,7 +20,9 @@ class Detect:
if self.detect_status == DetectStatus.DNone:
return
if self.detect_status == DetectStatus.DDetect:
if Constant.Debug:
self.detect_status = DetectStatus.DOk
return
_, img, xyz, uvw, points = self.detection.get_position(Point_isVision=False, Box_isPoint=True,
First_Depth=True, Iter_Max_Pixel=30,
save_img_point=0, Height_reduce=30, width_reduce=30)

View File

@ -188,13 +188,19 @@ class Feeding(QObject):
self.pos_near_index = -1
self.catch = Catch(self.robotClient)
self.detect = Detect(self.detection)
self.detect_thread_img = threading.Thread(target=self.detect.run)
self.detect_thread_img.start()
self.is_detected = True
self.detect_thread = threading.Thread(target=self.run_detect)
self.detect_thread.start()
pass
def init_detection_image(self):
self.detection_image = cv2.imread(Constant.feed_sign_path)
def run_detect(self):
while self.is_detected:
self.detect.run()
time.sleep(0.02)
def run(self):
self.catch.run()
# 获取事件坐标
@ -298,6 +304,11 @@ class Feeding(QObject):
if self.detect.detect_status == DetectStatus.DNone:
self.detect.detect_status = DetectStatus.DDetect
elif self.detect.detect_status == DetectStatus.DOk:
if Constant.Debug:
self.detect.detect_status = DetectStatus.DNone
self.feedConfig.feedLine.set_take_position(real_position)
self.next_position()
if self.detect.detect_position != None:
log.log_message(logging.INFO, Constant.str_feed_takePhoto_success)
self.feedConfig.feedLine.set_take_position(self.detect.detect_position)

View File

@ -1,6 +1,6 @@
import os
Debug = True
Debug = False
IO_EmergencyPoint = 3
bag_height = 10 # 一袋的高度
position_accuracy = 0.1

View File

@ -47,7 +47,7 @@ photo_v5 = 0.0
photo_w5 = 1.0
linecount = 2
remain_linename = 1
remain_count = 574
remain_count = 1
io_take_addr = 8
io_zip_addr = 11
io_shake_addr = 12

View File

@ -1935,6 +1935,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def closeEvent(self, event):
self.record_remain_num()
self.feeding.is_detected = False
self.feeding.detect_thread.join()
self.detection.release()
self.thread_signal = False
self.robotClient.close()