From badbb31e38a123b68bbfcdf49e63ef6d3b89709f Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 5 May 2026 09:14:55 +0900 Subject: [PATCH 01/10] late lat enable --- opendbc_repo/opendbc/car/hyundai/carstate.py | 12 +++++++----- selfdrive/car/card.py | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/opendbc_repo/opendbc/car/hyundai/carstate.py b/opendbc_repo/opendbc/car/hyundai/carstate.py index 79fcc3bbeb..98c72f3686 100644 --- a/opendbc_repo/opendbc/car/hyundai/carstate.py +++ b/opendbc_repo/opendbc/car/hyundai/carstate.py @@ -28,6 +28,8 @@ GearShifter = structs.CarState.GearShifter +READY_COUNT_OK = 200 + NUMERIC_TO_TZ = { 840: "America/New_York", # 미국 (US) → 동부 시간대 @@ -165,9 +167,9 @@ def __init__(self, CP): self.controls_ready_count = 0 def monitor_fingerprint(self, can_parsers, canfd): - if self.controls_ready_count <= 200: - if Params().get_bool("ControlsReady"): - self.controls_ready_count += 1 + if self.controls_ready_count <= READY_COUNT_OK: + self.controls_ready_count += 1 + self.cp = can_parsers[Bus.pt] self.cp_cam = can_parsers[Bus.cam] self.cp_alt = can_parsers[Bus.alt] if Bus.alt in can_parsers else None @@ -313,7 +315,7 @@ def update(self, can_parsers) -> structs.CarState: # cruise state if self.CP.openpilotLongitudinalControl: # These are not used for engage/disengage since openpilot keeps track of state using the buttons - ret.cruiseState.available = self.main_enabled #cp.vl["TCS13"]["ACCEnable"] == 0 + ret.cruiseState.available = self.main_enabled and self.controls_ready_count >= READY_COUNT_OK #cp.vl["TCS13"]["ACCEnable"] == 0 ret.cruiseState.enabled = cp.vl["TCS13"]["ACC_REQ"] == 1 ret.cruiseState.standstill = False ret.cruiseState.nonAdaptive = False @@ -563,7 +565,7 @@ def update_canfd(self, can_parsers) -> structs.CarState: if cruise_button in [Buttons.RES_ACCEL, Buttons.SET_DECEL] and self.CP.openpilotLongitudinalControl: self.main_enabled = True # CAN FD cars enable on main button press, set available if no TCS faults preventing engagement - ret.cruiseState.available = self.main_enabled #cp.vl["TCS"]["ACCEnable"] == 0 + ret.cruiseState.available = self.main_enabled and self.controls_ready_count >= READY_COUNT_OK #cp.vl["TCS"]["ACCEnable"] == 0 if self.CP.flags & HyundaiFlags.CAMERA_SCC.value: self.MainMode_ACC = cp_cam.vl["SCC_CONTROL"]["MainMode_ACC"] == 1 self.ACCMode = cp_cam.vl["SCC_CONTROL"]["ACCMode"] diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 7bf5074d53..22c28ba2aa 100644 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -212,7 +212,7 @@ def state_update(self) -> tuple[car.CarState, structs.RadarDataT | None]: CS.vCruiseCluster = float(v_cruise_cluster_kph) CS.softHoldActive = self.v_cruise_helper._soft_hold_active CS.activateCruise = self.v_cruise_helper._activate_cruise - CS.latEnabled = self.v_cruise_helper._lat_enabled + CS.latEnabled = self.v_cruise_helper._lat_enabled and CS.out.cruiseState.available CS.useLaneLineSpeed = self.v_cruise_helper.useLaneLineSpeedApply CS.carrotCruise = 1 if self.v_cruise_helper.carrot_cruise_active else 0 From d6c80bd435b2b7437325f3978f4f2347ace5f345 Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 5 May 2026 10:32:59 +0900 Subject: [PATCH 02/10] fix.. --- selfdrive/car/card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 22c28ba2aa..039db4cacc 100644 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -212,7 +212,7 @@ def state_update(self) -> tuple[car.CarState, structs.RadarDataT | None]: CS.vCruiseCluster = float(v_cruise_cluster_kph) CS.softHoldActive = self.v_cruise_helper._soft_hold_active CS.activateCruise = self.v_cruise_helper._activate_cruise - CS.latEnabled = self.v_cruise_helper._lat_enabled and CS.out.cruiseState.available + CS.latEnabled = self.v_cruise_helper._lat_enabled and CS.cruiseState.available CS.useLaneLineSpeed = self.v_cruise_helper.useLaneLineSpeedApply CS.carrotCruise = 1 if self.v_cruise_helper.carrot_cruise_active else 0 From 03b4c91f6035af7224588f49f08640578c08f711 Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 5 May 2026 10:36:41 +0900 Subject: [PATCH 03/10] fix.. --- opendbc_repo/opendbc/car/hyundai/carstate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opendbc_repo/opendbc/car/hyundai/carstate.py b/opendbc_repo/opendbc/car/hyundai/carstate.py index 98c72f3686..01eec01db4 100644 --- a/opendbc_repo/opendbc/car/hyundai/carstate.py +++ b/opendbc_repo/opendbc/car/hyundai/carstate.py @@ -168,7 +168,8 @@ def __init__(self, CP): def monitor_fingerprint(self, can_parsers, canfd): if self.controls_ready_count <= READY_COUNT_OK: - self.controls_ready_count += 1 + if Params().get_bool("ControlsReady"): + self.controls_ready_count += 1 self.cp = can_parsers[Bus.pt] self.cp_cam = can_parsers[Bus.cam] From 29b13faf3c344b77150912e48d4b6e4884d68fd5 Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 5 May 2026 11:09:29 +0900 Subject: [PATCH 04/10] double dynamic latSec --- selfdrive/modeld/modeld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index 1caced2c9c..cb3f7601d1 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -56,7 +56,7 @@ def get_lat_smooth_seconds_dynamic(model_output: dict[str, np.ndarray], except Exception: y_std_1s = 0.0 - extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.25], [0.0, base_lat_smooth_seconds])) + extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.25], [0.0, base_lat_smooth_seconds * 2])) dynamic_lat_smooth_seconds = float(np.clip(base_lat_smooth_seconds + extra_smooth_seconds, 0.0, 0.60)) From cee95f6657afd936ff0caf155edc72cf49285eb4 Mon Sep 17 00:00:00 2001 From: carrot <43668841+ajouatom@users.noreply.github.com> Date: Tue, 5 May 2026 11:28:52 +0900 Subject: [PATCH 05/10] =?UTF-8?q?modeld.py=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/modeld/modeld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index cb3f7601d1..63e8c00c8f 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -56,7 +56,7 @@ def get_lat_smooth_seconds_dynamic(model_output: dict[str, np.ndarray], except Exception: y_std_1s = 0.0 - extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.25], [0.0, base_lat_smooth_seconds * 2])) + extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.35], [0.0, base_lat_smooth_seconds * 2])) dynamic_lat_smooth_seconds = float(np.clip(base_lat_smooth_seconds + extra_smooth_seconds, 0.0, 0.60)) From 0bf0f100fa8a5e2ba74448bca873a3d451a33755 Mon Sep 17 00:00:00 2001 From: carrot <43668841+ajouatom@users.noreply.github.com> Date: Tue, 5 May 2026 13:36:05 +0900 Subject: [PATCH 06/10] =?UTF-8?q?modeld.py=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- selfdrive/modeld/modeld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index 63e8c00c8f..0b6709b05d 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -56,7 +56,7 @@ def get_lat_smooth_seconds_dynamic(model_output: dict[str, np.ndarray], except Exception: y_std_1s = 0.0 - extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.35], [0.0, base_lat_smooth_seconds * 2])) + extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.35], [0.0, base_lat_smooth_seconds])) dynamic_lat_smooth_seconds = float(np.clip(base_lat_smooth_seconds + extra_smooth_seconds, 0.0, 0.60)) From 999aafa89c43bd93577d1ed0fb66f6e5a71b4461 Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 5 May 2026 17:29:46 +0900 Subject: [PATCH 07/10] =?UTF-8?q?Revert=20"modeld.py=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0bf0f100fa8a5e2ba74448bca873a3d451a33755. --- selfdrive/modeld/modeld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index 0b6709b05d..63e8c00c8f 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -56,7 +56,7 @@ def get_lat_smooth_seconds_dynamic(model_output: dict[str, np.ndarray], except Exception: y_std_1s = 0.0 - extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.35], [0.0, base_lat_smooth_seconds])) + extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.35], [0.0, base_lat_smooth_seconds * 2])) dynamic_lat_smooth_seconds = float(np.clip(base_lat_smooth_seconds + extra_smooth_seconds, 0.0, 0.60)) From 8d443234367223d0afee35097de381ec4bceadeb Mon Sep 17 00:00:00 2001 From: ajouatom Date: Tue, 5 May 2026 17:29:52 +0900 Subject: [PATCH 08/10] =?UTF-8?q?Revert=20"modeld.py=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit cee95f6657afd936ff0caf155edc72cf49285eb4. --- selfdrive/modeld/modeld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index 63e8c00c8f..cb3f7601d1 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -56,7 +56,7 @@ def get_lat_smooth_seconds_dynamic(model_output: dict[str, np.ndarray], except Exception: y_std_1s = 0.0 - extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.35], [0.0, base_lat_smooth_seconds * 2])) + extra_smooth_seconds = float(np.interp(y_std_1s, [0.15, 0.25], [0.0, base_lat_smooth_seconds * 2])) dynamic_lat_smooth_seconds = float(np.clip(base_lat_smooth_seconds + extra_smooth_seconds, 0.0, 0.60)) From 4d3387df5ddb0749e20873a84c7040a7549c1fd1 Mon Sep 17 00:00:00 2001 From: ajouatom Date: Wed, 6 May 2026 20:53:09 +0900 Subject: [PATCH 09/10] fix lat enabled.. --- selfdrive/car/card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 039db4cacc..7bf5074d53 100644 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -212,7 +212,7 @@ def state_update(self) -> tuple[car.CarState, structs.RadarDataT | None]: CS.vCruiseCluster = float(v_cruise_cluster_kph) CS.softHoldActive = self.v_cruise_helper._soft_hold_active CS.activateCruise = self.v_cruise_helper._activate_cruise - CS.latEnabled = self.v_cruise_helper._lat_enabled and CS.cruiseState.available + CS.latEnabled = self.v_cruise_helper._lat_enabled CS.useLaneLineSpeed = self.v_cruise_helper.useLaneLineSpeedApply CS.carrotCruise = 1 if self.v_cruise_helper.carrot_cruise_active else 0 From 16b67d1b50a43056155efb7194ba30755d3e34dc Mon Sep 17 00:00:00 2001 From: ajouatom Date: Thu, 7 May 2026 07:40:42 +0900 Subject: [PATCH 10/10] fix.. --- opendbc_repo/opendbc/car/hyundai/carstate.py | 4 ++-- opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opendbc_repo/opendbc/car/hyundai/carstate.py b/opendbc_repo/opendbc/car/hyundai/carstate.py index 01eec01db4..6733627f94 100644 --- a/opendbc_repo/opendbc/car/hyundai/carstate.py +++ b/opendbc_repo/opendbc/car/hyundai/carstate.py @@ -227,6 +227,8 @@ def add_and_cache(parser, name: str, attr: str, ignore_counter: bool = False): cp_cruise = self.cp_cam if self.CP.flags & HyundaiFlags.CANFD_CAMERA_SCC else self.cp add_and_cache(cp_cruise, "SCC_CONTROL", "scc_control") elif self.controls_ready_count == 121: + add_and_cache(self.cp, "TCS", "tcs") + add_and_cache(self.cp, "MDPS", "mdps") add_and_cache(self.cp_cam, "LFA", "lfa") add_and_cache(self.cp_cam, "LFA_ALT", "lfa_alt") add_and_cache(self.cp_cam, "LFAHDA_CLUSTER", "lfahda_cluster") @@ -238,8 +240,6 @@ def add_and_cache(parser, name: str, attr: str, ignore_counter: bool = False): add_and_cache(self.cp_cam, "CCNC_0x162", "ccnc_0x162") elif self.controls_ready_count == 123: add_and_cache(self.cp, "HDA_INFO_4A3", "hda_info_4a3") - add_and_cache(self.cp, "TCS", "tcs") - add_and_cache(self.cp, "MDPS", "mdps") add_and_cache(self.cp, "STEER_TOUCH_2AF", "steer_touch_2af") elif self.controls_ready_count == 124: add_and_cache(self.cp, self.cruise_btns_msg_canfd, "cruise_buttons_msg") diff --git a/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py b/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py index c71b89e153..86d5340651 100644 --- a/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py @@ -154,7 +154,7 @@ def create_steering_messages_camera_scc(frame, packer, CP, CAN, CC, lat_active, values["NEW_SIGNAL_1"] = 10 ret.append(packer.make_can_msg("LFA", CAN.ECAN, values, rx_counter = rx_counter)) - else: + elif CS.lfa is not None: values = {} values["LKA_MODE"] = 2 values["LKA_ICON"] = 2 if lat_active else 1