Compare commits

..

319 Commits

Author SHA1 Message Date
Jason Wen a3ac5a2264 Merge branch 'master-new-merge-test' into mads-new-test-onroad-ui 2025-01-03 22:39:32 -05:00
Jason Wen a3ab6db7eb ui: sunnypilot panel in settings (#513)
* ui: sunnypilot panel in settings

* add panel to comment

* test populate screenshot

* Revert "test populate screenshot"

This reverts commit 426b6c26c5.
2025-01-03 17:18:38 -05:00
Jason Wen 3a64efe52f Bump submodules 2025-01-03 15:07:10 -05:00
Jason Wen 3966599e9d ui: sunnypilot offroad UI (#512)
* Revert "Revert "ui: sunnypilot offroad UI" (#511)"

This reverts commit 0e264e1b05.

* Revert "move files to sp dir"

This reverts commit c72d732259.

* remove drive stats for now

* update translation

* update onboarding

* remove sp onboarding for now

* rearrange

* remove more

* shorter license
2025-01-03 15:04:09 -05:00
Jason Wen 0e264e1b05 Revert "ui: sunnypilot offroad UI" (#511)
Revert "ui: sunnypilot offroad UI (#500)"

This reverts commit 3717a111af.
2025-01-03 11:02:19 -05:00
Jason Wen 3717a111af ui: sunnypilot offroad UI (#500)
* add sp flag

* return if sp macro

* controls

* drive stats

* some more

* more

* skip the whole thing

* missed

* more

* more main

* not ready to push yet but sure

* get them icons

* later

* own icons

* Revert "own icons"

This reverts commit e07bd8e670.

* blank icon

* render differently on mac

* static

* set toggle and title space properly

* format

* remove prior objects

* good spacing for ButtonParamControlSP

* more space formatting

* on device fix

* update home wifi prompt

* handle AbstractControlSP_SELECTOR hide events properly

* use sp

* ignore name

* more

* keep spacing

* better flag

* settings button moved

* small cleanup

* move files to sp dir

* remove for now

* developer different icon

* add scrolling to ui test

* Revert "add scrolling to ui test"

This reverts commit c8d1c65d89.

* format

* make them virtual

* do we still need this?

* Apply suggestions from code review

Co-authored-by: DevTekVE <devtekve@gmail.com>

* revert for now

* shorter license

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-01-03 09:36:36 -05:00
DevTekVE 1943b5fd28 Merge branch 'master-new' into mads-new
# Conflicts:
#	common/params.cc
#	selfdrive/ui/qt/offroad/developer_panel.cc
#	selfdrive/ui/translations/main_ar.ts
#	selfdrive/ui/translations/main_de.ts
#	selfdrive/ui/translations/main_es.ts
#	selfdrive/ui/translations/main_fr.ts
#	selfdrive/ui/translations/main_ja.ts
#	selfdrive/ui/translations/main_ko.ts
#	selfdrive/ui/translations/main_pt-BR.ts
#	selfdrive/ui/translations/main_th.ts
#	selfdrive/ui/translations/main_tr.ts
#	selfdrive/ui/translations/main_zh-CHS.ts
#	selfdrive/ui/translations/main_zh-CHT.ts
2024-12-23 09:21:48 +01:00
devtekve 33760e34d5 test_processes: update ref logs to 0a0b998 2024-12-19 16:28:20 +00:00
DevTekVE 0a0b99814a bump submodule 2024-12-19 17:11:09 +01:00
DevTekVE fac18d3c8d bump submodules 2024-12-19 17:06:08 +01:00
DevTekVE f51cc3e747 keep going 2024-12-19 17:04:31 +01:00
Jason Wen 9bf6fdaf41 fix mads button not allowed 2024-12-18 10:28:44 -05:00
Jason Wen 3663cb469f Apply suggestions from code review 2024-12-17 07:35:35 -05:00
Jason Wen 9706bdf226 test_processes: update ref logs to dd41005 2024-12-17 07:15:07 -05:00
Jason Wen dd41005393 Merge branch 'master-new' into mads-new 2024-12-17 07:09:01 -05:00
Jason Wen 6ed0eabddf Disengage Lateral on Brake -> Pause Lateral on Brake 2024-12-16 11:22:37 -05:00
DevTekVE 3dee7cac53 Updating translations + Adding spanish 2024-12-16 10:06:01 +01:00
DevTekVE 10fc0de603 Update MADS toggle descriptions for clarity.
Added notes to clarify behavior of the "MadsMainCruiseAllowed" setting, particularly its impact on vehicles without LFA/LKAS buttons. This ensures users are informed about potential implications when disabling this feature.
2024-12-16 09:52:05 +01:00
DevTekVE 6169b4df5c Bump opendbc 2024-12-16 09:44:28 +01:00
Jason Wen e034dc57d7 needs to be in carstate 2024-12-15 22:44:15 -05:00
Jason Wen 0eef033196 Merge remote-tracking branch 'sunnypilot/sunnypilot/mads-new' into mads-new 2024-12-15 21:22:30 -05:00
Jason Wen d42fca4beb code ignore spells 2024-12-15 21:22:24 -05:00
Jason Wen 5b8fba9403 Apply suggestions from code review 2024-12-15 21:19:21 -05:00
Jason Wen 3b8d1ed212 bump opendbc 2024-12-15 21:06:42 -05:00
Jason Wen 76307a9ce4 bump opendbc 2024-12-15 21:03:09 -05:00
Jason Wen 8d4d95227c bump opendbc 2024-12-15 20:21:30 -05:00
Jason Wen bab0b92055 bump opendbc 2024-12-15 19:41:31 -05:00
Jason Wen 1dfe5e7f0d bump to merged panda 2024-12-15 18:07:39 -05:00
Jason Wen 79ab4eb888 bump panda 2024-12-15 17:47:23 -05:00
Jason Wen cc02043f9b block tesla 2024-12-15 17:46:57 -05:00
Jason Wen a87ff0d33f remove toyota lta status for lkas, causes weird behaviors 2024-12-15 17:23:08 -05:00
Jason Wen 842a6b6c3b hard code to skip heartbeat check 2024-12-15 17:12:28 -05:00
Jason Wen 16fa4910ae use different heartbeat check if dlob 2024-12-14 21:45:58 -05:00
Jason Wen 68706ab0db flipped 2024-12-14 18:01:38 -05:00
Jason Wen b39831e727 block uem from engaging 2024-12-14 15:01:07 -05:00
Jason Wen 2ebb2b33cd fix not allowed engaged bug 2024-12-14 12:02:29 -05:00
Jason Wen 2d7009fa11 bump submodules 2024-12-13 13:29:42 -05:00
Jason Wen e7f9b44be8 uem: do not engage mads if long is engaged 2024-12-13 13:29:37 -05:00
Jason Wen 4b15a94e09 format 2024-12-13 09:46:13 -05:00
Jason Wen 81b273847f new events to retain long blocks 2024-12-13 09:44:20 -05:00
DevTekVE 2c1f03c504 bump panda 2024-12-13 12:42:01 +01:00
Jason Wen 5384333ec6 fix panda tests 2024-12-13 00:13:35 -05:00
Jason Wen a99bda1fe3 fix tests 2024-12-13 00:01:50 -05:00
Jason Wen ef28aefe60 use brake signal instead of pedal events when dlob is active 2024-12-12 23:26:56 -05:00
Jason Wen b3e1ecfa85 only force exit if actually actuating 2024-12-12 23:24:52 -05:00
Jason Wen 7fd83f056a ignore pre enable with mads 2024-12-12 23:23:41 -05:00
Jason Wen 13094cad29 use mads the third panda 2024-12-12 21:14:50 -05:00
Jason Wen fe4150de12 bump panda 2024-12-12 17:15:14 -05:00
Jason Wen 205bd3ca75 heartbeat engaged mads mismatch mutation test 2024-12-12 17:07:17 -05:00
Jason Wen 5b0ceb2d43 bump panda 2024-12-12 16:15:14 -05:00
Jason Wen 6fb9e2d253 remove main cruise allowed from alt 2024-12-12 11:50:14 -05:00
Jason Wen b64106333b move to safety_mads 2024-12-12 11:11:04 -05:00
Jason Wen b3c75f2f35 remove always allow mads button from alt 2024-12-12 11:10:08 -05:00
Jason Wen 33205f9742 heartbeat mismatch exit control 2024-12-12 10:51:08 -05:00
Jason Wen 35edaba95e heartbeat for mads 2024-12-12 10:44:41 -05:00
Jason Wen 8325bec69b squash! treat MADS button as user entry 2024-12-12 10:24:51 -05:00
Jason Wen abaa3118df controls allow should be allowed at all times 2024-12-12 10:22:36 -05:00
Jason Wen bc62544d0b remove unified engagement mode in panda 2024-12-12 10:20:12 -05:00
DevTekVE 6aeccfbb39 Simplify lateral disengagement logic for MADS configuration
Reversed the conditional to align the logic with the `disengage_lateral_on_brake` parameter. This ensures that lateral disengagement behavior is more intuitive and matches the expected configuration. Improves code readability and reduces potential misconfigurations.
2024-12-12 10:59:50 +01:00
Jason Wen f5f0e89f0b add controls mismatch lateral event 2024-12-12 00:37:05 -05:00
Jason Wen 026ccb49c0 bump panda 2024-12-11 23:40:07 -05:00
Jason Wen 580809fc49 bump submodules 2024-12-11 18:50:41 -05:00
Jason Wen fddf411c65 bump submodules 2024-12-11 14:25:48 -05:00
Jason Wen 3fcc1aa420 bump submodules 2024-12-11 14:25:16 -05:00
Jason Wen 1621674ee8 Merge remote-tracking branch 'sunnypilot/sunnypilot/mads-new' into mads-new 2024-12-11 11:05:07 -05:00
devtekve 4d875ad660 test_processes: update ref logs to 82c0278 2024-12-11 14:17:47 +00:00
Jason Wen ee38d746d1 Merge remote-tracking branch 'sunnypilot/sunnypilot/mads-new' into mads-new 2024-12-11 04:36:08 -05:00
DevTekVE 82c027877d Merge branch 'master-new' into mads-new 2024-12-11 10:23:25 +01:00
DevTekVE 6e4a6dbd44 whitelist jason's lastname to codespell 2024-12-11 09:43:09 +01:00
Jason Wen 9be96d625d fix 2024-12-10 23:18:11 -05:00
Jason Wen 69170840d2 use always allowed mads button alt exp 2024-12-10 19:02:42 -05:00
Jason Wen eaf590cb28 bump submodules 2024-12-10 18:41:20 -05:00
Jason Wen 955dc45da9 unused 2024-12-10 18:40:29 -05:00
Jason Wen 68758b0d0d remove 2024-12-10 17:22:50 -05:00
Jason Wen d25607561d license 2024-12-10 15:09:42 -05:00
Jason Wen 325bd77b6d ford mutation 2024-12-10 13:02:05 -05:00
Jason Wen b06d322e72 mutation for controls allowed rising edge 2024-12-10 12:47:40 -05:00
Jason Wen dfb0ce9bf4 missed 2024-12-10 12:37:32 -05:00
Jason Wen e47d1850be Parse more flags from alt exp, more tests, hyundai main cruise allowed 2024-12-10 12:32:18 -05:00
Jason Wen cb251230dd Parse more flags from alt exp, more tests, hyundai main cruise allowed 2024-12-10 12:32:08 -05:00
Jason Wen ccb452fb3a bump panda 2024-12-09 16:46:34 -05:00
Jason Wen d6bd1de814 bump with new panda 2024-12-09 16:07:38 -05:00
Jason Wen de3dafc9c2 Merge branch 'master-new' into mads-new
# Conflicts:
#	opendbc_repo
2024-12-09 16:07:24 -05:00
Jason Wen 0116697ac9 use sunny's newer states 2024-12-08 22:48:07 -05:00
DevTekVE a61eeb85f3 nuke nuke nuke 2024-12-08 22:32:35 +01:00
DevTekVE 3cdcb2bd76 changing refs 2024-12-08 22:13:56 +01:00
DevTekVE 8ac445e1c0 bump more panda 2024-12-08 16:58:48 +01:00
DevTekVE d0f3dad42a bump panda ref 2024-12-08 11:45:18 +01:00
Jason Wen 3e6204567e add todo-sp 2024-12-07 21:02:31 -05:00
DevTekVE 106b4ddc93 bump ref panda 2024-12-07 19:45:08 +01:00
DevTekVE e730ee6882 bump panda 2024-12-07 19:11:25 +01:00
Jason Wen e40b32e7c8 Apply suggestions from code review 2024-12-07 02:10:42 -05:00
Jason Wen c27b7c9a4d bump opendbc 2024-12-07 01:42:05 -05:00
Jason Wen df0164370b bump panda 2024-12-07 00:26:29 -05:00
Jason Wen a71335d1c6 should be none 2024-12-06 23:48:23 -05:00
Jason Wen ad691b675a Revert "PlayStation® model (#34133)"
This reverts commit 5160bee543.
2024-12-06 18:05:10 -05:00
DevTekVE 61bb1247f6 improving the state 2024-12-06 16:41:47 +01:00
Jason Wen ef884ac378 bump opendbc 2024-12-05 20:01:04 -05:00
Jason Wen 9d514766b8 bump opendbc 2024-12-05 19:59:37 -05:00
Jason Wen fb604cdc8a bump submodules 2024-12-05 19:41:03 -05:00
Jason Wen f5fe9e37e8 bump panda 2024-12-05 18:27:02 -05:00
Jason Wen 7eed4b60c2 Merge branch 'master-new' into mads-new
# Conflicts:
#	opendbc_repo
#	panda
#	selfdrive/selfdrived/tests/test_alerts.py
2024-12-05 18:17:30 -05:00
Jason Wen 355191040d bump msgq 2024-12-05 15:35:04 -05:00
DevTekVE dba3af0cfa bump panda 2024-12-05 20:47:34 +01:00
Jason Wen 1b9a1308fa more nissan 2024-12-04 22:55:54 -05:00
Jason Wen 1647c928f5 bump panda 2024-12-04 18:45:05 -05:00
DevTekVE 0378f1c4a3 Bump to latest mads-new panda 2024-12-04 20:29:27 +01:00
Jason Wen 2edec42681 Merge branch 'master-new' into mads-new
# Conflicts:
#	opendbc_repo
2024-11-27 08:19:39 -05:00
Jason Wen 78e15be5c4 bump submodules 2024-11-27 08:19:21 -05:00
Jason Wen 84bce5ccd6 flipped 2024-11-26 13:59:25 -05:00
Jason Wen bcff9ca4ce silent park brake 2024-11-26 13:57:42 -05:00
Jason Wen 1e11b6311f rename for clarity 2024-11-26 12:59:55 -05:00
Jason Wen 9d77783349 should not be all! 2024-11-26 12:57:48 -05:00
Jason Wen 2adfd5f193 Revert "allow in all"
This reverts commit 6375f14891.
2024-11-26 12:43:30 -05:00
Jason Wen 6375f14891 allow in all 2024-11-26 12:40:06 -05:00
Jason Wen ec7bd2afd9 Revert "allow no entry to paused for non-drive gears"
This reverts commit 6d64a4dd9c.
2024-11-26 12:01:40 -05:00
Jason Wen b72d3308ec use cereal 2024-11-25 23:11:32 -05:00
Jason Wen 289b5cd8c4 fix 2024-11-25 23:01:51 -05:00
Jason Wen 6d64a4dd9c allow no entry to paused for non-drive gears 2024-11-25 18:01:44 -05:00
Jason Wen 2fbe4e8f71 fix 2024-11-25 00:09:14 -05:00
Jason Wen 7fbdc63f11 more events 2024-11-25 00:05:07 -05:00
Jason Wen 207eff5c30 less frequent 2024-11-24 23:56:25 -05:00
Jason Wen b1658fea94 bump opendbc 2024-11-24 23:55:53 -05:00
Jason Wen 06c4fba102 Merge branch 'master-new' into mads-new
# Conflicts:
#	opendbc_repo
#	panda
2024-11-23 12:33:31 -05:00
Jason Wen 6c5afa789f bump submodules 2024-11-22 17:59:33 -05:00
Jason Wen 6a82baac9c fix 2024-11-22 10:25:56 -05:00
Jason Wen ccea6de343 Merge branch 'master-new' into mads-new
# Conflicts:
#	opendbc_repo
#	panda
2024-11-22 10:17:49 -05:00
Jason Wen 86a4cc6329 bump submodules 2024-11-21 23:48:28 -05:00
Jason Wen 7883de0b30 do this for dlob 2024-11-20 20:28:18 -05:00
Jason Wen a89e79e4bb unify silent enable 2024-11-20 12:08:26 -05:00
Jason Wen d7629c55df only mads in enabled state and long in disabled state 2024-11-20 11:55:22 -05:00
Jason Wen bcc4117217 fix 2024-11-20 11:52:35 -05:00
Jason Wen 9fa0d53b82 same thing 2024-11-20 11:51:38 -05:00
Jason Wen f403c5a93f unused 2024-11-20 11:28:57 -05:00
Jason Wen 0ba2286bf9 simpler 2024-11-20 11:28:51 -05:00
Jason Wen 8ee0f91642 update unit test 2024-11-20 11:23:04 -05:00
Jason Wen 4fb2c5c16c in lists 2024-11-20 11:22:58 -05:00
Jason Wen 692055df39 brake hold should apply to all 2024-11-20 10:43:16 -05:00
Jason Wen aced3ec768 allow entering paused state if no entry from disabled 2024-11-20 04:06:10 -05:00
Jason Wen b39d998d82 cleanup 2024-11-20 02:38:33 -05:00
Jason Wen 89ba9a7bf3 need this check 2024-11-20 02:31:04 -05:00
Jason Wen 95697afdf8 bump opendbc 2024-11-19 17:44:06 -05:00
Jason Wen 0744b1a0b9 fixme 2024-11-19 17:26:56 -05:00
Jason Wen 7ef9091d17 fix no entry 2024-11-19 17:25:11 -05:00
Jason Wen 5b7d5017f5 MUST REMOVE test process replay 2024-11-19 12:51:44 -05:00
Jason Wen 220b0a4eb8 just warning 2024-11-19 10:47:36 -05:00
Jason Wen 315312c30a user disable tests 2024-11-19 01:54:12 -05:00
Jason Wen e5a988bc2f no need 2024-11-19 01:10:32 -05:00
Jason Wen 347914d9bf silent lkas disable 2024-11-19 01:09:54 -05:00
Jason Wen 4c23b2728a revert 2024-11-18 22:42:04 -05:00
Jason Wen 6f5a44ecaa should be enabled 2024-11-18 22:39:24 -05:00
DevTekVE 5c7baa07d1 back to stock
removing allow_cancel
2024-11-17 20:22:59 +01:00
DevTekVE d541011bdc adjusting creation delays 2024-11-17 19:56:11 +01:00
DevTekVE ce5eea4a4d ignoring reserved events 2024-11-17 19:45:46 +01:00
DevTekVE aa32c33687 Revert "show MADS updates"
This reverts commit daf0ad62

Revert "fix changed events"

This reverts commit 31d8c97f
2024-11-17 19:41:08 +01:00
Jason Wen f3b448d7ff Show our overriding 2024-11-17 07:55:23 -05:00
DevTekVE 7f96037589 Rename test as collector was dying 2024-11-17 11:26:15 +01:00
Jason Wen a55c8f8e70 static analysis 2024-11-17 05:14:29 -05:00
DevTekVE c14f09f538 Merge remote-tracking branch 'origin/master-new' into mads-new 2024-11-17 09:52:05 +01:00
Jason Wen 0a9ca2b2a9 static analysis 2024-11-17 00:04:30 -05:00
Jason Wen 2550185feb bump opendbc 2024-11-16 23:58:27 -05:00
Jason Wen 4fb170b195 better format 2024-11-16 23:58:15 -05:00
Jason Wen 99c82a8eb9 enabled <-> active 2024-11-16 23:33:59 -05:00
Jason Wen bfa88cec5f should use enabled 2024-11-16 23:20:58 -05:00
Jason Wen d3c69aa0ba don't add pre enable if not long 2024-11-16 23:10:05 -05:00
Jason Wen 8e578bf0b0 fix cluster enabled 2024-11-16 23:00:08 -05:00
Jason Wen 31d8c97f6a fix changed events 2024-11-16 22:58:35 -05:00
Jason Wen 3ac6fa5c5c Merge branch 'master-new' into mads-new 2024-11-16 22:34:15 -05:00
Jason Wen fb5f8a74ac no longer needed 2024-11-16 19:28:13 -05:00
Jason Wen 6106fe3d2e Add TODO 2024-11-16 19:19:51 -05:00
Jason Wen daf0ad629b show MADS updates 2024-11-16 19:11:49 -05:00
Jason Wen e1904c5a3f UI border update 2024-11-16 18:54:18 -05:00
Jason Wen 3ee950d117 no need available 2024-11-16 18:10:56 -05:00
Jason Wen 059ae47c5c no unittest 2024-11-16 18:10:19 -05:00
Jason Wen 71fff2ea24 static analysis 2024-11-16 17:54:00 -05:00
Jason Wen 410e365f9c bump opendbc 2024-11-16 17:48:31 -05:00
Jason Wen abe4a61870 Merge branch 'master-new' into mads-new 2024-11-16 17:48:25 -05:00
Jason Wen 188fe9a1fd Merge branch 'master-new' into mads-new
# Conflicts:
#	opendbc_repo
2024-11-16 17:33:12 -05:00
Jason Wen 4f78e31cf4 use new cereal 2024-11-16 17:23:31 -05:00
Jason Wen ca4183808d bump opendbc 2024-11-16 16:56:49 -05:00
Jason Wen 8865ab708c add sunnypilot to unit tests 2024-11-16 16:56:39 -05:00
Jason Wen 7d8a64d781 move unit test 2024-11-16 16:50:17 -05:00
Jason Wen e1ce8e9f0f no longer needed 2024-11-16 16:45:50 -05:00
Jason Wen 69d55cbf72 always emit user disable 2024-11-16 16:21:42 -05:00
Jason Wen bb4ddcc483 Merge branch 'master-new' into mads-new 2024-11-16 10:25:52 -05:00
Jason Wen e5ac29640e final? 2024-11-16 10:07:40 -05:00
Jason Wen dc7ff7630c more! 2024-11-16 10:03:57 -05:00
Jason Wen b1be910d5d no more available 2024-11-16 10:03:20 -05:00
Jason Wen e648ff7341 more fixes 2024-11-16 10:01:52 -05:00
Jason Wen a7fa22a730 bump opendbc 2024-11-16 09:58:07 -05:00
Jason Wen 053ff2ad14 no need 2024-11-16 09:55:42 -05:00
Jason Wen 89073d6b88 Move car-specific changes to opendbc 2024-11-16 03:33:23 -05:00
Jason Wen e96db89f40 make sure it's car only 2024-11-16 02:37:01 -05:00
Jason Wen 8a01ed7de8 sunnyParams 2024-11-16 02:17:58 -05:00
Jason Wen 410535c47d hyundai: only allow for cars with lfa button 2024-11-16 01:41:47 -05:00
Jason Wen f446129afa cleaner 2024-11-16 01:35:04 -05:00
Jason Wen cdcd25f284 reserve events 2024-11-16 01:29:04 -05:00
Jason Wen c800614f44 add todo 2024-11-16 01:01:13 -05:00
Jason Wen fc73b567af group 2024-11-16 00:55:29 -05:00
Jason Wen 8ffd2ea8ee fix 2024-11-15 23:11:44 -05:00
Jason Wen d5b26f7f18 remoev already checks if it exists 2024-11-15 23:11:19 -05:00
Jason Wen 11c46cdc48 use replace 2024-11-15 23:10:06 -05:00
Jason Wen 9512a09dc7 add replace method 2024-11-15 23:07:48 -05:00
Jason Wen bfef1ff20e combine 2024-11-15 22:59:03 -05:00
Jason Wen 5018c11d35 fix settings 2024-11-15 18:37:39 -05:00
Jason Wen 436d771105 fix non drive gear re-engage 2024-11-15 17:38:54 -05:00
Jason Wen cf932da526 no fake lfa button for @devtekve ;) 2024-11-15 16:13:32 -05:00
Jason Wen 64a4d38d32 fix 2024-11-15 16:09:50 -05:00
Jason Wen 60d6e7efce fix panda safety 2024-11-15 12:19:16 -05:00
Jason Wen ba11b97c59 Rename 2024-11-15 12:03:28 -05:00
Jason Wen aaf35b391e check if engagement is from openpilot's state machine 2024-11-15 11:45:11 -05:00
Jason Wen a3c9d72a1e not needed 2024-11-15 11:40:18 -05:00
Jason Wen 6fa78b1db4 more fix 2024-11-15 11:39:13 -05:00
Jason Wen 8f0639ca6c combine 2024-11-15 11:34:01 -05:00
Jason Wen 6a0bc76e63 fix 2024-11-15 11:32:15 -05:00
Jason Wen 23e27bea92 make sure to disengage for allow always cars 2024-11-15 11:29:38 -05:00
Jason Wen 3be1fde36b Fix? 2024-11-15 09:01:12 -05:00
Jason Wen 473349e7b7 rename 2024-11-15 07:32:33 -05:00
Jason Wen 71ffd05027 fix 2024-11-15 07:31:41 -05:00
Jason Wen ab8547d04b bump opendbc 2024-11-15 07:17:21 -05:00
Jason Wen 74eacd2d44 apply pause/resume fix for hyundai (should do this in a separate PR) 2024-11-15 07:17:11 -05:00
Jason Wen 6a059c6877 bump panda 2024-11-15 07:10:14 -05:00
DevTekVE eb9b9a13ff Merge remote-tracking branch 'origin/master-new' into mads-new
# Conflicts:
#	panda
#	selfdrive/ui/qt/offroad/developer_panel.cc
2024-11-15 09:32:22 +01:00
DevTekVE 1d4da71784 bump opendbc 2024-11-15 09:30:50 +01:00
Jason Wen 82510dc48c allow re-regage 2024-11-14 23:41:19 -05:00
Jason Wen 5c6750b2ad bump opendbc 2024-11-14 23:34:07 -05:00
Jason Wen a13e5816bb enforce main 2024-11-14 23:34:02 -05:00
Jason Wen e1b2b10638 add logging for controls allowed lateral 2024-11-14 23:09:11 -05:00
Jason Wen 58fb1b44b6 hyundai: main button heartbeat 2024-11-14 22:29:38 -05:00
Jason Wen d78e66deef hyundai: main button handling 2024-11-14 21:46:47 -05:00
Jason Wen 4b1920ecce handle non drive gear events 2024-11-14 20:24:36 -05:00
Jason Wen dc45bda8b8 no longer needed 2024-11-14 20:00:20 -05:00
Jason Wen b824810be2 bump panda 2024-11-14 20:00:06 -05:00
Jason Wen 08962ad619 hkg always allow 2024-11-14 19:59:52 -05:00
Jason Wen 652a24f13e only allow lateral when cruise main or state is on 2024-11-14 17:19:23 -05:00
Jason Wen ca92ffcb57 rename 2024-11-14 17:05:35 -05:00
Jason Wen 80ebb43365 simply checks 2024-11-14 16:59:56 -05:00
Jason Wen 23f417f450 properly 2024-11-13 23:40:44 -05:00
Jason Wen e63ad5a011 handle available better 2024-11-13 22:44:22 -05:00
Jason Wen b8a82755e6 support toyota and ford 2024-11-13 20:57:38 -05:00
Jason Wen 70e7747f74 cruise main engage 2024-11-13 20:55:14 -05:00
Jason Wen de1b084902 enforce cruise main disengage 2024-11-13 20:39:47 -05:00
Jason Wen 097c976a49 Make sure to disengage with long engaged 2024-11-13 20:21:41 -05:00
Jason Wen 5efd1d63bb Unified Engagement Mode: more 2024-11-13 20:15:02 -05:00
Jason Wen fa3ce0e2a3 add TODO 2024-11-13 20:06:00 -05:00
Jason Wen 835cb71e3b refactor mads params read 2024-11-13 20:04:40 -05:00
Jason Wen 4603fd0f03 Unified Engagement Mode: init 2024-11-13 19:59:19 -05:00
Jason Wen 7f2660d0ad only when mads toggle is enabled 2024-11-13 19:47:51 -05:00
Jason Wen aa0f588248 change events 2024-11-13 19:42:05 -05:00
Jason Wen e3e65de225 add lkas enable and disable events 2024-11-13 19:26:22 -05:00
Jason Wen 37b461a591 unused 2024-11-13 16:57:26 -05:00
Jason Wen 2f09489746 enable should carry over from selfdrived 2024-11-13 13:33:00 -05:00
Jason Wen a9c1e7e277 Expose in settings 2024-11-13 13:25:55 -05:00
Jason Wen ca0020e613 should be the whole class 2024-11-13 13:12:24 -05:00
Jason Wen 5326b18130 set alt experience in helpers 2024-11-13 13:12:18 -05:00
Jason Wen c99299af1f no longer needed 2024-11-13 12:56:42 -05:00
Jason Wen 9422a3cf47 implement params 2024-11-13 12:54:02 -05:00
Jason Wen 872abdda17 this is checked after selfdrived states 2024-11-13 11:16:42 -05:00
Jason Wen 1c2e9bd5b1 inherit in carcontroller properly 2024-11-13 03:07:29 -05:00
Jason Wen 70cf693d15 bump panda 2024-11-13 02:38:25 -05:00
Jason Wen 06dc945b09 consolidate 2024-11-13 02:18:29 -05:00
Jason Wen 8fc21127bd use old copy as checks 2024-11-13 02:15:44 -05:00
Jason Wen eecffb9c8a should be here 2024-11-13 02:08:17 -05:00
Jason Wen 71eb28e1d8 Revert "update in method"
This reverts commit 0403a48e88.
2024-11-13 01:21:12 -05:00
Jason Wen e605398f55 Revert "reorder"
This reverts commit 1a988c716d.
2024-11-13 01:21:12 -05:00
Jason Wen 1a988c716d reorder 2024-11-13 01:18:51 -05:00
Jason Wen 0403a48e88 update in method 2024-11-13 01:15:22 -05:00
Jason Wen d9fb57e5f8 Revert "do it prior"
This reverts commit b38798c1a5.
2024-11-13 00:58:37 -05:00
Jason Wen b38798c1a5 do it prior 2024-11-13 00:00:08 -05:00
Jason Wen 555a753f4c brake check was not handled 2024-11-12 22:52:05 -05:00
Jason Wen 8485cd2013 make sure it's either or 2024-11-12 22:00:44 -05:00
Jason Wen 0fa1ff07f5 try this out 2024-11-12 19:58:22 -05:00
Jason Wen d2cbdeb683 take them out for all modes 2024-11-12 19:14:37 -05:00
Jason Wen 7c633afe7e skip pedal pressed for MADS 2024-11-12 17:53:50 -05:00
Jason Wen e5a34e9023 add always available for hyundai 2024-11-12 17:53:25 -05:00
Jason Wen 81708364b8 new logic 2024-11-12 16:15:27 -05:00
Jason Wen e0e940dd55 do this 2024-11-12 09:17:21 -05:00
Jason Wen c0b92dee04 more fixes 2024-11-11 22:17:11 -05:00
Jason Wen 249e7c2fa2 fixes 2024-11-11 20:46:56 -05:00
Jason Wen fae91beaae better 2024-11-11 20:38:10 -05:00
Jason Wen 376cbbdf83 missed 2024-11-11 20:28:00 -05:00
Jason Wen b497bc607f reset as it should 2024-11-11 09:46:47 -05:00
Jason Wen 90a1ff46b4 Merge branch 'master-new' into mads-new
# Conflicts:
#	cereal/car.capnp
#	cereal/car.capnp~HEAD
#	opendbc_repo
#	panda
2024-11-11 08:23:13 -05:00
DevTekVE c05191949a Updating submodules 2024-11-02 19:15:58 +01:00
Jason Wen 9d5ea83f5a Add Custom MIT License (#438) 2024-11-02 18:53:31 +01:00
Jason Wen 6a74dc253b typo! 2024-09-30 22:47:24 -04:00
Jason Wen 434a89d83e move to card 2024-09-30 18:51:36 -04:00
Jason Wen 20e6dc4246 hkg dbc 2024-09-30 17:03:50 -04:00
Jason Wen 96b5b7caeb more fix 2024-09-30 16:58:25 -04:00
Jason Wen 85cdce477e fix typo 2024-09-30 16:42:59 -04:00
Jason Wen cc06b0271c fix typo 2024-09-30 16:40:13 -04:00
Jason Wen e67833ae7d add events 2024-09-30 16:37:11 -04:00
Jason Wen 42e3061748 Merge branch 'master' into mads-new 2024-09-30 16:31:52 -04:00
Jason Wen 738484e628 some cleanup 2024-09-30 16:28:18 -04:00
Jason Wen 519ab8ec3e traditional state machine with tests 2024-09-30 16:18:59 -04:00
Jason Wen 00bc34b125 test 2024-09-30 15:33:44 -04:00
Jason Wen ff87abb45b comments 2024-09-30 11:04:56 -04:00
Jason Wen 000bb1b5b3 explicit 2024-09-30 10:56:30 -04:00
Jason Wen 7c95b43e1a should append 2024-09-30 10:45:00 -04:00
Jason Wen 9570a9240f fix type hint 2024-09-30 10:42:57 -04:00
Jason Wen 676702ae3c fixes 2024-09-29 22:43:18 -04:00
Jason Wen c27b112bbc misra 2024-09-29 12:27:50 -04:00
Jason Wen 0a1a878897 Merge branch 'master' into mads-new
# Conflicts:
#	opendbc_repo
#	panda
2024-09-29 12:11:54 -04:00
Jason Wen 3a593f85dc more 2024-09-29 12:00:46 -04:00
Jason Wen 6db0d94b83 cleanup 2024-09-29 11:58:38 -04:00
Jason Wen 66b900aea6 clearer 2024-09-29 11:55:36 -04:00
Jason Wen 9c57f6bad0 not really 2024-09-29 11:45:47 -04:00
Jason Wen 1b64a7debd move around 2024-09-29 11:30:39 -04:00
Jason Wen bd19439a4c move around 2024-09-29 11:28:27 -04:00
Jason Wen 18a237c0c0 more update 2024-09-29 11:25:19 -04:00
Jason Wen dd5ff7e1d3 fix 2024-09-29 11:20:30 -04:00
Jason Wen 515c00c379 fix 2024-09-20 00:01:41 -04:00
Jason Wen 7dc4073c9b safety init 2024-09-19 00:46:26 -04:00
Jason Wen a9c775bffe no need 2024-09-18 09:01:13 -04:00
Jason Wen c06d8db015 alternative experience 2024-09-18 08:57:58 -04:00
Jason Wen 8bb6c8fc17 some more infra 2024-09-18 08:22:13 -04:00
Jason Wen d58be609ac more infra 2024-09-18 07:33:23 -04:00
Jason Wen 434fab00f3 more 2024-09-18 07:15:51 -04:00
Jason Wen 8e62914e69 Modified Assist Driving System: init 2024-09-18 07:15:51 -04:00
182 changed files with 3368 additions and 241 deletions
+1
View File
@@ -0,0 +1 @@
Wen
+1 -1
View File
@@ -86,7 +86,7 @@ jobs:
run: >-
sudo apt-get install -y imagemagick
scenes="homescreen settings_device settings_software settings_toggles settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard"
scenes="homescreen settings_device settings_software settings_toggles settings_sunnypilot settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard"
A=($scenes)
DIFF=""
+10
View File
@@ -74,6 +74,12 @@ AddOption('--minimal',
default=os.path.exists(File('#.lfsconfig').abspath), # minimal by default on release branch (where there's no LFS)
help='the minimum build to run openpilot. no tests, tools, etc.')
AddOption('--stock-ui',
action='store_true',
dest='stock_ui',
default=False,
help='Build stock openpilot UI instead of sunnypilot UI')
## Architecture name breakdown (arch)
## - larch64: linux tici aarch64
## - aarch64: linux pc aarch64
@@ -172,6 +178,10 @@ else:
if arch != "Darwin":
ldflags += ["-Wl,--as-needed", "-Wl,--no-undefined"]
if not GetOption('stock_ui'):
cflags += ["-DSUNNYPILOT"]
cxxflags += ["-DSUNNYPILOT"]
ccflags_option = GetOption('ccflags')
if ccflags_option:
ccflags += ccflags_option.split(' ')
+17 -1
View File
@@ -8,7 +8,23 @@ $Cxx.namespace("cereal");
# cereal, so use these if you want custom events in your fork.
# you can rename the struct, but don't change the identifier
struct CustomReserved0 @0x81c2f05a394cf4af {
struct SelfdriveStateSP @0x81c2f05a394cf4af {
mads @0 :ModularAssistiveDrivingSystem;
struct ModularAssistiveDrivingSystem {
state @0 :ModularAssistiveDrivingSystemState;
enabled @1 :Bool;
active @2 :Bool;
available @3 :Bool;
enum ModularAssistiveDrivingSystemState {
disabled @0;
paused @1;
enabled @2;
softDisabling @3;
overriding @4;
}
}
}
struct CustomReserved1 @0xaedffd8f31e7b55d {
+76 -2
View File
@@ -125,6 +125,80 @@ struct OnroadEvent @0xc4fa6047f024e718 {
espActive @90;
personalityChanged @91;
aeb @92;
eventReserved93 @93;
eventReserved94 @94;
eventReserved95 @95;
eventReserved96 @96;
eventReserved97 @97;
eventReserved98 @98;
eventReserved99 @99;
eventReserved100 @100;
eventReserved101 @101;
eventReserved102 @102;
eventReserved103 @103;
eventReserved104 @104;
eventReserved105 @105;
eventReserved106 @106;
eventReserved107 @107;
eventReserved108 @108;
eventReserved109 @109;
eventReserved110 @110;
eventReserved111 @111;
eventReserved112 @112;
eventReserved113 @113;
eventReserved114 @114;
eventReserved115 @115;
eventReserved116 @116;
eventReserved117 @117;
eventReserved118 @118;
eventReserved119 @119;
eventReserved120 @120;
eventReserved121 @121;
eventReserved122 @122;
eventReserved123 @123;
eventReserved124 @124;
eventReserved125 @125;
eventReserved126 @126;
eventReserved127 @127;
eventReserved128 @128;
eventReserved129 @129;
eventReserved130 @130;
eventReserved131 @131;
eventReserved132 @132;
eventReserved133 @133;
eventReserved134 @134;
eventReserved135 @135;
eventReserved136 @136;
eventReserved137 @137;
eventReserved138 @138;
eventReserved139 @139;
eventReserved140 @140;
eventReserved141 @141;
eventReserved142 @142;
eventReserved143 @143;
eventReserved144 @144;
eventReserved145 @145;
eventReserved146 @146;
eventReserved147 @147;
eventReserved148 @148;
eventReserved149 @149;
eventReserved150 @150;
# sunnypilot
lkasEnable @151;
lkasDisable @152;
manualSteeringRequired @153;
manualLongitudinalRequired @154;
silentPedalPressed @155;
silentLkasEnable @156;
silentLkasDisable @157;
silentBrakeHold @158;
silentWrongGear @159;
silentReverseGear @160;
silentDoorOpen @161;
silentSeatbeltNotLatched @162;
silentParkBrake @163;
controlsMismatchLateral @164;
soundsUnavailableDEPRECATED @47;
}
@@ -589,6 +663,7 @@ struct PandaState @0xa7649e2575e4591e {
# safety stuff
controlsAllowed @3 :Bool;
controlsAllowedLat @5 :Bool;
safetyRxInvalid @19 :UInt32;
safetyTxBlocked @24 :UInt32;
safetyModel @14 :Car.CarParams.SafetyModel;
@@ -696,7 +771,6 @@ struct PandaState @0xa7649e2575e4591e {
}
gasInterceptorDetectedDEPRECATED @4 :Bool;
startedSignalDetectedDEPRECATED @5 :Bool;
hasGpsDEPRECATED @6 :Bool;
gmlanSendErrsDEPRECATED @9 :UInt32;
fanSpeedRpmDEPRECATED @11 :UInt16;
@@ -2558,7 +2632,7 @@ struct Event {
customReservedRawData2 @126 :Data;
# *********** Custom: reserved for forks ***********
customReserved0 @107 :Custom.CustomReserved0;
selfdriveStateSP @107 :Custom.SelfdriveStateSP;
customReserved1 @108 :Custom.CustomReserved1;
customReserved2 @109 :Custom.CustomReserved2;
customReserved3 @110 :Custom.CustomReserved3;
+3
View File
@@ -74,6 +74,9 @@ _services: dict[str, tuple] = {
"userFlag": (True, 0., 1),
"microphone": (True, 10., 10),
# sunnypilot
"selfdriveStateSP": (True, 100., 10),
# debug
"uiDebug": (True, 0., 1),
"testJoystick": (True, 0.),
+7
View File
@@ -200,6 +200,13 @@ std::unordered_map<std::string, uint32_t> keys = {
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
{"UpdaterLastFetchTime", PERSISTENT},
{"Version", PERSISTENT},
// sunnypilot params
{"Mads", PERSISTENT},
{"MadsMainCruiseAllowed", PERSISTENT},
{"MadsPauseLateralOnBrake", PERSISTENT},
{"MadsUnifiedEngagementMode", PERSISTENT},
{"HyundaiLongitudinalMainCruiseToggleable", PERSISTENT},
{"EnableGithubRunner", PERSISTENT},
};
+1
View File
@@ -163,6 +163,7 @@ testpaths = [
"tools/replay",
"tools/cabana",
"cereal/messaging/tests",
"sunnypilot",
]
[tool.codespell]
+1 -1
View File
@@ -57,7 +57,7 @@ function run_tests() {
if [[ -z "$FAST" ]]; then
run "mypy" mypy $PYTHON_FILES
run "codespell" codespell $ALL_FILES
run "codespell" codespell $ALL_FILES --ignore-words=$ROOT/.codespellignore
fi
return $FAILED
+6
View File
@@ -22,6 +22,8 @@ from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp
from openpilot.selfdrive.car.cruise import VCruiseHelper
from openpilot.selfdrive.car.car_specific import MockCarState
from openpilot.sunnypilot.mads.mads import MadsParams
REPLAY = "REPLAY" in os.environ
EventName = log.OnroadEvent.EventName
@@ -113,6 +115,10 @@ class Car:
if not disengage_on_accelerator:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS
# mads
MadsParams().set_alternative_experience(self.CP)
MadsParams().set_car_specific_params(self.CP)
openpilot_enabled_toggle = self.params.get_bool("OpenpilotEnabledToggle")
controller_available = self.CI.CC is not None and openpilot_enabled_toggle and not self.CP.dashcamOnly
+14 -1
View File
@@ -19,6 +19,7 @@ from openpilot.selfdrive.controls.lib.longcontrol import LongControl
from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
from openpilot.selfdrive.locationd.helpers import PoseCalibrator, Pose
from opendbc.sunnypilot import SunnypilotParamFlags
State = log.SelfdriveState.OpenpilotState
LaneChangeState = log.LaneChangeState
@@ -56,6 +57,9 @@ class Controls:
elif self.CP.lateralTuning.which() == 'torque':
self.LaC = LatControlTorque(self.CP, self.CI)
data_services = list(self.sm.data.keys()) + ['selfdriveStateSP']
self.sm = messaging.SubMaster(data_services, poll='selfdriveState')
def update(self):
self.sm.update(15)
if self.sm.updated["liveCalibration"]:
@@ -88,7 +92,16 @@ class Controls:
# Check which actuators can be enabled
standstill = abs(CS.vEgo) <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill
CC.latActive = self.sm['selfdriveState'].active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and not standstill
ss_sp = self.sm['selfdriveStateSP']
CC.madsEnabled = ss_sp.mads.enabled
if ss_sp.mads.available:
CC.sunnypilotParams |= SunnypilotParamFlags.ENABLE_MADS.value
_lat_active = ss_sp.mads.active
else:
_lat_active = self.sm['selfdriveState'].active
CC.latActive = _lat_active and not CS.steerFaultTemporary and not CS.steerFaultPermanent and not standstill
CC.longActive = CC.enabled and not any(e.overrideLongitudinal for e in self.sm['onroadEvents']) and self.CP.openpilotLongitudinalControl
actuators = CC.actuators
+50 -12
View File
@@ -1,13 +1,21 @@
#!/usr/bin/env python3
import os
from openpilot.system.hardware import TICI
from openpilot.selfdrive.modeld.runners.model_runner import ONNXRunner, TinygradRunner
#
if TICI:
from tinygrad.tensor import Tensor
from tinygrad.dtype import dtypes
from openpilot.selfdrive.modeld.runners.tinygrad_helpers import qcom_tensor_from_opencl_address
os.environ['QCOM'] = '1'
else:
from openpilot.selfdrive.modeld.runners.ort_helpers import make_onnx_cpu_runner
import time
import pickle
import numpy as np
import cereal.messaging as messaging
from cereal import car, log
from pathlib import Path
from setproctitle import setproctitle
from cereal.messaging import PubMaster, SubMaster
from msgq.visionipc import VisionIpcClient, VisionStreamType, VisionBuf
@@ -25,8 +33,13 @@ from openpilot.selfdrive.modeld.fill_model_msg import fill_model_msg, fill_pose_
from openpilot.selfdrive.modeld.constants import ModelConstants
from openpilot.selfdrive.modeld.models.commonmodel_pyx import DrivingModelFrame, CLContext
PROCESS_NAME = "selfdrive.modeld.modeld"
PROCESS_NAME = "selfdrive.modeld.modeld"
SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
MODEL_PATH = Path(__file__).parent / 'models/supercombo.onnx'
MODEL_PKL_PATH = Path(__file__).parent / 'models/supercombo_tinygrad.pkl'
METADATA_PATH = Path(__file__).parent / 'models/supercombo_metadata.pkl'
class FrameMeta:
frame_id: int = 0
@@ -56,12 +69,27 @@ class ModelState:
'features_buffer': np.zeros((1, ModelConstants.HISTORY_BUFFER_LEN, ModelConstants.FEATURE_LEN), dtype=np.float32),
}
# Initialize model runner
self.model_runner = TinygradRunner() if TICI else ONNXRunner(self.frames)
with open(METADATA_PATH, 'rb') as f:
model_metadata = pickle.load(f)
self.input_shapes = model_metadata['input_shapes']
self.output_slices = model_metadata['output_slices']
net_output_size = model_metadata['output_shapes']['outputs'][1]
self.output = np.zeros(net_output_size, dtype=np.float32)
self.parser = Parser()
net_output_size = self.model_runner.model_metadata['output_shapes']['outputs'][1]
self.output = np.zeros(net_output_size, dtype=np.float32)
if TICI:
self.tensor_inputs = {k: Tensor(v, device='NPY').realize() for k,v in self.numpy_inputs.items()}
with open(MODEL_PKL_PATH, "rb") as f:
self.model_run = pickle.load(f)
else:
self.onnx_cpu_runner = make_onnx_cpu_runner(MODEL_PATH)
def slice_outputs(self, model_outputs: np.ndarray) -> dict[str, np.ndarray]:
parsed_model_outputs = {k: model_outputs[np.newaxis, v] for k,v in self.output_slices.items()}
if SEND_RAW_PRED:
parsed_model_outputs['raw_pred'] = model_outputs.copy()
return parsed_model_outputs
def run(self, buf: VisionBuf, wbuf: VisionBuf, transform: np.ndarray, transform_wide: np.ndarray,
inputs: dict[str, np.ndarray], prepare_only: bool) -> dict[str, np.ndarray] | None:
@@ -78,15 +106,24 @@ class ModelState:
imgs_cl = {'input_imgs': self.frames['input_imgs'].prepare(buf, transform.flatten()),
'big_input_imgs': self.frames['big_input_imgs'].prepare(wbuf, transform_wide.flatten())}
# Prepare inputs using the model runner
self.model_runner.prepare_inputs(imgs_cl, self.numpy_inputs)
if TICI:
# The imgs tensors are backed by opencl memory, only need init once
for key in imgs_cl:
if key not in self.tensor_inputs:
self.tensor_inputs[key] = qcom_tensor_from_opencl_address(imgs_cl[key].mem_address, self.input_shapes[key], dtype=dtypes.uint8)
else:
for key in imgs_cl:
self.numpy_inputs[key] = self.frames[key].buffer_from_cl(imgs_cl[key]).reshape(self.input_shapes[key])
if prepare_only:
return None
# Run model inference
self.output = self.model_runner.run_model()
outputs = self.parser.parse_outputs(self.model_runner.slice_outputs(self.output))
if TICI:
self.output = self.model_run(**self.tensor_inputs).numpy().flatten()
else:
self.output = self.onnx_cpu_runner.run(None, self.numpy_inputs)[0].flatten()
outputs = self.parser.parse_outputs(self.slice_outputs(self.output))
self.full_features_20Hz[:-1] = self.full_features_20Hz[1:]
self.full_features_20Hz[-1] = outputs['hidden_state'][0, :]
@@ -153,6 +190,7 @@ def main(demo=False):
meta_main = FrameMeta()
meta_extra = FrameMeta()
if demo:
CP = get_demo_car_params()
else:
-92
View File
@@ -1,92 +0,0 @@
import os
from openpilot.system.hardware import TICI
#
if TICI:
from tinygrad.tensor import Tensor
from tinygrad.dtype import dtypes
from openpilot.selfdrive.modeld.runners.tinygrad_helpers import qcom_tensor_from_opencl_address
os.environ['QCOM'] = '1'
else:
from openpilot.selfdrive.modeld.runners.ort_helpers import make_onnx_cpu_runner
import pickle
import numpy as np
from pathlib import Path
from abc import ABC, abstractmethod
from openpilot.selfdrive.modeld.models.commonmodel_pyx import DrivingModelFrame, CLMem
SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
MODEL_PATH = Path(__file__).parent / '../models/supercombo.onnx'
MODEL_PKL_PATH = Path(__file__).parent / '../models/supercombo_tinygrad.pkl'
METADATA_PATH = Path(__file__).parent / '../models/supercombo_metadata.pkl'
class ModelRunner(ABC):
"""Abstract base class for model runners that defines the interface for running ML models."""
def __init__(self):
"""Initialize the model runner with paths to model and metadata files."""
with open(METADATA_PATH, 'rb') as f:
self.model_metadata = pickle.load(f)
self.input_shapes = self.model_metadata['input_shapes']
self.output_slices = self.model_metadata['output_slices']
self.inputs: dict = {}
@abstractmethod
def prepare_inputs(self, imgs_cl: dict[str, CLMem], numpy_inputs: dict[str, np.ndarray])-> dict:
"""Prepare inputs for model inference."""
@abstractmethod
def run_model(self):
"""Run model inference with prepared inputs."""
def slice_outputs(self, model_outputs: np.ndarray) -> dict:
"""Slice model outputs according to metadata configuration."""
parsed_outputs = {k: model_outputs[np.newaxis, v] for k, v in self.output_slices.items()}
if SEND_RAW_PRED:
parsed_outputs['raw_pred'] = model_outputs.copy()
return parsed_outputs
class TinygradRunner(ModelRunner):
"""Tinygrad implementation of model runner for TICI hardware."""
def __init__(self):
super().__init__()
# Load Tinygrad model
with open(MODEL_PKL_PATH, "rb") as f:
self.model_run = pickle.load(f)
def prepare_inputs(self, imgs_cl: dict[str, CLMem], numpy_inputs: dict[str, np.ndarray]) -> dict:
# Initialize image tensors if not already done
for key in imgs_cl:
if key not in self.inputs:
self.inputs[key] = qcom_tensor_from_opencl_address(imgs_cl[key].mem_address, self.input_shapes[key], dtype=dtypes.uint8)
# Update numpy inputs
for k, v in numpy_inputs.items():
if k not in self.inputs:
self.inputs[k] = Tensor(v, device='NPY').realize()
return self.inputs
def run_model(self):
return self.model_run(**self.inputs).numpy().flatten()
class ONNXRunner(ModelRunner):
"""ONNX implementation of model runner for non-TICI hardware."""
def __init__(self, frames: dict[str, DrivingModelFrame]):
super().__init__()
self.runner = make_onnx_cpu_runner(MODEL_PATH)
self.frames = frames
def prepare_inputs(self, imgs_cl: dict[str, CLMem], numpy_inputs: dict[str, np.ndarray]) -> dict:
self.inputs = numpy_inputs.copy()
for key in imgs_cl:
self.inputs[key] = self.frames[key].buffer_from_cl(imgs_cl[key]).reshape(self.input_shapes[key])
return self.inputs
def run_model(self):
return self.runner.run(None, self.inputs)[0].flatten()
+2 -2
View File
@@ -137,8 +137,8 @@ void Panda::enable_deepsleep() {
handle->control_write(0xfb, 0, 0);
}
void Panda::send_heartbeat(bool engaged) {
handle->control_write(0xf3, engaged, 0);
void Panda::send_heartbeat(bool engaged, bool engaged_mads) {
handle->control_write(0xf3, engaged, engaged_mads);
}
void Panda::set_can_speed_kbps(uint16_t bus, uint16_t speed) {
+1 -1
View File
@@ -75,7 +75,7 @@ public:
std::optional<std::string> get_serial();
void set_power_saving(bool power_saving);
void enable_deepsleep();
void send_heartbeat(bool engaged);
void send_heartbeat(bool engaged, bool engaged_mads);
void set_can_speed_kbps(uint16_t bus, uint16_t speed);
void set_can_fd_auto(uint16_t bus, bool enabled);
void set_data_speed_kbps(uint16_t bus, uint16_t speed);
+18 -2
View File
@@ -41,6 +41,8 @@
#define CUTOFF_IL 400
#define SATURATE_IL 1000
#define ALT_EXP_DISENGAGE_LATERAL_ON_BRAKE 2048
ExitHandler do_exit;
bool check_all_connected(const std::vector<Panda *> &pandas) {
@@ -53,6 +55,18 @@ bool check_all_connected(const std::vector<Panda *> &pandas) {
return true;
}
bool process_mads_heartbeat(SubMaster *sm) {
const int &alt_exp = (*sm)["carParams"].getCarParams().getAlternativeExperience();
const bool disengage_lateral_on_brake = (alt_exp & ALT_EXP_DISENGAGE_LATERAL_ON_BRAKE) != 0;
const auto &mads = (*sm)["selfdriveStateSP"].getSelfdriveStateSP().getMads();
const bool heartbeat_type = disengage_lateral_on_brake ? mads.getActive() : mads.getEnabled();
const bool engaged = sm->allAliveAndValid({"selfdriveStateSP"}) && heartbeat_type;
return engaged;
}
Panda *connect(std::string serial="", uint32_t index=0) {
std::unique_ptr<Panda> panda;
try {
@@ -144,6 +158,7 @@ void fill_panda_state(cereal::PandaState::Builder &ps, cereal::PandaState::Panda
ps.setIgnitionLine(health.ignition_line_pkt);
ps.setIgnitionCan(health.ignition_can_pkt);
ps.setControlsAllowed(health.controls_allowed_pkt);
ps.setControlsAllowedLat(health.controls_allowed_lat_pkt);
ps.setTxBufferOverflow(health.tx_buffer_overflow_pkt);
ps.setRxBufferOverflow(health.rx_buffer_overflow_pkt);
ps.setPandaType(hw_type);
@@ -327,7 +342,7 @@ void send_peripheral_state(Panda *panda, PubMaster *pm) {
}
void process_panda_state(std::vector<Panda *> &pandas, PubMaster *pm, bool spoofing_started) {
static SubMaster sm({"selfdriveState"});
static SubMaster sm({"selfdriveState", "selfdriveStateSP", "carParams"});
std::vector<std::string> connected_serials;
for (Panda *p : pandas) {
@@ -366,8 +381,9 @@ void process_panda_state(std::vector<Panda *> &pandas, PubMaster *pm, bool spoof
sm.update(0);
const bool engaged = sm.allAliveAndValid({"selfdriveState"}) && sm["selfdriveState"].getSelfdriveState().getEnabled();
const bool engaged_mads = process_mads_heartbeat(&sm);
for (const auto &panda : pandas) {
panda->send_heartbeat(engaged);
panda->send_heartbeat(engaged, engaged_mads);
}
}
}
+118
View File
@@ -105,6 +105,24 @@ class Events:
ret.append(event)
return ret
def has(self, event_name: int) -> bool:
return event_name in self.events
def contains_in_list(self, events_list: list[int]) -> bool:
return any(event_name in self.events for event_name in events_list)
def remove(self, event_name: int, static: bool = False) -> None:
if static and event_name in self.static_events:
self.static_events.remove(event_name)
if event_name in self.events:
self.event_counters[event_name] = self.event_counters[event_name] + 1
self.events.remove(event_name)
def replace(self, prev_event_name: int, cur_event_name: int, static: bool = False) -> None:
self.remove(prev_event_name, static)
self.add(cur_event_name, static)
class Alert:
def __init__(self,
@@ -951,6 +969,106 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.WARNING: personality_changed_alert,
},
# sunnypilot
EventName.lkasEnable: {
ET.ENABLE: EngagementAlert(AudibleAlert.engage),
},
EventName.lkasDisable: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.disengage),
},
EventName.manualSteeringRequired: {
ET.USER_DISABLE: Alert(
"Automatic Lane Centering is OFF",
"Manual Steering Required",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.disengage, 1.),
},
EventName.manualLongitudinalRequired: {
ET.WARNING: Alert(
"Smart/Adaptive Cruise Control: OFF",
"Manual Speed Control Required",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 1.),
},
# TODO-SP: remove prior merging
EventName.silentPedalPressed: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.none),
ET.NO_ENTRY: NoEntryAlert("Pedal Pressed During Attempt",
visual_alert=VisualAlert.brakePressed),
},
EventName.silentLkasEnable: {
ET.ENABLE: EngagementAlert(AudibleAlert.none),
},
EventName.silentLkasDisable: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.none),
},
EventName.silentBrakeHold: {
ET.USER_DISABLE: EngagementAlert(AudibleAlert.none),
ET.NO_ENTRY: NoEntryAlert("Brake Hold Active"),
},
EventName.silentWrongGear: {
ET.WARNING: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 0.),
ET.NO_ENTRY: Alert(
"Gear not D",
"openpilot Unavailable",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.none, 0.),
},
EventName.silentReverseGear: {
ET.PERMANENT: Alert(
"Reverse\nGear",
"",
AlertStatus.normal, AlertSize.full,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, .2, creation_delay=0.5),
ET.NO_ENTRY: NoEntryAlert("Reverse Gear"),
},
EventName.silentDoorOpen: {
ET.WARNING: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 0.),
ET.NO_ENTRY: NoEntryAlert("Door Open"),
},
EventName.silentSeatbeltNotLatched: {
ET.WARNING: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 0.),
ET.NO_ENTRY: NoEntryAlert("Seatbelt Unlatched"),
},
EventName.silentParkBrake: {
ET.WARNING: Alert(
"",
"",
AlertStatus.normal, AlertSize.none,
Priority.LOWEST, VisualAlert.none, AudibleAlert.none, 0.),
ET.NO_ENTRY: NoEntryAlert("Parking Brake Engaged"),
},
EventName.controlsMismatchLateral: {
ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Controls Mismatch: Lateral"),
ET.NO_ENTRY: NoEntryAlert("Controls Mismatch: Lateral"),
},
}
+20
View File
@@ -23,6 +23,8 @@ from openpilot.selfdrive.controls.lib.latcontrol import MIN_LATERAL_CONTROL_SPEE
from openpilot.system.version import get_build_metadata
from openpilot.sunnypilot.mads.mads import ModularAssistiveDrivingSystem
REPLAY = "REPLAY" in os.environ
SIMULATION = "SIMULATION" in os.environ
TESTING_CLOSET = "TESTING_CLOSET" in os.environ
@@ -131,6 +133,10 @@ class SelfdriveD:
elif self.CP.passive:
self.events.add(EventName.dashcamMode, static=True)
self.mads = ModularAssistiveDrivingSystem(self)
sock_services = list(self.pm.sock.keys()) + ['selfdriveStateSP']
self.pm = messaging.PubMaster(sock_services)
def update_events(self, CS):
"""Compute onroadEvents from carState"""
@@ -451,11 +457,25 @@ class SelfdriveD:
self.pm.send('onroadEvents', ce_send)
self.events_prev = self.events.names.copy()
# selfdriveStateSP
ss_sp_msg = messaging.new_message('selfdriveStateSP')
ss_sp_msg.valid = True
ss_sp = ss_sp_msg.selfdriveStateSP
mads = ss_sp.mads
mads.state = self.mads.state_machine.state
mads.enabled = self.mads.enabled
mads.active = self.mads.active
mads.available = self.mads.enabled_toggle
self.pm.send('selfdriveStateSP', ss_sp_msg)
def step(self):
CS = self.data_sample()
self.update_events(CS)
if not self.CP.passive and self.initialized:
self.enabled, self.active = self.state_machine.update(self.events)
if not self.CP.notCar:
self.mads.update(CS, self.sm)
self.update_alerts(CS)
self.publish_selfdriveState(CS)
+1 -1
View File
@@ -41,7 +41,7 @@ class TestAlerts:
events = log.OnroadEvent.EventName.schema.enumerants
for name, e in events.items():
if not name.endswith("DEPRECATED"):
if not name.endswith("DEPRECATED") and not name.startswith("eventReserved"):
fail_msg = f"{name} @{e} not in EVENTS"
assert e in EVENTS.keys(), fail_msg
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d09032a4d2ea3fc3eb767175ed8db8e18e744fc24da5e9b9a29497081c4319fe
size 356151
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:737f95d34912db53a303ba6499e6f697b510fa5872b8c71f701a4fe924b5466e
size 356169
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:991a71c6076682ae0787b1e67ecd9f982cd640b2649f066b03e9f160d0a5ffe1
size 253185
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e359e8f6b5a22b6f3f89b54989dac2110ee3a4463de2d785be83e20cda4f1cb6
size 254248
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:78b4554c29f3248335d01f09acf182c17b75e52b9c33e6404259b7a7296c81be
size 332298
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a8e4d044812a714ebdf0b15e73d4466e9ddaafa374368f308803c6b68dcd79ab
size 332433
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:26ba170ff2ea84034bd3108dbfaced47659ba1fdc3853e0eee507a1a50468805
size 268982
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:53b80c3c99a6897cafe7d408872c287ab0bbaac2751e344cf4623b312d2e4866
size 268928
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:db95ac6c8a8c03564384f720bdf165a82f3a952237dc023e56bc5ff2e2b588ef
size 437827
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4fa8a841c964e90b9c14b5aede8f30de949d319ae072cc291f0afb1c4c24baa
size 437808
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5a63d34fa7cb0ef60c210ad07efcb9d287db160a9e5421a424193fb4d69d6573
size 308605
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ce370994de01d6240fa753846ddc7e1b852acac3f649a4c29ea16acae126f974
size 308578
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9628a092168c01aa025e96ad8f33af93f20a4bef5818dded276e0df69ad7f143
size 393218
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:82333cfc026735eac81defae9e01b82b81ac30fd01ad265dbdd311dd97322198
size 393106
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f96b6a1a7682048e96ab3fa5133f4ec9034b65ca1676718796cc63b153b74d47
size 334220
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e4ebae1742e3bb7d89f8cd452928c5c6a1b8679155562d23c6303ca4ec2e3b02
size 334350
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6228c1abc757f7f2a95db885adda57e57d52140ed955534074b77729afb5a5b7
size 470440
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:03326fb4486c1ffdd3609a0e0200e65d1f30dca5d9b047501d98b1b2d5321e75
size 470495
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3cd0974a369a279d6619203c5b8d04f2bbe3ce69d711d8950a2a6184432a1b05
size 257619
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bffa062a5eace4d499c2fe12f2b0eb8c71207f4e7bea0e88456614f00e2859b1
size 258989
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a65d6822bc9ae953d146e6fa4423d44e752612a6068b6a77ff6c33684ad9982b
size 217462
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fe97d060fb6e60652b26b26406ca8b03890f6bff4b4bc5cb73fca267068a04c9
size 217460
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:398f4f15bf2c474fed96efba377c9797ca9f0df57378b356723bfe854c733698
size 293056
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:60e33d209f4f600acf344feca8ab6494a1bf3aafe3c7121e2110a82ea06aa61e
size 293084
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08bf874154b8127ca9310ad465318cb661bf9b4508c543aefc15f145ce0519b4
size 257404
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:754d601883db2377739f4112a8dff787b4b8181a8bb8bf4d7dbcf77c5cb6ac93
size 256838
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:720771d57150a2784303249c4fe27d6bab7b7ada2ba4f076a3d8b3a12cb2413c
size 100027
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:378d6fc5c674e62b51a12b994cfcd03c435a9731c6e2f4c0d14a39010540cc77
size 100067
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ba9e5837919bd6671d2a9b5ee360e00456e577d90a2b828c78ce1691936ea8b
size 262863
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:037825cd9b443d038ab3bb370eab802612d1ce528c5de1350fd99965eaa0d131
size 262910
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6cb6b2d2fd6fcbfb86fdf718a009445e968fd0b3c8600bb1a212c1e2a469c9ab
size 256534
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:58645abd939aa17cf291a254517865704c74124743a8a77da296c519a29567df
size 256653
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4313e41d5a8a53706d38f799ec1b9b99dc70ece5bed35ee328f3f0e9815bce38
size 268229
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fed5fa87ab0dfbf410b5a142e98eae9dacdb1a7c2ec38f91ba5ae18d8ad9a9e0
size 268234
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2596eabc16cffe9083352a330a275a373c589caf1010f7a107bacf4f422c2ee6
size 305143
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f8affdd98bd39d326a7d66e5bca4028ac81595a3f55a6fc094e8b93f535eab8f
size 305144
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5eb587d291f245858983b22e98494e1f97869d214293eb4d6231ec69e81af546
size 253475
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d82c14c33dc91196a5febc1c45d307a157d5b64b4eb1f8c880fa319af79bc5f5
size 253450

Some files were not shown because too many files have changed in this diff Show More