* init
* some fixes
* move
* more
* old navd helpers
* bring back cereal
* fix linting
* more
* add to cereal first
* sp events
* lint
* implement in long plan
* fixme-sp
* refactor state machine
* wrong state
* start refactor controller
* some type hints
* init these
* enable debug print
* ui? ui!
* print them out
* fix spinner import
* fix path
* let's use gps chips directly for now
* service missing
* publish events
* no nav for now
* need to sub
* no car state speed yet
* missed event
* Car: `CarStateSP`
* fix tests
* bring back car state speed limit
* fix
* use old controller for now
* fix
* fix source
* type hints
* none for now
* formatting
* more
* create directory if does not exist
* mypy my bt
* policy param catch exceptions
* handle all params with exceptions
* more
* single method
* define types in init
* rename
* simpler op enabled check
* more mypy stuff
* rename
* no need for brake pressed
* don't reset if gas pressed
* type hint all
* type hint all
* back to upstream
* in another pr
* no longer need data type
* qlog
* slc in another pr
* use horizontal accuracy
* set core affinity for all realtime processes
* unused
* sort
* unused
* type hint and slight cleanup
* from old implementation
* use directly
* combine pm
* slight more cleanup
* type hints
* even more type hint
* lint
* more cleanup
* even less
* license
* py sensord
* fix up mmc
* temp
* port over accel
* lil more
* kinda works
* rm that
* gpiochip
* mostly there
* lil more
* lil more
* irq timestamps
* fix ts
* fix double deg2rad
* test passes
* fix up mypy
* rm one more
* exception
* lint:
* read in all events
* bump that
* get under budget:
* accel self test
* gyro self-test
* keep these readable
* give it more cores
* debug
* valid
* rewrite that
---------
Co-authored-by: Comma Device <device@comma.ai>
* 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
* 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>
* 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.
* 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 76b08e37cb.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf.
* 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.
* parse inputs via metadata
* load model and metadata dynamically
* cherry pick from devtekve as base
* lateral_control_params & prev_desired_curv: MLSIM V0 to Null Pointer
* old desired_curv data: MLSIM V1 to Postal Service
* Bringing what was on master back then
* Cleaning up
* Refactor model pipeline for modularity and dynamic input handling
Refactored the model pipeline by introducing helper functions to modularize model loading, metadata extraction, and input preparation. Improved flexibility in handling dynamic input keys and parsing outputs based on model configuration. Removed deprecated or unused code segments for cleaner and more maintainable structure.
* Push NDv2 because why not and fix modeld
* `Refactor model parsing and clean unused code dependencies`
Simplified `parse_outputs` by removing unnecessary `input_keys` parameter, ensuring cleaner logic. Updated `PROCESS_NAME` for standardization and eliminated deprecated `Pathlib` dependencies in model paths. Minor adjustments improve input handling for lateral control parameters.
* Refactor model and metadata loading functions.
Simplified and clarified `load_model` by renaming it to `get_model_path` and removing redundant variable assignments. Streamlined `load_metadata` by directly returning the loaded metadata without intermediate variables. These changes improve code readability and maintainability.
* Refactor modeld process selection based on SNPE support.
Introduce conditional logic to determine and start the appropriate modeld process (SNPE or default) based on hardware support. This improves flexibility and ensures correct process management.
* Walrus baby
* Update longitudinal_planner.py
* Improve model download progress handling and translations
Refactored model download status handling logic for better clarity and added mechanisms to track status changes efficiently. Updated UI text and translations across multiple languages to reflect consistent and accurate model download states.
* Revert "Update longitudinal_planner.py"
This reverts commit b44a687e4c.
* Fix variable naming for curvature size in modeld.py
Renamed the variable `len` to `length` to avoid conflict with the built-in `len()` function, improving code clarity and preventing potential errors. Also removed trailing spaces in commented-out sections for better formatting consistency.
* sync with upstream
* some are different
* should work
* sim_pose only exists in in ndv3 and prior
* dynamic meta constants
* fix
* uiview: disable power saving
* fix this
* ain't coasting for y'all
* Static analysis
* Refactor initialization of model inputs for clarity.
Removed redundant pre-initialization of `driving_style`, `nav_features`, and `nav_instructions` variables. Instead, directly initialize these within their respective conditional blocks for better readability and reduced memory usage.
* default to none
* enable in next PR
* more
* Revert "more"
This reverts commit f5a4220588.
* Revert "enable in next PR"
This reverts commit 621cc4f18e.
* no need to cast bool
* nuke
* fix desired curvature for pre LAv1 models
* mypy
* static
* fix
* new json
* Going to a test branch with a different model json list
* renamed model json
* Update model runner handling in custom.capnp and helpers
Refactored model runner logic by introducing a `runner` field in `custom.capnp` and simplifying `get_active_model_runner` logic. Removed deprecated function `get_model_runner_by_filename` and added a temporary filter in `fetcher.py` to enforce `snpe` until full tinygrad support is implemented.
* Revert "Update model runner handling in custom.capnp and helpers"
This reverts commit f34d872c13.
* Revert "renamed model json"
This reverts commit 15c6ed303b.
* Revert "Going to a test branch with a different model json list"
This reverts commit 4c1408fee5.
* Reapply "renamed model json"
This reverts commit c6fec6912a.
Reapply "Going to a test branch with a different model json list"
This reverts commit 83e253e9a3.
* Add 'runner' property to 'ModelBundle' and update relevant functions
The 'ModelBundle' class in 'custom.capnp' has been extended to include a 'runner' property. This required updating 'fetcher.py' to handle the 'runner' property when parsing model bundles. Additionally, the helper function 'get_model_runner_by_filename' has been removed from 'helpers.py' as it is no longer needed because the 'runner' property provides this information. The 'get_active_model_runner' function has also been updated in light of these changes.
* Refine bundle selection logic in SoftwarePanelSP
Improve logic for determining which model bundle to display by considering download status and failure state. Remove unnecessary function call to enhance clarity and maintainability.
* tmp
* Add retrieval of active model bundle in manager loop
Introduce a call to `get_active_bundle` to fetch the active model bundle and store it in `self.active_bundle`. This ensures the active bundle is always up-to-date during the model management process.
* Add "Use Default" option for model selection
Introduced a "Use Default" option in the model selection dropdown, allowing users to reset to the default model. Adjusted logic to handle default selection and ensure proper parameter updates. Fixed bundle status handling during the download process in the model manager.
* Refactor type hint in active_bundle assignment.
Removed an unnecessary type hint in the active_bundle assignment for cleaner and more maintainable code. This change does not affect functionality but improves code readability.
* no nested
* update json url
* split out
* format
* condense
* more
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com>
* 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 76b08e37cb.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf.
* 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>
* 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 76b08e37cb.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf.
* 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>
* cabana: enhance message heatmap visualization (#34239)
* enhance message heatmap visualization
* TODO
* improve log_factor
* typo
* bit_flip_counts
* Openpilot webcam support improved (#34215)
* control webcam with ENV vars
* WIP: actual instructions
* wording
* file no longer exists
* this is expected behavior, just untested
* more readable
* tested on fresh install
* wording tweaks
* explicit USE_WEBCAM toggle required
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* debug-ability improved
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* newline removed
---------
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* Update metadrive wheel (#34292)
* test
* new wheel
* fix IR power scaling (#34293)
* fix IR power scaling
* Update system/hardware/tici/hardware.h
* replay: Update video immediately after seek when paused. (#34237)
replay: Update video immediately after seeking when paused.
Otherwise, if paused then have to resume playback for the video
frame to update and show the new location.
Implemented by temporarily un-pausing replay for a single
frame time.
* cabana: add live and time-window heatmap modes for enhanced signal analysis (#34296)
add live and time-window heatmap modes
* timed: diff against absolute value of timedelta (#34299)
* cabana: miscellaneous bug fixes and enhancements (#34297)
* toHexString
* use QToolBar
* fix incorrect groove rect
* limit CAN_MAX_DATA_BYTES
* add series type selector to chart toolbar
* dim inactive messages
* rename
* add help to chart
* cleanup
* cabana: real-time cursor and video frame sync for chart and video (#34301)
* sync cursor and thumbnail between chart and video
* Revert "replay: Update video immediately after seek when paused. (#34237)"
This reverts commit 3363881844.
* use thumbnails while scrubing
* draw alert
* no update on resume
* draw timestamp
* cleanup
* replay: fix various synchronization and event handling issues (#34254)
fix various synchronization and event handling issues
* cabana: fix crash in live streaming mode by skipping thumbnail display (#34302)
resolve crash in live streaming mode
* bump panda
* [bot] Update Python packages (#34304)
Update Python packages
Co-authored-by: Vehicle Researcher <user@comma.ai>
* cleanup touch_replay (#34305)
mathematics
* uv from brew doesn't have self update
* Skip registration on newer devices (#34316)
* tici: fix cpp device type (#34315)
fix cpp
* Tinygrad upstream master (#34325)
Upstream master
* [bot] Update Python packages (#34320)
Update Python packages
Co-authored-by: Vehicle Researcher <user@comma.ai>
* cabana: fix missing transmitter after undoing DBC message removal (#34329)
fix missing transmitter after undoing DBC message removal
* Quick GC pass heading into 2025 (#34330)
* first pass
* bye bye snpe
* [bot] Update Python packages (#34334)
Update Python packages
Co-authored-by: Vehicle Researcher <user@comma.ai>
* Notre Dame model in tinygrad (#34324)
* release model: 6f23a03f-486b-4d3e-a314-19d149644c7c/700
* old style model in tinygrad
* fix desire
* tg hack
* 20Hz
* no gas probs
* No gas here
* better indexing
---------
Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
---------
Co-authored-by: Dean Lee <deanlee3@gmail.com>
Co-authored-by: Mike Busuttil <31480000+MikeBusuttil@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Maxime Desroches <desroches.maxime@gmail.com>
Co-authored-by: Angus Gratton <gus@projectgus.com>
Co-authored-by: commaci-public <60409688+commaci-public@users.noreply.github.com>
Co-authored-by: Vehicle Researcher <user@comma.ai>
Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com>
Co-authored-by: Yassine Yousfi <yyousfi1@binghamton.edu>
* 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 1cf4f57502.
* try using compile2.py again
* add back symlink
* fix path
* more fix
* wrong path again
* Revert "wrong path again"
This reverts commit f5301c19d5.
* update
* hardcode path to our submodule
* force path
* try this
* fix file name
* try this
* again
* Revert "again"
This reverts commit 17c8cd7376.
* Revert "try this"
This reverts commit 767f78bbcf.
* Revert "fix file name"
This reverts commit 485eef68da.
* Revert "try this"
This reverts commit 41fef87680.
* Revert "force path"
This reverts commit 5c3b408937.
* Revert "hardcode path to our submodule"
This reverts commit 5ee1950b6f.
* Revert "update"
This reverts commit fb313bd7fb.
* Reapply "wrong path again"
This reverts commit 309639aeb3.
* Revert "wrong path again"
This reverts commit f5301c19d5.
* Revert "more fix"
This reverts commit 23dd423e78.
* Revert "fix path"
This reverts commit 75d338f2bd.
* Revert "add back symlink"
This reverts commit 9f71ad0b8a.
* Revert "try using compile2.py again"
This reverts commit 914117d2e1.
* Reapply "remove our own"
This reverts commit b1996377b3.
* 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>
* Add Sunnylink integration for improved device communication
This commit introduces Sunnylink support, including modules for API interactions, device registration, logging, and uploader processes. Key changes involve adding Sunnylink-related components, such as sunnylinkd, manage_sunnylinkd, and associated utilities, along with seamless integration into process management.
* Refactor Sunnylink modules and update import paths
Standardize parameter handling in Sunnylink functions by initializing Params within functions as needed. Update imports to use fully-qualified paths for better clarity and consistency. Also, refactor logging messages for improved readability and maintainability.
* Add Sunnylink support and improve log handling
Introduced Sunnylink-specific functionality, including compression for oversized logs and platform-specific socket handling for macOS. Improved logging mechanisms, refactored log queue management, and fixed exception handling in sunnylinkd.
* Refactor and fix minor coding style inconsistencies
Remove unnecessary string concatenation, adjust spacing for better readability, and ensure cleaner code in `athenad.py` and `sunnylink.py`. Added a macOS-specific comment for TCP_KEEPALIVE configuration to improve code clarity.
* Replace platform system check with sys platform in athenad.py
To check for macOS platform, the code in athenad.py has been altered. Originally, the platform.system() function was used. However, the function has been replaced with sys.platform for a more consistent and preferable syntax. Particularly, this has been modified in the context of setting socket options.
* Apply suggestions from code review
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* Simplify imports and reformat API function.
Removed unused `platform` import for cleanup in `athenad.py`. Improved readability of `api_get` in `__init__.py` by reformatting the long return statement into multiple lines.
* Adjust backoff logic and refactor API call formatting.
Introduce randomness to backoff calculation in Sunnylink API to reduce synchronization issues. Minor code refactoring improves readability in the API call logic.
* Refactor Sunnylink network check logic.
Removed hardware-based network check due to performance concerns and replaced it with a real-time device state monitoring loop. This improves efficiency and ensures accurate online status before proceeding with Sunnylink registration.
* Apply suggestions from code review
* `Refactor saveParams error handling and simplify logic`
Removed redundant try-except block wrapping the entire method for clarity. Moved error logging directly inside the loop to handle individual parameter exceptions more effectively. Simplified dictionary construction and improved error logging format.
* Add BACKUP flag to select persistent parameters
This commit introduces a new BACKUP flag and applies it to specific persistent parameters in `params.cc` and `params.h`. The BACKUP flag enhances data retention by designating parameters for inclusion in backups, ensuring crucial information is preserved across sessions.
* Simplify Sunnypilot params formatting
Removed unnecessary blank lines and adjusted the Sunnypilot comment format for better readability and consistency. No functional changes were made.
* SP: Move Sunnypilot-related code to sunnypilot/sunnylink (#504)
* Refactor and relocate sunnylink-related modules
sunnylink components have been reorganized for better modularity and clarity, with files moved under `sunnypilot/sunnylink`. Unused code was removed, and reusable utilities were separated for easier maintenance. Adjusted references across the project to reflect these changes.
* Permissions
* adding init py
* more
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* Introduce Model Manager to handle downloads and verification
This commit introduces a new Model Manager responsible for handling model downloads, including driving and navigation application models. The manager also verifies file hashes and communicates download progress for an improved user experience.
The Model Manager is asynchronous and utilizes asyncio and aiohttp for enhanced performance, including robust error handling.
Impacted files in the 'cereal', 'common', 'sunnypilot', and 'system' directories have been updated accordingly. The 'ModelsFetcher' process configuration has been modified to run only when off-road, ensuring optimum resource management.
This update aims to enhance code clarity, improve performance, and streamline the handling of model downloads.
* "Update model management and fetching for SunnyPilot"
This update refactors the model management, downloading and cache verification mechanisms of SunnyPilot. New functionalities, such as smart cache handling, have been implemented in ModelFetcher in sunnypilot/models/model_fetcher.py. Also, the model downloading process has been moved to a separate async function _download_bundle in ModelManagerSP in sunnypilot/models/model_manager.py. Hash verification of files is now performed in an async function verify_file in sunnypilot/models/model_helper.py. Changes in system parameters related to model management have been reflected in system/manager/manager.py.
* Integrate download ETA calculations in model manager
This commit introduces a new feature that calculates and tracks the Estimated Time of Arrival (ETA) for downloading models in the model manager component. The 'eta' property in the 'DownloadProgress' structure in 'custom.capnp' is changed from 'Float32' to 'UInt32'.
In the 'model_manager.py' file, a new method '_calculate_eta' has been added to perform ETA calculations. An additional dictionary '_download_start_times' has been created to keep track of the start time of each model download. The ETA is calculated every time a portion of the model file is downloaded, and it gets updated in the 'DownloadProgress' structure. Finally, the start time is cleared after the download completes.
In 'model_manager_audit.py', an additional check is added to only print downloadProgress for the downloads currently in progress.
* format
* no default model cache {} because it can be considered a valid json, we do not want that
* Refactor typing annotations to use PEP 604 syntax.
Updated type hints to adopt PEP 604 union syntax (`X | None`) and replaced `List` and `Dict` with modern built-in `list` and `dict`. This change improves consistency and readability while aligning with Python 3.10+ standards.
* Simplify logging messages and remove unused imports.
Removed an unused import from `model_manager.py` to improve clarity and maintainability. Also refined a log message in `model_fetcher.py` by removing unnecessary formatting for consistency.
* Refactor model handling and simplify cache fallback logic.
Updated type annotations for `selected_bundle` in `model_manager.py` for clarity. Streamlined cache fallback logic in `model_fetcher.py` by removing redundant conditionals while preserving functionality. These changes improve code readability and maintainability.
* "Fix formatting for ModelManager_DownloadIndex retrieval
Condensed parameter alignment in the get method for improved readability and adherence to style guidelines. This change does not affect functionality but ensures consistent code formatting."
* Need to have main defined for process_config to be able to run it
* Refactor model management to support active bundle tracking
Introduce the concept of an active model bundle with a new persistent parameter and API updates. Added fields for `generation` and `environment` in model metadata, improved caching, and updated methods to manage active model states efficiently.
* UI commit (#515)
* Refactor model management to support active bundle tracking
Introduce the concept of an active model bundle with a new persistent parameter and API updates. Added fields for `generation` and `environment` in model metadata, improved caching, and updated methods to manage active model states efficiently.
* Add new driving model selection feature to settings
This commit introduces a new feature to the settings that allows users to select different driving models. It fetches available models and displays their download progress. The created UI also suggests a calibration reset after model download. The changes include the creation of 'SoftwarePanelSP' within 'settings.' Additionally, 'sunnypilot/SConscript' has been updated to include 'settings.cc' and 'software_panel.cc'. Changes also include localization for this feature.
* Show model description during download status
This update ensures the model description is displayed when a model is in the downloading state. It improves the user interface by providing real-time feedback during the download process.
* Update translations for multiple languages
Added new and updated translation strings in several language files, including Spanish, Arabic, Chinese (Simplified and Traditional), Turkish, Korean, Thai, Japanese, and Brazilian Portuguese. These updates include placeholder translations for new UI elements and features.
* Refactor model name handling and add generation check.
Replaced `bundleName` with `model_name` for better clarity in status messages. Added a generation mismatch check before showing the reset parameters dialog to avoid unnecessary prompts.
* Update model handling in SoftwarePanelSP
Remove unused "common/model.h" and replace "CURRENT_MODEL" with "..." as the default return value in GetModelName. Adjust logic to check for active bundles instead of selected bundles for improved accuracy. Minor text change for clarity in UI label.
* Rename `GetModelName` to `GetActiveModelName` for clarity.
The new name better reflects the function's purpose of retrieving the active model name, improving code readability. All relevant calls and references have been updated to ensure consistency across the codebase.
* Update sunnypilot/models/model_helper.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* Refactor download status handling and add 'cached' state
Introduce 'cached' as a new download status and adjust relevant logic across components to support it. Simplify and streamline model status handling in the software panel for better readability and maintainability. Ensure consistent status reporting for all model types.
* Update translations for multiple languages
Refined and expanded translations across various languages, replacing placeholders with meaningful text. This improves clarity and user experience in the multilingual interface.
* Update terminology from 'bundle' to 'model' in UI texts
Replaced occurrences of 'bundle' with 'model' in button labels, dialog titles, and messages in the SoftwarePanelSP code. This improves clarity and aligns terminology with current functionality.
* Update translation placeholders for model fetching texts
Replaced "Fetching bundles" with "Fetching models" across multiple languages to align text placeholders with the updated functionality. Adjusted related background download messages for clarity and consistency.
* cleanup
* not used, and likely not needed
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* cleaning up
* Update system/manager/process_config.py
* Simplify model parsing and index handling logic.
Refactored `ModelManager_DownloadIndex` retrieval to use the walrus operator, streamlining the conditional logic. Additionally, restructured model list initialization in `_parse_bundle` for improved readability and maintainability. These changes enhance code clarity and reduce redundancy.
* `Improve error handling in model cache retrieval`
Revised the `get` method to ensure it returns an empty dictionary on errors or missing data, avoiding potential `None`-related issues. Added logging for clearer diagnostics when cached model data is unavailable or retrieval fails. This improves reliability and debuggability of the model fetching process.
* Fix cached model data handling by parsing JSON response
Previously, cached model data was returned as a raw string, causing potential issues when using the data. The change ensures the cached data is properly parsed into JSON format before returning, improving reliability and consistency.
* Adjust modelManagerSP rate and Ratekeeper frequency
Reduced the rate for modelManagerSP in services and aligned the Ratekeeper frequency in model_manager.py to 0.1.
* Update model fetcher URL and adjust modelManagerSP rate
Updated the model fetcher URL to point to the correct resource for driving models. Adjusted the rate of modelManagerSP in both its service definition and the corresponding Ratekeeper initialization to 1 Hz for improved consistency.
* Refactor model download logic for clarity and efficiency
Simplify the logic for finding the model to download by combining redundant constructs into a single line. This improves code readability and reduces unnecessary variable assignments.
* Fix cache keys for manual prebuilt actions because they were missing the cache when manually built
* no need to log
* formatting
* revert ci changes
* Refactor and restructure `modeld` to `models` module.
Renamed `modeld` directory to `models` for clarity and consistency. Updated all references and imports to reflect the new structure. This improves maintainability and aligns with naming conventions.
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* Add support for GitHub Actions runner management
Introduce a new process and configuration to manage a GitHub Actions runner. Added a persistent "EnableGithubRunner" parameter and a script to control the runner service. Integrated the feature into the system's process manager logic.
* Restrict GitHub runner usage on metered networks.
This update modifies the `use_github_runner` function to include a check for metered networks using `HARDWARE.get_network_metered()`. This ensures the GitHub runner is not enabled when the network is metered, improving network usage efficiency.
* Add GitHub runner service toggle to developer panel
Introduces a new toggle in the developer panel to enable or disable the GitHub runner service. This provides developers with a convenient way to control the service from the UI.
* translations
* Refactor network condition check for GitHub runner.
Updated `use_github_runner` to include network type in metered network checks. This ensures more accurate validation by considering specific network types when determining metered status.
* Mark as executable
* Update paths and shebangs for consistency across scripts
Modified file paths to align with the new directory structure under `/data/media/0/github` and updated the shebang in `github_runner.sh` for better environment compatibility. Adjusted the `BUILD_DIR` in the GitHub workflow to reflect the new path.
* Fix string translation for GitHub runner parameter text
Added translation support for the GitHub runner service description text. This ensures consistent localization across the UI.
* Remove gitlab_runner.sh from Sunnypilot blacklist.
The script is no longer required to be blacklisted, likely due to updates or changes in its usage. This improves the maintainability of the blacklist by removing unnecessary entries.
* lang stuff
* Update BASE_DIR determination based on mount point
Refactored scripts to dynamically set BASE_DIR depending on whether /data/media is a valid mount point. This ensures compatibility with different environments and improves robustness of path resolution.
* Refactor GitHub runner logic in process_config.
Simplified enabling conditions for the GitHub runner by removing dependency on hardware network checks and adding a logical combination of offroad and runner-related functions. This improves code readability and reduces hardware coupling.
* Split joystickd into joystickd and joystick_control
* Update process config
* Undeprecate testJoystick
* Static analysis fixes
* Mark as +x
* Update README
* Add testJoystick back to services
* reset if testJoystick not received
* Fix quotes
* Remove self
* Add a send thread instead
* Add joystick_control into process config
* Add main
* Add additional condition
* Fix imports
* add longitudinal profiles
* stash
* unfortunately even longitudinalPlan causes circle
* add to process config
* reach target speed smoothly
* stash
* works
* clean up
* debug alert
* rename
* fix
* better text
* toggle via exp button
* try coming to a stop better, smoother target reaching
* closer to target
* revert controlsd migration
* add description to alert
* generate report from local logs
* hide bad maneuvers
* pdflike
* Revert "pdflike"
This reverts commit 6d4af1bf9be2e9e0798eaecf026a53d860da7613.
* try this
* use alert manager
* fix that check
* wat
* Revert "wat"
This reverts commit 93d0d27ab838d3f580d06ff212f380e0b912d599.
* some clean up
* rm
* cleanup
* move
* fix test
* more fix
* clean up
* fix that
* Reapply "joystickd is a real process (#33490)"
This reverts commit c8465e3a21.
* catch this
* reset to 0 when unplugged
* catch this too
* pytest capturing breaks stdin (pytest -s) fixes
* true joystickd
* temp params hack, manager clears all on start
* implement main, assume js
* works
* fix enable
* clean up
* like a real controlsd
* clean up
* fix mypy
* clean up
* update refs
* clean up