* add EGL support to CameraView
* view 3 cameras
* use a more direct approach
* add new line
* cleanup
* cleanup close()
* extract EGL to a seperate file
* cleanup
* add try/except to close()
* rename egl_textures
* improve implementation
* Refactor model runner methods for improved abstraction.
Moved slicing logic to a private `_slice_outputs` method and decoupled `_run_model` for clearer subclass implementation. Removed redundant `output` attribute in `ModelState` to streamline data handling.
* Add output parsing to model_runner and remove duplicate logic
Integrates an output parser directly into `model_runner` for streamlined inference and parsing. Removes redundant parser initialization from `modeld` to avoid duplication and enhance maintainability.
* Reordering
* linter
* linter
* Refactor model handling with `ModelData` abstraction
Introduce a `ModelData` class to encapsulate model and metadata logic, improving code clarity and modularity. Refactor `ModelRunner` to manage multiple models and add conditional handling for fallback scenarios. Adjust `TinygradRunner` to validate and use the new `ModelData` structure.
* Refactor model handling to use dictionary-based structure
Replaces the model list with a dictionary keyed by model type to improve clarity and maintainability. Updates related logic and ensures consistent handling of model metadata and inputs. Adds `slice_outputs` implementation to the `TinygradRunner` for proper output parsing.
* Refactor model runners to support policy and vision separation
Introduced `TinygradPolicyRunner`, `TinygradVisionRunner`, and `TinygradSplitRunner` to enable separate handling of policy and vision models. Updated `TinygradRunner` initialization and input preparation to accommodate modular processing. Adjusted `modeld` to utilize the new runners, ensuring compatibility with separated model workflows.
* Refactor model runner initialization and simplify logic
Introduce `get_model_runner` to centralize model runner selection logic, replacing multiple conditional instantiations. Simplify the handling of model metadata by removing fallback logic and restructuring output slicing to enforce proper loading of model data. These changes improve code maintainability and clarity.
* Refactor model data access for TinygradRunner initialization
Update references to access nested artifact properties and align with structural changes to the model data schema. This simplifies input shapes handling and ensures compatibility with updated model attributes.
* Refactor imports and clean up redundant code.
Removed unused imports and improved formatting for clarity and maintainability. These changes simplify the codebase by eliminating unnecessary dependencies and ensuring consistency.
* Refactor model output parsing with specialized parsers.
Introduce abstract `_parse_outputs` method to standardize parsing logic. Add `SplitParser` for specialized parsing in `TinygradVisionRunner` and `TinygradPolicyRunner`. This improves modularity and paves the way for easier parser customization.
* Add parser for model output processing in modeld_v2
Introduce a new `Parser` class to handle parsing and processing of model outputs, including MDN, binary cross-entropy, and categorical cross-entropy outputs. This modularizes the logic, improves clarity, and prepares for handling various types of model data.
* Add `input_shapes` property to model runners
Introduce a new `input_shapes` property in the abstract base class and its implementation in derived classes. This provides a standardized way to access the input shapes of models, improving clarity and consistency in the model runners.
* Refactor model runner to use private `_model_data` attribute
Replaced public `model_data` with private `_model_data` for improved encapsulation. Updated all references and property accessors accordingly. Simplified model type handling by using raw types where applicable.
* Remove debug print statement from model_runner.py
The unnecessary `print(model_type)` statement was removed as it served no functional purpose in the code. This improves code cleanliness and avoids unintended console output during execution.
* Refactor `_parse_outputs` call in `run_model`.
Replaced the use of `self.parser.parse_outputs` with `self._parse_outputs` for clarity and consistency. Updated method signature to align with the revised usage.
* Refactor model output parsing for clarity and scope separation
Moved specific parsing logic (e.g., lane_lines, lead) from `parse_model_outputs` to `parse_policy_outputs` to better align with functional responsibilities. This improves modularity and readability while maintaining existing functionality.
* Refactor model_runner to simplify result handling
Renamed variable `result` to `parsed_result` for clarity and removed unnecessary slicing during model output parsing. These changes improve code readability and maintain consistency within the `run_model` method.
* Adjust _parse_outputs method signature in model_runner
Updated the method signature of _parse_outputs to accept a single np.ndarray instead of a dictionary. This aligns with the intended data structure and ensures consistency across subclasses implementing this abstract method.
* Refactor ModelRunner to enforce abstract base class compliance
Updated `ModelRunner` and its subclasses to properly inherit from `ABC` while refactoring methods to ensure compliance with Python's abstract base class standards. Streamlined the handling of `_parse_outputs` and added a new `input_shapes` property for improved functionality.
* Fix buffer length issue in 20Hz model initialization
Adjusted `FULL_HISTORY_BUFFER_LEN` by adding +1 for `full_features_20Hz` to address compatibility issues with the current FoF model. Added a comment noting potential failure for other models with this adjustment.
* Refactor TinygradRunner to remove abstract methods.
Simplified the TinygradRunner class by removing unnecessary @abstractmethod decorators and redundant method definitions. This streamlines the code and aligns it more effectively with its current usage and implementation.
* Refactor model runner classes and enhance type annotations
Simplified model runner implementations, added type annotations, and improved code readability and maintainability. Introduced new type definitions, updated metadata handling, and standardized input/output parsing across all runner classes. Minor comment update in `modeld.py` for clarity.
* Refactor model runner classes with detailed docstrings.
Enhanced class and function docstrings across model_runner.py for better clarity and maintainability. Descriptions now include detailed explanations of attributes, purposes, and workflows to aid understanding and future development.
* Refactor model runner classes and add TICI hardware optimization
Simplified and clarified class definitions, comments, and functionality for ModelRunner subclasses. Introduced the use of QCOM environment variable on TICI for potential hardware acceleration. Enhanced input/output handling and error reporting across Tinygrad and ONNX implementations.
* Update parser import and usage to use CombinedParser
Replaced the Parser class with CombinedParser in model_runner.py. This change ensures consistency with the updated parsing logic, aligning with the latest requirements for combined model output handling.
* Refactor TinygradRunner hierarchy for modular parsers
Reorganized the TinygradRunner and its specialized runners (Vision, Policy, and Supercombo) into a cleaner, modular structure using composable classes. This consolidates parser logic, removes redundancy, and simplifies initialization by leveraging a shared base class with a dictionary-based parser method.
* Refactor model runners to use ModularRunner as abstract base.
Introduce a new `ModularRunner` class to enforce a consistent interface across model runners. Updated existing runners, including `ModelRunner`, `SupercomboTinygrad`, `PolicyTinygrad`, and `VisionTinygrad`, to extend `ModularRunner`. Added abstract methods and properties to enhance modularity and code maintainability.
* Refactor model runners into modular components.
This commit separates the logic for Tinygrad, ONNX, and split runners into clearly defined modules and components. It introduces `PolicyTinygrad`, `VisionTinygrad`, `SupercomboTinygrad`, and centralized helpers for cleaner architecture. The changes improve modularity and maintainability of the model running and parsing workflows.
* Simplify imports and clean up unused code in ONNXRunner.
Removed unused imports and redundant environmental variables to streamline the codebase. Consolidated necessary imports and organized type definitions for improved readability and maintenance.
* Standardize imports and add model data validation.
Updated import paths to ensure consistency across modules by using `openpilot` as the base. Introduced validation in `_parse_outputs` methods to handle cases where `_model_data` is not initialized, preventing potential runtime errors.
* Remove unused import and fix whitespace in runners
The unused import `ModelData` was removed from `tinygrad_runner.py` to clean up the code. Additionally, extraneous whitespace was corrected in `onnx_runner.py` for improved readability and consistency.
* Remove unnecessary blank line in import statements
Cleaned up import section by removing an extra blank line. This helps maintain consistency and adheres to code style conventions.
* BROKEN!! Staging code but its not gonna work. Also I realized we need to run the split models in 2 stages because the output of one is immediately needed for the input of the other. We might handle it inside of the model_runner instead
* update smooth
* Revert "update smooth"
This reverts commit c335712e6e1ee189459ce34dfc9d4028feb9470f.
* match case made this very hard to read.
* shouldnt be there
* Refactor to allow TR (soon TM)
* TR 7 is .1
* metadata
* .2=3
* Remove redundant comments and clean up conditional blocks in modeld.py.
* Undoing wrong buffer
* Refactor model initialization and adjust ONNX runner import
Reorganized numpy input buffer initialization and updated `temporal_idxs` logic for better clarity and efficiency. Conditional import for ONNXRunner added for non-TICI platforms to optimize imports. These changes improve maintainability and compatibility across platforms.
* Update CURRENT_SELECTOR_VERSION to 4
Bump the CURRENT_SELECTOR_VERSION constant from 3 to 4 to reflect changes in the selector logic or requirements. This ensures compatibility with the updated selector version while maintaining the minimum required version as 2.
* Add output_slices property to model runners
Introduce output_slices property to provide access to the output slices for individual and combined models. This ensures consistent handling of output slices across vision and policy models, improving modularity and usability.
* Refactor imports to use SplitModelConstants consistently
Updated import references to use the renamed `SplitModelConstants` class for consistency across files. This change ensures clarity and better alignment with the updated class naming convention.
* Refactor buffer initialization and desired curvature handling
Refactored model input buffer initialization for improved clarity and consistency, leveraging dynamic shape calculations. Extracted `process_desired_curvature` method to encapsulate logic for handling 3D and non-3D cases. Simplified temporal index generation and related calculations for better maintainability.
* Refactor desire reshape dims logic in modeld.py
Adjust logic for setting desire reshape dimensions to handle `is_20hz_3d` separately. This improves clarity and ensures proper handling of different model runner configurations.
* Fix off-by-one error in full_desire buffer initialization
The full_desire buffer length was mistakenly set to full_history_buffer_len + 1. This change corrects it to match the intended full_history_buffer_len, ensuring proper alignment with other buffers.
* Simplify desire reshape logic by removing unused condition.
Removed the `is_20hz_3d` condition and associated reshape logic since it is no longer needed. This streamlines the code and avoids unnecessary checks for unused configurations.
* Refactor buffer initialization for 20Hz model variants
Reorganized buffer initialization logic to prioritize the 20Hz_3D condition. This improves clarity and ensures specific handling of different 20Hz configurations. Adjusted the order of conditions to streamline execution flow.
* Refactor: Move `get_action_from_model` and constants to `Model` class to improve encapsulation and readability.
* 12 line reshaping red diff
* .2 to match old models delay
* mypy fixes
* Revert "12 line reshaping red diff"
This reverts commit 8c7280f629.
* mypy
* remove this
* Fix desired curvature for models which do not output desired_curvature
* fix FoF
* flip policy and vision outs to allow FoF and tomb raider to live in harmony using conditional `if 'this' in outs:'`
* noqa
* single
* sunnypilot modeld.py
* action
* overrides methodology
* combine split outputs to its own method
* comments
* Fix static checker line length
* static will fail on line length
lines:
286,
206,
70 - 77,
159,
168
* Address E501 line length violations
* This will make TR better while not effecting FoF/VFF at all
* Reduce this to one conditional and just call normally in vision/policy
* Align with upstream in our own way.
* check for desired curvature in outputs first
* outputs
* Use a cleaner import method
* Fix output
* Clean up some values
* Only call on init
* slight cleanup
* names!!!!!!!!!
* Refactor overrides structure to support key-value pairs.
The overrides structure now uses a list of key-value pairs instead of fixed lat/long fields. This change improves flexibility, allowing dynamic addition of override parameters. Code adjustments ensure backward compatibility and consistent behavior throughout the application.
* Refactor: Use local variable for SplitModelConstants
Introduce a local `constants` variable to replace repeated access to `SplitModelConstants`. This simplifies code readability and adheres to linter recommendations for line length.
* Refactor model constant handling to improve modularity
Replaced direct usage of model constants with dynamic access through model runners for better scalability and maintainability. This change centralizes constant definitions, reduces redundancy, and ensures clearer integration with different model types.
---------
Co-authored-by: discountchubbs <alexgrant990@gmail.com>
Co-authored-by: Discountchubbs <159560811+Discountchubbs@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* Add job to fetch and upload model artifacts
Introduced a new `get_model` job to retrieve and upload model artifacts as part of the workflow. Updated the `build_model` job to download and clean up model files before building, ensuring an isolated and streamlined process. These changes improve modularity and artifact handling in the CI pipeline.
* Refine model file handling in build workflow
Restrict deletion and download commands to ".onnx" files to prevent unintended removal or overwriting of non-ONNX files. This ensures a more targeted and safer workflow for handling model artifacts.
* Update model artifact handling in build workflow
Changed artifact upload path to include only .onnx files and commented out the deletion of existing models. Also added a dependency for the build stage to ensure proper execution sequence.
* Update build workflow to refine model artifact handling
Removed unused code for deleting models and fixed the artifact path. Added a reference file logging custom name and upstream branch for better traceability. These changes streamline the workflow and improve clarity.
* Set dynamic run-name for sunnypilot build workflow
Added a customizable `run-name` field in the sunnypilot build model workflow. This allows more informative and dynamic naming based on input parameters such as `custom_name` or `upstream_branch`. Improves clarity and traceability in workflow runs.
* Add customization options and metadata generation to build
Introduce new inputs for file name prefix and 20Hz model specification in the workflow. Enable renaming of model files, generation of file hashes, and creation of a `metadata.json` file containing build details. This improves flexibility and enhances artifact information management.
* remove EOF
* No need for this hack anymore
* Add support for compiling ONNX models to Tinygrad format
* Add model directory environment variable and metadata generation script
* Fix quoting in model generator script command
* Refactor conditional flag for 20Hz input in build model script
* meh
* Add powersave management to build model workflow
* Add environment variable setup to build model workflow
* make it path call it a day
* kill me
* kill me x2
* mmm
* mmm
* Generate metadata.pkl
* Generate metadata.pkl
* ignore failure on getting model metadata
* Cleanup the existing onnxs
* Fix rm command syntax in build model script
* Cleaning a little
* Add optional file name parameter to generate_metadata function
* update
* stg
* linter
* more formatting
* Update sunnypilot model build workflow: improve custom naming, handle 20Hz default, and add commit date as output.
* Update commit date format in workflow script
Changed the commit date format in sunnypilot-build-model.yaml to a more human-readable format ('Month DD, YYYY'). This improves readability and consistency in the workflow outputs.
* Fix output naming in sunnypilot-build-model workflow
Corrected the output name from 'model_date' to 'commit_date' to match its usage. This ensures consistency and prevents potential errors in the workflow.
Add debug echo for model date in GitHub workflow
This change adds a debug echo statement to display the model date in the sunnypilot-build-model workflow. It helps verify the correct commit date is being set during the workflow process.
* Update BUILD_DIR path in sunnypilot workflow
Replaced hardcoded BUILD_DIR with a dynamic path using `github.workspace`. This enhances flexibility and ensures compatibility with different environments or runners.
* Revert "Update BUILD_DIR path in sunnypilot workflow"
This reverts commit 376971b616.
* Refactor model metadata generation to use short names
Replaced `file_name` with generated `short_name` for metadata and file naming. Introduced `create_short_name` function to simplify short name creation from custom names. Updated scripts and workflow to reflect the new parameter and improve metadata handling.
* `Use timezone-aware UTC timestamp for build_time`
Updated the code to use `datetime.now(timezone.utc)` instead of `datetime.utcnow()`. This ensures that the generated timestamps are timezone-aware, improving consistency and correctness in the output.
* Refactor short name generation logic in model metadata
Enhanced the `create_short_name` function to better handle name conversion by incorporating new rules for handling parentheses, alphanumeric words, and version pairs. Updated related variable names in metadata functions for improved clarity and consistency.
* Fix syntax error in assigning 'models' key in metadata
Corrected a typo where 'models' was missing quotes, causing it to be interpreted as a variable instead of a string key. This ensures proper metadata dictionary structure.
Update model metadata structure and JSON generation
Revised metadata to include detailed download URIs and a type field for artifacts. Enhanced the JSON generator with new fields like environment, runner, and overrides for better configurability. These changes aim to improve metadata clarity and compatibility with downstream processes.
* Refactor variable name from "escaped_name" to "short_name"
Renamed "escaped_name" to "short_name" across function parameters and internal logic for clarity and consistency. This improves readability and better aligns with its use case in the metadata generation process. No functional changes were introduced.
* Refactor variable names and improve type annotations.
Updated parameter names to align with Python naming conventions, enhancing readability and consistency. Added type annotations for function parameters to improve code clarity and maintainability.
* Refactor type annotations and clarify comments.
Updated type annotations to use "Str" for consistency with custom typing conventions. Improved clarity of a comment describing the normal case logic in the shortening function.
* Fix dict formatting in model_generator.py
Moved the "overrides" key for better alignment and consistency in the dictionary format. This improves readability without changing functionality.
Refactor model short name generation logic
Simplify and clarify the `create_short_name` function by improving readability and condensing comments. Adjust casing and truncation logic for single-word cases and handle versioned names more intuitively.
* Ensure custom file names are converted to lowercase.
When renaming files using a custom short name, enforce lowercase conversion to maintain consistency and prevent potential issues with case-sensitive file systems. This change applies to both the tinygrad and metadata file names.
* Use UTC alias for timezone in datetime imports
Replaced `timezone.utc` with `UTC` from the `datetime` module for clarity and consistency. This simplifies the representation of time zones and aligns with Python's updated best practices.
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* Hyundai CAN: re-enable auto-enable radar tracks
* check if radar tracks config bit is already enabled
* only show success message if already enabled
* test if it would actually skip
* 5 bytes only
* tested skipping, revert
* lint
* move to opendbc right after fping
* more
* lint
* bump
* car: initialize sunnypilot interface immediately
* init
* Revert "car: initialize sunnypilot interface immediately"
This reverts commit 2e0fc4d87eb312a3a74a61bb8cbc780e33efbfc7.
* show int
* show int
* work properly with cereal
* unused
* in its own module
* bump
* not yet
* not yet
* list comp and use structs directly
* allow default key if needed
* lint
* send it with None
* bump
* Mechanism to handle ambiguous estimates
* Use it
* Fix static
* Fix
* Comment
* Comment v2
* Use quantile instead
* Fix
* Make it better
* Make it confidence
* Make it a constant
* min_confidence as arg
* Make the test signal more like the real one
* Relax sample requirements
* Use constant
* Reduce confidence
* draft
* here too
* fixes
* fix
* ugh more fix, wifiManager is craze
* more
* be optimistic and let refresh happen naturally, the immediate refresh causes some paths/active connect to temporarily be unavailable
selfdrive/ui/qt/network/wifi_manager.cc: DBus call error: "Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the re
ply timeout expired, or the network connection was broken."
selfdrive/ui/qt/network/wifi_manager.cc: DBus call error: "Object path cannot be empty"
* nm is slow -- it takes 2s to commit to disk, and dbus errors are raised if you try again while previous is running (this is an ubuntu 24.04 bug)
* nice experience
* rm
* minor
* clean up
* self-explanatory
* rename
* rm this too
* revert
* draft
* Revert "draft"
This reverts commit 15283d977880fc60b8f9732772256e8337d6ac8e.
* Reapply "draft"
This reverts commit 8629921b0086ca71b88746d77ec7b8d3af3cd289.
* rm colors
* trinary, bit more code
* choose default when disabled
* only if enabling, wait for disable as normal
* remove original binary toggle
* clean up
* collapse
* clean up wifimanager
* update comment
* lite is a word
* init: lpa interface
* handle multiple messages
* handle timeouts
* delete old LPA, add enable/disable/validation
* check if valid
* keep old file the same for easier diff
* keep
* nickname, bug fixes
* space
* simple
* need to test this on slow conn
* initial HITL test for eSIM provisioning
* cleanup
* lint
* test flakes if lpac called concurrently
* no
* cleanup
* org
* comment
* vibe coded uts
* Revert "vibe coded uts"
This reverts commit 8b4d8f8ade50dbeaf3fa44f1df1aa2d809deca18.
* much simpler test
* no value
* remove no value add comments
* only one test flow now
* simpler
* reorganize
* replace impl
* brevity
* moar
* why didnt u rename
* moar
* check lpac installed
* Profile dataclass
* shorten
* print out profiles
* better
* plurals
* argparse
* download/nickname
* move to end to show change
* just end early if already enabled
* --reboot
* reconfigure conn
* mutations require reboot today
* not needed
* lint
* guard delete
* better
* print help
* spaceg
* rename
* support at device
* choose backend
* desc
* more
* brackets
* op esim
* Revert "brackets"
This reverts commit 124dbc0cbcc07d93f556ca80a6dc47aa118fda5c.
* Update Jenkinsfile
* expandable_row widget
* make MinMaxValue protected to allow inheritence
* add function to set width
* no more layout warnings
* format
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* update SConscript
Co-authored-by: Dean Lee <deanlee3@gmail.com>
* can't build on mac
* raylib installer
Co-authored-by: Dean Lee <deanlee3@gmail.com>
* rm
* debug pls
* cleanup
* quotes
* libs?
* bump
* hmm
* progress bar color
* more
* not rounded
* hardcode a font path..?
* embed (a subset of) inter into the installer
* different in CI
* closer font sizes
* closer
* add that back
* unnecessary
* closer to previous impl
* prefix is at start of string, substr between prefix and %
* Revert "prefix is at start of string, substr between prefix and %"
This reverts commit bc53fe8e356ca642680e90682285bd5e8d98ecb5.
* bigger on device?
* rm
---------
Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
* MADS: Tesla and Rivian support
* request lateral if acc is engaged
* try this out
* fix
* make sure we keep the toggle off for tesla
* namedtuple
* disallow steering past 90 degrees for rivian
* whoops
* Revert "Revert "MADS: Steering Mode on Brake Pedal Press (#687)" (#789)"
This reverts commit 8dec4ea5
* both rivian and tesla
* enforce disengage on brake steering mode for Rivian and Tesla
* wrong one
* MADS: Steering Mode on Brake Pedal Press
* bump
* bump
* descriptions
* bump
* bump
* no tesla or rivian yet
* codecov v5
* Revert "codecov v5"
This reverts commit a347e3fb27.
* cleanup
* refactor description
* sync name
* fix
* make sure we don't allow if brake was already being pressed
* no longer needed
* proper ui!
* allow LKAS tx at all times with MADS
* extra
* this ain't right
* try this
* test only
* bring them back
* some dynamic checks
* dynamic description for mads toggle
* one place for limited platforms
* update tests
* angle when long, lkas when mads
* bump
* MADS: Tesla and Rivian support
* request lateral if acc is engaged
* try this out
* fix
* make sure we keep the toggle off for tesla
* namedtuple
* disallow steering past 90 degrees for rivian
* whoops
* Revert "Revert "MADS: Steering Mode on Brake Pedal Press (#687)" (#789)"
This reverts commit 8dec4ea5
* both rivian and tesla
* enforce disengage on brake steering mode for Rivian and Tesla
* wrong one
* MADS: Steering Mode on Brake Pedal Press
* bump
* bump
* descriptions
* bump
* bump
* no tesla or rivian yet
* codecov v5
* Revert "codecov v5"
This reverts commit a347e3fb27.
* cleanup
* refactor description
* sync name
* fix
* make sure we don't allow if brake was already being pressed
* no longer needed
* proper ui!
* allow LKAS tx at all times with MADS
* extra
* this ain't right
* try this
* test only
* bring them back
* some dynamic checks
* dynamic description for mads toggle
* one place for limited platforms
* just rivian
* not here
* Revert "not here"
This reverts commit 53271b9428.
* get them out
* get them out
* no longer needed
* Revert "get them out"
This reverts commit 532b671bfb.
* bump
* bump
* less
* Revert "bump"
This reverts commit 05ee4be04f.
* MADS: prerequisite for partial platform support
* ui: support specific button enabled selections for `ButtonParamControlSP`
Replaced setDisabledSelectedButton with setEnableSelectedButtons for improved flexibility. The new implementation allows enabling multiple buttons based on a given list and maintains clarity in handling button states. This enhances functionality and aligns with better code practices.
* don't think we need to
* update