2021-03-07 22:02:08 -08:00
|
|
|
import os
|
2024-09-23 20:47:28 -07:00
|
|
|
import operator
|
2025-06-05 20:23:27 +03:00
|
|
|
import platform
|
2021-03-07 22:02:08 -08:00
|
|
|
|
models: retain pre-20hz drive model support (#531)
* modeld: Retain pre-20hz drive model support
* Method not available anymore on OP
* some fixes
* Revert "Long planner get accel: new function args (#34288)"
* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"
* Revert "long planner: allow throttle reflects usage (#33792)"
* Revert "Gate acceleration on model gas press predictions (#33643)"
* Reapply "Gate acceleration on model gas press predictions (#33643)"
This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b.
* don't need
* retain snpe
* wrong
* they're symlinks
* remove
* put back into VCS
* add back
* don't include built
* Refactor model runner retrieval with caching support
Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.
* Update model runner determination logic with caching fix
Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.
* 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 b44a687e4cfb1e2708457478e8626c731f42db0c.
* 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 f5a4220588c5b014b29173f8f89e1fecdec25336.
* Revert "enable in next PR"
This reverts commit 621cc4f18ead8489cb05a22a73b48e5e4fe33787.
* 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 f34d872c1369fa5479496ba4e0cce7b3063ab358.
* Revert "renamed model json"
This reverts commit 15c6ed303b01ab78d1a576dc1d4ad105db7518df.
* Revert "Going to a test branch with a different model json list"
This reverts commit 4c1408fee524656049ac6502ac4f578e5b632d54.
* Reapply "renamed model json"
This reverts commit c6fec6912a1517d161dc9b23dce43ddf46866312.
Reapply "Going to a test branch with a different model json list"
This reverts commit 83e253e9a3b6573191d907584d6368d991395b0a.
* 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>
2025-01-12 04:32:01 +01:00
|
|
|
from cereal import car, custom
|
2023-08-20 20:49:55 -07:00
|
|
|
from openpilot.common.params import Params
|
|
|
|
|
from openpilot.system.hardware import PC, TICI
|
2024-05-25 12:41:17 -07:00
|
|
|
from openpilot.system.manager.process import PythonProcess, NativeProcess, DaemonProcess
|
2025-06-07 03:47:09 -04:00
|
|
|
from openpilot.system.hardware.hw import Paths
|
|
|
|
|
|
|
|
|
|
from openpilot.sunnypilot.mapd.mapd_manager import MAPD_PATH
|
2025-01-10 18:34:06 -05:00
|
|
|
|
models: retain pre-20hz drive model support (#531)
* modeld: Retain pre-20hz drive model support
* Method not available anymore on OP
* some fixes
* Revert "Long planner get accel: new function args (#34288)"
* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"
* Revert "long planner: allow throttle reflects usage (#33792)"
* Revert "Gate acceleration on model gas press predictions (#33643)"
* Reapply "Gate acceleration on model gas press predictions (#33643)"
This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b.
* don't need
* retain snpe
* wrong
* they're symlinks
* remove
* put back into VCS
* add back
* don't include built
* Refactor model runner retrieval with caching support
Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.
* Update model runner determination logic with caching fix
Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.
* 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 b44a687e4cfb1e2708457478e8626c731f42db0c.
* 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 f5a4220588c5b014b29173f8f89e1fecdec25336.
* Revert "enable in next PR"
This reverts commit 621cc4f18ead8489cb05a22a73b48e5e4fe33787.
* 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 f34d872c1369fa5479496ba4e0cce7b3063ab358.
* Revert "renamed model json"
This reverts commit 15c6ed303b01ab78d1a576dc1d4ad105db7518df.
* Revert "Going to a test branch with a different model json list"
This reverts commit 4c1408fee524656049ac6502ac4f578e5b632d54.
* Reapply "renamed model json"
This reverts commit c6fec6912a1517d161dc9b23dce43ddf46866312.
Reapply "Going to a test branch with a different model json list"
This reverts commit 83e253e9a3b6573191d907584d6368d991395b0a.
* 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>
2025-01-12 04:32:01 +01:00
|
|
|
from sunnypilot.models.helpers import get_active_model_runner
|
sunnylink support (#499)
* 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>
2025-01-05 08:27:44 +01:00
|
|
|
from sunnypilot.sunnylink.utils import sunnylink_need_register, sunnylink_ready, use_sunnylink_uploader
|
2021-03-05 11:03:23 +01:00
|
|
|
|
2021-06-05 12:20:02 +08:00
|
|
|
WEBCAM = os.getenv("USE_WEBCAM") is not None
|
2021-03-07 22:02:08 -08:00
|
|
|
|
2022-05-03 23:30:35 -07:00
|
|
|
def driverview(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-08-24 06:00:55 -07:00
|
|
|
return started or params.get_bool("IsDriverViewEnabled")
|
2022-05-03 23:30:35 -07:00
|
|
|
|
|
|
|
|
def notcar(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-08-24 06:00:55 -07:00
|
|
|
return started and CP.notCar
|
2022-05-03 23:30:35 -07:00
|
|
|
|
2023-08-11 15:34:25 -07:00
|
|
|
def iscar(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-08-24 06:00:55 -07:00
|
|
|
return started and not CP.notCar
|
2023-08-11 15:34:25 -07:00
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def logging(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2022-05-04 14:57:39 -07:00
|
|
|
run = (not CP.notCar) or not params.get_bool("DisableLogging")
|
2022-05-03 23:46:59 -07:00
|
|
|
return started and run
|
2022-05-03 23:30:35 -07:00
|
|
|
|
2023-03-14 13:31:49 -07:00
|
|
|
def ublox_available() -> bool:
|
|
|
|
|
return os.path.exists('/dev/ttyHS0') and not os.path.exists('/persist/comma/use-quectel-gps')
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def ublox(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-03-14 13:31:49 -07:00
|
|
|
use_ublox = ublox_available()
|
2023-06-29 16:05:00 -07:00
|
|
|
if use_ublox != params.get_bool("UbloxAvailable"):
|
|
|
|
|
params.put_bool("UbloxAvailable", use_ublox)
|
2023-01-14 23:06:09 -08:00
|
|
|
return started and use_ublox
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def joystick(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2024-09-07 17:03:22 -07:00
|
|
|
return started and params.get_bool("JoystickDebugMode")
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def not_joystick(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2024-09-07 17:03:22 -07:00
|
|
|
return started and not params.get_bool("JoystickDebugMode")
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def long_maneuver(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2024-09-12 14:10:18 -07:00
|
|
|
return started and params.get_bool("LongitudinalManeuverMode")
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def not_long_maneuver(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2024-09-12 14:10:18 -07:00
|
|
|
return started and not params.get_bool("LongitudinalManeuverMode")
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def qcomgps(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-03-14 13:31:49 -07:00
|
|
|
return started and not ublox_available()
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def always_run(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-08-24 06:00:55 -07:00
|
|
|
return True
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def only_onroad(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-08-24 06:00:55 -07:00
|
|
|
return started
|
|
|
|
|
|
2024-10-14 09:35:35 -07:00
|
|
|
def only_offroad(started: bool, params: Params, CP: car.CarParams) -> bool:
|
2023-08-24 06:00:55 -07:00
|
|
|
return not started
|
2022-06-11 23:19:27 -07:00
|
|
|
|
2024-12-23 09:19:26 +01:00
|
|
|
def use_github_runner(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
return not PC and params.get_bool("EnableGithubRunner") and not params.get_bool("NetworkMetered")
|
|
|
|
|
|
sunnylink support (#499)
* 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>
2025-01-05 08:27:44 +01:00
|
|
|
def sunnylink_ready_shim(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
"""Shim for sunnylink_ready to match the process manager signature."""
|
|
|
|
|
return sunnylink_ready(params)
|
|
|
|
|
|
|
|
|
|
def sunnylink_need_register_shim(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
"""Shim for sunnylink_need_register to match the process manager signature."""
|
|
|
|
|
return sunnylink_need_register(params)
|
|
|
|
|
|
|
|
|
|
def use_sunnylink_uploader_shim(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
"""Shim for use_sunnylink_uploader to match the process manager signature."""
|
|
|
|
|
return use_sunnylink_uploader(params)
|
|
|
|
|
|
2025-01-10 18:34:06 -05:00
|
|
|
def is_snpe_model(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
"""Check if the active model runner is SNPE."""
|
models: retain pre-20hz drive model support (#531)
* modeld: Retain pre-20hz drive model support
* Method not available anymore on OP
* some fixes
* Revert "Long planner get accel: new function args (#34288)"
* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"
* Revert "long planner: allow throttle reflects usage (#33792)"
* Revert "Gate acceleration on model gas press predictions (#33643)"
* Reapply "Gate acceleration on model gas press predictions (#33643)"
This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b.
* don't need
* retain snpe
* wrong
* they're symlinks
* remove
* put back into VCS
* add back
* don't include built
* Refactor model runner retrieval with caching support
Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.
* Update model runner determination logic with caching fix
Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.
* 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 b44a687e4cfb1e2708457478e8626c731f42db0c.
* 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 f5a4220588c5b014b29173f8f89e1fecdec25336.
* Revert "enable in next PR"
This reverts commit 621cc4f18ead8489cb05a22a73b48e5e4fe33787.
* 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 f34d872c1369fa5479496ba4e0cce7b3063ab358.
* Revert "renamed model json"
This reverts commit 15c6ed303b01ab78d1a576dc1d4ad105db7518df.
* Revert "Going to a test branch with a different model json list"
This reverts commit 4c1408fee524656049ac6502ac4f578e5b632d54.
* Reapply "renamed model json"
This reverts commit c6fec6912a1517d161dc9b23dce43ddf46866312.
Reapply "Going to a test branch with a different model json list"
This reverts commit 83e253e9a3b6573191d907584d6368d991395b0a.
* 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>
2025-01-12 04:32:01 +01:00
|
|
|
return bool(get_active_model_runner(params, not started) == custom.ModelManagerSP.Runner.snpe)
|
2025-01-10 18:34:06 -05:00
|
|
|
|
2025-03-02 20:49:30 +01:00
|
|
|
def is_tinygrad_model(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
"""Check if the active model runner is SNPE."""
|
|
|
|
|
return bool(get_active_model_runner(params, not started) == custom.ModelManagerSP.Runner.tinygrad)
|
|
|
|
|
|
2025-01-10 18:34:06 -05:00
|
|
|
def is_stock_model(started, params, CP: car.CarParams) -> bool:
|
|
|
|
|
"""Check if the active model runner is stock."""
|
2025-03-02 20:49:30 +01:00
|
|
|
return bool(get_active_model_runner(params, not started) == custom.ModelManagerSP.Runner.stock)
|
2025-01-10 18:34:06 -05:00
|
|
|
|
2024-09-23 20:47:28 -07:00
|
|
|
def or_(*fns):
|
|
|
|
|
return lambda *args: operator.or_(*(fn(*args) for fn in fns))
|
|
|
|
|
|
|
|
|
|
def and_(*fns):
|
|
|
|
|
return lambda *args: operator.and_(*(fn(*args) for fn in fns))
|
|
|
|
|
|
2023-08-24 06:00:55 -07:00
|
|
|
procs = [
|
2024-05-20 14:59:43 -07:00
|
|
|
DaemonProcess("manage_athenad", "system.athena.manage_athenad", "AthenadPid"),
|
2023-08-24 06:00:55 -07:00
|
|
|
|
2025-02-20 16:53:07 -08:00
|
|
|
NativeProcess("loggerd", "system/loggerd", ["./loggerd"], logging),
|
|
|
|
|
NativeProcess("encoderd", "system/loggerd", ["./encoderd"], only_onroad),
|
|
|
|
|
NativeProcess("stream_encoderd", "system/loggerd", ["./encoderd", "--stream"], notcar),
|
|
|
|
|
PythonProcess("logmessaged", "system.logmessaged", always_run),
|
|
|
|
|
|
2024-12-19 17:36:36 -05:00
|
|
|
NativeProcess("camerad", "system/camerad", ["./camerad"], driverview, enabled=not WEBCAM),
|
|
|
|
|
PythonProcess("webcamerad", "tools.webcam.camerad", driverview, enabled=WEBCAM),
|
2025-06-05 20:23:27 +03:00
|
|
|
NativeProcess("logcatd", "system/logcatd", ["./logcatd"], only_onroad, platform.system() != "Darwin"),
|
|
|
|
|
NativeProcess("proclogd", "system/proclogd", ["./proclogd"], only_onroad, platform.system() != "Darwin"),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("micd", "system.micd", iscar),
|
2024-01-22 18:35:11 -08:00
|
|
|
PythonProcess("timed", "system.timed", always_run, enabled=not PC),
|
2023-08-24 06:00:55 -07:00
|
|
|
|
2025-03-17 09:11:51 +01:00
|
|
|
PythonProcess("modeld", "selfdrive.modeld.modeld", and_(only_onroad, is_stock_model)),
|
2025-03-15 15:55:29 -07:00
|
|
|
PythonProcess("dmonitoringmodeld", "selfdrive.modeld.dmonitoringmodeld", driverview, enabled=(WEBCAM or not PC)),
|
2025-03-02 13:39:36 -08:00
|
|
|
|
2025-05-30 13:31:07 -07:00
|
|
|
PythonProcess("sensord", "system.sensord.sensord", only_onroad, enabled=not PC),
|
2023-08-24 06:00:55 -07:00
|
|
|
NativeProcess("ui", "selfdrive/ui", ["./ui"], always_run, watchdog_max_dt=(5 if not PC else None)),
|
2023-12-05 18:10:01 -08:00
|
|
|
PythonProcess("soundd", "selfdrive.ui.soundd", only_onroad),
|
2024-09-04 02:54:57 -07:00
|
|
|
PythonProcess("locationd", "selfdrive.locationd.locationd", only_onroad),
|
2025-01-21 17:29:56 -08:00
|
|
|
NativeProcess("_pandad", "selfdrive/pandad", ["./pandad"], always_run, enabled=False),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("calibrationd", "selfdrive.locationd.calibrationd", only_onroad),
|
|
|
|
|
PythonProcess("torqued", "selfdrive.locationd.torqued", only_onroad),
|
2024-09-23 20:47:28 -07:00
|
|
|
PythonProcess("controlsd", "selfdrive.controls.controlsd", and_(not_joystick, iscar)),
|
|
|
|
|
PythonProcess("joystickd", "tools.joystick.joystickd", or_(joystick, notcar)),
|
2024-09-06 17:16:32 -07:00
|
|
|
PythonProcess("selfdrived", "selfdrive.selfdrived.selfdrived", only_onroad),
|
2024-05-21 03:18:10 -05:00
|
|
|
PythonProcess("card", "selfdrive.car.card", only_onroad),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("deleter", "system.loggerd.deleter", always_run),
|
2024-12-19 17:36:36 -05:00
|
|
|
PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", driverview, enabled=(WEBCAM or not PC)),
|
2023-11-18 23:23:16 -08:00
|
|
|
PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI),
|
2024-06-04 19:16:55 -07:00
|
|
|
PythonProcess("pandad", "selfdrive.pandad.pandad", always_run),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad),
|
2025-04-09 15:31:07 -07:00
|
|
|
PythonProcess("lagd", "selfdrive.locationd.lagd", only_onroad),
|
2023-08-24 06:00:55 -07:00
|
|
|
NativeProcess("ubloxd", "system/ubloxd", ["./ubloxd"], ublox, enabled=TICI),
|
2024-03-12 17:13:13 -07:00
|
|
|
PythonProcess("pigeond", "system.ubloxd.pigeond", ublox, enabled=TICI),
|
2024-09-12 14:10:18 -07:00
|
|
|
PythonProcess("plannerd", "selfdrive.controls.plannerd", not_long_maneuver),
|
|
|
|
|
PythonProcess("maneuversd", "tools.longitudinal_maneuvers.maneuversd", long_maneuver),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("radard", "selfdrive.controls.radard", only_onroad),
|
2024-06-05 15:58:00 -07:00
|
|
|
PythonProcess("hardwared", "system.hardware.hardwared", always_run),
|
2024-05-20 22:39:25 -07:00
|
|
|
PythonProcess("tombstoned", "system.tombstoned", always_run, enabled=not PC),
|
2024-05-25 12:22:02 -07:00
|
|
|
PythonProcess("updated", "system.updated.updated", only_offroad, enabled=not PC),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("uploader", "system.loggerd.uploader", always_run),
|
2024-05-20 22:39:25 -07:00
|
|
|
PythonProcess("statsd", "system.statsd", always_run),
|
2021-08-19 16:00:05 -07:00
|
|
|
|
2022-10-06 13:47:09 -07:00
|
|
|
# debug procs
|
2023-08-24 06:00:55 -07:00
|
|
|
NativeProcess("bridge", "cereal/messaging", ["./bridge"], notcar),
|
2023-12-01 21:13:37 -08:00
|
|
|
PythonProcess("webrtcd", "system.webrtc.webrtcd", notcar),
|
2023-08-24 06:00:55 -07:00
|
|
|
PythonProcess("webjoystick", "tools.bodyteleop.web", notcar),
|
2024-09-23 20:47:28 -07:00
|
|
|
PythonProcess("joystick", "tools.joystick.joystick_control", and_(joystick, iscar)),
|
sunnylink support (#499)
* 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>
2025-01-05 08:27:44 +01:00
|
|
|
|
|
|
|
|
# sunnylink <3
|
|
|
|
|
DaemonProcess("manage_sunnylinkd", "sunnypilot.sunnylink.athena.manage_sunnylinkd", "SunnylinkdPid"),
|
|
|
|
|
PythonProcess("sunnylink_registration_manager", "sunnypilot.sunnylink.registration_manager", sunnylink_need_register_shim),
|
2021-03-05 11:03:23 +01:00
|
|
|
]
|
|
|
|
|
|
Driving Model Manager (#457)
* 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>
2025-01-04 21:05:21 +01:00
|
|
|
# sunnypilot
|
|
|
|
|
procs += [
|
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 16:58:04 +01:00
|
|
|
# Models
|
Driving Model Manager (#457)
* 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>
2025-01-04 21:05:21 +01:00
|
|
|
PythonProcess("models_manager", "sunnypilot.models.manager", only_offroad),
|
2025-01-10 18:34:06 -05:00
|
|
|
NativeProcess("modeld_snpe", "sunnypilot/modeld", ["./modeld"], and_(only_onroad, is_snpe_model)),
|
2025-03-02 20:49:30 +01:00
|
|
|
NativeProcess("modeld_tinygrad", "sunnypilot/modeld_v2", ["./modeld"], and_(only_onroad, is_tinygrad_model)),
|
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 16:58:04 +01:00
|
|
|
|
|
|
|
|
# Backup
|
|
|
|
|
PythonProcess("backup_manager", "sunnypilot.sunnylink.backups.manager", and_(only_offroad, sunnylink_ready_shim)),
|
2025-06-07 03:47:09 -04:00
|
|
|
|
|
|
|
|
# mapd
|
|
|
|
|
NativeProcess("mapd", Paths.mapd_root(), [MAPD_PATH], always_run),
|
|
|
|
|
PythonProcess("mapd_manager", "sunnypilot.mapd.mapd_manager", always_run),
|
Driving Model Manager (#457)
* 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>
2025-01-04 21:05:21 +01:00
|
|
|
]
|
|
|
|
|
|
2024-12-23 09:19:26 +01:00
|
|
|
if os.path.exists("./github_runner.sh"):
|
|
|
|
|
procs += [NativeProcess("github_runner_start", "system/manager", ["./github_runner.sh", "start"], and_(only_offroad, use_github_runner), sigkill=False)]
|
|
|
|
|
|
sunnylink support (#499)
* 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>
2025-01-05 08:27:44 +01:00
|
|
|
if os.path.exists("../sunnypilot/sunnylink/uploader.py"):
|
|
|
|
|
procs += [PythonProcess("sunnylink_uploader", "sunnypilot.sunnylink.uploader", use_sunnylink_uploader_shim)]
|
|
|
|
|
|
2021-03-05 11:03:23 +01:00
|
|
|
managed_processes = {p.name: p for p in procs}
|