1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
| class OMSPostureSafetySystem: """ OMS姿态安全系统 核心逻辑: 1. 实时检测乘员姿态 2. 判断是否为OOP(Out-of-Position) 3. 动态调整约束系统参数 4. 必要时触发姿态矫正警告 """ POSTURE_CLASSES = { 'normal_upright': { 'recline_deg': '< 25', 'risk_level': 'safe', 'restraint_mode': 'standard', 'airbag_power': 'full', }, 'mild_recline': { 'recline_deg': '25-40', 'risk_level': 'caution', 'restraint_mode': 'pretension_boosted', 'airbag_power': 'full', 'warning': '建议调整座椅角度', }, 'deep_recline': { 'recline_deg': '40-55', 'risk_level': 'high', 'restraint_mode': 'maximum_pretension', 'airbag_power': 'reduced', 'warning': '座椅过度后仰,碰撞时可能造成严重伤害', 'auto_action': '调整座椅至安全角度', }, 'extreme_recline': { 'recline_deg': '> 55', 'risk_level': 'critical', 'restraint_mode': 'full_pretension + lap_belt_redirect', 'airbag_power': 'disabled', 'warning': '危险姿态!禁止行驶', 'auto_action': '禁止启动车辆', }, 'side_facing': { 'recline_deg': 'N/A', 'risk_level': 'critical', 'restraint_mode': 'N/A', 'airbag_power': 'disabled', 'warning': '侧向坐姿不安全,请调整至前向', 'auto_action': '禁止行驶', }, 'forward_lean': { 'recline_deg': '< 0 (前倾)', 'risk_level': 'high', 'restraint_mode': 'boosted_pretension', 'airbag_power': 'reduced', 'warning': '身体过度前倾,安全距离不足', 'auto_action': '座椅靠背后推2°', } } def __init__(self): self.pose_detector = None self.restraint_controller = None self.current_posture = 'normal_upright' def evaluate_posture(self, pose_3d: dict) -> dict: """ 评估3D姿态数据 Args: pose_3d: { 'recline_angle': float, # 座椅后仰角度 'head_position': (x, y, z), 'torso_orientation': (rx, ry, rz), 'pelvis_position': (x, y, z), 'shoulder_alignment': float, 'body_asymmetry': float, } Returns: { 'posture_class': str, 'risk_level': str, 'restraint_config': dict, 'action': str, } """ recline = pose_3d.get('recline_angle', 0) asymmetry = pose_3d.get('body_asymmetry', 0) if asymmetry > 30: posture_class = 'side_facing' elif recline > 55: posture_class = 'extreme_recline' elif recline > 40: posture_class = 'deep_recline' elif recline > 25: posture_class = 'mild_recline' elif recline < -5: posture_class = 'forward_lean' else: posture_class = 'normal_upright' config = self.POSTURE_CLASSES[posture_class] self.current_posture = posture_class return { 'posture_class': posture_class, 'risk_level': config['risk_level'], 'restraint_config': { 'mode': config.get('restraint_mode'), 'airbag_power': config.get('airbag_power'), }, 'action': config.get('auto_action', 'none'), 'warning': config.get('warning', ''), }
|