29 lines
1.2 KiB
Python
29 lines
1.2 KiB
Python
# core/state.py
|
|
class SystemState:
|
|
def __init__(self):
|
|
# 系统运行状态
|
|
self.running = False
|
|
|
|
# 下料控制相关
|
|
self.upper_door_position = 'default' # default(在搅拌楼下接料), over_lower(在下料斗上方), returning(返回中)
|
|
self.lower_feeding_stage = 0 # 0:未下料, 1:第一阶段, 2:第二阶段, 3:第三阶段, 4:等待模具车对齐
|
|
self.lower_feeding_cycle = 0 # 下料斗下料循环次数
|
|
self.upper_feeding_count = 0 # 上料斗已下料次数
|
|
self.upper_feeding_max = 2 #上料斗最大下料次数
|
|
|
|
# 重量相关
|
|
self.last_upper_weight = 0
|
|
self.last_lower_weight = 0
|
|
self.last_weight_time = 0
|
|
|
|
# 错误计数
|
|
self.upper_weight_error_count = 0
|
|
self.lower_weight_error_count = 0
|
|
|
|
# 视觉系统状态
|
|
self.angle_control_mode = "normal" # 角度控制模式: normal, reducing, maintaining, recovery
|
|
self.overflow_detected = False # 堆料检测
|
|
self.door_opening_large = False # 夹角
|
|
self.vehicle_aligned = False # 模具车是否对齐
|
|
self.last_angle = None # 上次检测角度
|