update 完成点位控制逻辑,UI可视化界面生成
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import logging
|
||||
from enum import Enum
|
||||
from turtle import Turtle
|
||||
|
||||
from numpy.array_api import trunc
|
||||
@ -9,6 +10,9 @@ import queue
|
||||
import json
|
||||
from Model.RobotModel import DataAddress,DATARequest,DATAReply
|
||||
from Util.util_log import log
|
||||
class DetectType(Enum):
|
||||
EyeOnHand = 0
|
||||
EyeOutHand = 1
|
||||
|
||||
class RobotClient(TCPClient):
|
||||
|
||||
@ -22,6 +26,7 @@ class RobotClient(TCPClient):
|
||||
self.time_delay_take= time_delay_take
|
||||
self.time_delay_put = time_delay_put
|
||||
self.time_delay_shake = time_delay_shake
|
||||
self.type_detection = DetectType.EyeOnHand
|
||||
def add_sendQuene(self,command): #后面 命令分等级,紧急命令直接执行
|
||||
self.command_quene.put(command)
|
||||
|
||||
@ -89,6 +94,9 @@ class RobotClient(TCPClient):
|
||||
log.log_message(logging.ERROR,f'{e}')
|
||||
raise
|
||||
|
||||
def get_origin_position(self):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
187
CU/Feeding_C.py
187
CU/Feeding_C.py
@ -8,7 +8,7 @@ import Constant
|
||||
import Expection
|
||||
from Model.Position import Real_Position, Detection_Position
|
||||
from enum import Enum, IntEnum
|
||||
from COM.COM_Robot import RobotClient
|
||||
from COM.COM_Robot import RobotClient, DetectType
|
||||
from Model.RobotModel import CMDInstructRequest, MoveType
|
||||
from Util.util_time import CRisOrFall
|
||||
from Vision.camera_coordinate_dete import Detection
|
||||
@ -30,6 +30,13 @@ class FeedStatus(IntEnum):
|
||||
FShake = 8
|
||||
FDropBag = 9
|
||||
FFinished = 10
|
||||
FReverse = 11
|
||||
FStartReverse = 12
|
||||
|
||||
class FeedMidStatus(Enum):
|
||||
FMid_Start = 1
|
||||
FMid_Take = 2
|
||||
FMid_Feed= 3
|
||||
|
||||
class FeedPosition:
|
||||
def __init__(self,status:FeedStatus,position:Real_Position):
|
||||
@ -46,22 +53,52 @@ class FeedLine:
|
||||
self.id = id
|
||||
self.get_position_list()
|
||||
|
||||
def get_current_position(self):
|
||||
def get_current_feed_position(self):
|
||||
pos = self.feeding_to_end[self.feeding2end_pos_index]
|
||||
return pos
|
||||
def get_next_feed_position(self):
|
||||
pos = self.feeding_to_end[self.feeding2end_pos_index]
|
||||
self.feeding2end_pos_index += 1
|
||||
return pos
|
||||
|
||||
def get_next_start_position(self):
|
||||
pos = self.origin2start_pos_index[self.origin2start_pos_index]
|
||||
self.origin2start_pos_index += 1
|
||||
return pos
|
||||
|
||||
def get_next_take_position(self):
|
||||
def get_current_take_position(self):
|
||||
pos = self.start2take_pos_index[self.start2take_pos_index]
|
||||
return pos
|
||||
def get_current_start_position(self):
|
||||
pos = self.origin2start_pos_index[self.origin2start_pos_index]
|
||||
return pos
|
||||
|
||||
def get_next_feed_position(self,reverse:bool=False):
|
||||
pos = self.feeding_to_end[self.feeding2end_pos_index]
|
||||
if reverse:
|
||||
self.feeding2end_pos_index -= 1
|
||||
if self.feeding2end_pos_index < 0:
|
||||
self.feeding2end_pos_index = len(self.feeding_to_end) - 1
|
||||
else:
|
||||
self.feeding2end_pos_index += 1
|
||||
if self.feeding2end_pos_index >= len(self.feeding_to_end):
|
||||
self.feeding2end_pos_index = 0
|
||||
return pos
|
||||
|
||||
|
||||
def get_next_start_position(self,reverse:bool=False):
|
||||
pos = self.origin2start_pos_index[self.origin2start_pos_index]
|
||||
if reverse:
|
||||
self.origin2start_pos_index -= 1
|
||||
if self.origin2start_pos_index < 0:
|
||||
self.origin2start_pos_index = len(self.origin2start_pos) - 1
|
||||
else:
|
||||
self.origin2start_pos_index += 1
|
||||
if self.origin2start_pos_index >= len(self.origin2start_pos):
|
||||
self.origin2start_pos_index = 0
|
||||
|
||||
return pos
|
||||
|
||||
def get_next_take_position(self,reverse:bool=False):
|
||||
pos = self.start2take_pos_index[self.start2take_pos_index]
|
||||
if reverse:
|
||||
self.start2take_pos_index -= 1
|
||||
if self.start2take_pos_index < 0:
|
||||
self.start2take_pos_index = len(self.start2take_pos) - 1
|
||||
else:
|
||||
self.start2take_pos_index += 1
|
||||
if self.start2take_pos_index >= len(self.start2take_pos):
|
||||
self.start2take_pos_index = 0
|
||||
return pos
|
||||
|
||||
def get_take_position(self):
|
||||
@ -81,7 +118,7 @@ class FeedLine:
|
||||
index_start = i
|
||||
break
|
||||
for i in range(len(self.feed_positions)):
|
||||
if self.feed_positions[i].status == FeedStatus.FTake:
|
||||
if self.feed_positions[i].status == FeedStatus.FPhoto:
|
||||
index_take = i
|
||||
|
||||
self.origin_to_start = self.feed_positions[: index_start+1]
|
||||
@ -116,7 +153,8 @@ class Feeding:
|
||||
self.init_detection_image()
|
||||
self.pause = False
|
||||
self.cRis_photo = CRisOrFall()
|
||||
|
||||
self.feed_Mid_Status = FeedMidStatus.FMid_Start
|
||||
self.is_reverse = False
|
||||
pass
|
||||
|
||||
def init_detection_image(self):
|
||||
@ -140,17 +178,11 @@ class Feeding:
|
||||
|
||||
if self.feedConfig == None:
|
||||
self.feedStatus = FeedStatus.FNone
|
||||
elif self.feedConfig.num == 0:
|
||||
elif self.feedConfig.num == 0 and self.feedStatus!=FeedStatus.FReverse:
|
||||
self.feedStatus = FeedStatus.FNone
|
||||
|
||||
if self.feedStatus == FeedStatus.FNone or self.pause:
|
||||
return
|
||||
|
||||
|
||||
elif self.feedStatus == FeedStatus.FStart:
|
||||
log.log_message(logging.INFO, Constant.str_feed_start)
|
||||
self.feedStatus = FeedStatus.FCheck if self.feedStatus != FeedStatus.FNone else FeedStatus.FNone
|
||||
pass
|
||||
elif self.feedStatus == FeedStatus.FCheck:
|
||||
log.log_message(logging.INFO, Constant.str_feed_check)
|
||||
# 1, 检查是否是三列
|
||||
@ -158,21 +190,51 @@ class Feeding:
|
||||
# if self.safe_check_columns() and self.safe_check_person():
|
||||
# pass
|
||||
# else:
|
||||
if self.feedConfig.num != 0:
|
||||
self.next_target()
|
||||
# if self.feedConfig.num != 0:
|
||||
# self.next_target()
|
||||
# if == 原点 继续判断
|
||||
# else:
|
||||
# QMessageBox.information(None, "提示", Constant.str_feed_safe_error_msgbox)
|
||||
if self.is_reverse:
|
||||
self.feed_Mid_Status = FeedMidStatus.FMid_Start
|
||||
else:
|
||||
self.feed_Mid_Status = FeedMidStatus.FMid_Take
|
||||
self.next_position(self.is_reverse)
|
||||
|
||||
elif self.feedStatus == FeedStatus.FStart:
|
||||
log.log_message(logging.INFO, Constant.str_feed_start)
|
||||
if not self.robotClient.get_origin_position().compare(real_position) and not self.is_reverse:
|
||||
QMessageBox.information(None, "提示", Constant.str_feed_start_error)
|
||||
self.feedStatus = FeedStatus.FNone
|
||||
if self.is_reverse and self.robotClient.get_origin_position().compare(real_position):
|
||||
self.feedStatus = FeedStatus.FNone
|
||||
self.is_reverse = False
|
||||
|
||||
self.feed_Mid_Status = FeedMidStatus.FMid_Start
|
||||
self.next_position(self.is_reverse)
|
||||
|
||||
|
||||
elif self.feedStatus == FeedStatus.FMid:
|
||||
log.log_message(logging.INFO, Constant.str_feed_mid)
|
||||
feed_pos = self.feedConfig.feedLine.get_current_position()
|
||||
feed_pos = self.get_current_position()
|
||||
if feed_pos.position.compare(real_position):
|
||||
self.next_target()
|
||||
self.next_position(self.is_reverse)
|
||||
|
||||
|
||||
|
||||
elif self.feedStatus == FeedStatus.FPhoto:
|
||||
log.log_message(logging.INFO, Constant.str_feed_photo)
|
||||
if self.feedConfig.num == 0:
|
||||
log.log_message(logging.INFO, Constant.str_feed_finish)
|
||||
self.is_reverse = True
|
||||
self.FeedMid_Status = FeedMidStatus.FMid_Take
|
||||
self.next_position(self.is_reverse)
|
||||
return
|
||||
|
||||
if self.robotClient.type_detection == DetectType.EyeOutHand:
|
||||
self.feed_Mid_Status = FeedMidStatus.FMid_Feed
|
||||
self.next_position()
|
||||
return
|
||||
detect_pos_list = []
|
||||
if not Constant.Debug:
|
||||
try:
|
||||
@ -197,7 +259,7 @@ class Feeding:
|
||||
from Trace.handeye_calibration import R_matrix, getPosition
|
||||
rotation = R_matrix(self.robotClient.status_model.world_0,
|
||||
self.robotClient.status_model.world_1,
|
||||
self.robotClient.status_model.world_2 - 10, # TODO 这个10 需要确定
|
||||
self.robotClient.status_model.world_2,
|
||||
self.robotClient.status_model.world_3,
|
||||
self.robotClient.status_model.world_4,
|
||||
self.robotClient.status_model.world_5)
|
||||
@ -231,66 +293,67 @@ class Feeding:
|
||||
log.log_message(logging.INFO, Constant.str_feed_takePhoto_line)
|
||||
|
||||
self.feedConfig.feedLine.set_take_position(take_position) ##TODO 检查有没有异常
|
||||
self.next_target()
|
||||
self.next_position()
|
||||
except:
|
||||
log.log_message(logging.ERROR, Constant.str_feed_takePhoto_fail)
|
||||
self.error_photo_count += 1
|
||||
else:
|
||||
self.feedConfig.feedLine.set_take_position(real_position) ##TODO 检查有没有异常
|
||||
self.next_target()
|
||||
self.next_position()
|
||||
log.log_message(logging.INFO, Constant.str_feed_takePhoto_move)
|
||||
|
||||
elif self.feedStatus == FeedStatus.FTake:
|
||||
log.log_message(logging.INFO, Constant.str_feed_take)
|
||||
if self.feedConfig.feedLine.take_position != None and self.feedConfig.feedLine.get_current_position().compare(
|
||||
real_position):
|
||||
if self.feedConfig.feedLine.get_take_position() != None:
|
||||
if self.feedConfig.feedLine.get_take_position().compare(real_position):
|
||||
# 打开吸嘴并返回
|
||||
self.sendIOControl(self.robotClient.con_ios[0], 1)
|
||||
self.sendIOControl(self.robotClient.con_ios[1], 1)
|
||||
self.sendIOControl(self.robotClient.con_ios[2], 1)
|
||||
|
||||
# TODO 检测是否通 不然报警
|
||||
|
||||
self.feedConfig.feedLine.set_take_position(None)
|
||||
time.sleep(self.robotClient.time_delay_take)
|
||||
log.log_message(logging.INFO, Constant.str_feed_take_success)
|
||||
self.next_target()
|
||||
|
||||
|
||||
|
||||
elif self.feedStatus == FeedStatus.FBroken1:
|
||||
log.log_message(logging.INFO, Constant.str_feed_broken)
|
||||
if self.feedConfig.feedLine.get_current_position.compare(real_position):
|
||||
self.next_target()
|
||||
if self.get_current_position().compare(real_position):
|
||||
self.next_position()
|
||||
|
||||
|
||||
elif self.feedStatus == FeedStatus.FBroken2:
|
||||
log.log_message(logging.INFO, Constant.str_feed_broken)
|
||||
if self.feedConfig.feedLine.get_current_position.compare(real_position):
|
||||
self.next_target()
|
||||
if self.get_current_position().compare(real_position):
|
||||
self.next_position()
|
||||
|
||||
elif self.feedStatus == FeedStatus.FShake:
|
||||
log.log_message(logging.INFO, Constant.str_feed_shake)
|
||||
if self.feedConfig.feedLine.get_current_position.compare(real_position):
|
||||
if self.get_current_position().compare(real_position):
|
||||
# TODO 震动方案
|
||||
time.sleep(self.robotClient.time_delay_shake)
|
||||
self.next_target()
|
||||
self.next_position()
|
||||
|
||||
elif self.feedStatus == FeedStatus.FDropBag:
|
||||
log.log_message(logging.INFO, Constant.str_feed_drop)
|
||||
|
||||
if self.feedConfig.feedLine.get_current_position.compare(real_position):
|
||||
if self.get_current_position().compare(real_position):
|
||||
self.sendIOControl(self.robotClient.con_ios[0], 0)
|
||||
self.sendIOControl(self.robotClient.con_ios[1], 0)
|
||||
self.sendIOControl(self.robotClient.con_ios[2], 0)
|
||||
# TODO 检测是否断 不然报警
|
||||
time.sleep(self.robotClient.time_delay_put)
|
||||
# TODO 获取目标位置
|
||||
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)
|
||||
|
||||
self.feedConfig.num = self.feedConfig.num - 1
|
||||
log.log_message(logging.INFO, f'{Constant.str_feed_feed_num}{self.feedConfig.num}')
|
||||
self.next_position()
|
||||
|
||||
|
||||
|
||||
if self.feedConfig.num ==0 and self.feedConfig.feedLine.pos_index == 0:
|
||||
log.log_message(logging.INFO, Constant.str_feed_finish)
|
||||
self.feedStatus = FeedStatus.FNone
|
||||
self.init_detection_image()
|
||||
|
||||
def send_emergency_sound(self):
|
||||
self.sendIOControl(Constant.IO_EmergencyPoint, 1)
|
||||
@ -341,11 +404,39 @@ class Feeding:
|
||||
self.robotClient.add_sendQuene(request_command)
|
||||
pass
|
||||
|
||||
def
|
||||
def next_target(self):
|
||||
feed_pos = self.feedConfig.feedLine.get_next_position()
|
||||
self.feedStatus = feed_pos.status
|
||||
|
||||
def next_start(self,reverse=False):
|
||||
start_pos = self.feedConfig.feedLine.get_next_start_position(reverse)
|
||||
self.feedStatus = start_pos.status if self.feedStatus != FeedStatus.FNone else FeedStatus.FNone
|
||||
self.sendTargPosition(start_pos.position)
|
||||
pass
|
||||
|
||||
def next_take(self,reverse=False):
|
||||
take_pos = self.feedConfig.feedLine.get_next_take_position(reverse)
|
||||
self.feedStatus = take_pos.status if self.feedStatus != FeedStatus.FNone else FeedStatus.FNone
|
||||
self.sendTargPosition(take_pos.position)
|
||||
pass
|
||||
|
||||
def next_Feed(self,reverse=False):
|
||||
feed_pos = self.feedConfig.feedLine.get_next_feed_position(reverse)
|
||||
self.feedStatus = feed_pos.status if self.feedStatus != FeedStatus.FNone else FeedStatus.FNone
|
||||
self.sendTargPosition(feed_pos.position)
|
||||
|
||||
def get_current_position(self):
|
||||
if self.feed_Mid_Status == FeedMidStatus.FMid_Start:
|
||||
return self.feedConfig.feedLine.get_current_start_position()
|
||||
elif self.feed_Mid_Status == FeedMidStatus.FMid_Take:
|
||||
return self.feedConfig.feedLine.get_current_take_position()
|
||||
elif self.feed_Mid_Status == FeedMidStatus.FMid_Feed:
|
||||
return self.feedConfig.feedLine.get_current_feed_position()
|
||||
def next_position(self,reverse=False):
|
||||
if self.feed_Mid_Status == FeedMidStatus.FMid_Start:
|
||||
self.next_start(reverse)
|
||||
elif self.feed_Mid_Status == FeedMidStatus.FMid_Take:
|
||||
self.next_take(reverse)
|
||||
elif self.feed_Mid_Status == FeedMidStatus.FMid_Feed:
|
||||
self.next_Feed(reverse)
|
||||
|
||||
def safe_check_columns(self):
|
||||
return True
|
||||
pass
|
||||
|
||||
@ -53,6 +53,7 @@ str_feed_photo_confirm = '确认摆好'
|
||||
str_feed_io_control = '发送IO控制: '
|
||||
str_feed_safe_error_msgbox = '未在安全位置,请先复位!'
|
||||
str_feed_shake = '摇摆'
|
||||
str_feed_start_error = '请先复位机械臂'
|
||||
str_sys_start = '进入系统'
|
||||
str_sys_exit = '退出系统'
|
||||
str_sys_switch_tool = '切换到工具坐标'
|
||||
|
||||
31
MainWin.ui
31
MainWin.ui
@ -4777,6 +4777,37 @@ font: 10pt "楷体";
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_23">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_savePosition">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(255, 255, 255);
|
||||
background-color: rgb(0, 85, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="tableWidget_positions"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
6
Model/Robot.py
Normal file
6
Model/Robot.py
Normal file
@ -0,0 +1,6 @@
|
||||
class Robot:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def get_origin_position(self):
|
||||
return Real_Position(0,0,0,0,0,0)
|
||||
@ -9123,3 +9123,53 @@ Warning 2024-11-21 20:52:26:0056 DevID:Virtual USB3 Vision Source-Line:MvCamer
|
||||
Warning 2024-11-21 20:52:26:0056 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(15072) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-21 20:52:26:0056 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(15072) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-21 20:52:26:0056 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(15072) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Error 2024-11-30 22:28:04:0247 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(17884) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
|
||||
Warning 2024-11-30 22:28:04:0259 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(17884) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:28:04:0268 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(17884) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Error 2024-11-30 22:29:34:0576 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(17868) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
|
||||
Warning 2024-11-30 22:29:34:0578 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(17868) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:29:34:0580 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(17868) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Error 2024-11-30 22:30:47:0422 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(14212) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
|
||||
Warning 2024-11-30 22:30:47:0425 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(14212) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:30:47:0426 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(14212) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Error 2024-11-30 22:41:37:0040 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(3620) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
|
||||
Warning 2024-11-30 22:41:37:0042 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(3620) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:41:37:0044 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(3620) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Error 2024-11-30 22:44:34:0357 DevID: Source-Line:MvCameraControl.dll(OtherLoadLibrary.cpp-L0709) ProcessName:python.exe(14324) Description:[LoadSRAllFunctions]hSRModule is NULL, Ret[0x8000000c]
|
||||
Warning 2024-11-30 22:44:34:0359 DevID: Source-Line:MvCameraControl.dll(GenTLLoadLibraryEx.cpp-L0345) ProcessName:python.exe(14324) Description:[LoadCtiLibInter]MV_GCSetConfigIntValue is NULL, CTI path[D:\environment\envs\UICreater\lib\site-packages\MvProducerVIR.dll]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual GigE Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0992) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MODEL] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L0996) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_VERSION] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1000) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_MANUFACTURER] failed, Ret[0x80000001]
|
||||
Warning 2024-11-30 22:44:34:0360 DevID:Virtual USB3 Vision Source-Line:MvCameraControl.dll(GenTLManager.cpp-L1004) ProcessName:python.exe(14324) Description:[GetInterfaceInfos]TLGetInterfaceInfo[INTERFACE_INFO_USER_DEFINED_NAME] failed, Ret[0x80000001]
|
||||
|
||||
35
main.py
35
main.py
@ -5,12 +5,14 @@ import queue
|
||||
import sys
|
||||
from multiprocessing import Process
|
||||
import traceback
|
||||
|
||||
import PySide6
|
||||
from PyQt5.uic.properties import QtWidgets
|
||||
from PySide6 import QtCore
|
||||
from PySide6.QtCore import QThread, Signal, Slot, QObject, QEvent, QTimer
|
||||
from PySide6.QtGui import QIntValidator, QStandardItemModel, QStandardItem, Qt, QMovie, QIcon
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QHeaderView, QTableWidget, \
|
||||
QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy
|
||||
QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy, QComboBox
|
||||
from datetime import datetime
|
||||
|
||||
from click import clear
|
||||
@ -51,7 +53,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.init_IOPanel()
|
||||
self.start_Runing()
|
||||
self.init_log()
|
||||
|
||||
self.init_table_positions()
|
||||
|
||||
|
||||
|
||||
@ -157,7 +159,32 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
|
||||
|
||||
|
||||
def init_table_positions(self):
|
||||
self.tableWidget_positions.setRowCount(9)
|
||||
self.tableWidget_positions.setColumnCount(2)
|
||||
self.tableWidget_positions.setHorizontalHeaderLabels(["名字", "删除点位"])
|
||||
self.tableWidget_positions.setSelectionBehavior(QTableWidget.SelectRows)
|
||||
self.tableWidget_positions.setAutoScroll(True)
|
||||
|
||||
# 自动调整列宽
|
||||
header = self.tableWidget_positions.horizontalHeader()
|
||||
|
||||
# 让第一列宽度根据内容自动调整
|
||||
header.setSectionResizeMode(0, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
|
||||
|
||||
# 第二列宽度根据内容自动调整
|
||||
header.setSectionResizeMode(1, PySide6.QtWidgets.QHeaderView.ResizeMode.Stretch)
|
||||
|
||||
|
||||
for row in range(5):
|
||||
combo = QComboBox()
|
||||
combo.addItems(["位置 A", "位置 B", "位置 C"])
|
||||
self.tableWidget_positions.setCellWidget(row, 0, combo)
|
||||
|
||||
for row in range(5):
|
||||
get_button = QPushButton("获取位置")
|
||||
# get_button.clicked.connect(self.get_location)
|
||||
self.tableWidget_positions.setCellWidget(row, 1, get_button)
|
||||
def init_qss(self):
|
||||
pass
|
||||
|
||||
@ -230,7 +257,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
self.pushButton_leftmenu_IO.clicked.connect(lambda _, index=1: self.send_click_change_stackView(index))
|
||||
self.pushButton_leftmenu_position.clicked.connect(lambda _, index=2: self.send_click_change_stackView(index))
|
||||
self.pushButton_leftmenu_baseSeting.clicked.connect(lambda _, index=3: self.send_click_change_stackView(index))
|
||||
self.pushButton_leftmenu_posDebug.clicked.connect(lambda _, index=4: self.send_click_change_stackView(index))
|
||||
self.pushButton_leftmenu_posDebug.clicked.connect(lambda _, index=5: self.send_click_change_stackView(index))
|
||||
self.pushButton_exit.clicked.connect(self.send_exit_button_click)
|
||||
|
||||
|
||||
@ -950,7 +977,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
if isinstance(command, FeedCommand) and command.status == Status.Prepareing:
|
||||
if self.feeding.feedStatus == FeedStatus.FNone:
|
||||
self.feeding.feedConfig = command.feed_config
|
||||
self.feeding.feedStatus = FeedStatus.FStart
|
||||
self.feeding.feedStatus = FeedStatus.FCheck
|
||||
command.status = Status.Runing
|
||||
|
||||
try:
|
||||
|
||||
61
test_ui.py
Normal file
61
test_ui.py
Normal file
@ -0,0 +1,61 @@
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QTableWidget, QTableWidgetItem, QComboBox, QPushButton, QVBoxLayout, QHBoxLayout
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
class TableWithComboAndButtons(QWidget):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.setWindowTitle("表格:两列按钮,某一列下拉框")
|
||||
self.setGeometry(100, 100, 600, 400)
|
||||
|
||||
# 布局
|
||||
layout = QVBoxLayout()
|
||||
|
||||
# 创建表格
|
||||
self.table = QTableWidget(5, 3) # 5行,3列
|
||||
self.table.setHorizontalHeaderLabels(["位置", "获取位置", "保存位置"])
|
||||
|
||||
# 设置“位置”列为下拉框
|
||||
for row in range(5):
|
||||
combo = QComboBox()
|
||||
combo.addItems(["位置 A", "位置 B", "位置 C"])
|
||||
self.table.setCellWidget(row, 0, combo)
|
||||
|
||||
# 设置“获取位置”和“保存位置”列为按钮
|
||||
for row in range(5):
|
||||
get_button = QPushButton("获取位置")
|
||||
get_button.clicked.connect(self.get_location)
|
||||
self.table.setCellWidget(row, 1, get_button)
|
||||
|
||||
save_button = QPushButton("保存位置")
|
||||
save_button.clicked.connect(self.save_location)
|
||||
self.table.setCellWidget(row, 2, save_button)
|
||||
|
||||
# 将表格添加到布局中
|
||||
layout.addWidget(self.table)
|
||||
self.setLayout(layout)
|
||||
|
||||
def get_location(self):
|
||||
# 获取当前行的“位置”列的内容
|
||||
selected_row = self.table.currentRow()
|
||||
if selected_row >= 0:
|
||||
location = self.table.cellWidget(selected_row, 0).currentText()
|
||||
print(f"获取位置: {location}")
|
||||
else:
|
||||
print("没有选中任何行")
|
||||
|
||||
def save_location(self):
|
||||
# 获取当前行的“位置”列的内容并保存
|
||||
selected_row = self.table.currentRow()
|
||||
if selected_row >= 0:
|
||||
location = self.table.cellWidget(selected_row, 0).currentText()
|
||||
print(f"保存位置: {location}")
|
||||
self.table.setItem(selected_row, 0, QTableWidgetItem(f"已保存 - {location}"))
|
||||
else:
|
||||
print("没有选中任何行")
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication([])
|
||||
window = TableWithComboAndButtons()
|
||||
window.show()
|
||||
app.exec()
|
||||
@ -2991,6 +2991,36 @@ class Ui_MainWindow(object):
|
||||
self.verticalLayout_19.addWidget(self.frame_30)
|
||||
|
||||
self.stackedWidget_view.addWidget(self.page_2)
|
||||
self.page_8 = QWidget()
|
||||
self.page_8.setObjectName(u"page_8")
|
||||
self.verticalLayout_22 = QVBoxLayout(self.page_8)
|
||||
self.verticalLayout_22.setSpacing(0)
|
||||
self.verticalLayout_22.setObjectName(u"verticalLayout_22")
|
||||
self.verticalLayout_22.setContentsMargins(0, 0, 0, 0)
|
||||
self.frame_16 = QFrame(self.page_8)
|
||||
self.frame_16.setObjectName(u"frame_16")
|
||||
self.frame_16.setFrameShape(QFrame.Shape.StyledPanel)
|
||||
self.frame_16.setFrameShadow(QFrame.Shadow.Raised)
|
||||
self.verticalLayout_23 = QVBoxLayout(self.frame_16)
|
||||
self.verticalLayout_23.setSpacing(0)
|
||||
self.verticalLayout_23.setObjectName(u"verticalLayout_23")
|
||||
self.verticalLayout_23.setContentsMargins(0, 0, 0, 0)
|
||||
self.pushButton_savePosition = QPushButton(self.frame_16)
|
||||
self.pushButton_savePosition.setObjectName(u"pushButton_savePosition")
|
||||
self.pushButton_savePosition.setStyleSheet(u"color: rgb(255, 255, 255);\n"
|
||||
"background-color: rgb(0, 85, 0);")
|
||||
|
||||
self.verticalLayout_23.addWidget(self.pushButton_savePosition)
|
||||
|
||||
self.tableWidget_positions = QTableWidget(self.frame_16)
|
||||
self.tableWidget_positions.setObjectName(u"tableWidget_positions")
|
||||
|
||||
self.verticalLayout_23.addWidget(self.tableWidget_positions)
|
||||
|
||||
|
||||
self.verticalLayout_22.addWidget(self.frame_16)
|
||||
|
||||
self.stackedWidget_view.addWidget(self.page_8)
|
||||
|
||||
self.verticalLayout_8.addWidget(self.stackedWidget_view)
|
||||
|
||||
@ -3602,7 +3632,7 @@ class Ui_MainWindow(object):
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
|
||||
self.stackedWidget_view.setCurrentIndex(0)
|
||||
self.stackedWidget_view.setCurrentIndex(5)
|
||||
self.tabWidget.setCurrentIndex(0)
|
||||
self.stackedWidget_num.setCurrentIndex(0)
|
||||
|
||||
@ -3775,6 +3805,7 @@ class Ui_MainWindow(object):
|
||||
self.label_33.setText(QCoreApplication.translate("MainWindow", u"J4", None))
|
||||
self.lineEdit_manual_adjust_accuracy.setText(QCoreApplication.translate("MainWindow", u"1", None))
|
||||
self.lineEdit_manual_adjust_accuracy.setPlaceholderText(QCoreApplication.translate("MainWindow", u"0.001-20", None))
|
||||
self.pushButton_savePosition.setText(QCoreApplication.translate("MainWindow", u"\u4fdd\u5b58", None))
|
||||
self.label_3.setText("")
|
||||
self.label_date.setText(QCoreApplication.translate("MainWindow", u"2024-08-01", None))
|
||||
self.label_time.setText(QCoreApplication.translate("MainWindow", u"08:00:00", None))
|
||||
|
||||
Reference in New Issue
Block a user