三阶段投料修正
This commit is contained in:
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@ -2,5 +2,6 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
875
Fedding.py
875
Fedding.py
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,28 @@
|
|||||||
# 网络配置
|
# 网络配置
|
||||||
network:
|
network:
|
||||||
relay:
|
relay:
|
||||||
|
# 网络继电器(所有485设备通过此接口转发)
|
||||||
host: "192.168.0.18"
|
host: "192.168.0.18"
|
||||||
port: 50000
|
port: 50000
|
||||||
|
|
||||||
|
# Modbus设备配置(通过网络继电器访问的RTU设备)
|
||||||
|
modbus_devices:
|
||||||
inverter:
|
inverter:
|
||||||
host: "192.168.0.20"
|
# 变频器
|
||||||
port: 502
|
|
||||||
slave_id: 1
|
slave_id: 1
|
||||||
|
address: 1 # 设备地址(用于网络继电器转发识别)
|
||||||
transmitters:
|
transmitters:
|
||||||
upper:
|
upper:
|
||||||
host: "192.168.0.21"
|
# 上料斗变送器
|
||||||
port: 502
|
slave_id: 2
|
||||||
slave_id: 1
|
address: 2
|
||||||
weight_register: 0
|
weight_register: 1
|
||||||
register_count: 2
|
register_count: 2
|
||||||
lower:
|
lower:
|
||||||
host: "192.168.0.22"
|
# 下料斗变送器
|
||||||
port: 502
|
slave_id: 3
|
||||||
slave_id: 2
|
address: 3
|
||||||
weight_register: 0
|
weight_register: 1
|
||||||
register_count: 2
|
register_count: 2
|
||||||
|
|
||||||
# 系统参数
|
# 系统参数
|
||||||
@ -41,4 +45,4 @@ relay:
|
|||||||
door_lower_1: 1 # DO1 - 出砼门控制1
|
door_lower_1: 1 # DO1 - 出砼门控制1
|
||||||
door_lower_2: 2 # DO2 - 出砼门控制2
|
door_lower_2: 2 # DO2 - 出砼门控制2
|
||||||
break_arch_upper: 3 # DO3 - 上料斗破拱
|
break_arch_upper: 3 # DO3 - 上料斗破拱
|
||||||
break_arch_lower: 4 # DO4 - 下料斗破拱
|
break_arch_lower: 4 # DO4 - 下料斗破拱
|
||||||
|
|||||||
0
logs/app.log
Normal file
0
logs/app.log
Normal file
@ -9,7 +9,6 @@ from .state_machine import FeedingStateMachine, FeedingState
|
|||||||
|
|
||||||
class FeedingController:
|
class FeedingController:
|
||||||
"""下料控制器"""
|
"""下料控制器"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.logger = app_logger.getChild('FeedingController')
|
self.logger = app_logger.getChild('FeedingController')
|
||||||
self.state_machine = FeedingStateMachine()
|
self.state_machine = FeedingStateMachine()
|
||||||
@ -24,7 +23,7 @@ class FeedingController:
|
|||||||
|
|
||||||
# 下料参数
|
# 下料参数
|
||||||
self.stage_frequencies = {
|
self.stage_frequencies = {
|
||||||
1: config.get('feeding.stage1_frequency', 30.0),
|
1: config.get('feeding.stage1_frequency', 30.0),#三阶段的频率
|
||||||
2: config.get('feeding.stage2_frequency', 40.0),
|
2: config.get('feeding.stage2_frequency', 40.0),
|
||||||
3: config.get('feeding.stage3_frequency', 50.0)
|
3: config.get('feeding.stage3_frequency', 50.0)
|
||||||
}
|
}
|
||||||
@ -50,22 +49,24 @@ class FeedingController:
|
|||||||
relay_mapping = config.get('relay')
|
relay_mapping = config.get('relay')
|
||||||
self.relay.set_device_mapping(relay_mapping)
|
self.relay.set_device_mapping(relay_mapping)
|
||||||
|
|
||||||
# 变频器
|
# 变频器 - 修改为使用新的配置结构
|
||||||
inverter_config = config.get('network.inverter')
|
inverter_config = config.get('modbus_devices.inverter')
|
||||||
self.inverter = InverterController(
|
self.inverter = InverterController(
|
||||||
inverter_config['host'],
|
relay_config['host'], # 使用网络继电器的host
|
||||||
inverter_config['port'],
|
relay_config['port'], # 使用网络继电器的port
|
||||||
inverter_config['slave_id']
|
inverter_config['slave_id'],
|
||||||
|
inverter_config['address'] # 添加设备地址参数
|
||||||
)
|
)
|
||||||
|
|
||||||
# 变送器
|
# 变送器 - 修改为使用新的配置结构
|
||||||
transmitters_config = config.get('network.transmitters')
|
transmitters_config = config.get('modbus_devices.transmitters')
|
||||||
|
|
||||||
self.upper_transmitter = TransmitterController(
|
self.upper_transmitter = TransmitterController(
|
||||||
'upper',
|
'upper',
|
||||||
transmitters_config['upper']['host'],
|
relay_config['host'], # 使用网络继电器的host
|
||||||
transmitters_config['upper']['port'],
|
relay_config['port'], # 使用网络继电器的port
|
||||||
transmitters_config['upper']['slave_id']
|
transmitters_config['upper']['slave_id'],
|
||||||
|
transmitters_config['upper']['address'] # 添加设备地址参数
|
||||||
)
|
)
|
||||||
self.upper_transmitter.set_config(
|
self.upper_transmitter.set_config(
|
||||||
transmitters_config['upper']['weight_register'],
|
transmitters_config['upper']['weight_register'],
|
||||||
@ -74,9 +75,10 @@ class FeedingController:
|
|||||||
|
|
||||||
self.lower_transmitter = TransmitterController(
|
self.lower_transmitter = TransmitterController(
|
||||||
'lower',
|
'lower',
|
||||||
transmitters_config['lower']['host'],
|
relay_config['host'], # 使用网络继电器的host
|
||||||
transmitters_config['lower']['port'],
|
relay_config['port'], # 使用网络继电器的port
|
||||||
transmitters_config['lower']['slave_id']
|
transmitters_config['lower']['slave_id'],
|
||||||
|
transmitters_config['lower']['address'] # 添加设备地址参数
|
||||||
)
|
)
|
||||||
self.lower_transmitter.set_config(
|
self.lower_transmitter.set_config(
|
||||||
transmitters_config['lower']['weight_register'],
|
transmitters_config['lower']['weight_register'],
|
||||||
@ -106,7 +108,8 @@ class FeedingController:
|
|||||||
self.error_count = 0
|
self.error_count = 0
|
||||||
|
|
||||||
if current_weight < self.min_required_weight:
|
if current_weight < self.min_required_weight:
|
||||||
self.logger.info("上料斗重量不足,通知搅拌楼要料")
|
self.logger.info("上料斗重量不足,通知搅拌楼要料")#通知搅拌楼要料,调用彭琪的接口
|
||||||
|
#一个通讯的函数,内容包括(要料数据)
|
||||||
self.move_upper_door_to_mixer()
|
self.move_upper_door_to_mixer()
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -182,7 +185,6 @@ class FeedingController:
|
|||||||
(time.time() - start_time) > self.timeout:
|
(time.time() - start_time) > self.timeout:
|
||||||
self.state_machine.set_state(FeedingState.STAGE_TWO)
|
self.state_machine.set_state(FeedingState.STAGE_TWO)
|
||||||
break
|
break
|
||||||
|
|
||||||
time.sleep(2) # 每2秒读取一次
|
time.sleep(2) # 每2秒读取一次
|
||||||
|
|
||||||
def execute_stage_two(self):
|
def execute_stage_two(self):
|
||||||
|
|||||||
@ -6,10 +6,11 @@ from src.utils.logger import app_logger
|
|||||||
class InverterController:
|
class InverterController:
|
||||||
"""变频器控制器"""
|
"""变频器控制器"""
|
||||||
|
|
||||||
def __init__(self, host: str, port: int, slave_id: int = 1):
|
def __init__(self, relay_host: str, relay_port: int, slave_id: int = 1, device_address: int = 1):
|
||||||
self.host = host
|
self.relay_host = relay_host
|
||||||
self.port = port
|
self.relay_port = relay_port
|
||||||
self.slave_id = slave_id
|
self.slave_id = slave_id
|
||||||
|
self.device_address = device_address # 设备地址,用于网络继电器转发识别
|
||||||
self.client = None
|
self.client = None
|
||||||
self.logger = app_logger.getChild('InverterController')
|
self.logger = app_logger.getChild('InverterController')
|
||||||
|
|
||||||
@ -23,8 +24,13 @@ class InverterController:
|
|||||||
def connect(self):
|
def connect(self):
|
||||||
"""连接变频器"""
|
"""连接变频器"""
|
||||||
try:
|
try:
|
||||||
self.client = ModbusTcpClient(self.host, port=self.port)
|
self.client = ModbusTcpClient(self.relay_host, port=self.relay_port)
|
||||||
return self.client.connect()
|
connection_result = self.client.connect()
|
||||||
|
|
||||||
|
# 这里可能需要添加设备地址的处理逻辑,具体取决于网络继电器的协议
|
||||||
|
# 例如,可能需要发送一个初始化命令告诉继电器要与哪个设备通信
|
||||||
|
|
||||||
|
return connection_result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"连接变频器失败: {e}")
|
self.logger.error(f"连接变频器失败: {e}")
|
||||||
return False
|
return False
|
||||||
|
|||||||
@ -7,11 +7,12 @@ from src.utils.logger import app_logger
|
|||||||
class TransmitterController:
|
class TransmitterController:
|
||||||
"""重量变送器控制器"""
|
"""重量变送器控制器"""
|
||||||
|
|
||||||
def __init__(self, name: str, host: str, port: int, slave_id: int = 1):
|
def __init__(self, name: str, relay_host: str, relay_port: int, slave_id: int = 1, device_address: int = 1):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.host = host
|
self.relay_host = relay_host
|
||||||
self.port = port
|
self.relay_port = relay_port
|
||||||
self.slave_id = slave_id
|
self.slave_id = slave_id
|
||||||
|
self.device_address = device_address # 设备地址,用于网络继电器转发识别
|
||||||
self.client = None
|
self.client = None
|
||||||
self.logger = app_logger.getChild(f'TransmitterController.{name}')
|
self.logger = app_logger.getChild(f'TransmitterController.{name}')
|
||||||
|
|
||||||
@ -19,16 +20,15 @@ class TransmitterController:
|
|||||||
self.weight_register = 0
|
self.weight_register = 0
|
||||||
self.register_count = 2
|
self.register_count = 2
|
||||||
|
|
||||||
def set_config(self, weight_register: int, register_count: int):
|
|
||||||
"""设置变送器配置"""
|
|
||||||
self.weight_register = weight_register
|
|
||||||
self.register_count = register_count
|
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
"""连接变送器"""
|
"""连接变送器"""
|
||||||
try:
|
try:
|
||||||
self.client = ModbusTcpClient(self.host, port=self.port)
|
self.client = ModbusTcpClient(self.relay_host, port=self.relay_port)
|
||||||
return self.client.connect()
|
connection_result = self.client.connect()
|
||||||
|
|
||||||
|
# 这里可能需要添加设备地址的处理逻辑,具体取决于网络继电器的协议
|
||||||
|
|
||||||
|
return connection_result
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"连接变送器 {self.name} 失败: {e}")
|
self.logger.error(f"连接变送器 {self.name} 失败: {e}")
|
||||||
return False
|
return False
|
||||||
@ -61,9 +61,12 @@ class TransmitterController:
|
|||||||
|
|
||||||
# 解析重量数据
|
# 解析重量数据
|
||||||
if self.register_count == 2:
|
if self.register_count == 2:
|
||||||
# 组合两个寄存器为32位浮点数 (大端序)
|
# 根据协议,重量数据从第三个寄存器开始,需要4个字节
|
||||||
|
# 组合两个寄存器为32位整数 (大端序)
|
||||||
|
# 按照协议描述,应该是4个字节的数据: [reg0_high, reg0_low, reg1_high, reg1_low]
|
||||||
weight_bytes = struct.pack('>HH', result.registers[0], result.registers[1])
|
weight_bytes = struct.pack('>HH', result.registers[0], result.registers[1])
|
||||||
weight = struct.unpack('>f', weight_bytes)[0]
|
# 按照协议,从第4个字节开始是重量数据,即前4个字节就是重量数据
|
||||||
|
weight = struct.unpack('>I', weight_bytes)[0] # 使用大端序无符号整数解析
|
||||||
elif self.register_count == 1:
|
elif self.register_count == 1:
|
||||||
# 单个寄存器直接作为整数
|
# 单个寄存器直接作为整数
|
||||||
weight = float(result.registers[0])
|
weight = float(result.registers[0])
|
||||||
@ -72,11 +75,16 @@ class TransmitterController:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
self.logger.debug(f"变送器 {self.name} 读取重量: {weight}kg")
|
self.logger.debug(f"变送器 {self.name} 读取重量: {weight}kg")
|
||||||
return weight
|
return float(weight)
|
||||||
|
|
||||||
except ModbusException as e:
|
except ModbusException as e:
|
||||||
self.logger.error(f"变送器 {self.name} Modbus通信错误: {e}")
|
self.logger.error(f"变送器 {self.name} Modbus通信错误: {e}")
|
||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"变送器 {self.name} 数据解析错误: {e}")
|
self.logger.error(f"变送器 {self.name} 数据解析错误: {e}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def set_config(self, weight_register, register_count):
|
||||||
|
"""设置重量读取相关的寄存器配置"""
|
||||||
|
self.weight_register = weight_register
|
||||||
|
self.register_count = register_count
|
||||||
116
src/logs/app.log
116
src/logs/app.log
@ -118,3 +118,119 @@
|
|||||||
2025-09-13 10:36:49,725 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
2025-09-13 10:36:49,725 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
2025-09-13 10:36:49,725 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
2025-09-13 10:36:49,725 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
2025-09-13 10:36:49,725 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
2025-09-13 10:36:49,725 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:07,373 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:07,373 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:11,736 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:11,736 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:12,696 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:45:12,696 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:45:15,710 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1
|
||||||
|
2025-09-16 19:45:15,710 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1
|
||||||
|
2025-09-16 19:45:18,711 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:18,711 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:21,725 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:21,725 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:25,741 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:25,741 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:25,741 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 2
|
||||||
|
2025-09-16 19:45:25,741 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 2
|
||||||
|
2025-09-16 19:45:28,752 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:28,752 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:31,765 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:45:31,765 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:45:31,765 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:31,765 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:35,782 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:35,782 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:35,782 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 3
|
||||||
|
2025-09-16 19:45:35,782 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 3
|
||||||
|
2025-09-16 19:45:35,782 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:35,782 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:38,797 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:38,797 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:41,810 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:45:41,810 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:45:41,810 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:41,810 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:45,835 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:45,835 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:45,835 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 4
|
||||||
|
2025-09-16 19:45:45,835 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 4
|
||||||
|
2025-09-16 19:45:45,835 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:45,835 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:48,845 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:48,845 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:51,859 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:45:51,859 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:45:51,859 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:51,859 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:45:55,885 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:55,885 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:55,885 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 5
|
||||||
|
2025-09-16 19:45:55,885 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 5
|
||||||
|
2025-09-16 19:45:55,885 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:55,885 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:45:58,890 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:45:58,890 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:01,900 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:01,900 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:01,900 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:01,900 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:05,921 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:05,921 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:05,921 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 6
|
||||||
|
2025-09-16 19:46:05,921 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 6
|
||||||
|
2025-09-16 19:46:05,921 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:46:05,921 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:46:08,926 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:08,926 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:11,936 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:11,936 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:11,936 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:11,936 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:15,950 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:15,950 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:15,950 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 7
|
||||||
|
2025-09-16 19:46:15,950 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 7
|
||||||
|
2025-09-16 19:46:15,950 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:46:15,950 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:46:18,958 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:18,958 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:21,965 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:21,965 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:21,965 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:21,965 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:25,987 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:25,987 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:25,987 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 8
|
||||||
|
2025-09-16 19:46:25,987 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 8
|
||||||
|
2025-09-16 19:46:25,987 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:46:25,987 - FeedingControl.FeedingController - ERROR - <20><><EFBFBD>棺<EFBFBD><E6A3BA><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:46:28,989 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:28,989 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:46:31,993 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:31,993 - FeedingControl.TransmitterController.lower - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> lower Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.22:502]
|
||||||
|
2025-09-16 19:46:31,993 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:31,993 - FeedingControl.StateMachine - INFO - ϵͳ<CFB5><CDB3><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>״̬
|
||||||
|
2025-09-16 19:46:32,358 - FeedingControl.MainSystem - INFO - <20>յ<EFBFBD><D5B5>ź<EFBFBD> 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣϵͳ...
|
||||||
|
2025-09-16 19:46:32,358 - FeedingControl.MainSystem - INFO - <20>յ<EFBFBD><D5B5>ź<EFBFBD> 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣϵͳ...
|
||||||
|
2025-09-16 19:46:32,358 - FeedingControl.MainSystem - INFO - ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:46:32,358 - FeedingControl.MainSystem - INFO - ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:46:32,358 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ֹͣ
|
||||||
|
2025-09-16 19:46:32,358 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ֹͣ
|
||||||
|
2025-09-16 19:57:25,205 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:57:25,205 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:57:30,519 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:57:30,519 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-16 19:57:32,282 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:57:32,282 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:57:47,433 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1
|
||||||
|
2025-09-16 19:57:47,433 - FeedingControl.FeedingController - WARNING - <20><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡʧ<C8A1>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1
|
||||||
|
2025-09-16 19:58:06,833 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:58:06,833 - FeedingControl.TransmitterController.upper - ERROR - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> upper Modbusͨ<73>Ŵ<EFBFBD><C5B4><EFBFBD>: Modbus Error: [Connection] Failed to connect[ModbusTcpClient 192.168.0.21:502]
|
||||||
|
2025-09-16 19:58:12,731 - FeedingControl.MainSystem - INFO - <20>յ<EFBFBD><D5B5>ź<EFBFBD> 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣϵͳ...
|
||||||
|
2025-09-16 19:58:12,731 - FeedingControl.MainSystem - INFO - <20>յ<EFBFBD><D5B5>ź<EFBFBD> 2<><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣϵͳ...
|
||||||
|
2025-09-16 19:58:12,731 - FeedingControl.MainSystem - INFO - ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:58:12,731 - FeedingControl.MainSystem - INFO - ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>ϵͳ
|
||||||
|
2025-09-16 19:58:12,731 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ֹͣ
|
||||||
|
2025-09-16 19:58:12,731 - FeedingControl.MainSystem - INFO - <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>ֹͣ
|
||||||
|
|||||||
BIN
src/vision/alig.pt
Normal file
BIN
src/vision/alig.pt
Normal file
Binary file not shown.
84
src/vision/anger_caculate.py
Normal file
84
src/vision/anger_caculate.py
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import cv2
|
||||||
|
import os
|
||||||
|
import numpy as np
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
def predict_obb_best_angle(model=None, model_path=None, image_path=None, save_path=None):
|
||||||
|
"""
|
||||||
|
输入:
|
||||||
|
model: 预加载的YOLO模型实例(可选)
|
||||||
|
model_path: YOLO 权重路径(当model为None时使用)
|
||||||
|
image_path: 图片路径
|
||||||
|
save_path: 可选,保存带标注图像
|
||||||
|
输出:
|
||||||
|
angle_deg: 置信度最高两个框的主方向夹角(度),如果检测少于两个目标返回 None
|
||||||
|
annotated_img: 可视化图像
|
||||||
|
"""
|
||||||
|
# 1. 使用预加载的模型或加载新模型
|
||||||
|
if model is not None:
|
||||||
|
# 使用预加载的模型
|
||||||
|
loaded_model = model
|
||||||
|
elif model_path is not None:
|
||||||
|
# 加载模型
|
||||||
|
loaded_model = YOLO(model_path)
|
||||||
|
else:
|
||||||
|
raise ValueError("必须提供model或model_path参数")
|
||||||
|
|
||||||
|
# 2. 读取图像
|
||||||
|
img = cv2.imread(image_path)
|
||||||
|
if img is None:
|
||||||
|
print(f"无法读取图像: {image_path}")
|
||||||
|
return None, None
|
||||||
|
|
||||||
|
# 3. 推理 OBB
|
||||||
|
results = loaded_model(img, save=False, imgsz=640, conf=0.5, mode='obb')
|
||||||
|
result = results[0]
|
||||||
|
|
||||||
|
# 4. 可视化
|
||||||
|
annotated_img = result.plot()
|
||||||
|
if save_path:
|
||||||
|
os.makedirs(os.path.dirname(save_path), exist_ok=True)
|
||||||
|
cv2.imwrite(save_path, annotated_img)
|
||||||
|
print(f"推理结果已保存至: {save_path}")
|
||||||
|
|
||||||
|
# 5. 提取旋转角度和置信度
|
||||||
|
boxes = result.obb
|
||||||
|
if boxes is None or len(boxes) < 2:
|
||||||
|
print("检测到少于两个目标,无法计算夹角。")
|
||||||
|
return None, annotated_img
|
||||||
|
|
||||||
|
box_info = []
|
||||||
|
for box in boxes:
|
||||||
|
conf = box.conf.cpu().numpy()[0]
|
||||||
|
cx, cy, w, h, r_rad = box.xywhr.cpu().numpy()[0]
|
||||||
|
direction = r_rad if w >= h else r_rad + np.pi/2
|
||||||
|
direction = direction % np.pi
|
||||||
|
box_info.append((conf, direction))
|
||||||
|
|
||||||
|
# 6. 取置信度最高两个框
|
||||||
|
box_info = sorted(box_info, key=lambda x: x[0], reverse=True)
|
||||||
|
dir1, dir2 = box_info[0][1], box_info[1][1]
|
||||||
|
|
||||||
|
# 7. 计算夹角(最小夹角,0~90°)
|
||||||
|
diff = abs(dir1 - dir2)
|
||||||
|
diff = min(diff, np.pi - diff)
|
||||||
|
angle_deg = np.degrees(diff)
|
||||||
|
|
||||||
|
print(f"置信度最高两个框主方向夹角: {angle_deg:.2f}°")
|
||||||
|
return angle_deg, annotated_img
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------- 测试 -------------------
|
||||||
|
# if __name__ == "__main__":
|
||||||
|
# weight_path = r'angle.pt'
|
||||||
|
# image_path = r"./test_image/3.jpg"
|
||||||
|
# save_path = "./inference_results/detected_3.jpg"
|
||||||
|
#
|
||||||
|
# #angle_deg, annotated_img = predict_obb_best_angle(weight_path, image_path, save_path)
|
||||||
|
# angle_deg,_ = predict_obb_best_angle(model_path=weight_path, image_path=image_path, save_path=save_path)
|
||||||
|
# annotated_img = None
|
||||||
|
# print(angle_deg)
|
||||||
|
# if annotated_img is not None:
|
||||||
|
# cv2.imshow("YOLO OBB Prediction", annotated_img)
|
||||||
|
# cv2.waitKey(0)
|
||||||
|
# cv2.destroyAllWindows()
|
||||||
BIN
src/vision/angle.pt
Normal file
BIN
src/vision/angle.pt
Normal file
Binary file not shown.
BIN
src/vision/overflow.pt
Normal file
BIN
src/vision/overflow.pt
Normal file
Binary file not shown.
106
src/vision/resize_main.py
Normal file
106
src/vision/resize_main.py
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
from pathlib import Path
|
||||||
|
from ultralytics import YOLO
|
||||||
|
import cv2
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# ROI 裁剪函数
|
||||||
|
# ---------------------------
|
||||||
|
def load_global_rois(txt_path):
|
||||||
|
"""加载全局 ROI 坐标"""
|
||||||
|
rois = []
|
||||||
|
if not os.path.exists(txt_path):
|
||||||
|
print(f"❌ ROI 文件不存在: {txt_path}")
|
||||||
|
return rois
|
||||||
|
with open(txt_path, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if line:
|
||||||
|
try:
|
||||||
|
x, y, w, h = map(int, line.split(','))
|
||||||
|
rois.append((x, y, w, h))
|
||||||
|
print(f"📌 加载 ROI: (x={x}, y={y}, w={w}, h={h})")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"⚠️ 无法解析 ROI 行: {line}, 错误: {e}")
|
||||||
|
return rois
|
||||||
|
|
||||||
|
def crop_and_resize(img, rois, target_size=640):
|
||||||
|
"""根据 ROI 裁剪并 resize"""
|
||||||
|
crops = []
|
||||||
|
for i, (x, y, w, h) in enumerate(rois):
|
||||||
|
h_img, w_img = img.shape[:2]
|
||||||
|
if x < 0 or y < 0 or x + w > w_img or y + h > h_img:
|
||||||
|
print(f"⚠️ ROI 越界,跳过: {x},{y},{w},{h}")
|
||||||
|
continue
|
||||||
|
roi_img = img[y:y+h, x:x+w]
|
||||||
|
roi_resized = cv2.resize(roi_img, (target_size, target_size), interpolation=cv2.INTER_AREA)
|
||||||
|
crops.append((roi_resized, i))
|
||||||
|
return crops
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 分类函数
|
||||||
|
# ---------------------------
|
||||||
|
def classify_and_save_images(model_path, input_folder, output_root, roi_file, target_size=640):
|
||||||
|
# 加载模型
|
||||||
|
model = YOLO(model_path)
|
||||||
|
|
||||||
|
# 确保输出根目录存在
|
||||||
|
output_root = Path(output_root)
|
||||||
|
output_root.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
# 创建类别子文件夹 (class0 到 class4)
|
||||||
|
class_dirs = []
|
||||||
|
for i in range(5): # 假设有5个类别 (0-4)
|
||||||
|
class_dir = output_root / f"class{i}"
|
||||||
|
class_dir.mkdir(exist_ok=True)
|
||||||
|
class_dirs.append(class_dir)
|
||||||
|
|
||||||
|
# 加载 ROI
|
||||||
|
rois = load_global_rois(roi_file)
|
||||||
|
if len(rois) == 0:
|
||||||
|
print("❌ 没有有效 ROI,退出")
|
||||||
|
return
|
||||||
|
|
||||||
|
# 遍历输入文件夹
|
||||||
|
for img_path in Path(input_folder).glob("*.*"):
|
||||||
|
if img_path.suffix.lower() not in ['.jpg', '.jpeg', '.png', '.bmp', '.tif']:
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 读取原图
|
||||||
|
img = cv2.imread(str(img_path))
|
||||||
|
if img is None:
|
||||||
|
print(f"❌ 无法读取图像: {img_path}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# 根据 ROI 裁剪
|
||||||
|
crops = crop_and_resize(img, rois, target_size)
|
||||||
|
|
||||||
|
for roi_img, roi_idx in crops:
|
||||||
|
# YOLO 推理
|
||||||
|
results = model(roi_img)
|
||||||
|
|
||||||
|
pred = results[0].probs.data # 获取概率分布
|
||||||
|
class_id = int(pred.argmax())
|
||||||
|
|
||||||
|
# 保存到对应类别文件夹
|
||||||
|
suffix = f"_roi{roi_idx}" if len(crops) > 1 else ""
|
||||||
|
dst_path = class_dirs[class_id] / f"{img_path.stem}{suffix}{img_path.suffix}"
|
||||||
|
cv2.imwrite(dst_path, roi_img) # 保存裁剪后的 ROI 图像
|
||||||
|
print(f"Processed {img_path.name}{suffix} -> Class {class_id}")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error processing {img_path.name}: {str(e)}")
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 主程序
|
||||||
|
# ---------------------------
|
||||||
|
if __name__ == "__main__":
|
||||||
|
model_path = r"overflow.pt"
|
||||||
|
input_folder = "/media/hx/04e879fa-d697-4b02-ac7e-a4148876ebb0/dataset/f6"
|
||||||
|
output_root = "/media/hx/04e879fa-d697-4b02-ac7e-a4148876ebb0/dataset/class111"
|
||||||
|
roi_file = "./roi_coordinates/1_rois.txt" # 训练时使用的 ROI 文件
|
||||||
|
target_size = 640
|
||||||
|
|
||||||
|
classify_and_save_images(model_path, input_folder, output_root, roi_file, target_size)
|
||||||
184
src/vision/resize_tuili_image_main.py
Normal file
184
src/vision/resize_tuili_image_main.py
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
from ultralytics import YOLO
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 类别映射
|
||||||
|
# ---------------------------
|
||||||
|
CLASS_NAMES = {
|
||||||
|
0: "未堆料",
|
||||||
|
1: "小堆料",
|
||||||
|
2: "大堆料",
|
||||||
|
3: "未浇筑满",
|
||||||
|
4: "浇筑满"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 加载 ROI 列表
|
||||||
|
# ---------------------------
|
||||||
|
def load_global_rois(txt_path):
|
||||||
|
rois = []
|
||||||
|
if not os.path.exists(txt_path):
|
||||||
|
print(f"ROI 文件不存在: {txt_path}")
|
||||||
|
return rois
|
||||||
|
with open(txt_path, 'r') as f:
|
||||||
|
for line in f:
|
||||||
|
s = line.strip()
|
||||||
|
if s:
|
||||||
|
try:
|
||||||
|
x, y, w, h = map(int, s.split(','))
|
||||||
|
rois.append((x, y, w, h))
|
||||||
|
except Exception as e:
|
||||||
|
print(f"无法解析 ROI 行 '{s}': {e}")
|
||||||
|
return rois
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 裁剪并 resize ROI
|
||||||
|
# ---------------------------
|
||||||
|
def crop_and_resize(img, rois, target_size=640):
|
||||||
|
crops = []
|
||||||
|
h_img, w_img = img.shape[:2]
|
||||||
|
for i, (x, y, w, h) in enumerate(rois):
|
||||||
|
if x < 0 or y < 0 or x + w > w_img or y + h > h_img:
|
||||||
|
continue
|
||||||
|
roi = img[y:y + h, x:x + w]
|
||||||
|
roi_resized = cv2.resize(roi, (target_size, target_size), interpolation=cv2.INTER_AREA)
|
||||||
|
crops.append((roi_resized, i))
|
||||||
|
return crops
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# class1/class2 加权判断
|
||||||
|
# ---------------------------
|
||||||
|
def weighted_small_large(pred_probs, threshold=0.4, w1=0.3, w2=0.7):
|
||||||
|
p1 = float(pred_probs[1])
|
||||||
|
p2 = float(pred_probs[2])
|
||||||
|
total = p1 + p2
|
||||||
|
if total > 0:
|
||||||
|
score = (w1 * p1 + w2 * p2) / total
|
||||||
|
else:
|
||||||
|
score = 0.0
|
||||||
|
final_class = "大堆料" if score >= threshold else "小堆料"
|
||||||
|
return final_class, score, p1, p2
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 单张图片推理函数
|
||||||
|
# ---------------------------
|
||||||
|
def classify_image_weighted(image, model, threshold=0.4):
|
||||||
|
results = model(image)
|
||||||
|
pred_probs = results[0].probs.data.cpu().numpy().flatten()
|
||||||
|
class_id = int(pred_probs.argmax())
|
||||||
|
confidence = float(pred_probs[class_id])
|
||||||
|
class_name = CLASS_NAMES.get(class_id, f"未知类别({class_id})")
|
||||||
|
|
||||||
|
# class1/class2 使用加权得分
|
||||||
|
if class_id in [1, 2]:
|
||||||
|
final_class, score, p1, p2 = weighted_small_large(pred_probs, threshold=threshold)
|
||||||
|
else:
|
||||||
|
final_class = class_name
|
||||||
|
score = confidence
|
||||||
|
p1 = float(pred_probs[1])
|
||||||
|
p2 = float(pred_probs[2])
|
||||||
|
|
||||||
|
return final_class, score, p1, p2
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 实时视频流推理函数
|
||||||
|
# ---------------------------
|
||||||
|
def real_time_inference(rtsp_url, model_path, roi_file, target_size=640, threshold=0.4):
|
||||||
|
"""
|
||||||
|
从RTSP流实时推理
|
||||||
|
:param rtsp_url: RTSP流URL
|
||||||
|
:param model_path: 模型路径
|
||||||
|
:param roi_file: ROI文件路径
|
||||||
|
:param target_size: 目标尺寸
|
||||||
|
:param threshold: 分类阈值
|
||||||
|
"""
|
||||||
|
# 加载模型
|
||||||
|
model = YOLO(model_path)
|
||||||
|
|
||||||
|
# 加载ROI
|
||||||
|
rois = load_global_rois(roi_file)
|
||||||
|
if not rois:
|
||||||
|
print("❌ 没有有效 ROI,退出")
|
||||||
|
return
|
||||||
|
|
||||||
|
# 打开RTSP流
|
||||||
|
cap = cv2.VideoCapture(rtsp_url)
|
||||||
|
|
||||||
|
if not cap.isOpened():
|
||||||
|
print(f"❌ 无法打开视频流: {rtsp_url}")
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"✅ 成功连接到视频流: {rtsp_url}")
|
||||||
|
print("按 'q' 键退出,按 's' 键保存当前帧")
|
||||||
|
|
||||||
|
frame_count = 0
|
||||||
|
while True:
|
||||||
|
ret, frame = cap.read()
|
||||||
|
if not ret:
|
||||||
|
print("❌ 无法读取帧,可能连接已断开")
|
||||||
|
break
|
||||||
|
|
||||||
|
frame_count += 1
|
||||||
|
print(f"\n处理第 {frame_count} 帧")
|
||||||
|
|
||||||
|
try:
|
||||||
|
# 裁剪并调整ROI
|
||||||
|
crops = crop_and_resize(frame, rois, target_size)
|
||||||
|
|
||||||
|
for roi_resized, roi_idx in crops:
|
||||||
|
final_class, score, p1, p2 = classify_image_weighted(roi_resized, model, threshold=threshold)
|
||||||
|
|
||||||
|
print(f"ROI {roi_idx} -> 类别: {final_class}, 加权分数: {score:.2f}, "
|
||||||
|
f"class1 置信度: {p1:.2f}, class2 置信度: {p2:.2f}")
|
||||||
|
|
||||||
|
# 判断是否溢料
|
||||||
|
if "大堆料" in final_class or "浇筑满" in final_class:
|
||||||
|
print(f"🚨 检测到溢料: ROI {roi_idx} - {final_class}")
|
||||||
|
|
||||||
|
# 可视化(可选)
|
||||||
|
cv2.imshow(f'ROI {roi_idx}', roi_resized)
|
||||||
|
|
||||||
|
# 显示原始帧
|
||||||
|
cv2.imshow('Original Frame', frame)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"处理帧时出错: {e}")
|
||||||
|
continue
|
||||||
|
|
||||||
|
# 键盘控制
|
||||||
|
key = cv2.waitKey(1) & 0xFF
|
||||||
|
if key == ord('q'): # 按q退出
|
||||||
|
break
|
||||||
|
elif key == ord('s'): # 按s保存当前帧
|
||||||
|
cv2.imwrite(f"frame_{frame_count}.jpg", frame)
|
||||||
|
print(f"保存帧到 frame_{frame_count}.jpg")
|
||||||
|
|
||||||
|
# 清理资源
|
||||||
|
cap.release()
|
||||||
|
cv2.destroyAllWindows()
|
||||||
|
print("✅ 视频流处理结束")
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------
|
||||||
|
# 主函数 - 实时推理示例
|
||||||
|
# ---------------------------
|
||||||
|
if __name__ == "__main__":
|
||||||
|
# RTSP流URL
|
||||||
|
rtsp_url = "rtsp://admin:XJ123456@192.168.1.51:554/streaming/channels/101"
|
||||||
|
|
||||||
|
# 配置参数
|
||||||
|
model_path = r"overflow.pt"
|
||||||
|
roi_file = r"./roi_coordinates/1_rois.txt"
|
||||||
|
target_size = 640
|
||||||
|
threshold = 0.4
|
||||||
|
|
||||||
|
print("开始实时视频流推理...")
|
||||||
|
real_time_inference(rtsp_url, model_path, roi_file, target_size, threshold)
|
||||||
1
src/vision/roi_coordinates/1_rois.txt
Normal file
1
src/vision/roi_coordinates/1_rois.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
859,810,696,328
|
||||||
BIN
src/vision/test_image/1.jpg
Normal file
BIN
src/vision/test_image/1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 587 KiB |
BIN
src/vision/test_image/2.jpg
Normal file
BIN
src/vision/test_image/2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 513 KiB |
BIN
src/vision/test_image/3.jpg
Normal file
BIN
src/vision/test_image/3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.9 MiB |
@ -1,3 +1,4 @@
|
|||||||
2025-09-12 19:40:24,636 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-09-12 19:40:24,636 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
2025-09-12 19:40:27,379 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-09-12 19:40:27,379 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
2025-09-12 19:40:31,216 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2025-09-12 19:40:31,216 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
2025-09-13 11:01:27,838 - FeedingControl.FeedingController - INFO - <20>豸<EFBFBD><E8B1B8>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
|||||||
@ -1 +1,5 @@
|
|||||||
2025-09-13 10:37:43,979 - FeedingControl.RelayController - INFO - <20><><EFBFBD>Ƽ̵<C6BC><CCB5><EFBFBD> door_upper (0) open
|
2025-09-13 10:37:43,979 - FeedingControl.RelayController - INFO - <20><><EFBFBD>Ƽ̵<C6BC><CCB5><EFBFBD> door_upper (0) open
|
||||||
|
2025-09-13 11:03:31,681 - FeedingControl.RelayController - INFO - <20><><EFBFBD>Ƽ̵<C6BC><CCB5><EFBFBD> door_upper (0) open
|
||||||
|
2025-09-13 11:03:34,120 - FeedingControl.RelayController - ERROR - <20><>Ч<EFBFBD>ļ̵<C4BC><CCB5><EFBFBD><EFBFBD>豸: invalid_device
|
||||||
|
2025-09-13 11:03:36,864 - FeedingControl.RelayController - ERROR - <20><>Ч<EFBFBD>ļ̵<C4BC><CCB5><EFBFBD><EFBFBD>豸: invalid_device
|
||||||
|
2025-09-13 11:03:36,864 - FeedingControl.RelayController - INFO - <20><><EFBFBD>Ƽ̵<C6BC><CCB5><EFBFBD> door_upper (0) open
|
||||||
|
|||||||
Reference in New Issue
Block a user