From 4667241fe7548a9f7a609e755f1bc4b66108e22d Mon Sep 17 00:00:00 2001 From: granolaFPV <65827214+granolaFPV@users.noreply.github.com> Date: Fri, 21 Aug 2026 17:51:43 -0700 Subject: [PATCH 1/3] [TIZI/TICI] ui: dynamic path width color (#1926) * Fix UI path color and thickness based on lateral steering state (Issue #1441) * Fix UI path color and thickness based on lateral control engagement (Issue #1441) * Fix UI path width and color based on MADS lateral engagement (Issue #1441) * Fix UI path width and color based on MADS lateral engagement (Issue #1441) * move to ModelRendererSP * match torque bar * same behavior across the board * simplify --------- Co-authored-by: Brennan Browne Co-authored-by: Jason Wen --- openpilot/selfdrive/ui/onroad/model_renderer.py | 4 ++-- .../selfdrive/ui/sunnypilot/onroad/model_renderer.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/openpilot/selfdrive/ui/onroad/model_renderer.py b/openpilot/selfdrive/ui/onroad/model_renderer.py index def1c644af..f5a39a2a5b 100644 --- a/openpilot/selfdrive/ui/onroad/model_renderer.py +++ b/openpilot/selfdrive/ui/onroad/model_renderer.py @@ -192,7 +192,7 @@ class ModelRenderer(Widget, ChevronMetrics, ModelRendererSP): max_idx = self._get_path_length_idx(path_x_array, max_distance) self._path.projected_points = self._map_line_to_polygon( - self._path.raw_points, 0.9, self._path_offset_z, max_idx, max_distance, allow_invert=False + self._path.raw_points, self._get_path_half_width(), self._path_offset_z, max_idx, max_distance, allow_invert=False ) self._update_experimental_gradient() @@ -292,7 +292,7 @@ class ModelRenderer(Widget, ChevronMetrics, ModelRendererSP): allow_throttle = sm['longitudinalPlan'].allowThrottle or not self._longitudinal_control self._blend_filter.update(int(allow_throttle)) - if ui_state.rainbow_path: + if ui_state.rainbow_path and self._lateral_active: self.rainbow_path.draw_rainbow_path(self._rect, self._path) return diff --git a/openpilot/selfdrive/ui/sunnypilot/onroad/model_renderer.py b/openpilot/selfdrive/ui/sunnypilot/onroad/model_renderer.py index 5d78997662..3cf639d0a1 100644 --- a/openpilot/selfdrive/ui/sunnypilot/onroad/model_renderer.py +++ b/openpilot/selfdrive/ui/sunnypilot/onroad/model_renderer.py @@ -4,11 +4,23 @@ Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. This file is part of sunnypilot and is licensed under the MIT License. See the LICENSE.md file in the root directory for more details. """ +from openpilot.common.filter_simple import FirstOrderFilter +from openpilot.selfdrive.ui.ui_state import ui_state, UIStatus from openpilot.selfdrive.ui.sunnypilot.onroad.chevron_metrics import ChevronMetrics from openpilot.selfdrive.ui.sunnypilot.onroad.rainbow_path import RainbowPath +from openpilot.system.ui.lib.application import gui_app class ModelRendererSP: def __init__(self): self.rainbow_path = RainbowPath() self.chevron_metrics = ChevronMetrics() + self._width_filter = FirstOrderFilter(0.9, 0.1, 1 / gui_app.target_fps) + + @property + def _lateral_active(self) -> bool: + return ui_state.status in (UIStatus.ENGAGED, UIStatus.LAT_ONLY) + + def _get_path_half_width(self) -> float: + target = 0.9 if self._lateral_active else 0.40 + return self._width_filter.update(target) From ca9338812e3622766f9cb62554f7963f13121ba5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 22 Aug 2026 00:16:10 -0400 Subject: [PATCH 2/3] ci: prep for chestnut prebuilts --- .../workflows/build-default-big-model.yaml | 82 +++++++++++++++++++ release/ci/upload_default_model.py | 74 +++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 .github/workflows/build-default-big-model.yaml create mode 100644 release/ci/upload_default_model.py diff --git a/.github/workflows/build-default-big-model.yaml b/.github/workflows/build-default-big-model.yaml new file mode 100644 index 0000000000..1a734a3af8 --- /dev/null +++ b/.github/workflows/build-default-big-model.yaml @@ -0,0 +1,82 @@ +name: Build default big model + +on: + push: + branches: [ master, master-dev ] + paths: + - 'openpilot/selfdrive/modeld/models/big_driving_supercombo.onnx' + workflow_dispatch: + +env: + HF_REPO: sunnypilot/sunnypilot_models_v1 + HF_DEFAULTS_PATH: models/defaults/big + +jobs: + build_model: + uses: ./.github/workflows/sunnypilot-build-model.yaml + with: + upstream_branch: ${{ github.sha }} + custom_name: default-big-model + target_hardware: usbgpu + secrets: inherit + + upload_defaults: + needs: build_model + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + - run: git lfs pull -I "openpilot/selfdrive/modeld/models/big_driving_supercombo.onnx" + + - name: Install huggingface_hub + run: pip install --upgrade "huggingface_hub>=0.22.0" + + - name: Download artifact name + uses: actions/download-artifact@v4 + with: + name: artifact-name-default-big-model + path: artifact_name + + - name: Read artifact name + id: artifact + run: | + ARTIFACT_NAME=$(cat artifact_name/artifact_name.txt) + echo "artifact_name=$ARTIFACT_NAME" >> $GITHUB_OUTPUT + + - name: Download model artifact + uses: actions/download-artifact@v4 + with: + name: ${{ steps.artifact.outputs.artifact_name }} + path: output + + - name: Upload model to HF defaults + env: + HF_OIDC_RESOURCE: datasets/${{ env.HF_REPO }} + ARTIFACT_NAME: ${{ steps.artifact.outputs.artifact_name }} + run: | + rm -f output/artifact_name.txt + hf upload ${{ env.HF_REPO }} \ + output/ \ + "${HF_DEFAULTS_PATH}/${ARTIFACT_NAME}/" \ + --repo-type=dataset + + - name: Get tinygrad ref and ONNX hash + id: meta + run: | + export PYTHONPATH=$(pwd) + echo "tinygrad_ref=$(python3 openpilot/sunnypilot/models/tinygrad_ref.py)" >> $GITHUB_OUTPUT + echo "onnx_sha256=$(sha256sum openpilot/selfdrive/modeld/models/big_driving_supercombo.onnx | cut -d' ' -f1)" >> $GITHUB_OUTPUT + + - name: Update default_models.json on HF + env: + HF_OIDC_RESOURCE: datasets/${{ env.HF_REPO }} + ARTIFACT_NAME: ${{ steps.artifact.outputs.artifact_name }} + run: | + python3 release/ci/upload_default_model.py \ + --hf-repo "${{ env.HF_REPO }}" \ + --hf-defaults-path "${{ env.HF_DEFAULTS_PATH }}" \ + --artifact-name "$ARTIFACT_NAME" \ + --metadata-path "output/metadata.json" \ + --onnx-sha256 "${{ steps.meta.outputs.onnx_sha256 }}" \ + --tinygrad-ref "${{ steps.meta.outputs.tinygrad_ref }}" diff --git a/release/ci/upload_default_model.py b/release/ci/upload_default_model.py new file mode 100644 index 0000000000..ab31dcabce --- /dev/null +++ b/release/ci/upload_default_model.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +""" +Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + +This file is part of sunnypilot and is licensed under the MIT License. +See the LICENSE.md file in the root directory for more details. +""" + +import argparse +import json +import sys +import tempfile + +from huggingface_hub import HfApi, hf_hub_download + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--hf-repo", required=True) + parser.add_argument("--hf-defaults-path", required=True) + parser.add_argument("--artifact-name", required=True) + parser.add_argument("--metadata-path", required=True) + parser.add_argument("--onnx-sha256", required=True) + parser.add_argument("--tinygrad-ref", required=True) + args = parser.parse_args() + + with open(args.metadata_path) as f: + metadata = json.load(f) + + bundle = metadata['bundles'][0] + bundle['onnx_sha256'] = args.onnx_sha256 + + artifact = bundle['models'][0]['artifact'] + hf_base = f"https://huggingface.co/datasets/{args.hf_repo}/resolve/main/{args.hf_defaults_path}/{args.artifact_name}" + artifact['download_uri']['url'] = f"{hf_base}/{artifact['file_name']}" + for chunk in artifact.get('chunks', []): + chunk['url'] = f"{hf_base}/{chunk['file_name']}" + + json_filename = f"{args.hf_defaults_path}/default_models.json" + try: + local_path = hf_hub_download(repo_id=args.hf_repo, repo_type='dataset', filename=json_filename) + with open(local_path) as f: + defaults_json = json.load(f) + except Exception: + defaults_json = {"tinygrad_ref": args.tinygrad_ref, "bundles": []} + + defaults_json['tinygrad_ref'] = args.tinygrad_ref + + existing_idx = next((i for i, b in enumerate(defaults_json['bundles']) + if b.get('display_name') == bundle.get('display_name')), None) + if existing_idx is not None: + defaults_json['bundles'][existing_idx] = bundle + else: + defaults_json['bundles'].append(bundle) + + print(json.dumps(defaults_json, indent=2)) + + api = HfApi() + with tempfile.NamedTemporaryFile(mode='w', suffix='.json', delete=False) as f: + json.dump(defaults_json, f, indent=2) + tmp_path = f.name + + api.upload_file( + path_or_fileobj=tmp_path, + path_in_repo=json_filename, + repo_id=args.hf_repo, + repo_type="dataset", + ) + + print(f"Updated {json_filename}") + + +if __name__ == "__main__": + main() From 07558166c81c1b8ba091adfbf607449c449ecdb6 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 22 Aug 2026 00:32:35 -0400 Subject: [PATCH 3/3] ci: only check default model on dispatch --- .github/workflows/build-default-big-model.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-default-big-model.yaml b/.github/workflows/build-default-big-model.yaml index 1a734a3af8..008659086d 100644 --- a/.github/workflows/build-default-big-model.yaml +++ b/.github/workflows/build-default-big-model.yaml @@ -1,10 +1,6 @@ name: Build default big model on: - push: - branches: [ master, master-dev ] - paths: - - 'openpilot/selfdrive/modeld/models/big_driving_supercombo.onnx' workflow_dispatch: env: