Repository navigation
Conversation
Process replay diff reportReplays driving segments through this PR and compares the behavior to master. ✅ 0 changed, 80 passed, 0 errors |
UIState.update and both road views call onroad_export, which loads an optional plugin from /data/onroad_export/plugin.py and passes it the UI state, the camera shown and the road projection. Without a plugin every call returns at once; a plugin that fails is logged and dropped.
RhynoTech
force-pushed
the
onroad-export-hook
branch
from
November 28, 2026 18:20
c97c8ac to
ebfccde
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An extension point for apps that show the onroad screen somewhere else, such as a phone or a car's head unit. Today such an app has to patch
ui_state.pyand the road views at install time. With this hook it installs one plugin file and leaves sunnypilot's code alone.This replaces #2, which was made against
staging.What it adds
selfdrive/ui/sunnypilot/onroad_export.py: loads an optional plugin from/data/onroad_export/plugin.pyon the first UI update, if that file exists.publish(ui_state),set_onroad_camera(**kwargs)andset_onroad_projection(**kwargs).cloudlogand dropped until the UI restarts, so it can't break the UI.UIState.update:onroad_export.publish(self), afterUIStateSP.update.set_onroad_camera(active_camera, wide_camera_available).set_transform:set_onroad_projection(ui_state, active_camera, content_rect, video_frame_matrix, model_transform, camera_offset), the values the model renderer draws with.No line of existing code changes. That's on purpose, so apps that patch these files today keep working while they move to the hook.
Cost
Nothing new on the message bus and no new subscribers. Without a plugin, each call is a module-level check that returns immediately.
Tests
selfdrive/ui/sunnypilot/tests/test_onroad_export.pycovers four cases: no plugin, a plugin receiving the calls, a plugin that fails to load, and a plugin that raises.Also rendered headless on the comma four and comma 3X onroad screens with a recording plugin installed:
ruffwith the repository's config passes.CI
Static analysis, unit tests and docs pass. Process replay fails for a reason that comes from upstream, not this change. Every process's output matches the reference except one sanity check:
plannerd'sjerk_rmson routeregenB328FF8BA0A|2025-04-08--22-57-45--0is 0.15746, over its 0.15 limit (check_jerk_rms, added in openpilot #39286, Nov 12). This PR doesn't touchplannerd. sunnypilotmasterfails the same step: its latest run (#4772, 55b3192) shows exit code 1 on process replay. The workflow lets that step fail onmasteronly (continue-on-error: ${{ github.ref == 'refs/heads/master' }}), so it shows red only on pull requests.Generated by Claude Code