From ba460bbb7bdf3f4bdc05e5c8ae33c25bf74a6515 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Wed, 15 Jul 2026 11:32:02 -0500 Subject: [PATCH] patch --- opendbc_repo/opendbc/dbc/SConscript | 1 + .../generator/hyundai/hyundai_can_refresh.py | 22 +++++++++++++++++++ .../mine_connect_route_bookmarks.py | 3 ++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 opendbc_repo/opendbc/dbc/generator/hyundai/hyundai_can_refresh.py diff --git a/opendbc_repo/opendbc/dbc/SConscript b/opendbc_repo/opendbc/dbc/SConscript index 481e024ba..00594c451 100644 --- a/opendbc_repo/opendbc/dbc/SConscript +++ b/opendbc_repo/opendbc/dbc/SConscript @@ -10,6 +10,7 @@ source_files = [ for f in Path("generator").rglob("*") if f.is_file() and f.suffix in {".py", ".dbc"} ] +source_files.append(File("hyundai_kia_generic.dbc")) output_files = [ f.name.replace(".dbc", "_generated.dbc") diff --git a/opendbc_repo/opendbc/dbc/generator/hyundai/hyundai_can_refresh.py b/opendbc_repo/opendbc/dbc/generator/hyundai/hyundai_can_refresh.py new file mode 100644 index 000000000..a02d7adcf --- /dev/null +++ b/opendbc_repo/opendbc/dbc/generator/hyundai/hyundai_can_refresh.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +from pathlib import Path + + +GENERIC_LFAHDA = "BO_ 1157 LFAHDA_MFC: 4 XXX" +REFRESH_LFAHDA = "BO_ 1157 LFAHDA_MFC: 8 XXX" + + +def main() -> None: + dbc_dir = Path(__file__).resolve().parents[2] + source = dbc_dir / "hyundai_kia_generic.dbc" + target = dbc_dir / "hyundai_can_refresh_generated.dbc" + + dbc = source.read_text(encoding="utf-8") + if dbc.count(GENERIC_LFAHDA) != 1: + raise RuntimeError(f"expected exactly one {GENERIC_LFAHDA!r} definition") + + target.write_text(dbc.replace(GENERIC_LFAHDA, REFRESH_LFAHDA, 1), encoding="utf-8") + + +if __name__ == "__main__": + main() diff --git a/scripts/speed_limit_vision/mine_connect_route_bookmarks.py b/scripts/speed_limit_vision/mine_connect_route_bookmarks.py index 29b2940d0..70c88a842 100644 --- a/scripts/speed_limit_vision/mine_connect_route_bookmarks.py +++ b/scripts/speed_limit_vision/mine_connect_route_bookmarks.py @@ -45,6 +45,7 @@ def parse_args() -> argparse.Namespace: parser.add_argument("--search-after", type=float, default=1.0, help="Seconds after each bookmark to scan for the most sign-like frame.") parser.add_argument("--localize-sample-every", type=float, default=0.25, help="Seconds between frames while searching for the best sign candidate.") parser.add_argument("--top-k", type=int, default=1, help="Number of localized candidates to keep per bookmark.") + parser.add_argument("--model-only", action="store_true", help="Match the production detector/classifier path without crop OCR.") parser.add_argument("--overwrite", action="store_true", help="Overwrite any existing outputs.") return parser.parse_args() @@ -227,7 +228,7 @@ def main() -> int: args.search_after, args.localize_sample_every, ): - scored = score_frame(daemon, frame_bgr) + scored = score_frame(daemon, frame_bgr, use_ocr=not args.model_only) if scored is None: continue ranked.append((scored["score"], relative_time_s, source_video_path, frame_bgr, scored))