diff --git a/COM/COM_Robot.py b/COM/COM_Robot.py index 51fc269..fcb38c9 100644 --- a/COM/COM_Robot.py +++ b/COM/COM_Robot.py @@ -1,7 +1,9 @@ import logging from enum import Enum from turtle import Turtle -# from numpy.array_api import trunc + +from numpy.array_api import trunc + import Constant from COM.COM_TCP import TCPClient import queue @@ -43,11 +45,17 @@ class RobotClient(TCPClient): def send_Command(self): try: if self.command_quene.qsize()!=0: + log.log_message(logging.INFO, f'robot-command:从队列获取命令') command = self.command_quene.get() + log.log_message(logging.INFO, f'robot-command:{command}') self.client_socket.send(command.encode()) if True: response = self.client_socket.recv(1024).decode('utf-8') # response_message = json.loads(response) + if response: + log.log_message(logging.INFO, f'robot-command:{response},剩余:{self.command_quene.qsize()}条命令') + else: + log.log_message(logging.INFO, f'robot-command:无返回值,剩余:{self.command_quene.qsize()}条命令') return True else: return True diff --git a/COM/COM_TCP.py b/COM/COM_TCP.py index e8af9eb..99371b3 100644 --- a/COM/COM_TCP.py +++ b/COM/COM_TCP.py @@ -41,10 +41,11 @@ class TCPClient: if (self.send_Status() and self.send_Command()): self.error_count = 0 except Exception as e: + log.log_message(logging.ERROR,f'COM_TCP: {str(e)}') self.error_count += 1 if self.error_count> 5: print("Error: 机械臂控制程序中TCPClient is not connected") - log.log_message(logging.ERROR,Constant.str_tcp_connect_no_reply) + log.log_message(logging.ERROR,f'{Constant.str_tcp_connect_no_reply}:{str(e)}') try: self.CreatConnect() log.log_message(logging.INFO, Constant.str_tcp_reconnect) diff --git a/COM/__pycache__/COM_Robot.cpython-39.pyc b/COM/__pycache__/COM_Robot.cpython-39.pyc index 832d773..4f22e92 100644 Binary files a/COM/__pycache__/COM_Robot.cpython-39.pyc and b/COM/__pycache__/COM_Robot.cpython-39.pyc differ diff --git a/COM/__pycache__/COM_TCP.cpython-39.pyc b/COM/__pycache__/COM_TCP.cpython-39.pyc index 10d2e88..04b765e 100644 Binary files a/COM/__pycache__/COM_TCP.cpython-39.pyc and b/COM/__pycache__/COM_TCP.cpython-39.pyc differ diff --git a/CU/Feeding.py b/CU/Feeding.py index 3062ed3..85fb19f 100644 --- a/CU/Feeding.py +++ b/CU/Feeding.py @@ -29,7 +29,7 @@ from Util.util_log import log from Model.RobotModel import Instruction from EMV.EMV import RelayController from CU.drop import DropPositionManager -# from Mv3D.CameraImg import CameraImg +from Mv3D.CameraUtil import CameraUtil class ResetStatus(Enum): RNone = 0 RStart = 1 @@ -326,7 +326,7 @@ class Feeding(QObject): #用于同步控制EMV相关 self.relay_controller = relay_controller self.relay_controller.take_robot_signal.connect(self.take_feed_notice) - # self.camera_img=CameraImg() + self.camera_img=CameraUtil() # 启动传感器2线程 # self.relay_controller._running = True # self.sensor2_thread = None @@ -340,8 +340,8 @@ class Feeding(QObject): # self.detect_thread.join() if self.detect.detection: self.detect.detection.release() - # if self.camera_img: - # self.camera_img.close_camera() + if self.camera_img: + self.camera_img.release() def run_detect(self): #图片相关线程 @@ -502,7 +502,7 @@ class Feeding(QObject): time.sleep(1) # 每秒检查一次 #第二次执行FeedStatus.FPhoto时,改变码垛点 - # self.camera_img.save_frame_path() + self.camera_img.save_img() self.feedConfig.feedLine.set_feeding_to_end() # self.take_photo_sigal.emit() self.next_position() diff --git a/CU/__pycache__/Catch.cpython-39.pyc b/CU/__pycache__/Catch.cpython-39.pyc index 1053da3..dbe7a5a 100644 Binary files a/CU/__pycache__/Catch.cpython-39.pyc and b/CU/__pycache__/Catch.cpython-39.pyc differ diff --git a/CU/__pycache__/Command.cpython-39.pyc b/CU/__pycache__/Command.cpython-39.pyc index dfd4570..22d7484 100644 Binary files a/CU/__pycache__/Command.cpython-39.pyc and b/CU/__pycache__/Command.cpython-39.pyc differ diff --git a/CU/__pycache__/Detect.cpython-39.pyc b/CU/__pycache__/Detect.cpython-39.pyc index f5aa744..c4c147e 100644 Binary files a/CU/__pycache__/Detect.cpython-39.pyc and b/CU/__pycache__/Detect.cpython-39.pyc differ diff --git a/CU/__pycache__/EMV.cpython-39.pyc b/CU/__pycache__/EMV.cpython-39.pyc index 2215df0..ad6c6d6 100644 Binary files a/CU/__pycache__/EMV.cpython-39.pyc and b/CU/__pycache__/EMV.cpython-39.pyc differ diff --git a/CU/__pycache__/Feeding.cpython-39.pyc b/CU/__pycache__/Feeding.cpython-39.pyc index 242680e..ade07a4 100644 Binary files a/CU/__pycache__/Feeding.cpython-39.pyc and b/CU/__pycache__/Feeding.cpython-39.pyc differ diff --git a/CU/__pycache__/drop.cpython-39.pyc b/CU/__pycache__/drop.cpython-39.pyc index 516f334..e7a72aa 100644 Binary files a/CU/__pycache__/drop.cpython-39.pyc and b/CU/__pycache__/drop.cpython-39.pyc differ diff --git a/Constant.py b/Constant.py index 60677af..cfbccfa 100644 --- a/Constant.py +++ b/Constant.py @@ -3,7 +3,7 @@ import os # 调试变量 Debug = False # 控制不加图像的Fphoto False是不加 Debug1 = False # 打印很多日志节点 -DebugPosition = False # 调试位置,关闭机器人和传感器及判断 +DebugPosition = True # 调试位置,关闭机器人和传感器及判断 # Debug2 = False feedStatus = True #feedStatus的状态打印 diff --git a/EMV/__pycache__/EMV.cpython-39.pyc b/EMV/__pycache__/EMV.cpython-39.pyc index ff07aaa..c6e57ac 100644 Binary files a/EMV/__pycache__/EMV.cpython-39.pyc and b/EMV/__pycache__/EMV.cpython-39.pyc differ diff --git a/MainRecources_rc.py b/MainRecources_rc.py index ec7c396..5885c57 100644 --- a/MainRecources_rc.py +++ b/MainRecources_rc.py @@ -102112,31 +102112,31 @@ qt_resource_struct = b"\ \x00\x00\x00\x0e\x00\x02\x00\x00\x00\x0d\x00\x00\x00\x03\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\xb2\x00\x00\x00\x00\x00\x01\x00\x03/R\ -\x00\x00\x01\x99\x8e\x16\x01I\ +\x00\x00\x01\x9a\x01M\x90X\ \x00\x00\x00\x1e\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x99\x8e\x16\x01R\ +\x00\x00\x01\x9a\x01M\x90h\ \x00\x00\x008\x00\x00\x00\x00\x00\x01\x00\x00\x05\x9a\ -\x00\x00\x01\x99\x8e\x16\x01N\ +\x00\x00\x01\x9a\x01M\x90X\ \x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x03\x13\xe9\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x9a\x01M\x90h\ \x00\x00\x00\xe4\x00\x00\x00\x00\x00\x01\x00\x0ff\xaf\ -\x00\x00\x01\x99\x8e\x16\x01I\ +\x00\x00\x01\x9a\x01M\x90X\ \x00\x00\x01\xbc\x00\x00\x00\x00\x00\x01\x00\x18\xcf\xe2\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x9a\x01M\x90h\ \x00\x00\x01\x88\x00\x00\x00\x00\x00\x01\x00\x16\xd0\xa3\ -\x00\x00\x01\x99\x8e\x16\x01N\ +\x00\x00\x01\x9a\x01M\x90X\ \x00\x00\x01\xa6\x00\x00\x00\x00\x00\x01\x00\x16\xd7X\ -\x00\x00\x01\x99\x8e\x16\x01Q\ +\x00\x00\x01\x9a\x01M\x90h\ \x00\x00\x01\x16\x00\x00\x00\x00\x00\x01\x00\x0f\xd3\xa7\ -\x00\x00\x01\x99\x8e\x16\x01L\ +\x00\x00\x01\x9a\x01M\x90X\ \x00\x00\x00\x92\x00\x00\x00\x00\x00\x01\x00\x03\x1eU\ -\x00\x00\x01\x99\x8e\x16\x01P\ +\x00\x00\x01\x9a\x01M\x90h\ \x00\x00\x00\xc2\x00\x00\x00\x00\x00\x01\x00\x0f\x5c\xad\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x9a\x01M\x90X\ \x00\x00\x01\xd6\x00\x00\x00\x00\x00\x01\x00\x18\xd4\xc0\ -\x00\x00\x01\x99\x8e\x16\x01O\ +\x00\x00\x01\x9a\x01M\x90h\ \x00\x00\x01P\x00\x00\x00\x00\x00\x01\x00\x16\xbe\x07\ -\x00\x00\x01\x99\x8e\x16\x01N\ +\x00\x00\x01\x9a\x01M\x90X\ " def qInitResources(): diff --git a/Model/__pycache__/FeedModel.cpython-39.pyc b/Model/__pycache__/FeedModel.cpython-39.pyc index f76e240..0c5671d 100644 Binary files a/Model/__pycache__/FeedModel.cpython-39.pyc and b/Model/__pycache__/FeedModel.cpython-39.pyc differ diff --git a/Model/__pycache__/Position.cpython-39.pyc b/Model/__pycache__/Position.cpython-39.pyc index baefbe0..876037c 100644 Binary files a/Model/__pycache__/Position.cpython-39.pyc and b/Model/__pycache__/Position.cpython-39.pyc differ diff --git a/Model/__pycache__/RobotModel.cpython-39.pyc b/Model/__pycache__/RobotModel.cpython-39.pyc index 22ac572..43541fb 100644 Binary files a/Model/__pycache__/RobotModel.cpython-39.pyc and b/Model/__pycache__/RobotModel.cpython-39.pyc differ diff --git a/Mv3D/CameraUtil.py b/Mv3D/CameraUtil.py new file mode 100644 index 0000000..111d5b4 --- /dev/null +++ b/Mv3D/CameraUtil.py @@ -0,0 +1,202 @@ +# vision/camera.py +import cv2 +import os +import time +from datetime import datetime +import numpy as np +import shutil # 用于检查磁盘空间 + +class CameraUtil: + """ + 海康摄像头工具类,用于初始化、设置配置、捕获图像等操作 + """ + def __init__(self): + self.camera = None + self.camera_type = "ip" + self.camera_ip = "192.168.0.234" + self.camera_port = 554 + self.camera_username = "admin" + self.camera_password = "ailaimiye123" + self.camera_channel = 1 + + def set_config(self, camera_type="ip", ip=None, port=None, username=None, password=None, channel=1): + """ + 设置摄像头配置 + """ + self.camera_type = camera_type + if ip: + self.camera_ip = ip + if port: + self.camera_port = port + if username: + self.camera_username = username + if password: + self.camera_password = password + self.camera_channel = channel + + def setup_capture(self, camera_index=0): + """ + 设置摄像头捕获 + """ + try: + rtsp_url = f"rtsp://{self.camera_username}:{self.camera_password}@{self.camera_ip}:{self.camera_port}/streaming/channels/{self.camera_channel}01" + self.camera = cv2.VideoCapture(rtsp_url, cv2.CAP_FFMPEG) + + if not self.camera.isOpened(): + print(f"无法打开网络摄像头: {rtsp_url}") + return False + print(f"网络摄像头初始化成功,地址: {rtsp_url}") + # 关键优化:设置极低的缓冲区大小 + self.camera.set(cv2.CAP_PROP_BUFFERSIZE, 1) + # 确保设置合理的帧率 + self.camera.set(cv2.CAP_PROP_FPS, 25) + + # 设置超时参数 + self.camera.set(cv2.CAP_PROP_OPEN_TIMEOUT_MSEC, 5000) # 5秒超时 + self.camera.set(cv2.CAP_PROP_READ_TIMEOUT_MSEC, 1000) # 1秒读取超时 + return True + except Exception as e: + print(f"摄像头设置失败: {e}") + return False + + def capture_frame(self): + """捕获当前帧并返回numpy数组,设置5秒总超时""" + try: + if self.camera is None: + print("摄像头未初始化") + return None + + # 设置总超时时间为5秒 + total_timeout = 5.0 # 5秒总超时时间 + start_time = time.time() + + # 跳20帧,获取最新图像 + frames_skipped = 0 + while frames_skipped < 20: + # 检查总超时 + if time.time() - start_time > total_timeout: + print("捕获图像总超时") + return None + self.camera.grab() + time.sleep(0.05) # 稍微增加延迟,确保有新帧到达 + frames_skipped += 1 + + # 尝试读取帧,使用同一超时计时器 + read_attempts = 0 + max_read_attempts = 3 + if self.camera.grab(): + while read_attempts < max_read_attempts: + # 使用同一个超时计时器检查 + if time.time() - start_time > total_timeout: + print("捕获图像总超时") + return None + + ret, frame = self.camera.retrieve() + if ret: + return frame + else: + print(f"尝试读取图像帧失败,重试 ({read_attempts+1}/{max_read_attempts})") + read_attempts += 1 + # 短暂延迟后重试 + time.sleep(0.05) + + print("多次尝试后仍无法捕获有效图像帧") + return None + except Exception as e: + print(f"图像捕获失败: {e}") + return None + + def release(self): + """释放摄像头资源""" + if self.camera is not None: + self.camera.release() + self.camera = None + print("摄像头资源已释放") + + def save_frame(self, frame, save_dir="captured_frames", filename=None): + """ + 保存图像帧到指定目录,按日期创建子文件夹 + :param frame: 要保存的图像帧 + :param save_dir: 保存根目录 + :param filename: 保存的文件名,如果为None则使用时分秒格式 + :return: 保存的文件路径 + """ + try: + # 确保保存根目录存在 + if not os.path.exists(save_dir): + os.makedirs(save_dir) + print(f"创建保存根目录: {save_dir}") + + # 检查磁盘可用空间 - 修复变量名称错误 + total, used, free = shutil.disk_usage(save_dir) + if free < 1024 * 1024 * 20: # 小于 20MB 就停止 + print(f"❌ 磁盘空间严重不足(仅剩 {free / (1024**3):.2f} GB),停止运行。") + return None + + # 获取当前日期,创建日期子文件夹 + current_date = datetime.now().strftime("%Y%m%d") + date_dir = os.path.join(save_dir, current_date) + + # 确保日期子文件夹存在 + if not os.path.exists(date_dir): + os.makedirs(date_dir) + print(f"创建日期文件夹: {date_dir}") + + # 生成文件名(时分秒格式) + if filename is None: + time_str = datetime.now().strftime("%Y%m%d%H%M%S") + filename = f"{time_str}.jpg" + + # 保存图像到日期子文件夹 + save_path = os.path.join(date_dir, filename) + loc_status=cv2.imwrite(save_path, frame) + if not loc_status: + print(f"保存图像失败: {save_path}") + return None + print(f"图像已保存到: {save_path}") + return save_path + except Exception as e: + print(f"保存图像失败: {e}") + return None + + def save_img(self): + """ + 保存当前帧 + :return: None + """ + if self.camera is None: + self.setup_capture() + frame = self.capture_frame() + if frame is not None: + self.save_frame(frame) + self.release() + else: + print("无法捕获图像帧") + return None + + + def __del__(self): + """关闭 + """ + self.release() + + +if __name__ == "__main__": + camera = CameraUtil() + for i in range(10): + camera.save_img() + time.sleep(5) + camera.release() + # camera.set_config(camera_type="ip", ip="192.168.0.234", port=554, username="admin", password="ailaimiye123", channel=1) + # camera.setup_capture() + # for i in range(10): + # frame = camera.capture_frame() + + # if frame is not None: + # 保存当前帧 + # camera.save_frame(frame) + # cv2.imshow("Camera Feed", frame) + print('success') + + # camera.release() + # cv2.destroyAllWindows() diff --git a/Trace/__pycache__/handeye_calibration.cpython-39.pyc b/Trace/__pycache__/handeye_calibration.cpython-39.pyc index 00d29c5..42b805f 100644 Binary files a/Trace/__pycache__/handeye_calibration.cpython-39.pyc and b/Trace/__pycache__/handeye_calibration.cpython-39.pyc differ diff --git a/Util/__pycache__/util_ini.cpython-39.pyc b/Util/__pycache__/util_ini.cpython-39.pyc index 3f00984..d81e6ab 100644 Binary files a/Util/__pycache__/util_ini.cpython-39.pyc and b/Util/__pycache__/util_ini.cpython-39.pyc differ diff --git a/Util/__pycache__/util_log.cpython-39.pyc b/Util/__pycache__/util_log.cpython-39.pyc index 16dc201..c36c224 100644 Binary files a/Util/__pycache__/util_log.cpython-39.pyc and b/Util/__pycache__/util_log.cpython-39.pyc differ diff --git a/Util/__pycache__/util_math.cpython-39.pyc b/Util/__pycache__/util_math.cpython-39.pyc index c67aa79..6d15819 100644 Binary files a/Util/__pycache__/util_math.cpython-39.pyc and b/Util/__pycache__/util_math.cpython-39.pyc differ diff --git a/Util/__pycache__/util_pic.cpython-39.pyc b/Util/__pycache__/util_pic.cpython-39.pyc index a421dde..740dd64 100644 Binary files a/Util/__pycache__/util_pic.cpython-39.pyc and b/Util/__pycache__/util_pic.cpython-39.pyc differ diff --git a/Util/__pycache__/util_time.cpython-39.pyc b/Util/__pycache__/util_time.cpython-39.pyc index da6d484..8461fef 100644 Binary files a/Util/__pycache__/util_time.cpython-39.pyc and b/Util/__pycache__/util_time.cpython-39.pyc differ diff --git a/__pycache__/Constant.cpython-39.pyc b/__pycache__/Constant.cpython-39.pyc index ac54e65..5ce79db 100644 Binary files a/__pycache__/Constant.cpython-39.pyc and b/__pycache__/Constant.cpython-39.pyc differ diff --git a/__pycache__/Expection.cpython-39.pyc b/__pycache__/Expection.cpython-39.pyc index 8d9e7ea..cdf178b 100644 Binary files a/__pycache__/Expection.cpython-39.pyc and b/__pycache__/Expection.cpython-39.pyc differ diff --git a/__pycache__/MainRecources_rc.cpython-39.pyc b/__pycache__/MainRecources_rc.cpython-39.pyc index f51d7fd..33935d3 100644 Binary files a/__pycache__/MainRecources_rc.cpython-39.pyc and b/__pycache__/MainRecources_rc.cpython-39.pyc differ diff --git a/__pycache__/toggleswitch.cpython-39.pyc b/__pycache__/toggleswitch.cpython-39.pyc index cb5ae41..dd08069 100644 Binary files a/__pycache__/toggleswitch.cpython-39.pyc and b/__pycache__/toggleswitch.cpython-39.pyc differ diff --git a/__pycache__/ui_MainWin.cpython-39.pyc b/__pycache__/ui_MainWin.cpython-39.pyc index 235a4ca..d085d50 100644 Binary files a/__pycache__/ui_MainWin.cpython-39.pyc and b/__pycache__/ui_MainWin.cpython-39.pyc differ diff --git a/log/log.log b/log/log.log index 6d4e00b..8998ef2 100644 --- a/log/log.log +++ b/log/log.log @@ -17227,3 +17227,115 @@ 2025-09-24 21:48:05 - INFO - 退出系统 2025-09-28 10:57:07 - INFO - 进入系统 2025-09-28 10:57:30 - INFO - 退出系统 +2025-10-20 19:19:29 - INFO - 进入系统 +2025-10-20 19:20:09 - INFO - 退出系统 +2025-10-20 19:22:08 - INFO - 进入系统 +2025-10-20 19:22:21 - INFO - 退出系统 +2025-10-20 19:29:07 - INFO - 进入系统 +2025-10-20 19:29:43 - INFO - 退出系统 +2025-10-20 19:30:35 - INFO - 进入系统 +2025-10-20 19:33:22 - INFO - 退出系统 +2025-10-20 19:33:33 - INFO - 进入系统 +2025-10-20 19:34:22 - INFO - 退出系统 +2025-10-20 19:34:34 - INFO - 进入系统 +2025-10-20 19:34:50 - INFO - 退出系统 +2025-10-20 19:35:01 - INFO - 进入系统 +2025-10-20 19:35:19 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:35:19 - INFO - 切换到工具坐标 +2025-10-20 19:35:19 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:35:19 - INFO - 切换到自动运行状态 +2025-10-20 19:37:38 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:37:38 - INFO - 切换到工具坐标 +2025-10-20 19:37:38 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:37:38 - INFO - 切换到自动运行状态 +2025-10-20 19:37:39 - INFO - 第一层确认生产 +2025-10-20 19:37:40 - INFO - 1号线:投料开始 +2025-10-20 19:37:40 - INFO - 发送命令{"dsID":"HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"200","type":"0","io_status":"1","point":"2","delay":"0"}]} +2025-10-20 19:37:40 - INFO - 发送IO控制: 2,1 +2025-10-20 19:37:45 - INFO - 发送命令{"dsID":"HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"200","type":"0","io_status":"0","point":"2","delay":"0"}]} +2025-10-20 19:37:45 - INFO - 发送IO控制: 2,0 +2025-10-20 19:37:46 - INFO - 投料开始 +2025-10-20 19:37:46 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:37:46 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:37:46 - INFO - 投料开始 +2025-10-20 19:37:46 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:37:46 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:37:46 - INFO - 移动到中位位置 +2025-10-20 19:37:46 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:37:46 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:37:47 - INFO - 检测是否安全投料 +2025-10-20 19:37:47 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:37:47 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:37:47 - INFO - 检测是否安全投料 +2025-10-20 19:37:47 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:37:47 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:37:47 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:37:47 - INFO - 拍照 +2025-10-20 19:37:47 - INFO - 识别图像成功 +2025-10-20 19:37:48 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:37:48 - INFO - 拍照 +2025-10-20 19:37:48 - INFO - 传感器2检测到料包到位开始执行抓取 +2025-10-20 19:37:53 - INFO - 投料暂停 +2025-10-20 19:37:53 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["actionPause","1"]} +2025-10-20 19:37:56 - INFO - 退出系统 +2025-10-20 19:38:18 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"-550.23053","m1":"-1411.78418","m2":"-825.0","m3":"-149.776047","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:37 - INFO - 进入系统 +2025-10-20 19:38:48 - INFO - 投料暂停 +2025-10-20 19:38:48 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["actionPause","1"]} +2025-10-20 19:38:49 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:38:50 - INFO - 切换到工具坐标 +2025-10-20 19:38:50 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:38:50 - INFO - 切换到自动运行状态 +2025-10-20 19:38:50 - INFO - 第一层确认生产 +2025-10-20 19:38:51 - INFO - 1号线:投料开始 +2025-10-20 19:38:51 - INFO - 发送命令{"dsID":"HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"200","type":"0","io_status":"1","point":"2","delay":"0"}]} +2025-10-20 19:38:51 - INFO - 发送IO控制: 2,1 +2025-10-20 19:38:56 - INFO - 发送命令{"dsID":"HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"200","type":"0","io_status":"0","point":"2","delay":"0"}]} +2025-10-20 19:38:56 - INFO - 发送IO控制: 2,0 +2025-10-20 19:38:56 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:57 - INFO - 投料开始 +2025-10-20 19:38:57 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:38:57 - INFO - 投料开始 +2025-10-20 19:38:57 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:38:57 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:57 - INFO - 移动到中位位置 +2025-10-20 19:38:57 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:38:57 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:57 - INFO - 检测是否安全投料 +2025-10-20 19:38:58 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:38:58 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:58 - INFO - 检测是否安全投料 +2025-10-20 19:38:58 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:38:58 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:58 - INFO - 拍照 +2025-10-20 19:38:58 - INFO - 识别图像成功 +2025-10-20 19:38:58 - INFO - 移动到位置:姿势直线:X:19.275372-Y:-1531.274658-Z:-59.998802-U:-73.544907-V:0.0-W:-0.0 +2025-10-20 19:38:58 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"19.275372","m1":"-1531.274658","m2":"-59.998802","m3":"-73.544907","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:38:59 - INFO - 拍照 +2025-10-20 19:38:59 - INFO - 传感器2检测到料包到位开始执行抓取 +2025-10-20 19:39:12 - INFO - 退出系统 +2025-10-20 19:39:29 - INFO - 发送命令{"dsID":"www.hc-system.com.HCRemoteCommand","reqType":"AddRCC","emptyList":"0","instructions":[{"oneshot":"1","action":"10","m0":"-550.23053","m1":"-1411.78418","m2":"-825.0","m3":"-149.776047","ckStatus":"0x3F","speed":"100","delay":"0","smooth":"9","tool":"2"}]} +2025-10-20 19:50:26 - INFO - 进入系统 +2025-10-20 19:50:45 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:50:45 - INFO - 切换到工具坐标 +2025-10-20 19:50:45 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:50:46 - INFO - 切换到自动运行状态 +2025-10-20 19:50:56 - INFO - 第一层确认生产 +2025-10-20 19:51:33 - INFO - 退出系统 +2025-10-20 19:51:44 - INFO - 进入系统 +2025-10-20 19:51:47 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:51:47 - INFO - 切换到工具坐标 +2025-10-20 19:51:47 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:51:47 - INFO - 切换到自动运行状态 +2025-10-20 19:51:54 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:51:54 - INFO - 切换到工具坐标 +2025-10-20 19:51:55 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:51:55 - INFO - 切换到自动运行状态 +2025-10-20 19:51:55 - INFO - 第一层确认生产 +2025-10-20 19:52:01 - INFO - 退出系统 +2025-10-20 19:52:49 - INFO - 进入系统 +2025-10-20 19:52:55 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["switchTool","2"]} +2025-10-20 19:52:56 - INFO - 切换到工具坐标 +2025-10-20 19:52:56 - INFO - 发送命令{"dsID":"www.hc-system.com.RemoteMonitor","reqType":"command","cmdData":["startButton","1"]} +2025-10-20 19:52:56 - INFO - 切换到自动运行状态 +2025-10-20 19:53:06 - INFO - 退出系统 diff --git a/main.py b/main.py index d82ca50..d15529c 100644 --- a/main.py +++ b/main.py @@ -17,7 +17,7 @@ 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, QCursor, QColor, \ - QTextCursor + QTextCursor,QFont from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QHeaderView, QTableWidget, \ QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy, QComboBox, QMenu, QDialog, QGridLayout from datetime import datetime @@ -1019,6 +1019,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): msg_box_person.setIcon(QMessageBox.Icon.Information) msg_box_person.setText("是否确认生产区域安全继续生产?") msg_box_person.setWindowTitle("提示") + font=QFont("Microsoft YaHei UI",20) + msg_box_person.setFont(font) ok_button = msg_box_person.addButton("确定", PySide6.QtWidgets.QMessageBox.ButtonRole.AcceptRole) cancel_button = msg_box_person.addButton("取消", PySide6.QtWidgets.QMessageBox.ButtonRole.RejectRole) @@ -1154,7 +1156,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): button.setStyleSheet( """ *{background-color: #101F3F; - font: 10pt "楷体"; + font: 20pt "楷体"; color:#ffffff; border-radius: 5px; min-height: 40px; @@ -1181,7 +1183,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): cancel_button.setStyleSheet( """ *{background-color: #6c757d; - font: 10pt "楷体"; + font: 20pt "楷体"; color:#ffffff; border-radius: 5px; min-height: 40px; @@ -1678,6 +1680,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): msg_box_finish.setText("码垛完成,请移走拖板") msg_box_finish.setWindowTitle("提示") msg_box_finish.addButton("确定", QMessageBox.AcceptRole) + loc_font=QFont("Microsoft YaHei UI",20) + msg_box_finish.setFont(font) result=msg_box_finish.exec() self.label_remain_num.setText(str(self.feeding.feedConfig.remain_count)) self.stop_all_work() diff --git a/resources_rc.py b/resources_rc.py index 4eb583e..d503211 100644 --- a/resources_rc.py +++ b/resources_rc.py @@ -4260,7 +4260,7 @@ qt_resource_struct = b"\ \x00\x00\x00\x0a\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01\x99\x8e\x16\x01P\ +\x00\x00\x01\x9a\x01M\x90h\ " def qInitResources(): diff --git a/ui_MainWin.py b/ui_MainWin.py index e2757f3..9b9e117 100644 --- a/ui_MainWin.py +++ b/ui_MainWin.py @@ -3445,7 +3445,7 @@ class Ui_MainWindow(object): self.lineEdit_num.setSizePolicy(sizePolicy1) self.lineEdit_num.setStyleSheet(u"color: rgb(255, 255, 255);\n" "border: 1px solid #dcdfe6;\n" -"font: 9pt \"Microsoft YaHei UI\";") +"font: 12pt \"Microsoft YaHei UI\";") self.gridLayout.addWidget(self.lineEdit_num, 0, 0, 1, 4) @@ -3455,7 +3455,7 @@ class Ui_MainWindow(object): self.pushButton_numkeybord.setSizePolicy(sizePolicy1) self.pushButton_numkeybord.setStyleSheet(u"\n" "*{background-color: #101F3F;\n" -"font: 11pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "color:#ffffff\n" "}\n" "*:hover {\n" @@ -3475,7 +3475,7 @@ class Ui_MainWindow(object): self.pushButton_num_confirm.setSizePolicy(sizePolicy1) self.pushButton_num_confirm.setStyleSheet(u"\n" "*{background-color: #101F3F;\n" -"font: 11pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "color:#ffffff\n" "}\n" "*:hover {\n" @@ -3516,7 +3516,7 @@ class Ui_MainWindow(object): self.label_button_status.setStyleSheet(u"\n" "QLabel{\n" "background-color: rgba(255, 255, 255, 0);\n" -"font: 700 16pt \"Microsoft YaHei UI\";\n" +"font: 700 36pt \"Microsoft YaHei UI\";\n" "color:#FF0000;\n" "}") @@ -3545,7 +3545,7 @@ class Ui_MainWindow(object): self.pushButton_reset.setSizePolicy(sizePolicy5) self.pushButton_reset.setStyleSheet(u"*{\n" "background-color: #FFFFBF;\n" -"font: 9pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "border-radius: 10px;\n" "}\n" "*:pressed\n" @@ -3584,7 +3584,7 @@ class Ui_MainWindow(object): self.pushButton_stopFeed.setSizePolicy(sizePolicy5) self.pushButton_stopFeed.setStyleSheet(u"*{\n" "background-color: #FF0000;\n" -"font: 9pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "border-radius: 10px;\n" "}\n" "*:pressed\n" @@ -3603,7 +3603,7 @@ class Ui_MainWindow(object): self.pushButton_pauseFeed.setSizePolicy(sizePolicy5) self.pushButton_pauseFeed.setStyleSheet(u"*{\n" "background-color: #2196F3;\n" -"font: 9pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "border-radius: 10px;\n" "}\n" "*:pressed\n" @@ -3622,7 +3622,7 @@ class Ui_MainWindow(object): self.pushButton_startFeed.setSizePolicy(sizePolicy5) self.pushButton_startFeed.setStyleSheet(u"*{\n" "background-color: #499C54;\n" -"font: 9pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "\n" "border-radius: 10px;\n" "}\n" @@ -3642,7 +3642,7 @@ class Ui_MainWindow(object): self.pushButton_clearAlarm.setSizePolicy(sizePolicy5) self.pushButton_clearAlarm.setStyleSheet(u"*{\n" "background-color: #1CB2B1;\n" -"font: 9pt \"\u6977\u4f53\";\n" +"font: 20pt \"\u6977\u4f53\";\n" "border-radius: 10px;\n" "}\n" "*:pressed\n" diff --git a/view/__pycache__/ResetView.cpython-39.pyc b/view/__pycache__/ResetView.cpython-39.pyc index f6eab99..7734ba3 100644 Binary files a/view/__pycache__/ResetView.cpython-39.pyc and b/view/__pycache__/ResetView.cpython-39.pyc differ diff --git a/view/__pycache__/ui_Dialog_Reset.cpython-39.pyc b/view/__pycache__/ui_Dialog_Reset.cpython-39.pyc index f26ba73..85e2286 100644 Binary files a/view/__pycache__/ui_Dialog_Reset.cpython-39.pyc and b/view/__pycache__/ui_Dialog_Reset.cpython-39.pyc differ