update 更新设定

This commit is contained in:
FrankCV2048
2024-12-17 19:56:40 +08:00
parent cc8f2e483c
commit 4dbf8d4cf3
5 changed files with 20 additions and 5 deletions

View File

@ -20,7 +20,9 @@ class Detect:
if self.detect_status == DetectStatus.DNone: if self.detect_status == DetectStatus.DNone:
return return
if self.detect_status == DetectStatus.DDetect: 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, _, img, xyz, uvw, points = self.detection.get_position(Point_isVision=False, Box_isPoint=True,
First_Depth=True, Iter_Max_Pixel=30, First_Depth=True, Iter_Max_Pixel=30,
save_img_point=0, Height_reduce=30, width_reduce=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.pos_near_index = -1
self.catch = Catch(self.robotClient) self.catch = Catch(self.robotClient)
self.detect = Detect(self.detection) self.detect = Detect(self.detection)
self.detect_thread_img = threading.Thread(target=self.detect.run) self.is_detected = True
self.detect_thread_img.start() self.detect_thread = threading.Thread(target=self.run_detect)
self.detect_thread.start()
pass pass
def init_detection_image(self): def init_detection_image(self):
self.detection_image = cv2.imread(Constant.feed_sign_path) 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): def run(self):
self.catch.run() self.catch.run()
# 获取事件坐标 # 获取事件坐标
@ -298,6 +304,11 @@ class Feeding(QObject):
if self.detect.detect_status == DetectStatus.DNone: if self.detect.detect_status == DetectStatus.DNone:
self.detect.detect_status = DetectStatus.DDetect self.detect.detect_status = DetectStatus.DDetect
elif self.detect.detect_status == DetectStatus.DOk: 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: if self.detect.detect_position != None:
log.log_message(logging.INFO, Constant.str_feed_takePhoto_success) log.log_message(logging.INFO, Constant.str_feed_takePhoto_success)
self.feedConfig.feedLine.set_take_position(self.detect.detect_position) self.feedConfig.feedLine.set_take_position(self.detect.detect_position)

View File

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

View File

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

View File

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