From 5903aa4c322b8420e04c15a7343159cab91f4e04 Mon Sep 17 00:00:00 2001 From: eFini Date: Thu, 29 Jun 2023 12:16:01 +0800 Subject: [PATCH] Toyota: experimental longitudinal when using smartDSU on radar-ACC TSS2 car (#28440) * disallowed openpilotLongitudinalControl when experimental_long is off on radarUnavailable vehicle * try this * this is a better check? * use it here * use it here * more explicit (pending more cleanup) * some documentation * clean up * same * this also works, but it adds a bunch of indirection * Revert "this also works, but it adds a bunch of indirection" This reverts commit 822095b96569faf10a6841cf3892b5db29f0c01b. * Update selfdrive/car/toyota/interface.py --------- Co-authored-by: Shane Smiskol old-commit-hash: 1b98fea696e0d7e6fff06cbce2b3812cbabd90f1 --- selfdrive/car/toyota/interface.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 413785ed69..75f61609db 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -222,8 +222,20 @@ class CarInterface(CarInterfaceBase): ret.enableDsu = len(found_ecus) > 0 and Ecu.dsu not in found_ecus and candidate not in (NO_DSU_CAR | UNSUPPORTED_DSU_CAR) and not (ret.flags & ToyotaFlags.SMART_DSU) ret.enableGasInterceptor = 0x201 in fingerprint[0] - # if the smartDSU is detected, openpilot can send ACC_CMD (and the smartDSU will block it from the DSU) or not (the DSU is "connected") - ret.openpilotLongitudinalControl = bool(ret.flags & ToyotaFlags.SMART_DSU) or ret.enableDsu or candidate in (TSS2_CAR - RADAR_ACC_CAR) + # if the smartDSU is detected, openpilot can send ACC_CONTROL and the smartDSU will block it from the DSU or radar. + # since we don't yet parse radar on TSS2 radar-based ACC cars, gate longitudinal behind experimental toggle + use_sdsu = bool(ret.flags & ToyotaFlags.SMART_DSU) + if candidate in RADAR_ACC_CAR: + ret.experimentalLongitudinalAvailable = use_sdsu + use_sdsu = use_sdsu and experimental_long + + # openpilot longitudinal enabled by default: + # - non-(TSS2 radar ACC cars) w/ smartDSU installed + # - cars w/ DSU disconnected + # - TSS2 cars with camera sending ACC_CONTROL where we can block it + # openpilot longitudinal behind experimental long toggle: + # - TSS2 radar ACC cars w/ smartDSU installed + ret.openpilotLongitudinalControl = use_sdsu or ret.enableDsu or candidate in (TSS2_CAR - RADAR_ACC_CAR) ret.autoResumeSng = ret.openpilotLongitudinalControl and candidate in NO_STOP_TIMER_CAR if not ret.openpilotLongitudinalControl: