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
| class ADASSensitivityAdapter: """ ADAS灵敏度自适应 """ def __init__(self): self.base_sensitivity = { 'fcw': 1.0, 'ldw': 1.0, 'lka': 0.0, 'aeb': 1.0 } def adjust_for_driver_state(self, driver_state): """ 根据驾驶员状态调整 """ adjustments = {} distraction = driver_state['distraction_level'] if distraction == 'mild': adjustments = { 'fcw': 1.1, 'ldw': 1.2, 'lka': 0.5, 'aeb': 1.0 } elif distraction == 'moderate': adjustments = { 'fcw': 1.2, 'ldw': 1.5, 'lka': 1.0, 'aeb': 1.1 } elif distraction == 'severe': adjustments = { 'fcw': 1.3, 'ldw': 2.0, 'lka': 1.5, 'aeb': 1.2 } elif driver_state['is_unresponsive']: adjustments = { 'fcw': 2.0, 'ldw': 2.0, 'lka': 2.0, 'aeb': 1.5 } else: adjustments = self.base_sensitivity return adjustments def apply_adjustments(self, adjustments): """ 应用调整 """ for system, sensitivity in adjustments.items(): self.set_sensitivity(system, sensitivity)
|