9 Commits

Author SHA1 Message Date
James Vecellio-Grant
ddf05d7126 modeld_v2: tinygrad transformation warp (#1698)
* chore: sync tinygrad

Runs great in sim. now we need to rebuild some models

* oops forgot to unblock this after testing

* helpers

* oh yeah

* latest tg

* this wont do anything empriically

* reduce complexity

* okay lint

* Update tinygrad_runner.py

* Update modeld.py

* Update build-all-tinygrad-models.yaml

* tinygrad bump

* Update modeld.py

* Update tinygrad_runner.py

* bump

* Update SConscript

* Update SConscript

* com

* Update fetcher.py

* Update helpers.py

* life is froughtless, when you're thoughtless

* lint

* ozdust ballroom

* shiz

* Update tinygrad_runner.py

* Update tinygrad_runner.py

* slough it off as i do

* try old support one last time

* support mixed input dtypes

* use internal

* dont need that shiz

* Update fill_model_msg.py

* Update onnx_runner.py

* Update onnx_runner.py

* Update model_runner.py

* see if this speeds up execution

if not, revert me

* no

* Update helpers.py

* rebase

* more

* planplus

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2026-02-27 16:15:59 -05:00
Jason Wen
53327edb50 Merge branch 'upstream/openpilot/master' into sync-20260111
# Conflicts:
#	common/api.py
#	docs/CARS.md
#	opendbc_repo
#	panda
#	scripts/lint/lint.sh
#	selfdrive/car/car_specific.py
#	selfdrive/car/card.py
#	selfdrive/test/process_replay/ref_commit
#	system/hardware/hardwared.py
#	tinygrad_repo
2026-01-20 07:29:25 -05:00
Jason Wen
ecee67dd64 Locationd: reimplement liveLocationKalman and use position_geodetic in liveMapDataSP (#1275)
* init

* desc

* llk welcome back

* more

* new param to write

* update mapd

* no migration

* no refactor for now

* exec

* rename

* bearing

* fix test

* lint
2025-09-22 23:39:55 -04:00
DevTekVE
1a8dd310ae Model: split modeld into it's own contained modeld implementation (#642)
* Add support for TinyGrad model runner processing

Introduced a new function `is_tinygrad_model` to detect TinyGrad as an active model runner. Updated the `is_stock_model` logic to account for TinyGrad models and added a new process entry for TinyGrad in the model manager. This enables handling TinyGrad models alongside existing configurations.

adding modeld back

Add support for `modeld_v2` and update paths for consistency

Updated `SConscript` files to integrate `modeld_v2` alongside `modeld` and adjusted script paths for correct metadata handling. Adjusted various configurations and scripts, such as `labeler.yaml` and `build_release.sh`, to include `modeld_v2` and ensure cohesive project structure.

Refactor imports to use updated `modeld_v2` paths.

Replaced outdated `modeld` references with their `modeld_v2` counterparts for consistency and clarity across the codebase. Also updated `.gitignore` to accommodate new directory structure. This change ensures better maintainability and alignment with the new directory schema.

Refactor and reorganize modeld to sunnypilot/modeld_v2 structure.

Moved and renamed `modeld` components to the new `sunnypilot/modeld_v2` directory for better organization and modularity. Updated imports and file references to align with the new structure, ensuring compatibility and functionality. Streamlined project structure to improve maintainability and future development.

* typo

* Use `stock` model runner and refactor model checks.

Replaces outdated model detection logic with unified `stock` runner integration, simplifying the decision flow for model selection. Includes `stock` as a new enum in the `Runner` type and updates affected references accordingly.

* Handle missing 'sim_pose' in model outputs gracefully.

Added conditional checks to ensure the code handles cases where 'sim_pose' is absent in the model outputs. Fallback behaviors use 'plan' data when 'sim_pose' is unavailable, preventing potential errors and enhancing robustness.
2025-03-02 20:49:30 +01:00
Jason Wen
acd46aa94b modeld: retain SNPE and thneed drive model support (#555)
* modeld: Retain pre-20hz drive model support

* Method not available anymore on OP

* some fixes

* Revert "Long planner get accel: new function args (#34288)"

* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"

* Revert "long planner: allow throttle reflects usage (#33792)"

* Revert "Gate acceleration on model gas press predictions (#33643)"

* Reapply "Gate acceleration on model gas press predictions (#33643)"

This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428.

* Reapply "long planner: allow throttle reflects usage (#33792)"

This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693.

* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"

This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807.

* Reapply "Long planner get accel: new function args (#34288)"

This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b.

* don't need

* retain snpe

* wrong

* they're symlinks

* remove

* put back into VCS

* add back

* don't include built

* Refactor model runner retrieval with caching support

Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.

* Update model runner determination logic with caching fix

Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.

* default to none

* enable in next PR

* more

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-01-10 18:34:06 -05:00
Jason Wen
402ee444b7 Revert "modeld: retain SNPE and thneed drive model support" (#551)
Revert "modeld: retain SNPE and thneed drive model support (#530)"

This reverts commit 56aa07844a.
2025-01-10 16:25:16 -05:00
Jason Wen
56aa07844a modeld: retain SNPE and thneed drive model support (#530)
* modeld: Retain pre-20hz drive model support

* Method not available anymore on OP

* some fixes

* Revert "Long planner get accel: new function args (#34288)"

* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"

* Revert "long planner: allow throttle reflects usage (#33792)"

* Revert "Gate acceleration on model gas press predictions (#33643)"

* Reapply "Gate acceleration on model gas press predictions (#33643)"

This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428.

* Reapply "long planner: allow throttle reflects usage (#33792)"

This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693.

* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"

This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807.

* Reapply "Long planner get accel: new function args (#34288)"

This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b.

* don't need

* retain snpe

* wrong

* they're symlinks

* remove

* put back into VCS

* add back

* don't include built

* Refactor model runner retrieval with caching support

Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.

* Update model runner determination logic with caching fix

Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.

* default to none

* enable in next PR

* more

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-01-10 08:56:10 -05:00
Jason Wen
c13f159a77 Revert "models: retain SNPE runner support" (#529)
Revert "models: retain SNPE runner support (#522)"

This reverts commit f84d27c4ee.
2025-01-06 22:06:50 +00:00
Jason Wen
f84d27c4ee models: retain SNPE runner support (#522)
* tinygrad with snpe

* force with snpe to validate

* fix path

* fix more paths

* Adjust modeld execution logic based on active model runner

Introduced a check to conditionally execute `modeld` based on the active model runner. Added support for distinguishing between SNPE and TinyGrad runners using new helper functions and updated `custom.capnp` definitions. This change optimizes process management by ensuring compatibility with the selected model runner.

* Refactor modeld process function checks.

Introduce `is_stock_model` to clarify logic and replace direct uses of `is_snpe_model` where the stock model condition is needed. Additionally, rename the duplicate "modeld" process in sunnyPilot to "modeld_snpe" for clarity and consistency.

* ignore tg

* fix process name

* ruff

* fix thneed paths

* mypy

* remove our own

* use upstream compile3

* fix thneed

* try this

* Revert "remove our own"

This reverts commit 1cf4f57502565c274628e185c66f1eb04c4d9bbe.

* try using compile2.py again

* add back symlink

* fix path

* more fix

* wrong path again

* Revert "wrong path again"

This reverts commit f5301c19d594defb23cda2604168bcb02c830f3e.

* update

* hardcode path to our submodule

* force path

* try this

* fix file name

* try this

* again

* Revert "again"

This reverts commit 17c8cd73768a2de5aaf2a34d202aa6f03d59d72d.

* Revert "try this"

This reverts commit 767f78bbcf17b08edbc20f283d10a1990bf4264f.

* Revert "fix file name"

This reverts commit 485eef68da981da571fe9a9ebf3aecdb95e5588c.

* Revert "try this"

This reverts commit 41fef87680cdda1ba8cbd7e5c59256e6c57010a0.

* Revert "force path"

This reverts commit 5c3b408937bff0f61b150971b328d127501c5bf0.

* Revert "hardcode path to our submodule"

This reverts commit 5ee1950b6f4fce73e7e73b6971b996a9989d0a93.

* Revert "update"

This reverts commit fb313bd7fbeb50111f3c4a11137b4cfd9cabc3fa.

* Reapply "wrong path again"

This reverts commit 309639aeb3575e20b215bbbcc27e48923ee95c87.

* Revert "wrong path again"

This reverts commit f5301c19d594defb23cda2604168bcb02c830f3e.

* Revert "more fix"

This reverts commit 23dd423e78e60bd6a0bd73e921bfba9a5aad88bd.

* Revert "fix path"

This reverts commit 75d338f2bda2dfa77044e33f4c6553390621b13b.

* Revert "add back symlink"

This reverts commit 9f71ad0b8ae2068e431c455af9d4f954d024eec7.

* Revert "try using compile2.py again"

This reverts commit 914117d2e1c6c4270f7bef1a5305847a1d7bab17.

* Reapply "remove our own"

This reverts commit b1996377b346658f2094cba9032a66230784cb3e.

* don't even compile anymore

* need it for default snpe model

* add to lfs

* bring onnx back for sim

* must add this back

* need this

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-01-05 17:47:27 -05:00