image_font

This commit is contained in:
2025-10-24 10:29:00 +08:00
parent a571d91fd5
commit 640faf26b8
35 changed files with 361 additions and 34 deletions

View File

@ -1,7 +1,9 @@
import logging import logging
from enum import Enum from enum import Enum
from turtle import Turtle from turtle import Turtle
# from numpy.array_api import trunc
from numpy.array_api import trunc
import Constant import Constant
from COM.COM_TCP import TCPClient from COM.COM_TCP import TCPClient
import queue import queue
@ -43,11 +45,17 @@ class RobotClient(TCPClient):
def send_Command(self): def send_Command(self):
try: try:
if self.command_quene.qsize()!=0: if self.command_quene.qsize()!=0:
log.log_message(logging.INFO, f'robot-command:从队列获取命令')
command = self.command_quene.get() command = self.command_quene.get()
log.log_message(logging.INFO, f'robot-command:{command}')
self.client_socket.send(command.encode()) self.client_socket.send(command.encode())
if True: if True:
response = self.client_socket.recv(1024).decode('utf-8') response = self.client_socket.recv(1024).decode('utf-8')
# response_message = json.loads(response) # 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 return True
else: else:
return True return True

View File

@ -41,10 +41,11 @@ class TCPClient:
if (self.send_Status() and self.send_Command()): if (self.send_Status() and self.send_Command()):
self.error_count = 0 self.error_count = 0
except Exception as e: except Exception as e:
log.log_message(logging.ERROR,f'COM_TCP: {str(e)}')
self.error_count += 1 self.error_count += 1
if self.error_count> 5: if self.error_count> 5:
print("Error: 机械臂控制程序中TCPClient is not connected") 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: try:
self.CreatConnect() self.CreatConnect()
log.log_message(logging.INFO, Constant.str_tcp_reconnect) log.log_message(logging.INFO, Constant.str_tcp_reconnect)

View File

@ -29,7 +29,7 @@ from Util.util_log import log
from Model.RobotModel import Instruction from Model.RobotModel import Instruction
from EMV.EMV import RelayController from EMV.EMV import RelayController
from CU.drop import DropPositionManager from CU.drop import DropPositionManager
# from Mv3D.CameraImg import CameraImg from Mv3D.CameraUtil import CameraUtil
class ResetStatus(Enum): class ResetStatus(Enum):
RNone = 0 RNone = 0
RStart = 1 RStart = 1
@ -326,7 +326,7 @@ class Feeding(QObject):
#用于同步控制EMV相关 #用于同步控制EMV相关
self.relay_controller = relay_controller self.relay_controller = relay_controller
self.relay_controller.take_robot_signal.connect(self.take_feed_notice) self.relay_controller.take_robot_signal.connect(self.take_feed_notice)
# self.camera_img=CameraImg() self.camera_img=CameraUtil()
# 启动传感器2线程 # 启动传感器2线程
# self.relay_controller._running = True # self.relay_controller._running = True
# self.sensor2_thread = None # self.sensor2_thread = None
@ -340,8 +340,8 @@ class Feeding(QObject):
# self.detect_thread.join() # self.detect_thread.join()
if self.detect.detection: if self.detect.detection:
self.detect.detection.release() self.detect.detection.release()
# if self.camera_img: if self.camera_img:
# self.camera_img.close_camera() self.camera_img.release()
def run_detect(self): def run_detect(self):
#图片相关线程 #图片相关线程
@ -502,7 +502,7 @@ class Feeding(QObject):
time.sleep(1) # 每秒检查一次 time.sleep(1) # 每秒检查一次
#第二次执行FeedStatus.FPhoto时改变码垛点 #第二次执行FeedStatus.FPhoto时改变码垛点
# self.camera_img.save_frame_path() self.camera_img.save_img()
self.feedConfig.feedLine.set_feeding_to_end() self.feedConfig.feedLine.set_feeding_to_end()
# self.take_photo_sigal.emit() # self.take_photo_sigal.emit()
self.next_position() self.next_position()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,7 +3,7 @@ import os
# 调试变量 # 调试变量
Debug = False # 控制不加图像的Fphoto False是不加 Debug = False # 控制不加图像的Fphoto False是不加
Debug1 = False # 打印很多日志节点 Debug1 = False # 打印很多日志节点
DebugPosition = False # 调试位置,关闭机器人和传感器及判断 DebugPosition = True # 调试位置,关闭机器人和传感器及判断
# Debug2 = False # Debug2 = False
feedStatus = True #feedStatus的状态打印 feedStatus = True #feedStatus的状态打印

Binary file not shown.

View File

@ -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\x0e\x00\x02\x00\x00\x00\x0d\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\xb2\x00\x00\x00\x00\x00\x01\x00\x03/R\ \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\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\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\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\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\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\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\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\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\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\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\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\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(): def qInitResources():

202
Mv3D/CameraUtil.py Normal file
View File

@ -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()

Binary file not shown.

Binary file not shown.

View File

@ -17227,3 +17227,115 @@
2025-09-24 21:48:05 - INFO - 退出系统 2025-09-24 21:48:05 - INFO - 退出系统
2025-09-28 10:57:07 - INFO - 进入系统 2025-09-28 10:57:07 - INFO - 进入系统
2025-09-28 10:57:30 - 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控制: 21
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控制: 20
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控制: 21
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控制: 20
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 - 退出系统

10
main.py
View File

@ -17,7 +17,7 @@ from PyQt5.uic.properties import QtWidgets
from PySide6 import QtCore from PySide6 import QtCore
from PySide6.QtCore import QThread, Signal, Slot, QObject, QEvent, QTimer from PySide6.QtCore import QThread, Signal, Slot, QObject, QEvent, QTimer
from PySide6.QtGui import QIntValidator, QStandardItemModel, QStandardItem, Qt, QMovie, QIcon, QCursor, QColor, \ 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, \ from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QLabel, QHeaderView, QTableWidget, \
QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy, QComboBox, QMenu, QDialog, QGridLayout QTableWidgetItem, QWidget, QHBoxLayout, QAbstractItemView, QMessageBox, QSizePolicy, QComboBox, QMenu, QDialog, QGridLayout
from datetime import datetime from datetime import datetime
@ -1019,6 +1019,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
msg_box_person.setIcon(QMessageBox.Icon.Information) msg_box_person.setIcon(QMessageBox.Icon.Information)
msg_box_person.setText("是否确认生产区域安全继续生产?") msg_box_person.setText("是否确认生产区域安全继续生产?")
msg_box_person.setWindowTitle("提示") 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) ok_button = msg_box_person.addButton("确定", PySide6.QtWidgets.QMessageBox.ButtonRole.AcceptRole)
cancel_button = msg_box_person.addButton("取消", PySide6.QtWidgets.QMessageBox.ButtonRole.RejectRole) cancel_button = msg_box_person.addButton("取消", PySide6.QtWidgets.QMessageBox.ButtonRole.RejectRole)
@ -1154,7 +1156,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
button.setStyleSheet( button.setStyleSheet(
""" """
*{background-color: #101F3F; *{background-color: #101F3F;
font: 10pt "楷体"; font: 20pt "楷体";
color:#ffffff; color:#ffffff;
border-radius: 5px; border-radius: 5px;
min-height: 40px; min-height: 40px;
@ -1181,7 +1183,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
cancel_button.setStyleSheet( cancel_button.setStyleSheet(
""" """
*{background-color: #6c757d; *{background-color: #6c757d;
font: 10pt "楷体"; font: 20pt "楷体";
color:#ffffff; color:#ffffff;
border-radius: 5px; border-radius: 5px;
min-height: 40px; min-height: 40px;
@ -1678,6 +1680,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
msg_box_finish.setText("码垛完成,请移走拖板") msg_box_finish.setText("码垛完成,请移走拖板")
msg_box_finish.setWindowTitle("提示") msg_box_finish.setWindowTitle("提示")
msg_box_finish.addButton("确定", QMessageBox.AcceptRole) msg_box_finish.addButton("确定", QMessageBox.AcceptRole)
loc_font=QFont("Microsoft YaHei UI",20)
msg_box_finish.setFont(font)
result=msg_box_finish.exec() result=msg_box_finish.exec()
self.label_remain_num.setText(str(self.feeding.feedConfig.remain_count)) self.label_remain_num.setText(str(self.feeding.feedConfig.remain_count))
self.stop_all_work() self.stop_all_work()

View File

@ -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\x0a\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x1a\x00\x00\x00\x00\x00\x01\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(): def qInitResources():

View File

@ -3445,7 +3445,7 @@ class Ui_MainWindow(object):
self.lineEdit_num.setSizePolicy(sizePolicy1) self.lineEdit_num.setSizePolicy(sizePolicy1)
self.lineEdit_num.setStyleSheet(u"color: rgb(255, 255, 255);\n" self.lineEdit_num.setStyleSheet(u"color: rgb(255, 255, 255);\n"
"border: 1px solid #dcdfe6;\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) 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.setSizePolicy(sizePolicy1)
self.pushButton_numkeybord.setStyleSheet(u"\n" self.pushButton_numkeybord.setStyleSheet(u"\n"
"*{background-color: #101F3F;\n" "*{background-color: #101F3F;\n"
"font: 11pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"color:#ffffff\n" "color:#ffffff\n"
"}\n" "}\n"
"*:hover {\n" "*:hover {\n"
@ -3475,7 +3475,7 @@ class Ui_MainWindow(object):
self.pushButton_num_confirm.setSizePolicy(sizePolicy1) self.pushButton_num_confirm.setSizePolicy(sizePolicy1)
self.pushButton_num_confirm.setStyleSheet(u"\n" self.pushButton_num_confirm.setStyleSheet(u"\n"
"*{background-color: #101F3F;\n" "*{background-color: #101F3F;\n"
"font: 11pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"color:#ffffff\n" "color:#ffffff\n"
"}\n" "}\n"
"*:hover {\n" "*:hover {\n"
@ -3516,7 +3516,7 @@ class Ui_MainWindow(object):
self.label_button_status.setStyleSheet(u"\n" self.label_button_status.setStyleSheet(u"\n"
"QLabel{\n" "QLabel{\n"
"background-color: rgba(255, 255, 255, 0);\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" "color:#FF0000;\n"
"}") "}")
@ -3545,7 +3545,7 @@ class Ui_MainWindow(object):
self.pushButton_reset.setSizePolicy(sizePolicy5) self.pushButton_reset.setSizePolicy(sizePolicy5)
self.pushButton_reset.setStyleSheet(u"*{\n" self.pushButton_reset.setStyleSheet(u"*{\n"
"background-color: #FFFFBF;\n" "background-color: #FFFFBF;\n"
"font: 9pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"border-radius: 10px;\n" "border-radius: 10px;\n"
"}\n" "}\n"
"*:pressed\n" "*:pressed\n"
@ -3584,7 +3584,7 @@ class Ui_MainWindow(object):
self.pushButton_stopFeed.setSizePolicy(sizePolicy5) self.pushButton_stopFeed.setSizePolicy(sizePolicy5)
self.pushButton_stopFeed.setStyleSheet(u"*{\n" self.pushButton_stopFeed.setStyleSheet(u"*{\n"
"background-color: #FF0000;\n" "background-color: #FF0000;\n"
"font: 9pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"border-radius: 10px;\n" "border-radius: 10px;\n"
"}\n" "}\n"
"*:pressed\n" "*:pressed\n"
@ -3603,7 +3603,7 @@ class Ui_MainWindow(object):
self.pushButton_pauseFeed.setSizePolicy(sizePolicy5) self.pushButton_pauseFeed.setSizePolicy(sizePolicy5)
self.pushButton_pauseFeed.setStyleSheet(u"*{\n" self.pushButton_pauseFeed.setStyleSheet(u"*{\n"
"background-color: #2196F3;\n" "background-color: #2196F3;\n"
"font: 9pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"border-radius: 10px;\n" "border-radius: 10px;\n"
"}\n" "}\n"
"*:pressed\n" "*:pressed\n"
@ -3622,7 +3622,7 @@ class Ui_MainWindow(object):
self.pushButton_startFeed.setSizePolicy(sizePolicy5) self.pushButton_startFeed.setSizePolicy(sizePolicy5)
self.pushButton_startFeed.setStyleSheet(u"*{\n" self.pushButton_startFeed.setStyleSheet(u"*{\n"
"background-color: #499C54;\n" "background-color: #499C54;\n"
"font: 9pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"\n" "\n"
"border-radius: 10px;\n" "border-radius: 10px;\n"
"}\n" "}\n"
@ -3642,7 +3642,7 @@ class Ui_MainWindow(object):
self.pushButton_clearAlarm.setSizePolicy(sizePolicy5) self.pushButton_clearAlarm.setSizePolicy(sizePolicy5)
self.pushButton_clearAlarm.setStyleSheet(u"*{\n" self.pushButton_clearAlarm.setStyleSheet(u"*{\n"
"background-color: #1CB2B1;\n" "background-color: #1CB2B1;\n"
"font: 9pt \"\u6977\u4f53\";\n" "font: 20pt \"\u6977\u4f53\";\n"
"border-radius: 10px;\n" "border-radius: 10px;\n"
"}\n" "}\n"
"*:pressed\n" "*:pressed\n"