diff --git a/common/params.py b/common/params.py index 57d2e56ba..9d0c029d7 100755 --- a/common/params.py +++ b/common/params.py @@ -174,6 +174,9 @@ keys = { "DragonLastModified": [TxType.PERSISTENT], "DragonEnableRegistration": [TxType.PERSISTENT], "DragonDynamicFollow": [TxType.PERSISTENT], + "DragonEnableDoorCheck": [TxType.PERSISTENT], + "DragonEnableSeatBeltCheck": [TxType.PERSISTENT], + "DragonEnableGearCheck": [TxType.PERSISTENT], } diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index c66fb7ec5..a5b3e38f5 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -44,6 +44,9 @@ class CarInterfaceBase(): self.ts_last_check = 0. self.dragon_lat_ctrl = True self.dp_last_modified = None + self.dp_door_check = True + self.dp_seatbelt_check = True + self.dp_gear_check = True @staticmethod def calc_accel_override(a_ego, a_target, v_ego, v_target): @@ -113,25 +116,29 @@ class CarInterfaceBase(): self.dragon_toyota_stock_dsu = False if not self.dragon_toyota_stock_dsu: self.dragon_allow_gas = True if params.get("DragonAllowGas", encoding='utf8') == "1" else False + self.dp_door_check = False if params.get("DragonEnableDoorCheck", encoding='utf8') == "0" else True + self.dp_seatbelt_check = False if params.get("DragonEnableSeatBeltCheck", encoding='utf8') == "0" else True + self.dp_gear_check = False if params.get("DragonEnableGearCheck", encoding='utf8') == "0" else True self.dp_last_modified = modified self.ts_last_check = ts def create_common_events(self, cs_out, extra_gears=[], gas_resume_speed=-1): events = [] - if cs_out.doorOpen: + if self.dp_door_check and cs_out.doorOpen: events.append(create_event('doorOpen', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if cs_out.seatbeltUnlatched: + if self.dp_seatbelt_check and cs_out.seatbeltUnlatched: events.append(create_event('seatbeltNotLatched', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if cs_out.gearShifter != GearShifter.drive and cs_out.gearShifter not in extra_gears: - events.append(create_event('wrongGear', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if cs_out.gearShifter == GearShifter.reverse: - events.append(create_event('reverseGear', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) + if self.dp_gear_check: + if cs_out.gearShifter != GearShifter.drive and cs_out.gearShifter not in extra_gears: + events.append(create_event('wrongGear', [ET.NO_ENTRY, ET.SOFT_DISABLE])) + if cs_out.gearShifter == GearShifter.reverse: + events.append(create_event('reverseGear', [ET.NO_ENTRY, ET.IMMEDIATE_DISABLE])) if not cs_out.cruiseState.available: events.append(create_event('wrongCarMode', [ET.NO_ENTRY, ET.USER_DISABLE])) if cs_out.espDisabled: events.append(create_event('espDisabled', [ET.NO_ENTRY, ET.SOFT_DISABLE])) - if cs_out.gasPressed and not self.dragon_toyota_stock_dsu and not self.dragon_allow_gas: + if not self.dragon_allow_gas and cs_out.gasPressed and not self.dragon_toyota_stock_dsu: events.append(create_event('pedalPressed', [ET.PRE_ENABLE])) # TODO: move this stuff to the capnp strut diff --git a/selfdrive/dragonpilot/dragonconf/__init__.py b/selfdrive/dragonpilot/dragonconf/__init__.py index 9bd27b33d..798e2f498 100644 --- a/selfdrive/dragonpilot/dragonconf/__init__.py +++ b/selfdrive/dragonpilot/dragonconf/__init__.py @@ -72,6 +72,9 @@ default_conf = { 'DragonLastModified': str(floor(time.time())), 'DragonEnableRegistration': '1', 'DragonDynamicFollow': '-2', # OFF = -2, LONG = -1, NORMAL = 0, SHORT = 1 + 'DragonEnableDoorCheck': '1', + 'DragonEnableSeatBeltCheck': '1', + 'DragonEnableGearCheck': '1', } deprecated_conf = {