Files
2025-09-26 13:32:34 +08:00

52 lines
1.9 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# config/settings.py
import os
class Settings:
def __init__(self):
# 项目根目录
self.project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# 网络继电器配置
self.relay_host = '192.168.0.18'
self.relay_port = 50000
# 摄像头配置
self.camera_type = "ip"
self.camera_ip = "192.168.1.51"
self.camera_port = 554
self.camera_username = "admin"
self.camera_password = "XJ123456"
self.camera_channel = 1
# 下料控制参数
self.min_required_weight = 500 # 模具车最小需要重量(kg)
self.target_vehicle_weight = 5000 # 目标模具车重量(kg)
self.upper_buffer_weight = 500 # 上料斗缓冲重量(kg)
self.single_batch_weight = 2500 # 单次下料重量(kg)
# 角度控制参数
self.target_angle = 20.0 # 目标角度
self.min_angle = 10.0 # 最小角度
self.max_angle = 80.0 # 最大角度
self.angle_threshold = 60.0 # 角度阈值
self.angle_tolerance = 5.0 # 角度容差
# 变频器配置
self.inverter_max_frequency = 400.0 # 频率最大值
self.frequencies = [220.0, 230.0, 240.0] # 下料阶段频率Hz
# 模型路径配置
self.models_dir = os.path.join(self.project_root, 'vision', 'models')
self.angle_model_path = os.path.join(self.models_dir, 'angle.pt')
self.overflow_model_path = os.path.join(self.models_dir, 'overflow.pt')
self.alignment_model_path = os.path.join(self.models_dir, 'alig.pt')
# ROI路径配置
self.roi_file_path = os.path.join(self.project_root, 'vision', 'roi_coordinates', '1_rois.txt')
# 系统控制参数
self.visual_check_interval = 1.0 # 视觉检查间隔(秒)
self.alignment_check_interval = 0.5 # 对齐检查间隔(秒)
self.max_error_count = 3 # 最大错误计数