Commit Graph

906 Commits

Author SHA1 Message Date
rav4kumar
cf9b45783d Merge remote-tracking branch 'comma/master' into sync-20250427 2025-04-28 14:06:18 -04:00
DevTekVE
be168d14e9 SL: updating localproxy implementation (#841)
* Adding capabilities to route localProxy via sunnylink

* Undo

* Thx lint

* get api token

* cert is not valid when it's an IP. Still use cert, but don't validate
2025-04-26 19:33:35 +02:00
Cameron Clough
9d17c73f6b avoid importing Raylib UI (#35078) 2025-04-25 19:09:19 -07:00
Cameron Clough
83b84a5bec Revert "ui(raylib): create BaseWindow (#35074)"
This reverts commit 124198460b.
2025-04-26 01:20:58 +01:00
Cameron Clough
124198460b ui(raylib): create BaseWindow (#35074)
* ui(raylib): create BaseWindow

* test without typing

* revert

* Revert "test without typing"

This reverts commit c8a5e1b8322bb7250ede540d7b6d25eefa72cef1.

* lines
2025-04-25 23:33:32 +01:00
Cameron Clough
362ddfc0c7 ui: replace qt text window with raylib (#35064)
* remove qt text window

* use wrapper, render text window in thread

* add wait_for_exit method

* update imports
2025-04-25 14:17:47 +01:00
Cameron Clough
7eb1c31d72 ui(raylib/text): spacing between button and scrollbar (#35069) 2025-04-25 14:06:37 +01:00
Cameron Clough
92ada2170f ui(raylib): start scroll at bottom of text window (#35068) 2025-04-25 14:00:31 +01:00
Cameron Clough
c961fb095f ui(raylib): preserve whitespace in wrapped text (#35067)
* ui(raylib): preserve whitespace in wrapped text

* lint
2025-04-25 13:57:04 +01:00
Cameron Clough
3ee2882093 ui: replace qt spinner with raylib (#35059)
* use raylib spinner

* remove qt spinner

* use wrapper, render spinner in thread

* english

* fix?

* match Qt font size more closely
2025-04-24 21:16:38 +01:00
Cameron Clough
7c223e5586 ui(raylib): decrease target FPS to 30 (#35062) 2025-04-24 21:00:48 +01:00
Cameron Clough
8088438bd6 hardware: make set_display_power not abstract (#35061)
hardware: make set_dispaly_power not abstract

follow-up to https://github.com/commaai/openpilot/pull/35060#discussion_r2058829397
2025-04-24 20:18:31 +01:00
Cameron Clough
196848c023 ui(raylib): set display power and brightness on init (#35060)
* add set_display_power to hardware.py

* set display power and brightness on app init
2025-04-24 15:55:15 +01:00
ZwX1616
e85d833a80 Revert "Revert "OS04C10: use IFE downscaler for road cameras"" (#35047)
* Revert "Revert "OS04C10: use IFE downscaler for road cameras" (#35046)"

This reverts commit aaaa2d0dd0.

* fixed

* patch it here

* surely
2025-04-23 21:09:22 -07:00
Jason Wen
b8b29a210a Merge branch 'upstream/openpilot/master' into sync-20250423 2025-04-23 23:44:50 -04:00
Cameron Clough
281a72780b Reapply "ui(raylib): "exit" btn in text window on PC" (#35053)
* ui(raylib): "exit" btn in text window on PC

* unused import

* request close

* this was missing
2025-04-23 14:06:09 +01:00
Jason Wen
b9385a2368 Merge branch 'upstream/openpilot/master' into sync-20250422
# Conflicts:
#	.github/workflows/selfdrive_tests.yaml
#	.github/workflows/ui_preview.yaml
#	common/params_keys.h
#	opendbc_repo
#	panda
#	selfdrive/car/card.py
#	selfdrive/car/tests/test_car_interfaces.py
#	selfdrive/car/tests/test_models.py
#	selfdrive/controls/lib/longitudinal_planner.py
#	selfdrive/modeld/fill_model_msg.py
#	selfdrive/test/process_replay/process_replay.py
#	selfdrive/ui/qt/offroad/developer_panel.cc
#	selfdrive/ui/qt/offroad/settings.cc
#	selfdrive/ui/translations/main_de.ts
Sync: `commaai/opendbc:master` into `sunnypilot/opendbc:master-new`

Sync: `commaai/panda:master` into `sunnypilot/panda:master-new`
2025-04-23 00:44:53 -04:00
Cameron Clough
754f5aa955 Revert "ui(raylib): "exit" btn in text window on PC (#35052)"
This reverts commit f9767d2650.
2025-04-22 22:30:20 +01:00
Cameron Clough
f9767d2650 ui(raylib): "exit" btn in text window on PC (#35052)
* ui(raylib): "exit" btn in text window on PC

* unused import
2025-04-22 22:07:47 +01:00
Cameron Clough
c9259a9bcf ui(raylib): update spinner vertical pos (#35051)
Adjust the spinner vertical position when displaying text or a progress bar

- When displaying the progress bar, center the comma logo and spinner in the middle of the screen
- When displaying text, center the entire content vertically

Also updated `wrap_text` to not include an empty line in the array if it's the first line, so that `wrap_text("")` always returns `[]`
2025-04-22 20:54:36 +01:00
Cameron Clough
651ff78cb0 ui(raylib): increase font size and wrap text in spinner (#35049)
- Wrap text onto separate lines
- Increase font size to be closer to Qt
- Remove extra letter spacing - 0.0 should use font default spacing, and this is used in `wrap_text`

Will fix vertical alignment separately, as both the text and progress bar layouts need to be considered
2025-04-22 16:07:05 +01:00
Cameron Clough
23524e2038 ui(raylib): reduce spinner rotation artifact (#35048)
* ui(raylib): reduce spinner rotation artifact

A visual artifact (white pixels) appeared on the edge of the
rotating spinner track texture, likely due to RGB color bleed during
bilinear filtering in Raylib.

Pre-multiplying the alpha channel of the spinner track image using
`rl.image_alpha_premultiply` significantly reduces the visibility of the
artifact.

* lint
2025-04-22 15:28:54 +01:00
ZwX1616
aaaa2d0dd0 Revert "OS04C10: use IFE downscaler for road cameras" (#35046)
Revert "OS04C10: use IFE downscaler for road cameras (#35023)"

This reverts commit 3b60b22cee.
2025-04-21 17:02:36 -07:00
Adeeb Shihadeh
a9b9e0bb54 raylib: init updater (#35045)
* raylib: init updater

* cleanup
2025-04-21 16:13:55 -07:00
Cameron Clough
d56baa0fbb ui(raylib): constant spinner rotation speed (#35037) 2025-04-20 15:03:49 +01:00
Cameron Clough
618b7ccf23 ui(raylib): calculate spinner progress in set_text (#35036) 2025-04-19 17:08:33 +01:00
Cameron Clough
fb5fa70e78 ui(raylib): update text window font, new lines and indentation (#35031) 2025-04-19 16:17:18 +01:00
ZwX1616
3b60b22cee OS04C10: use IFE downscaler for road cameras (#35023)
* squashh

* wrong

* clean up

* rename
2025-04-18 14:29:37 -07:00
Cameron Clough
4f913f0cfb ui(raylib): fix typos (#35030) 2025-04-18 01:11:22 +01:00
Cameron Clough
c933914f86 ui(raylib): update spinner progress bar to match Qt (#35028) 2025-04-17 23:11:19 +01:00
Nayan
f1d703e6e4 Device: Customizable Max Time Offroad (#796)
* Max Time Offroad

* Refactor & Fix param

* Error Handling

* rename SP variable

* Update selfdrive/ui/sunnypilot/qt/widgets/controls.h

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

* Update selfdrive/ui/sunnypilot/qt/widgets/controls.h

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

* Update selfdrive/ui/sunnypilot/qt/widgets/controls.h

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

* Update selfdrive/ui/sunnypilot/qt/widgets/controls.h

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

* Update selfdrive/ui/sunnypilot/qt/widgets/controls.cc

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

* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/max_time_offroad.h

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

* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/max_time_offroad.cc

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

* UI layout changes for better alignment

selector is not big enough -> make it bigger ;)

OptionControlSP now includes a QMap argument to allow actual values to be set in param directly

* Rebase & resolve reviews

* change default to be closer to OP default

* me dumb

* MaxTimeOffroad: Add support for 30h limit and improve label formatting

* power_monitoring: Refactor MaxTimeOffroad parameter handling for clarity

* test: Add unit tests for MaxTimeOffroad parameter handling

* power_monitoring: Update MaxTimeOffroad handling to use seconds and improve shutdown logic

* power_monitoring: Improve exception handling and remove redundant shutdown check for MaxTimeOffroad

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-04-12 16:33:17 +02:00
Robbe Derks
3e6267967b Raise thermal setpoint (#35008)
We don't need to control all the way down to 70C
2025-04-10 16:33:36 +02:00
Kacper Rączy
f237649a7a Reapply "Online lateral lag learning" (#34975)
* Online lateral lag learning (#34974)

This reverts commit b4cc9e68d1.

* pad to the best size for fft

* Fix static analysis

* Add typing

* Fix typing

* MAX_LAG

* Calculate cross correlation regardless if the points are valid

* Back to lagd

* Add lagd to process_config

* Lagd in test onroad

* Move lag estimator for lagd

* Remove duplicate entry from test_onroad

* Update process replay

* pre-fill the data

* Update cpu usage

* 25sec window

* Change the meaning of lateralDelayEstimate

* No newline

* Fix typing

* Prefill

* Update ref commit

* Add a unit test

* Fix static issues

* Time limit

* Or timeout

* Use mocker

* Update estimate every time

* empty test

* DT const

* enable RIVIAN again

* Update ref commit

* Update that again

* Improve the tests

* Fix static

* Add masking test

* Increase timeout

* Add liveDelay to selfdrived

* Add liveDelay to selfdrived in process_replay

* Fix block_avg restore after num_blocks

* regen most

* Update bolt

* Update ref commit

* Change the key name

* Add assert

* True weighted average
2025-04-09 22:31:07 +00:00
Adeeb Shihadeh
84b0baf68b Revert "hardwared: give stuck LTE connections a kick"
This reverts commit e4aa346259.
2025-04-08 11:04:00 -07:00
Adeeb Shihadeh
e4aa346259 hardwared: give stuck LTE connections a kick
This reverts commit e3e694096a.
2025-04-08 11:03:24 -07:00
DevTekVE
a2761ba731 Merge remote-tracking branch 'comma/master' into sync-20250407
# Conflicts:
#	opendbc_repo
#	panda
2025-04-07 21:11:47 -04:00
Maxime Desroches
cdc801c3c1 update to latest userdata partition (#34990)
update
2025-04-07 11:51:53 -07:00
Adeeb Shihadeh
f3c1427027 agnos 11.13 (#34980)
* agnos 11.12

* new build
2025-04-06 12:42:09 -07:00
Jason Wen
8dec4ea5d7 Revert "MADS: Steering Mode on Brake Pedal Press (#687)" (#789)
This reverts commit bf2731b4
2025-04-04 22:43:00 -04:00
Jason Wen
9dba62e686 Merge branch 'upstream/openpilot/master' into sync-20250403
# Conflicts:
#	.github/workflows/auto_pr_review.yaml
#	.github/workflows/selfdrive_tests.yaml
#	.github/workflows/ui_preview.yaml
#	msgq_repo
#	opendbc_repo
#	panda
#	selfdrive/controls/controlsd.py
2025-04-03 21:53:04 -04:00
Adeeb Shihadeh
3707efff6b camerad: don't gate first frame on FSIN (#34972)
don't wait
2025-04-01 16:54:53 -07:00
Robbe Derks
b8065d3138 Parse out more ublox sat info (#34947)
parse out more sat info
2025-03-28 10:26:37 +01:00
Kumar
34bbdf4d7f Controls: Automatic lane change (#653)
* init alc controller

* only for sunny

* rebase fix

* ui

* add ui preview

* Update common/params_keys.h

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>

* Update selfdrive/ui/sunnypilot/SConscript

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>

* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/lane_change_settings.h

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>

* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral/lane_change_settings.cc

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>

* review sugg

* code review

* renaming

* move around

* style

* fix types and params exceptions handling

* take out magic numbers

* more

* rename

* shorter

* make sure reset happens at the end of every DH loop

* split into multiple updates

* just 3 seconds

* use default states

* oops

* more readable

* oops

* some space and lines

* run in DH loop directly

* adjust ui preview

* nudgeless should process immediately

* check option instead

* more explicit

* even more explicit

* tests

* brake pedal release should not allow auto lane change (caught by test)

* unnecessary

* no continuous auto lane change

* Revert "unnecessary"

This reverts commit 93d135b54a.

* more tests

* less

* less less

* update again

* more cleanup

* better

* AutoLaneChangeState -> AutoLaneChangeMode

* update

* lint

* unused

* test all states

* license

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-03-24 22:26:48 -04:00
Adeeb Shihadeh
2382f1cab0 Run DM model twice, prep for bigger models (#34894)
* twice

* swap

* adjust
2025-03-24 15:54:42 -07:00
Kumar
029a601674 Device: Quiet Mode (#654)
* init quiet mode

* only for sunny

* static

* toggle

* let's back this up

* review sugg

* oh okay

* review

* fix: ensure boolean conversion for QuietDrive parameter

* Refactor return statement to use boolean conversion for clarity in quiet mode logic

* Update selfdrive/ui/sunnypilot/quietmode.py

* rename

* sunny

* Revert "sunny"

This reverts commit 6ac4cf4b8d.

* sunny

* Revert "sunny"

This reverts commit c2bffddc05.

* sunny

* ui: support dynamic state updates for `PushButtonSP`

* test btn

* override mouse release events

* Revert "test btn"

This reverts commit cd9c9dde9a.

* Reapply "test btn"

This reverts commit 9b36b2e085.

* abstract param flipping

* Revert "Reapply "test btn""

This reverts commit 8104a262b0.

* use new button state for PushButtonSP

* Quiet Drive -> Quiet Mode

* driver camera btn moved

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-03-23 23:15:11 -04:00
Jason Wen
e6177c49aa athenad: avoid infinite loop waiting for comma registration (#701)
Athenad: avoid infinite loop waiting for comma registration
2025-03-22 22:48:58 -04:00
DevTekVE
43e43849ad sunnylink: Settings backup & restore (#681)
* Add AES encryption and utility methods

This commit introduces a new AESCipher class that can be used for AES encryption with support for both AES-128 and AES-256. It also adds a set of utility functions, including methods for RSA to AES key derivation, file decryption and compression, and encryption and decompression. These changes provide fundamental cryptographic functionalities for data security within the system.

* Revised backup management system with new structures

This update introduces important revisions to the backup management system. A new struct named 'BackupManagerSP' has been integrated into the 'custom.capnp' file, replacing 'CustomReserved6'. This new struct includes several variables that help keep track of backup and restore status, progress and related messages.

Additional code modifications were made in 'base.py' and 'api.py' to include a 'json' parameter in the 'api_get' method. Lastly, 'manager.py' has been updated with functions to manage device configuration backups to and from sunnylink.

The changes promote better handling and management of data backup and restoration processes. The update is specifically designed to ensure that the backup information is well integrated into the system, with properly tracked status and progress.

* Refactor `allKeys` to filter by parameter key type

Updated the `allKeys` method to support filtering by `ParamKeyType`, allowing more specific key retrieval. Added a default value for backward compatibility and updated related bindings and keys to reflect this change.

* Improve Backup and Restore mechanisms

The commit refactors and improves several aspects of the backup and restore mechanisms in the `BackupManagerSP` class.

These improvements include removing redundant status tracking variables and replacing them with unified ones, updating the messaging system to handle all changes correctly, and including an enumeration `OperationType` to keep track of the type of operation currently being processed.

This commit also applies stricter conditions for restore operations, such that it only restores parameters that are currently marked as backupable, and skips those that are not. This is a preventive measure against potential issues when restoring parameters that are no longer relevant or could conflict with current versions.

Also, the encryption and decryption methods were updated to use AES-256 for more security. These changes have increased the robustness and reliability of the backup and restoration processes.

* copyright

* Add backup_manager process to offroad sunnypilot tasks

The backup_manager process is introduced to handle backups during offroad mode when SunnyLink is ready. This ensures proper backup management functionality integrated into the system.

* Simplify backup endpoint construction in restore method

Replaced conditional expression with a more concise and readable `or` operation for constructing the backup endpoint. This makes the code cleaner and easier to maintain while preserving functionality.

* Added support for backing up and restoring sunnypilot settings

An update to the sunnypilot functionality now provides two new features that allow users to backup and restore their sunnypilot settings. The changes include the addition of UI controls for initiating backup and restore operations, and the creation of a system-wide state management function for tracking these operations. This enhancement significantly improves the user experience by providing a safety net for user settings in case of software failures, bugs, or unintended changes.

* Refactor type hints to use PEP 604 syntax for clarity

Replaced `Optional` and `Dict` type hints with `|` and `dict` syntax for improved readability and compliance with Python 3.10+. Updated related imports and adjusted list comprehension for cleaner code.

* Update import path for hardware module in utils.py

Replaced the import path for the `Paths` module to align with the new directory structure under `openpilot`. This ensures compatibility with recent project reorganization and avoids import errors.

* Improve RSA key handling and fix backup status comparison

Added explicit RSA key type checks to handle invalid key formats. Enhanced type safety in `manager.py` by ensuring the backup status comparison returns a boolean. These changes improve robustness and error handling in backups.

* format

* more

* Improve backup and restore flow with progress tracking and fixes

Added proper progress tracking and cleanup logic during restore operations. Enhanced restore experience by resetting progress after completion and introducing confirmation dialogs for errors and completion. Updated API compatibility with a version query parameter for backups.

* Enable backup button only when restore process is complete

Previously, the backup button could be enabled during a restore operation, which might cause unintended behavior. This update introduces a check to ensure the backup button remains disabled while a restore process is active. This improves user experience and prevents potential conflicts.

* Fix restore button state handling during restore process

Ensure the restore button is disabled consistently when a restore is in progress. This prevents user interaction issues and aligns the button state with the restore operation status.

* "Refactor restore logic and improve button state handling"

Replaced `is_restoring` with `restore_request_pending` for clarity and better state management. Adjusted button behavior to immediately disable upon user action, ensuring improved UX and preventing repeat inputs. Refined restore completion flow for better consistency and reliability.

* Refine restore process logic for SunnyLink settings.

Introduced `restore_request_started` to improve handling of restore states and ensure accurate UI updates during the process. Adjusted case handling to enhance clarity and maintain proper behavior when restoring settings, especially during ongoing or completed requests.

* revert

* move around

* fix enabled states for different statuses

* add prompt to notify backup is complete

* same states as restore

* disable buttons if sunnylink is off

* can use the same texts

---------

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2025-03-22 15:58:04 +00:00
Jason Wen
309304a352 Controls: Neural Network Lateral Control (NNLC) for Torque Lateral Accel Control (#695)
* init

* more init

* keep it alive

* fixes

* more fixes

* more fix

* new submodule for nn data

* bump submodule

* update path to submodule

* spacing???

* update submodule path

* update submodule path

* bump

* dump

* bump

* introduce params

* Add Neural Network Lateral Control toggle to developer panel

This introduces a new toggle for enabling Neural Network Lateral Control (NNLC), providing detailed descriptions of its functionality and compatibility. It includes UI integration, car compatibility checks, and feedback links for unsupported vehicles.

* decouple even more

* static

* codespell

* remove debug

* in structs

* fix import

* convert to capnp

* fixes

* debug

* only initialize if NNLC is enabled or allow to enable

* oops

* fix initialization

* only allow engage if nnlc is off

* fix toggle param

* fix tests

* lint

* fix more test

* capnp test

* try this out

* validate if it's not None

* make it 33 to match

* align

* share the same friction input calculation

* return stock values if not enabled

* unused

* split base and child

* space

* rename

* NeuralNetworkFeedForwardModel

* less

* just use file name

* try this

* more explicit

* rename

* move it

* child class for additional controllers

* rename

* time to split out custom lateral acceleration

* move around

* space

* fix

* TODO-SP

* TODO-SP

* update regardless, it's an extension now

* update name and expose toggle

* ui: sunnypilot Panel -> Steering Panel

* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral_panel.h

* merge

* move to steering panel

* no need for this

* live params in a thread

* no live for now

* new structs

* more ui

* more flexible

* more ui

* no longer needed

* another ui

* cereal changes

* bump opendbc

* simplify checks

* all in one place

* split Enhanced Lat Accel

* handle unrecognized platform

* test for fingerprinting

* fix fingerprint

* NNLC: Mock data for unrecognized cars

* fix fingerprints

* test to verify model loading

* bump neural_network_data

* use pytest

* use different one for now

* fix ui preview alignments

* typing

* more type

* show a platform

* show match

* init params for tests

* ok ruff

* make sure to loop through tests

* ok again ruff

* ok we need this lol

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-03-22 09:40:29 -04:00
Jason Wen
0990212edc Revert "Controls: Neural Network Lateral Control (NNLC) for Torque Lateral Accel Control" (#694)
Revert "Controls: Neural Network Lateral Control (NNLC) for Torque Lateral Ac…"

This reverts commit ecb4026269.
2025-03-21 16:13:50 -04:00
Jason Wen
ecb4026269 Controls: Neural Network Lateral Control (NNLC) for Torque Lateral Accel Control (#667)
* init

* more init

* keep it alive

* fixes

* more fixes

* more fix

* new submodule for nn data

* bump submodule

* update path to submodule

* spacing???

* update submodule path

* update submodule path

* bump

* dump

* bump

* introduce params

* Add Neural Network Lateral Control toggle to developer panel

This introduces a new toggle for enabling Neural Network Lateral Control (NNLC), providing detailed descriptions of its functionality and compatibility. It includes UI integration, car compatibility checks, and feedback links for unsupported vehicles.

* decouple even more

* static

* codespell

* remove debug

* in structs

* fix import

* convert to capnp

* fixes

* debug

* only initialize if NNLC is enabled or allow to enable

* oops

* fix initialization

* only allow engage if nnlc is off

* fix toggle param

* fix tests

* lint

* fix more test

* capnp test

* try this out

* validate if it's not None

* make it 33 to match

* align

* share the same friction input calculation

* return stock values if not enabled

* unused

* split base and child

* space

* rename

* NeuralNetworkFeedForwardModel

* less

* just use file name

* try this

* more explicit

* rename

* move it

* child class for additional controllers

* rename

* time to split out custom lateral acceleration

* move around

* space

* fix

* TODO-SP

* TODO-SP

* update regardless, it's an extension now

* update name and expose toggle

* ui: sunnypilot Panel -> Steering Panel

* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral_panel.h

* merge

* move to steering panel

* no need for this

* live params in a thread

* no live for now

* new structs

* more ui

* more flexible

* more ui

* no longer needed

* another ui

* cereal changes

* bump opendbc

* simplify checks

* all in one place

* split Enhanced Lat Accel

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-03-21 15:38:31 -04:00