From d41fd6c755ec4002c9d07cc0530fd49941edcd0e Mon Sep 17 00:00:00 2001 From: jjackbrandt Date: Sun, 30 Aug 2026 01:41:47 +0000 Subject: [PATCH 1/2] tesla_preap: restore regen demand margins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prompt sound still repeats until the warning clears. Put the trigger back to 0.2 m/s² below the envelope and 0.3s of evidence. Bump opendbc to the matching monitor thresholds. --- opendbc_repo | 2 +- selfdrive/selfdrived/preap_regen.py | 6 +++--- selfdrive/selfdrived/tests/test_preap_regen.py | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index 3c4da443534de3..49dcfe81c3e196 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 3c4da443534de39ba019cc5a00d39afecb80d3f1 +Subproject commit 49dcfe81c3e196ad060f81861ca6854549f252fe diff --git a/selfdrive/selfdrived/preap_regen.py b/selfdrive/selfdrived/preap_regen.py index 6d03e952ba9fb7..62a3671458cd77 100644 --- a/selfdrive/selfdrived/preap_regen.py +++ b/selfdrive/selfdrived/preap_regen.py @@ -16,9 +16,9 @@ # Evidence accumulates in a saturating up/down counter so a single MPC sample # cannot flash a driver prompt, while brief dropouts do not restart the clock. -REGEN_DEMAND_EVIDENCE_COUNT = int(0.2 / DT_CTRL) -REGEN_DEMAND_TRIGGER_MARGIN = 0.1 # m/s² below the envelope floor -REGEN_DEMAND_CLEAR_MARGIN = 0.03 # m/s² +REGEN_DEMAND_EVIDENCE_COUNT = int(0.3 / DT_CTRL) +REGEN_DEMAND_TRIGGER_MARGIN = 0.2 # m/s² below the envelope floor +REGEN_DEMAND_CLEAR_MARGIN = 0.05 # m/s² REGEN_DEMAND_MIN_SPEED = 2.0 # m/s; do not prompt for a stopped/settling car REGEN_DEMAND_CLEAR_SPEED = 1.0 # m/s diff --git a/selfdrive/selfdrived/tests/test_preap_regen.py b/selfdrive/selfdrived/tests/test_preap_regen.py index 92bc77b2a354f2..88982bb674574d 100644 --- a/selfdrive/selfdrived/tests/test_preap_regen.py +++ b/selfdrive/selfdrived/tests/test_preap_regen.py @@ -37,8 +37,7 @@ def test_demand_prompt_survives_single_sample_dropouts(): for _ in range(3 * REGEN_DEMAND_EVIDENCE_COUNT): for _ in range(9): fired = _update(check) or fired - # -1.55 is inside the 0.10 trigger margin, outside the 0.03 clear margin. - fired = _update(check, a_target=-1.55) or fired + fired = _update(check, a_target=-1.6) or fired if fired: break assert fired @@ -67,7 +66,7 @@ def test_demand_prompt_uses_hysteresis_before_clearing(): assert check.active # Back inside the trigger margin but still beyond the clear margin. - assert _update(check, a_target=-1.55, v_ego=1.5) + assert _update(check, a_target=-1.6, v_ego=1.5) # Demand returns to the envelope: prompt clears. assert not _update(check, a_target=-1.5) From ebcbd2b1ae70a13035c1fb146c62f05f1d9d4197 Mon Sep 17 00:00:00 2001 From: jjackbrandt Date: Sun, 30 Aug 2026 01:56:55 +0000 Subject: [PATCH 2/2] fix 0.11.1 pytest collection and macOS scons openpilot scons never entered opendbc, so libsafety.so and the generated honda DBCs were missing and unit tests died on import. Find openssl without brew on PATH. NAP opendbc still names the hyundai safety bit CANFD_LKA_STEERING. --- SConstruct | 16 ++++++++++++++++ selfdrive/test/process_replay/migration.py | 2 +- tools/replay/SConscript | 14 +++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 58cae70c355aba..d0c4a193f8ba12 100644 --- a/SConstruct +++ b/SConstruct @@ -231,6 +231,22 @@ Export('messaging') # Build other submodules SConscript(['panda/SConscript']) +# Pytest collection loads libsafety and generated DBCs from the opendbc +# tree. openpilot scons does not otherwise enter that repo. +if GetOption('extras'): + env.Command( + target=[ + File('#opendbc_repo/opendbc/safety/tests/libsafety/libsafety.so'), + File('#opendbc_repo/opendbc/dbc/honda_bosch_radarless_generated.dbc'), + ], + source=[ + File('#opendbc_repo/SConstruct'), + File('#opendbc_repo/opendbc/safety/tests/libsafety/safety.c'), + File('#opendbc_repo/opendbc/dbc/generator/generator.py'), + ], + action='scons -C opendbc_repo', + ) + # Build rednose library SConscript(['rednose/SConscript']) diff --git a/selfdrive/test/process_replay/migration.py b/selfdrive/test/process_replay/migration.py index bc6399aa941db9..b5eba466a34d4a 100644 --- a/selfdrive/test/process_replay/migration.py +++ b/selfdrive/test/process_replay/migration.py @@ -307,7 +307,7 @@ def migrate_pandaStates(msgs): safety_param_migration = { "TOYOTA_PRIUS": EPS_SCALE["TOYOTA_PRIUS"] | ToyotaSafetyFlags.STOCK_LONGITUDINAL, "TOYOTA_RAV4": EPS_SCALE["TOYOTA_RAV4"] | ToyotaSafetyFlags.ALT_BRAKE, - "KIA_EV6": HyundaiSafetyFlags.EV_GAS | HyundaiSafetyFlags.CANFD_LKA_STEER_MSG, + "KIA_EV6": HyundaiSafetyFlags.EV_GAS | HyundaiSafetyFlags.CANFD_LKA_STEERING, "CHEVROLET_VOLT": GMSafetyFlags.EV, "CHEVROLET_BOLT_EUV": GMSafetyFlags.EV | GMSafetyFlags.HW_CAM, } diff --git a/tools/replay/SConscript b/tools/replay/SConscript index eb7a7322861d8a..4d6ca9671e5f5e 100644 --- a/tools/replay/SConscript +++ b/tools/replay/SConscript @@ -1,3 +1,5 @@ +import os +import shutil import subprocess Import('env', 'arch', 'common', 'messaging', 'visionipc', 'cereal') @@ -5,7 +7,17 @@ Import('env', 'arch', 'common', 'messaging', 'visionipc', 'cereal') replay_env = env.Clone() replay_env['CCFLAGS'] += ['-Wno-deprecated-declarations'] if arch == "Darwin": - openssl_prefix = subprocess.check_output(['brew', '--prefix', 'openssl@3'], encoding='utf8').strip() + openssl_prefix = None + brew = shutil.which("brew") + if brew: + openssl_prefix = subprocess.check_output([brew, '--prefix', 'openssl@3'], encoding='utf8').strip() + else: + for candidate in ("/opt/homebrew/opt/openssl@3", "/usr/local/opt/openssl@3"): + if os.path.isdir(candidate): + openssl_prefix = candidate + break + if not openssl_prefix: + raise FileNotFoundError("openssl@3 not found (brew not on PATH and no keg at /opt/homebrew or /usr/local)") replay_env['CPPPATH'] += [f'{openssl_prefix}/include'] replay_env['LIBPATH'] += [f'{openssl_prefix}/lib']