* init
* fix
* event
* UI
* events..for real
* SP
* ugh
* toggles
* read params first
* stoopid it is
* fix green light img
* fix green light image. for real this time
* move events to longitudinal_planner
* move events to longitudinal_planner
* move e2e alerts to separate class
* fix
* fixxxxxxx
* blinky blink
* blinky blink
* refactor
* more refactor
---------
Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* init
* fix
* event
* UI
* events..for real
* SP
* ugh
* toggles
* read params first
* stoopid it is
* fix green light img
* fix green light image. for real this time
* move events to longitudinal_planner
* move events to longitudinal_planner
* move e2e alerts to separate class
* green light alert only for this PR
* fix
* fixxxxxxx
* blinky blink
* blinky blink
* slight cleanup
* only used for params
* a bit more
* only when long is not engaged
* too long
* update description
* always 3 seconds if not moving
* initialize in constructor instead
* less
* rename
* always init at 0
---------
Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* init
* bump
* bump
* bump
* recheck openpilot long availability
* bump
* bump
* bump
* bump
* bump
* just base for now
* bump
* bump
* bump
* bump
* flipped
* apparently it's yucky, reverting most
* bump
* need to add for toyota
* should've been remove
* flipped
* bump
* no way
* fix
* test sdsu distance
* final tuning for pedal
* bump
* formatting
* more
* create directory if does not exist
* mypy my bt
* policy param catch exceptions
* handle all params with exceptions
* more
* single method
* define types in init
* rename
* simpler op enabled check
* more mypy stuff
* rename
* no need for brake pressed
* don't reset if gas pressed
* type hint all
* type hint all
* back to upstream
* in another pr
* no longer need data type
* qlog
* slc in another pr
* use horizontal accuracy
* use horizontal accuracy
* set core affinity for all realtime processes
* unused
* sort
* unused
* type hint and slight cleanup
* from old implementation
* use directly
* combine pm
* slight more cleanup
* type hints
* even more type hint
* Revert "slc in another pr"
This reverts commit 3a6987e6
* Revert "in another pr"
This reverts commit a29bccff12.
* rebump
* no need to check alive
* use it directly
* fix test
* refactor
* use gps data directly
* quote...?
* lint
* fix tests
* use CC.longActive
* user confirm in another PR
* rename
* fix import
* params fix
* no more
* fix
* drop new state machine for now
* more fixes
* internalize output
* unused
* rearrange
* auto draft
* rename
* this
* no
* no need
* use existing
* wrong cruise speed
* fix
* not used for now
* Revert "not used for now"
This reverts commit f0083d6241.
* some
* use frames instead
* split speed limit resolver out of slc
* no need to pass sm
* fix params
* test init
* use frame instead of time
* track session
* some tests
* too limiting
* bump
* always reset state
* end session if long_active but slc inactive at any given time
* off
* no warning in this PR
* no speed factor engage type yet
* wide open
* no
* introduce disabled, no longer transitions at inactive
* fix tests
* no more tempinactive
* clean
* rename
* offset default > off
* new tests, fixes controller
* more tests
* not really needed yet
* lint
* fix
* some more tests
* wrap
* more
* more
* use vCruiseCluster for set speed
* init better
* finish it up
* no
* typo
* one method state machine
* refactor preactive timeout check
* refactor new session check
* directly return statuses
* comments
* v_target
* refactor speed limit resolver
* turn off debug
* more resolver refactor
* no longer needed
* lint
* more lint
* fix
* move around
* fix events
* update event
* already happens while in enabled
* add carstateSP
* less
* Speed Limit Control -> Speed Limit Assist
* in another PR
* more rename
* overriding state
* fix
* make sure to return the correct type
* sync with latest
* housekeeping
* use v cruise cluster instead
* fix var
* show it in UI!
* actually show it
* update event texts
* todo
* no override for now
* wrong timer!
* add vtarget and atarget
* fix
* handle no speed limit events
* fix size
* unused
* skip preActive if init max speed was already reached
* display last known speed limit and its state with SLA
* pending event
* much shorter disable guard
* update events
* convert max init for metric
* fix even if unused atm
* just use it
* red for all
* not disabled
* rename
* 10s pre active
* kumar wants it higher, blame him
* fix
* pcm long only
* some fixes
* rename
* use consolidate method to evaluate set speed status
* init non pcm cruise
* tests
* disable non pcm long state machine for now
* lint
* lint
* let the non PCM party begins
* fix event
* update event
* use speed limit final last
* only do direction checks if preActive
* use resolver
* use it directly
* no longer applies
* do it globally
* non pcm long: adapting or pending unused
* use button events instead of raw vals
* need to initialize
* move
* what?
* what #2???
* cst!
* circular
* slight fixes for tests
* change up checks for user confirm
* get buttonEvents at 100 hz and process for 20 hz consumption
* get v cruise cluster from outer loop
* Revert "get v cruise cluster from outer loop"
This reverts commit be8068e8ab.
* Revert "get buttonEvents at 100 hz and process for 20 hz consumption"
This reverts commit a739d4d437.
* don't need
* do not allow target speed confirm if inactive
* do not allow preActive if no valid speed limit
* gimme them arrow pls
* less
* descriptive direction
* fix event
* update cs in 100 hz
* Revert "don't need"
This reverts commit 1eec763be7.
* missed
* wrong
* stop
* throw them to helpers class
* property
* hold speed behavior changes
* abstract it
* use converted to check last set speed change
* Revert "do not allow target speed confirm if inactive"
This reverts commit 9840e74e
* pre active too short
* slight fixes
* fix tests
* linty lint
* speed limit changed hold timer for non pcm long
* should be 0
* less loopy
* some gates
* special sauce for sla
---------
Co-authored-by: nayan <nayan8teen@gmail.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
* init
* some fixes
* move
* more
* old navd helpers
* bring back cereal
* fix linting
* more
* add to cereal first
* sp events
* lint
* implement in long plan
* fixme-sp
* refactor state machine
* wrong state
* start refactor controller
* some type hints
* init these
* enable debug print
* ui? ui!
* print them out
* fix spinner import
* fix path
* let's use gps chips directly for now
* service missing
* publish events
* no nav for now
* need to sub
* no car state speed yet
* missed event
* Car: `CarStateSP`
* fix tests
* bring back car state speed limit
* fix
* use old controller for now
* fix
* fix source
* type hints
* none for now
* formatting
* more
* create directory if does not exist
* mypy my bt
* policy param catch exceptions
* handle all params with exceptions
* more
* single method
* define types in init
* rename
* simpler op enabled check
* more mypy stuff
* rename
* no need for brake pressed
* don't reset if gas pressed
* type hint all
* type hint all
* back to upstream
* in another pr
* no longer need data type
* qlog
* slc in another pr
* use horizontal accuracy
* use horizontal accuracy
* set core affinity for all realtime processes
* unused
* sort
* unused
* type hint and slight cleanup
* from old implementation
* use directly
* combine pm
* slight more cleanup
* type hints
* even more type hint
* Revert "slc in another pr"
This reverts commit 3a6987e6
* Revert "in another pr"
This reverts commit a29bccff12.
* rebump
* no need to check alive
* use it directly
* fix test
* refactor
* use gps data directly
* quote...?
* lint
* fix tests
* use CC.longActive
* user confirm in another PR
* rename
* fix import
* params fix
* no more
* fix
* drop new state machine for now
* more fixes
* internalize output
* unused
* rearrange
* auto draft
* rename
* this
* no
* no need
* use existing
* wrong cruise speed
* fix
* not used for now
* Revert "not used for now"
This reverts commit f0083d6241.
* some
* use frames instead
* split speed limit resolver out of slc
* no need to pass sm
* fix params
* test init
* use frame instead of time
* track session
* some tests
* too limiting
* bump
* always reset state
* end session if long_active but slc inactive at any given time
* off
* no warning in this PR
* no speed factor engage type yet
* wide open
* no
* introduce disabled, no longer transitions at inactive
* fix tests
* no more tempinactive
* clean
* rename
* offset default > off
* new tests, fixes controller
* more tests
* not really needed yet
* lint
* fix
* some more tests
* wrap
* more
* more
* use vCruiseCluster for set speed
* init better
* finish it up
* no
* typo
* one method state machine
* refactor preactive timeout check
* refactor new session check
* directly return statuses
* comments
* v_target
* refactor speed limit resolver
* turn off debug
* more resolver refactor
* no longer needed
* lint
* more lint
* fix
* move around
* fix events
* update event
* already happens while in enabled
* add carstateSP
* less
* Speed Limit Control -> Speed Limit Assist
* in another PR
* more rename
* overriding state
* fix
* make sure to return the correct type
* just slr in this one
* more
* update
* redundant
* fix
* fix
* lint
* fix
* fix
* match toggle
* fix priority checks
* fix combined source for picking 0 limit
* no need to wrap
* add speed limit offset to resolver
* add speed limit offset
* make sure it displays distance when higher
* Revert "make sure it displays distance when higher"
This reverts commit 15c6834d4e.
* some rename
* translations
* unused for now
* more
* lint
---------
Co-authored-by: nayan <nayan8teen@gmail.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
* init
* slightly more
* check across all
* publish on CC_SP
* more infra setup
* try it out for HKG for now
* slight cleanup
* oops
* legacy
* send
* actually take over
* expose toggle
* icbm
* need to allow
* fix
* name
* small fixes
* actually send it now
* set default
* use cs is_metric
* offroad only lol
* allow them all
* fix
* send desire as-is
* use stock method
* clean up hysteresis
* speed cluster may be more accurate
* rename
* allow init and resume from pcmCruise
* just send it
* fix
* only allow custom v cruise after no button press at initial enabled
* no hysteresis for now
* fix tests
* fix min check
* only apply to non pcm changes
* add ICBM
* some more ui
* bump
* slight cleanup
* fixup
* cleanup
* type hints
* type hints
* bump
* bump
* bring back hysteresis
* fix ui
* do not spam if overriding or below allowed speed
* Controls: Vision Turn Speed Control
* fix
* Data type temp fix
* format
* more
* even more
* self contain targets
* state cleanup
* fix
* param updates
* no need
* use similar state machine
* raise exception if not found
* new state
* entirely internal
* use long active
* more
* rename and expose aTarget
* rename to SCC-V
* init tests
* slight tests
* expose toggle
* lint
* todo
* remove lat planner sub and mock sm data
* introduce aTarget
* rename
* rename
* update fill_model_msg.py to calculate PLAN_T_IDXS for lanelines and road edges
* sync upstream
* no SCC-V yet
* Revert "no SCC-V yet"
This reverts commit b67281bcac.
* wrap it with SCC main
* leave enabled out of here
* wat
* enabled and active on cereal
* OP long for now, enable for ICBM once merged
* need this
* unused
* let's go hybrid
* fix
* add override state
* update tests
* huh
* don't math here if not enabled
* ui: Smart Cruise Control - Vision (SCC-V) (#1253)
* vtsc-ui
* slight cleanup
* more cleanup
* unused
* a bit more
* pulse like it's hot
* draw only enabled and active
* let's try this for now
* settle
* finalize UI
* brighter color so we blind devtekve
* add long override
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* slight cleanup
* more
* type hints
---------
Co-authored-by: discountchubbs <alexgrant990@gmail.com>
Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com>
* Controls: Vision Turn Speed Control
* fix
* Data type temp fix
* format
* more
* even more
* self contain targets
* state cleanup
* fix
* param updates
* no need
* use similar state machine
* raise exception if not found
* new state
* entirely internal
* use long active
* more
* rename and expose aTarget
* rename to SCC-V
* init tests
* slight tests
* expose toggle
* lint
* todo
* remove lat planner sub and mock sm data
* introduce aTarget
* rename
* rename
* update fill_model_msg.py to calculate PLAN_T_IDXS for lanelines and road edges
* sync upstream
* no SCC-V yet
* Revert "no SCC-V yet"
This reverts commit b67281bcac.
* wrap it with SCC main
* no SCC-V yet
* noqa now
* fix
* OP long for now, enable for ICBM once merged
* type hints
* let's get it straight from carcontrol instead
* not needed
* unused
* add source to track
* we can do this
---------
Co-authored-by: discountchubbs <alexgrant990@gmail.com>
* Add modelDataV2SP and lane turn logic implementation
Note: still need to hook up to other modeld's create unit test, fix stuff, and do the UI for it
* add unit tests for lane turn logic
* Add lane turn desire controls to models panel
* use `events_sp` instead of `events`
* integrate modelDataV2SP messaging to the other modeld controllers
* move this to that
* use min for general population here, on custom branches, change this to max :)
* Update events.py
Co-authored-by: royjr <royjr96@gmail.com>
* Update events.py
Co-authored-by: royjr <royjr96@gmail.com>
* refactor lane turn value control into one method
* Update selfdrive/ui/sunnypilot/qt/offroad/settings/models_panel.cc
* add integration tests for lane turn desire
* 10 updates is possibly more representative of real life
* real objects ofc
* desc: add toggle description for clarity
---------
Co-authored-by: royjr <royjr96@gmail.com>
* init
* some fixes
* move
* more
* old navd helpers
* bring back cereal
* fix linting
* more
* add to cereal first
* sp events
* lint
* implement in long plan
* fixme-sp
* refactor state machine
* wrong state
* start refactor controller
* some type hints
* init these
* enable debug print
* ui? ui!
* print them out
* fix spinner import
* fix path
* let's use gps chips directly for now
* service missing
* publish events
* no nav for now
* need to sub
* no car state speed yet
* missed event
* Car: `CarStateSP`
* fix tests
* bring back car state speed limit
* fix
* use old controller for now
* fix
* fix source
* type hints
* none for now
* formatting
* more
* create directory if does not exist
* mypy my bt
* policy param catch exceptions
* handle all params with exceptions
* more
* single method
* define types in init
* rename
* simpler op enabled check
* more mypy stuff
* rename
* no need for brake pressed
* don't reset if gas pressed
* type hint all
* type hint all
* back to upstream
* in another pr
* no longer need data type
* qlog
* slc in another pr
* use horizontal accuracy
* set core affinity for all realtime processes
* unused
* sort
* unused
* type hint and slight cleanup
* from old implementation
* use directly
* combine pm
* slight more cleanup
* type hints
* even more type hint
* lint
* more cleanup
* even less
* license
* 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>
* 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
* MADS: Refactor Unified Engagement Mode
* init
* bring back pedal pressed event while trying to engage long
* MADS: prep for refactor
* no longer
* this is cleaner?
* in another pr
* Add enhanced HyundaiCAN extension
Introduced HyundaiCanEXT for improved object parsing and control integration, leveraging new fields like lead distance and relative speed in CarControlSP.
Refactored controlsd to utilize a modular design with ControlsdExt for additional sunnypilot specific functionality.
* self.cc_sp
* Refactor CarControlSP handling for improved state updates
* refactor
* bool
* Refactor controlsd SP communication logic
Update `publish_sp` method to include `CC_SP` parameter and refine SP SubMaster to exclude `radarState`. Remove custom lead vehicle state processing as it is no longer needed.
* remove in this pr
* bump
* start cleanup
* inherit instead
* even more!
* lint
* type hint
* use the same objects for submaster and pubmaster
* more
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* Refactor model and artifact structures with version compatibility filtering
- Introduced `Artifact` struct and nested it within the `Model` struct for improved clarity and organization.
- Updated enums, logic, and parsing to align with the new struct definitions.
- Implemented version compatibility filtering for model bundles using the `is_bundle_version_compatible` helper.
- Enhanced artifact download handling by adding checks for missing URIs, better error management, and improved logging.
- Adjusted model fetching to point to the latest endpoint (`v3`).
* Make linter happy
* Make linter happy
* Refactor model data parsing to improve readability.
Replaced kwargs-based data extraction with explicit parameter passing for clarity. This enhances code readability and reduces ambiguities in method calls, making the parsing logic more maintainable and straightforward.
* Refactor error handling in active model bundle retrieval.
Wrapped the logic to fetch the active model bundle in a try-except block to prevent unhandled exceptions. This ensures more robust error handling and avoids potential crashes when retrieving or processing model data.
* Refactor exception handling in get_active_model_bundle
Replace bare except with Exception to improve specificity and clarity. This ensures better debugging practices and aligns with recommended coding standards. Other minor whitespace adjustments were made for improved readability.
* Update model path to use artifact fileName property
Replaced `fileName` with `artifact.fileName` in the custom model path construction. This ensures compatibility with updated drive model structures and avoids potential file resolution issues.
* MADS: prevent `wrongCarMode` from disabling MADS enabled state
Add wrongCarModeNoEntry as a NO_ENTRY event to replace wrongCarMode (USER_DISABLE)
that would incorrectly disable MADS when in the wrong car mode. Provides
contextual guidance to users based on car brand, showing appropriate
instructions for re-engagement without requiring MADS to be re-enabled.
* move down
* warning only?
* cereal SIKE
* remove duplicate
* try this out
* final
* Refactor OnroadEventSP structure to contain list of events
A restructuring of the OnroadEventSP structure has been undertaken to accommodate a list of 'Event' substructures. The change is reflected in different files where OnroadEventSP is used. This update allows for more efficient management of multiple events by grouping them together under the revised OnroadEventSP structure.
* Rename `OnroadEventSP` to `OnroadEventsSP` across codebase.
Updated all references to `OnroadEventSP` to ensure consistency with the renamed struct `OnroadEventsSP`. This change improves code clarity and aligns naming conventions across modules.
* Add optional debug logging to schema validation script
Introduced a `DEBUG` flag and a `print_debug` function to streamline debug output management. This replaces direct `print` calls with conditional logging to control verbosity during execution.
Refactor structural validation logic in cereal test
Simplify the iteration over read_instances to streamline structural validation. Removed redundant comparisons and improved error handling to detect unreadable fields more effectively. Updated error messages for better clarity during debugging.
Update build command to include 'cereal' target in CI
Modified the scons build command in selfdrive_tests workflow to explicitly build the 'cereal' target. This ensures necessary components are included during the CI process, improving reliability and consistency.
Added workflow for cereal validation artifacts generation and validation against upstream
This commit encompasses significant changes to .github/workflows/selfdrive_tests.yaml, including the addition of two new jobs. One is responsible for 'Generating cereal validation artifacts' and the other for 'Validating cereal with Upstream'. This includes generating cereal schemas, building openpilot, and running validation schema instances against master. Furthermore, a new Python script (validate_sp_cereal_upstream.py) was also added to perform cereal schema instance generation and validation. These changes aim to enhance the testing process, ensuring schema compatibility and integration quality.
* Relocate cereal validation to a dedicated GitHub workflow
This commit introduces a distinct GitHub workflow for cereal validation named 'cereal_validation.yaml'. This workflow includes two jobs: one for generating cereal validation artifacts and another for validating cereal with the upstream project. Previously, these operations were included as separate jobs in 'selfdrive_tests.yaml'. However, the decoupling in this commit allows for a better organization of GitHub workflows within the project. Additionally, this separation allows these workflows to be individually configured and run, providing a greater degree of flexibility in managing our continuous integration activities.
* Rename workflow to "cereal validation" for clarity.
Updated the workflow name in the GitHub Actions configuration to better reflect its purpose. This change improves maintainability and ensures clearer identification of the workflow's function.
* Add LFS configuration and GitLab SSH setup to workflow
Integrate GitLab LFS handling by configuring LFS URLs and enabling SSH setup. This includes adding public GitLab keys and updating the workflow to support secure connections for LFS operations. Ensures proper handling of large files and seamless integration with GitLab.
* rename
* format
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* 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>
* init
* more init
* keep it alive
* fixes
* more fixes
* more fix
* new submodule for nn data
* bump submodule
* update path to submodule
* spacing???
* update submodule path
* update submodule path
* bump
* dump
* bump
* introduce params
* Add Neural Network Lateral Control toggle to developer panel
This introduces a new toggle for enabling Neural Network Lateral Control (NNLC), providing detailed descriptions of its functionality and compatibility. It includes UI integration, car compatibility checks, and feedback links for unsupported vehicles.
* decouple even more
* static
* codespell
* remove debug
* in structs
* fix import
* convert to capnp
* fixes
* debug
* only initialize if NNLC is enabled or allow to enable
* oops
* fix initialization
* only allow engage if nnlc is off
* fix toggle param
* fix tests
* lint
* fix more test
* capnp test
* try this out
* validate if it's not None
* make it 33 to match
* align
* share the same friction input calculation
* return stock values if not enabled
* unused
* split base and child
* space
* rename
* NeuralNetworkFeedForwardModel
* less
* just use file name
* try this
* more explicit
* rename
* move it
* child class for additional controllers
* rename
* time to split out custom lateral acceleration
* move around
* space
* fix
* TODO-SP
* TODO-SP
* update regardless, it's an extension now
* update name and expose toggle
* ui: sunnypilot Panel -> Steering Panel
* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral_panel.h
* merge
* move to steering panel
* no need for this
* live params in a thread
* no live for now
* new structs
* more ui
* more flexible
* more ui
* no longer needed
* another ui
* cereal changes
* bump opendbc
* simplify checks
* all in one place
* split Enhanced Lat Accel
* handle unrecognized platform
* test for fingerprinting
* fix fingerprint
* NNLC: Mock data for unrecognized cars
* fix fingerprints
* test to verify model loading
* bump neural_network_data
* use pytest
* use different one for now
* fix ui preview alignments
* typing
* more type
* show a platform
* show match
* init params for tests
* ok ruff
* make sure to loop through tests
* ok again ruff
* ok we need this lol
---------
Co-authored-by: DevTekVE <devtekve@gmail.com>
* init
* more init
* keep it alive
* fixes
* more fixes
* more fix
* new submodule for nn data
* bump submodule
* update path to submodule
* spacing???
* update submodule path
* update submodule path
* bump
* dump
* bump
* introduce params
* Add Neural Network Lateral Control toggle to developer panel
This introduces a new toggle for enabling Neural Network Lateral Control (NNLC), providing detailed descriptions of its functionality and compatibility. It includes UI integration, car compatibility checks, and feedback links for unsupported vehicles.
* decouple even more
* static
* codespell
* remove debug
* in structs
* fix import
* convert to capnp
* fixes
* debug
* only initialize if NNLC is enabled or allow to enable
* oops
* fix initialization
* only allow engage if nnlc is off
* fix toggle param
* fix tests
* lint
* fix more test
* capnp test
* try this out
* validate if it's not None
* make it 33 to match
* align
* share the same friction input calculation
* return stock values if not enabled
* unused
* split base and child
* space
* rename
* NeuralNetworkFeedForwardModel
* less
* just use file name
* try this
* more explicit
* rename
* move it
* child class for additional controllers
* rename
* time to split out custom lateral acceleration
* move around
* space
* fix
* TODO-SP
* TODO-SP
* update regardless, it's an extension now
* update name and expose toggle
* ui: sunnypilot Panel -> Steering Panel
* Update selfdrive/ui/sunnypilot/qt/offroad/settings/lateral_panel.h
* merge
* move to steering panel
* no need for this
* live params in a thread
* no live for now
* new structs
* more ui
* more flexible
* more ui
* no longer needed
* another ui
* cereal changes
* bump opendbc
* simplify checks
* all in one place
* split Enhanced Lat Accel
---------
Co-authored-by: DevTekVE <devtekve@gmail.com>
* init
* do it for hyundai
* Bump submodules
* no complaints
* use latest opendbc pr ref
* don't need this for leaf for now
* bump opendbc
* gotta set the sp safety flags in test models and safety replay!
* actually fetch CP_SP
* set safety param for lda button availability (lol forgot)
* use GET_FLAG
* Add TODO-SP
* bump submodules
* Add support for TinyGrad model runner processing
Introduced a new function `is_tinygrad_model` to detect TinyGrad as an active model runner. Updated the `is_stock_model` logic to account for TinyGrad models and added a new process entry for TinyGrad in the model manager. This enables handling TinyGrad models alongside existing configurations.
adding modeld back
Add support for `modeld_v2` and update paths for consistency
Updated `SConscript` files to integrate `modeld_v2` alongside `modeld` and adjusted script paths for correct metadata handling. Adjusted various configurations and scripts, such as `labeler.yaml` and `build_release.sh`, to include `modeld_v2` and ensure cohesive project structure.
Refactor imports to use updated `modeld_v2` paths.
Replaced outdated `modeld` references with their `modeld_v2` counterparts for consistency and clarity across the codebase. Also updated `.gitignore` to accommodate new directory structure. This change ensures better maintainability and alignment with the new directory schema.
Refactor and reorganize modeld to sunnypilot/modeld_v2 structure.
Moved and renamed `modeld` components to the new `sunnypilot/modeld_v2` directory for better organization and modularity. Updated imports and file references to align with the new structure, ensuring compatibility and functionality. Streamlined project structure to improve maintainability and future development.
* typo
* Use `stock` model runner and refactor model checks.
Replaces outdated model detection logic with unified `stock` runner integration, simplifying the decision flow for model selection. Includes `stock` as a new enum in the `Runner` type and updates affected references accordingly.
* Handle missing 'sim_pose' in model outputs gracefully.
Added conditional checks to ensure the code handles cases where 'sim_pose' is absent in the model outputs. Fallback behaviors use 'plan' data when 'sim_pose' is unavailable, preventing potential errors and enhancing robustness.
* Add buffer length parameter for enhanced frame handling
Introduce a configurable `buffer_length` parameter to `DrivingModelFrame` to support dynamic buffer sizes, enabling better handling of different frame rates like 20Hz. Updates include necessary adjustments in buffer initialization, copying logic, and related model inputs for improved compatibility and flexibility.
* Rename variable `len` to `length` to avoid shadowing built-in.
Replaced the usage of `len` with `length` across the code to prevent conflicts with Python's built-in `len` function. This improves code clarity and reduces potential errors or misunderstandings in variable usage.
* Fix spacing inconsistency in modeld.py
Added a missing newline for better code readability and consistency. This change has no impact on functionality but improves code formatting.
* Move numpy_inputs initialization to correct position
Repositioned the `numpy_inputs` initialization to align with the input shape processing logic. This ensures consistency in buffer management and clarifies the flow of code execution related to input handling.
* Add 20Hz model state, smart input, and model switcher classes
Introduce `ModelState20Hz`, `ModelSmartInput`, and `ModelSwitcher` for enhanced modularity and flexibility in modeld. Refactor `ModelState` to inherit from these new classes, enabling support for 20Hz processing and smart input initialization. Update associated files to handle the new buffer length parameter and metadata management.
* Refactor `modeld` to streamline feature handling logic
Simplified feature processing for both standard and "smart input" modes by consolidating logic into reusable methods. Updated variable naming, formatting, and spacing for consistency and readability. This refactor enhances maintainability and reduces redundancy in feature update operations.
* Silence debug print statements and use cloudlog for warnings.
Commented out a debug print statement in `commonmodel.cc` to reduce noise. Replaced `print` statements with `cloudlog.warning` in `model_smart_input.py` for improved logging consistency and better integration with the logging system.
* Clean up formatting and fix minor style inconsistencies
Removed unnecessary blank lines and adjusted spacing to standardize code style across the file. These changes improve readability without altering functionality or logic.
* Refactor modeld logic and remove unused 20Hz and smart inputs
Eliminated `ModelSmartInput`, `ModelSwitcher`, and `ModelState20Hz` classes, simplifying model state handling. Centralized model processing within a unified `ModelState` class and moved related code into `sunnypilot/modeld_20hz`. This improves maintainability by removing unused features and consolidating model execution logic, aligning with current system requirements.
* clean
* Remove debug print statement in commonmodel.cc
The `printf` statement logging buffer movement details was removed as it is unnecessary for release builds. This helps streamline the code and avoid excessive console output during execution.
* Refactor model handling for 20Hz and introduce model runners
Introduce ModelRunner abstraction with TinygradRunner and ONNXRunner to streamline model handling for TICI and non-TICI hardware. Added support for dynamic input preparation and 20Hz models while simplifying the model parsing logic. This improves modularity, readability, and extensibility for future updates.
* Remove unused import and fix import order in model_runner.py
This commit removes the unused 'dtypes' import from tinygrad.tensor and adjusts the import order for cleaner code. These changes enhance readability and maintain coding standards.
* Add is20hz field to custom.capnp schema
Introduce a new boolean field `is20hz` to the `custom.capnp` schema. This allows the system to identify 20Hz-specific configurations or data processing. No changes to existing behavior are introduced for non-20Hz cases.
* Add Meta20hz class for 20Hz model message handling.
Introduces a new Meta20hz class for filling 20Hz model messages, encapsulating functionality for curvature, lane lines, road edges, and more. Refactored `modeld.py` to utilize the new class, improving modularity and maintainability. Minor adjustments were made to initialize and handle model metadata.
* Refactor import paths to align with `openpilot` structure.
Updated several import statements to use the `openpilot` namespace for better consistency and organization. This aligns the sunnypilot components more closely with the overall project structure.
* Refactor modeld to support 20Hz models and modularize runners
Replaced legacy runner logic with a unified ONNX and Tinygrad runner to support 20Hz models. Centralized model metadata management and optimized input preparation for adaptability. Updated curvature handling and output parsing for improved modularity and maintainability.
* Add 20Hz metadata handling for model predictions
Introduce `Meta20hz` class for 20Hz-specific metadata and implement dynamic loading of meta model classes in `meta_helper.py`. Update `fill_model_msg.py` to use the new metadata structure, ensuring seamless integration with 20Hz models. Adjust imports in `model_runner.py` to align with project structure.
* "Refactor modeld_20hz to modeld_v2 with cleanup"
Refactored `modeld_20hz` module to `modeld_v2` for improved clarity and consistency. Removed unused code and aligned imports across modules to reflect the new structure. Enhanced maintainability by restructuring model-related files and updating references accordingly.
* Refactor variable names and adjust imports for clarity.
Renamed `len` to `length` to avoid conflict with the built-in function and improve readability. Reorganized imports in `fill_model_msg.py` for better structure and consistency.
* "Add missing newline at end of file in __init__.py
Ensure proper formatting by adding a newline at the end of the file. This adheres to POSIX standards and improves compatibility with some tools and version control systems."
* Handle model runner initialization errors gracefully
Wrap the model runner initialization in a try-except block to catch and log exceptions. This ensures that failures during initialization are logged with detailed information, improving debugging and error tracing.
* Refactor curvature calculation for clarity and reuse.
Introduce a dedicated `get_curvature_from_output` function to handle desired curvature retrieval, improving code readability and reusability. Replace redundant logic in curvature calculation with the new function to streamline the flow.
* Make 20Hz-specific variables conditional in modeld.py
Moved the initialization of 20Hz-specific variables to be conditional based on the `is_20hz` flag. This ensures that unnecessary memory allocations are avoided when the model is not running at 20Hz, improving efficiency and clarity.
* cleanup
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* carControlSP and move MADS to outside structs
* publish it
* apply to all car controller
* migrate sunnypilotParams
* migrate madsEnabled
* tldr
* convert to capnp
* unused
* wrong module
* fix name
* cancer is right (all tests should be passing now)
* bump opendbc
* sp flags
* pass CP_SP to card and car interfaces
* CP_SP in radar interface
* bump opendbc
* use dataclass like old times
* bump opendbc
* write to params for controls
* fix test models
* fix
* need to use copy instead
* fix data type
* add service
* more
* fix
* Revert "fix"
This reverts commit 74723d7fb2.
* Revert "fix data type"
This reverts commit 02355f44df.
* missed
* more
* no more lagging
* Reapply "fix data type"
This reverts commit dbf1b8583f.
* Reapply "fix"
This reverts commit 9cbce9968a.
* Revert "Reapply "fix""
This reverts commit 1871919b63.
* Revert "Reapply "fix data type""
This reverts commit 5e95752fd5.
* no longer
* Revert "no longer"
This reverts commit 66ee1ba151.
* Reapply "Reapply "fix data type""
This reverts commit 670a384333.
* Reapply "Reapply "fix""
This reverts commit 42f09f955c.
* only for car params sp
* rename
* fix more test
* no need for process replay
* pass stock car params to sp set car params
* pass stock car params to sp set car params
* deprecate CarParams.sunnypilotFlags to CarParamsSP.flags
* missed arg
* fix tests
* tests fixed
* need to pass this too
* must generate cp_sp!
* fix typing
* must be initialized prior can comm callback!
* no more cancer (@devtekve)
* remove more cancer
* Refactor `get_non_essential_params_sp` to simplify arguments (#612)
* Refactor 'get_non_essential_params_sp' function calls in tests
In both `test_latcontrol.py` and `process_replay.py`, simplified the function calls to 'get_non_essential_params_sp'. Removed an unnecessary call to 'get_non_essential_params'. This change makes the code cleaner and more efficient by reducing redundancy in the function calls. This modification also ensures consistency across different code files.
* Refactor get_non_essential_params_sp to take car_params.
Simplify parameters by modifying `get_non_essential_params_sp` to use `car_params` as input. Adjust related calls in test files and process replay to match the updated method signature. This improves code clarity and reduces redundancy.
* bump opendbc
* Refactor parameter handling for `get_params_sp`.
Removed unnecessary reassignment of `car_params` in calls to `get_params_sp`, ensuring a cleaner and more streamlined code structure. This change improves code clarity and eliminates redundant operations. All relevant assertions and behavior remain unaffected.
* bumping opedbc
* bump opendbc
---------
Co-authored-by: DevTekVE <devtekve@gmail.com>
* Events: Migrate sunnypilot onroad events to its own cereal
* more
* slightly more
* typing
* fix more
* fix mads state machine tests
* readjust order
* fix event
* abstract
* need these
* move around
* let's make sure it cleared on every loop
* Update selfdrive/selfdrived/alertmanager.py
Co-authored-by: DevTekVE <devtekve@gmail.com>
* use upstream custom struct
---------
Co-authored-by: DevTekVE <devtekve@gmail.com>
* Events: Migrate sunnypilot onroad events to its own cereal
* more
* slightly more
* typing
* fix more
* fix mads state machine tests
* readjust order
* fix event
* abstract
* need these
* move around
* let's make sure it cleared on every loop
* Update selfdrive/selfdrived/alertmanager.py
Co-authored-by: DevTekVE <devtekve@gmail.com>
---------
Co-authored-by: DevTekVE <devtekve@gmail.com>
* init dec
* Update sunnypilot/selfdrive/controls/lib/dynamic_experimental_controller.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* Update sunnypilot/selfdrive/controls/lib/dynamic_experimental_controller.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* fix static test
* ff
* fix static test
* unitee testt
* Refactor test_dynamic_controller and fix formatting issues
Added a new import for STOP_AND_GO_FRAME and corrected a float initialization for v_ego in MockCarState. Also fixed indentation in the test_standstill_detection method for consistency.
* Refactor test indentation for dynamic controller tests
Adjust indentation and formatting in test_dynamic_controller.py to ensure consistency and readability. This change does not alter functionality but improves the maintainability of the test code.
* Migrated to pytest using claude
* Integrate radar parameter into dynamic controller's pytest tests
Added a `has_radar` parameter to the test functions in the dynamic controller's pytest file. This allows each function to run both with and without radar inputs, thus enhancing the coverage of our test cases.
* Disabling unittest file to allow checks on the pipeline to succeed.
Pending to remove this, but leaving it to validate the move to pytest is okay before merging
* Replace unittest with pytest for dynamic controller tests
Migrated dynamic controller tests from unittest to pytest for improved readability and maintainability. Refactored mock setup using pytest fixtures and monkeypatching while preserving test coverage.
* new line...
* Refactor and modularize DynamicExperimentalController logic
Moved DynamicExperimentalController logic and helper functions to a dedicated module for better readability and maintainability. Simplified longitudinal planner logic by introducing reusable methods to manage MPC mode and longitudinal plan publishing. Adjusted file structure for dynamic controller-related components and updated relevant imports.
* Add missing import for messaging in helpers.py
The `messaging` module was added to resolve potential issues with undefined references. This change ensures all required imports are present, improving the reliability and maintainability of the code.
* Format
* Formatting
* rebase fix
* Refactor MpcSource definition and update references.
Moved MpcSource enum into LongitudinalPlanSP for better encapsulation. Updated references in helpers.py to use the new path. This change improves code organization and maintains functionality.
* Format
* Refactor DEC into a dedicated longitudinal planner class
Move Dynamic Experimental Control (DEC) logic to a new `DecLongitudinalPlanner` class for better modularity and maintainability. This simplifies the `LongitudinalPlanner` by delegating DEC-specific behavior and consolidates related methods into a single file. Additionally, redundant code was removed to improve readability and reduce complexity.
* **Refactor DEC module structure for better organization**
Moved DEC-related files from `dec` to `lib` for improved clarity and consistency within the project structure. Updated all relevant import paths to reflect the new locations. Ensured functionality remains unaffected with these changes.
* static test
* static
* had moved to car_state
* cleanup
* some more
* static method
* move around
* more cleanup
* stuff
* into their own
* rename
* check live param
* sync with stock
* type hint
* unused
* smoother trans
* window time
* fix type hint
* pass sm.frame from plannerd
* more fixes
* more
* more explicit
* fix test
* Revert "fix test"
This reverts commit 635b15f2bc.
* Revert "pass sm.frame from plannerd"
This reverts commit a8deaa69b8.
* use internal frame
* update name
* never used
* this is why it was never using DEC
* more logs
* slight cleanup
* remove to fail test
* update name
* more
* rename
* move around
* explicit type hints
* move to constants py
* Revert "explicit type hints"
This reverts commit c205497b
* more
* don't set to exp mode initial if DEC is active
* use walrus for None
* Revert "use walrus for None"
This reverts commit 5f2396d490.
* fix wrong typing and variable name
* use walrus (needs cleanup)
* fix tests
* revert smooht lead for now
* dec: how good is FirstOrderFilter?
* Update dec.py
* dec: faster ?
* Revert "dec: faster ?"
This reverts commit 40259cd22a.
* Revert "Update dec.py"
This reverts commit 3f29ccbd99.
* Revert "dec: how good is FirstOrderFilter?"
This reverts commit 01e06df542.
* Update slow-down logic and constants for improved behavior
Adjust the slowdown scaling factor and anomaly handling to refine behavior without abrupt resets. Modify constants to increase window size and adjust probabilities and distances for smoother adaptation. Update version to reflect the new changes.
* Fix lead detection fallback for weighted average check.
Add a fallback value of -1 when computing the weighted average to prevent errors caused by invalid or None values. This ensures robust lead detection and avoids potential crashes or undefined behavior.
* visuals for DEC
* try this
* add opacity
* should be active and dimmer
* even dimmer
* Update dec.py
* Update constants.py
* use another method for drawing
* migrate to sp only
* fix
* init
---------
Co-authored-by: rav4kumar <meetkumardesai@gmail.com>
Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
* init dec
* Update sunnypilot/selfdrive/controls/lib/dynamic_experimental_controller.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* Update sunnypilot/selfdrive/controls/lib/dynamic_experimental_controller.py
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* fix static test
* ff
* fix static test
* unitee testt
* Refactor test_dynamic_controller and fix formatting issues
Added a new import for STOP_AND_GO_FRAME and corrected a float initialization for v_ego in MockCarState. Also fixed indentation in the test_standstill_detection method for consistency.
* Refactor test indentation for dynamic controller tests
Adjust indentation and formatting in test_dynamic_controller.py to ensure consistency and readability. This change does not alter functionality but improves the maintainability of the test code.
* Migrated to pytest using claude
* Integrate radar parameter into dynamic controller's pytest tests
Added a `has_radar` parameter to the test functions in the dynamic controller's pytest file. This allows each function to run both with and without radar inputs, thus enhancing the coverage of our test cases.
* Disabling unittest file to allow checks on the pipeline to succeed.
Pending to remove this, but leaving it to validate the move to pytest is okay before merging
* Replace unittest with pytest for dynamic controller tests
Migrated dynamic controller tests from unittest to pytest for improved readability and maintainability. Refactored mock setup using pytest fixtures and monkeypatching while preserving test coverage.
* new line...
* Refactor and modularize DynamicExperimentalController logic
Moved DynamicExperimentalController logic and helper functions to a dedicated module for better readability and maintainability. Simplified longitudinal planner logic by introducing reusable methods to manage MPC mode and longitudinal plan publishing. Adjusted file structure for dynamic controller-related components and updated relevant imports.
* Add missing import for messaging in helpers.py
The `messaging` module was added to resolve potential issues with undefined references. This change ensures all required imports are present, improving the reliability and maintainability of the code.
* Format
* Formatting
* rebase fix
* Refactor MpcSource definition and update references.
Moved MpcSource enum into LongitudinalPlanSP for better encapsulation. Updated references in helpers.py to use the new path. This change improves code organization and maintains functionality.
* Format
* Refactor DEC into a dedicated longitudinal planner class
Move Dynamic Experimental Control (DEC) logic to a new `DecLongitudinalPlanner` class for better modularity and maintainability. This simplifies the `LongitudinalPlanner` by delegating DEC-specific behavior and consolidates related methods into a single file. Additionally, redundant code was removed to improve readability and reduce complexity.
* **Refactor DEC module structure for better organization**
Moved DEC-related files from `dec` to `lib` for improved clarity and consistency within the project structure. Updated all relevant import paths to reflect the new locations. Ensured functionality remains unaffected with these changes.
* static test
* static
* had moved to car_state
* cleanup
* some more
* static method
* move around
* more cleanup
* stuff
* into their own
* rename
* check live param
* sync with stock
* type hint
* unused
* smoother trans
* window time
* fix type hint
* pass sm.frame from plannerd
* more fixes
* more
* more explicit
* fix test
* Revert "fix test"
This reverts commit 635b15f2bc.
* Revert "pass sm.frame from plannerd"
This reverts commit a8deaa69b8.
* use internal frame
---------
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: DevTekVE <devtekve@gmail.com>
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
* modeld: Retain pre-20hz drive model support
* Method not available anymore on OP
* some fixes
* Revert "Long planner get accel: new function args (#34288)"
* Revert "Fix low-speed allow_throttle behavior in long planner (#33894)"
* Revert "long planner: allow throttle reflects usage (#33792)"
* Revert "Gate acceleration on model gas press predictions (#33643)"
* Reapply "Gate acceleration on model gas press predictions (#33643)"
This reverts commit 76b08e37cb.
* Reapply "long planner: allow throttle reflects usage (#33792)"
This reverts commit c75244ca4e.
* Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)"
This reverts commit b2b7d21b7b.
* Reapply "Long planner get accel: new function args (#34288)"
This reverts commit 74dca2fccf.
* don't need
* retain snpe
* wrong
* they're symlinks
* remove
* put back into VCS
* add back
* don't include built
* Refactor model runner retrieval with caching support
Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions.
* Update model runner determination logic with caching fix
Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks.
* parse inputs via metadata
* load model and metadata dynamically
* cherry pick from devtekve as base
* lateral_control_params & prev_desired_curv: MLSIM V0 to Null Pointer
* old desired_curv data: MLSIM V1 to Postal Service
* Bringing what was on master back then
* Cleaning up
* Refactor model pipeline for modularity and dynamic input handling
Refactored the model pipeline by introducing helper functions to modularize model loading, metadata extraction, and input preparation. Improved flexibility in handling dynamic input keys and parsing outputs based on model configuration. Removed deprecated or unused code segments for cleaner and more maintainable structure.
* Push NDv2 because why not and fix modeld
* `Refactor model parsing and clean unused code dependencies`
Simplified `parse_outputs` by removing unnecessary `input_keys` parameter, ensuring cleaner logic. Updated `PROCESS_NAME` for standardization and eliminated deprecated `Pathlib` dependencies in model paths. Minor adjustments improve input handling for lateral control parameters.
* Refactor model and metadata loading functions.
Simplified and clarified `load_model` by renaming it to `get_model_path` and removing redundant variable assignments. Streamlined `load_metadata` by directly returning the loaded metadata without intermediate variables. These changes improve code readability and maintainability.
* Refactor modeld process selection based on SNPE support.
Introduce conditional logic to determine and start the appropriate modeld process (SNPE or default) based on hardware support. This improves flexibility and ensures correct process management.
* Walrus baby
* Update longitudinal_planner.py
* Improve model download progress handling and translations
Refactored model download status handling logic for better clarity and added mechanisms to track status changes efficiently. Updated UI text and translations across multiple languages to reflect consistent and accurate model download states.
* Revert "Update longitudinal_planner.py"
This reverts commit b44a687e4c.
* Fix variable naming for curvature size in modeld.py
Renamed the variable `len` to `length` to avoid conflict with the built-in `len()` function, improving code clarity and preventing potential errors. Also removed trailing spaces in commented-out sections for better formatting consistency.
* sync with upstream
* some are different
* should work
* sim_pose only exists in in ndv3 and prior
* dynamic meta constants
* fix
* uiview: disable power saving
* fix this
* ain't coasting for y'all
* Static analysis
* Refactor initialization of model inputs for clarity.
Removed redundant pre-initialization of `driving_style`, `nav_features`, and `nav_instructions` variables. Instead, directly initialize these within their respective conditional blocks for better readability and reduced memory usage.
* default to none
* enable in next PR
* more
* Revert "more"
This reverts commit f5a4220588.
* Revert "enable in next PR"
This reverts commit 621cc4f18e.
* no need to cast bool
* nuke
* fix desired curvature for pre LAv1 models
* mypy
* static
* fix
* new json
* Going to a test branch with a different model json list
* renamed model json
* Update model runner handling in custom.capnp and helpers
Refactored model runner logic by introducing a `runner` field in `custom.capnp` and simplifying `get_active_model_runner` logic. Removed deprecated function `get_model_runner_by_filename` and added a temporary filter in `fetcher.py` to enforce `snpe` until full tinygrad support is implemented.
* Revert "Update model runner handling in custom.capnp and helpers"
This reverts commit f34d872c13.
* Revert "renamed model json"
This reverts commit 15c6ed303b.
* Revert "Going to a test branch with a different model json list"
This reverts commit 4c1408fee5.
* Reapply "renamed model json"
This reverts commit c6fec6912a.
Reapply "Going to a test branch with a different model json list"
This reverts commit 83e253e9a3.
* Add 'runner' property to 'ModelBundle' and update relevant functions
The 'ModelBundle' class in 'custom.capnp' has been extended to include a 'runner' property. This required updating 'fetcher.py' to handle the 'runner' property when parsing model bundles. Additionally, the helper function 'get_model_runner_by_filename' has been removed from 'helpers.py' as it is no longer needed because the 'runner' property provides this information. The 'get_active_model_runner' function has also been updated in light of these changes.
* Refine bundle selection logic in SoftwarePanelSP
Improve logic for determining which model bundle to display by considering download status and failure state. Remove unnecessary function call to enhance clarity and maintainability.
* tmp
* Add retrieval of active model bundle in manager loop
Introduce a call to `get_active_bundle` to fetch the active model bundle and store it in `self.active_bundle`. This ensures the active bundle is always up-to-date during the model management process.
* Add "Use Default" option for model selection
Introduced a "Use Default" option in the model selection dropdown, allowing users to reset to the default model. Adjusted logic to handle default selection and ensure proper parameter updates. Fixed bundle status handling during the download process in the model manager.
* Refactor type hint in active_bundle assignment.
Removed an unnecessary type hint in the active_bundle assignment for cleaner and more maintainable code. This change does not affect functionality but improves code readability.
* no nested
* update json url
* split out
* format
* condense
* more
---------
Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
Co-authored-by: Kumar <36933347+rav4kumar@users.noreply.github.com>