Honda Bosch Safety Hooks - #90
Merged
Merged
Conversation
gregjhogan
force-pushed
the
can-forwarding
branch
from
March 1, 2018 02:00
f90114b to
4c9ec61
Compare
gregjhogan
force-pushed
the
can-forwarding
branch
2 times, most recently
from
March 6, 2018 02:30
4ae87a0 to
7d12a53
Compare
gregjhogan
force-pushed
the
can-forwarding
branch
from
March 6, 2018 04:18
7d12a53 to
d0c2634
Compare
gregjhogan
force-pushed
the
can-forwarding
branch
from
March 6, 2018 19:56
7a6d7fc to
f7226ff
Compare
Contributor
Author
|
@geohot this is 100% functional now (but still needs testing listed above which I can't easily do). See any problems with the code changes (see questions above)? Thanks! |
Contributor
|
Looks good, merging! |
Jamezz
pushed a commit
to Jamezz/panda
that referenced
this pull request
Apr 24, 2018
Update maneuver.py
Jamezz
pushed a commit
to Jamezz/panda
that referenced
this pull request
Apr 24, 2018
67d5208 fix signedness issue in toyota safety fe15d3f bump pandacan 11c2b08 add fault invalid 2c26e45 add sleep 27c7637 forgot the counter 3a6d7db don't hang bfa7d2e canloader works b259e2a can flasher is close to working 83f2edf isotp can support in softloader 7ae7c79 typo e85cc47 forgot the selfs 190b4f6 start work on canflasher 5c655c9 add recover support ae3457f usbflash is reliable f7a0ab0 pedal usbflash works 585d0f9 add way to call isotp be82899 despite it being bad code, move isotp 000715b start work on pedal canloader 626e312 pedal has a bootstub now 3662d1e redundant check 81e6b0d fix bug 083cd12 should have bounty to refactor that ish b65d30c bad asserts b2e6c3f isotp untested support for subaddr 30fd66a Merge pull request commaai#93 from vntarasov/volt 06f5109 Merge pull request commaai#94 from gregjhogan/can-printer-hex c7d098c Merge pull request commaai#95 from gregjhogan/setup-script 22fe250 Merge pull request commaai#99 from gregjhogan/bit-transition-example ba16ba3 Merge pull request commaai#100 from gregjhogan/j2534-troubleshooting-instructions ad08ea4 Merge pull request commaai#90 from gregjhogan/can-forwarding f3b6f5d added j2534 troubleshooting instructions 858d150 added script to find bits that transition from 0 to 1 c6acac8 added checking pedal interceptor message length f7226ff added brake safety checks d0c2634 added gas safety checks d378e4a removed bosch safety forwarding restriction on 29 bit addresses 5c7ef9e added bosch safety hooks and forwarding 90c64b6 add note 23de8d4 Merge pull request commaai#97 from commaai/pedal_improvements 0261641 added missing python packages b92b235 fix bytearray encode issue 2434f1c Tweak Volt's brake pedal stickiness e2f73d2 enable has a whole byte to itself d5a9e1e correct checksum f8ed9fa better names 986a14c don't alias pointers 9b8472e add watchdog support 8f0add9 handle faults 1d917f8 split gas set into 2 values, and have a fault state 1b77026 j2534 isn't alpha anymore fbcc872 Merge pull request commaai#92 from commaai/pedal 8a6f44b pedal is sending messages 08f464c python 3 bro is bad bro 9390961 kline checksum algo was broken... 3b7c33b add kline debug support aa622bc init values 631ea9f better refactor eb1fd75 add PEDAL adc sets ccaa310 don't build with usb 8d4d763 debug console works bd09883 comma pedal is building 75a29d5 Merge pull request commaai#84 from gregjhogan/j2534-hds eece37d only the panda has gmlan 9f43abe Merge pull request commaai#89 from vntarasov/volt 5364d43 Merge pull request commaai#88 from vntarasov/smaller-firmware 377a1ec bump version for descriptor fix 4fabdf0 Merge pull request commaai#87 from gregjhogan/usb-multi-packet-control 8580773 fix sending WinUSB Extended Properties Feature Descriptor 6908feb Chevy Volt safety 786a004 Enable optimization to reduce firmware size d70f43b hack to fix thinkpad 95ab1ae fixed flow control message padding bbd04d1 updated installer 62216d0 single standalone DLL for J2534 driver 5c9138d fixed 11 bit address issue f3b0ad2 fix LOOPBACK getting set when DATA_RATE is set b750d36 updated README a9a097f lowered CPU utilization 7c26a70 TIS needs unsupported protocols to return an error 42692b4 TIS doesn't like ChannelID being zero cf126bb SET_CONFIG return error for reserved parameters 2e99dbf fix HDS issues 8203cc8 add is_grey e946a54 add insecure_okay flag 4363b3e check webpage 4f59ded add secure mode note 6b11fb5 add autosecuring to tests b27d185 Merge pull request commaai#86 from commaai/better_pairing 4b53b42 elm wifi isn't an automated test 99f85cb Merge pull request commaai#85 from gregjhogan/usb-wcid 0d38060 auto-install WinUSB device driver c6653ca from python import 38cc0ee add wifi_secure_mode, boots in insecure mode git-subtree-dir: panda git-subtree-split: 67d5208
elkoled
pushed a commit
to elkoled/panda
that referenced
this pull request
Aug 14, 2025
…is detec…" (commaai#90) This reverts commit ba4774c.
liej6799
added a commit
to liej6799/panda
that referenced
this pull request
Jul 8, 2026
* Add Custom MIT License (commaai#38) * initial attempt at adjusting tests * Hyundai: Enhanced Smart Cruise Control (ESCC) (commaai#39) * Integrate Enhanced SCC (ESCC) support for Hyundai vehicles Add support for ESCC in Hyundai vehicles by introducing the ESCC class and modifying the CarController, safety hooks, and radar interface. This enhancement allows better longitudinal control by leveraging ESCC data, ensuring more reliable Advanced Emergency Braking (AEB) and Forward Collision Avoidance (FCA) alerts. Additional configurations and safety parameters have been incorporated to support this functionality. * common escc * misra * escc unit test * 100% * we don't check if using escc * bump submodules * unit test! --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> * Modular Assistive Driving System (MADS) (commaai#40) * alternative experience * safety init * fix * more update * not really * misra * Add Custom MIT License (commaai#38) * brake check was not handled * revert * alt -> lkas * explicit checks * support toyota and ford * rename * hyundai can-fd support * only allow lkas if enabled * hyundai: main button handling * revert * hyundai: main button heartbeat * add logging for controls allowed lateral * fix panda safety * ford btn * toyota btn * fca btn * honda btn * mads safety tests * more tests * safety misra * safety mutation * misra * mutation experiment * fix * ford test main button * ford test lkas button * more ford test * hyundai lkas and main * more ford * hyundai canfd * rename * rename * cleaner * more fixes * more hyundai tests * no longer needed * thanks for tests! * more tests for lat * more explicit * make sure to reset * try this out * probably needed * move * misra * not needed * move to safety_mads * not really needed * remove * MADS: Refactor MADS safety with improved state management (pull request commaai#46) Refactor MADS safety with improved state management This commit introduces a major refactoring of the MADS safety module, improving state management and control flow. Key changes include: Core Changes: - Introduced a MADSState struct to centralize state management - Removed global state variables in favor of structured state - Implemented button transition handling with explicit state tracking (PRESSED/RELEASED/NO_CHANGE) - Added state flags for button availability detection - Simplified lateral control permission logic Button Handling: - Separated main button and LKAS button state tracking - Added independent engagement states for each button - Improved button press detection across multiple platforms - Added support for main and LKAS buttons on Hyundai platforms - Modified ACC main state handling Testing: - Added comprehensive test coverage for MADS state transitions - Added new MADS-specific test base class for consistent testing across platforms - Added mutation testing for state management - Extended timeout for mutation tests from 5 to 8 minutes - Added extensive button press validation tests - Enhanced debugging output in replay drive tests The refactored code provides a more organized implementation of MADS safety features while maintaining compatibility with existing safety checks. * adding note * adding ford (WIP) * adding honda (WIP) * adding toyota (WIP) * adding chrysler (WIP) * Standardize Button State Handling Across Platforms Refactor button state handling by replacing integer constants with an enumerated `ButtonState` type and updating logic to improve readability and maintainability. This change affects button press detection in Ford, Honda, Hyundai, and Toyota safety modules and aligns them with a unified MADS button state approach. Enums provide a clearer understanding of button states and transitions, facilitating easier maintenance and future enhancements. * Disable LKAS button press logic in Honda and Toyota safety. The code for processing LKAS button presses has been commented out in both Honda and Toyota safety implementations. This change aims to investigate or temporarily halt the button press effects without removing the logic altogether. It will be important to test for any impacts this may have on vehicle control functionality. * Remove commented out code in toyota_rx_hook function This commit cleans up the toyota_rx_hook function by removing unnecessary commented-out code that checks for LKAS button presses on bus 2. This helps improve code readability and maintainability without altering the existing functionality. * GM, mazda, nissan, subaru (global & preglobal) * Honda LKAS * Revert "Remove commented out code in toyota_rx_hook function" This reverts commit d6b012c. * Toyota, Subaru Global LKAS * nissan fix * gm fix * use speed msg to force rx * im bored * misra * subaru/toyota/honda * nope * attempt * go through all buttons * try nissan * more nissan * nissan tests passed! * subaru lkas test (not sure why it's not passing 2 and 3 values) * Improved code organization in safety_subaru.h and test_subaru.py This commit includes a minor restructuring in safety_subaru.h and test_subaru.py for better readability and flow. The condition check in safety_subaru.h for lkas_hud now has explicit parentheses. With regard to test_subaru.py, an unnecessary import was removed, and the sequence of steps in the test was reordered - now enabling mads and cleaning up mads_states happens before each subtest. * Refactor tests to use _speed_msg instead of _user_brake_msg. Updated the MADS safety tests to utilize the _speed_msg(0) function call in place of _user_brake_msg(False). * Reworking the tests a little for clarity * disabling lkas again on toyota temporarily * fix mads condition to engage * hyundai and honda good with new tests * Redoing more tests * update for safety tick ensuring mads control is exited while lagging * Updating tests for toyota * cleaning up tests on hkg * commenting out temp_debug for future use * revert * constants * cleanup * format! * match yota * Apply suggestions from code review * force * explicit checks * revert --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> * MADS: Chrysler: Allow `LKAS_HEARTBIT` (commaai#50) * MADS: Allow `LKAS_HEARTBIT` * only for non-RAM platforms * Revert "MADS: Chrysler: Allow `LKAS_HEARTBIT` (commaai#50)" (commaai#53) This reverts commit 8fccd5e. * Revert "Modular Assistive Driving System (MADS) (commaai#40)" (commaai#54) This reverts commit 4c2ccd7. * Dockerfile: point to sunnypilot/opendbc (commaai#55) * Dockerfile: point to sunnypilot/opendbc * Happy days :) * Revert "Happy days :)" This reverts commit 7ea27b5. * symlink prior building --------- Co-authored-by: DevTekVE <devtekve@gmail.com> * Modular Assistive Driving System (MADS) (commaai#57) * improvements on the state machine for exiting controls and improvements on replay drive, and optimizations * New tests on hyundai for now to see how they behave with lkas and main button pressed interchangeably * cleaning up hyundai tests and ensuring we always cleanup mads states at the end of the tests * Adjusting tests * Adjusting the tests a bit more to ensure clean states * Cleaning up and simplifying logic * ensuring all tests always cleanup * improving the state * make static happy * Refactor safety replay script for better debugging and update Honda safety code The commit performs a comprehensive revision of the safety replay script, specifically focusing on introducing debug variables and enhancing the logging capabilities for improved debugging. Furthermore, changes were made to the Honda safety code. The test helpers within libpanda were also expanded for inclusion of additional test conditions. * Introduce 'ACC_MAIN_OFF' as a new disengagement reason in Sunnypilot's 'safety_mads.h' The Sunnypilot's 'safety_mads.h' file has been updated to include 'ACC_MAIN_OFF' as a new cause for disconnection in the 'DisengageReason' enumeration. If an 'acc_main_off' signal is received, the 'mads_exit_controls' function halts all requests for lateral control engagement. Additionally, the status of 'controls_requested_lat' now mirrors 'controls_allowed_lat' after a button press. * simpler logic cleaner * reorder code for readability * tmp * Refactor state transitions and add event handlers Renamed StateTransition to EdgeTransition for clarity and updated related logic. Introduced event handlers for button presses and ACC state changes, reducing duplicated control flow code. Improved encapsulation and maintainability by restructuring state update functions. * reorder * Refactor MADS state handling logic Removed redundant event handler functions and unnecessary timestamp fields to streamline the code. Simplified button and binary state updates by integrating logic directly into transition checks. Commented out unused fields * adding some more tests * split init * format * update naming * Refine lateral control request logic in safety_mads.h The logic for setting the `controls_requested_lat` variable in safety_mads.h has been refined. Previously, it switched state based on the current value of `controls_allowed_lat`. Now, it also takes into account the current state of `acc_main`, ensuring a more nuanced control request mechanism that accounts for different operational scenarios. * Fix button state handling in mads_exit_controls logic. Refactor button state transitions to better handle lateral control requests when ACC is active. Ensure controls are correctly disengaged under specific conditions, by setting `controls_requested_lat` more reliably during state transitions. This change improves safety by preventing inadvertent disengagement when ACC is not active. * Add test for LKAS button press with ACC main on This commit introduces a new test to ensure that controls remain enabled when the LKAS/LFA button is pressed while ACC main is on. It checks that LKAS button operations don't interfere with control permissions in this specific configuration, improving test coverage and preventing potential safety issues. * Add mismatch detection and change mads_acc_main to bool Enhanced mismatch detection logic by tracking cases where 'controls_allowed' is true while 'controls_allowed_lat' is false, updating the script to print relevant debug information. Additionally, changed the data type of 'mads_acc_main' and 'mads_acc_main_prev' from int to bool for improved type accuracy and consistency. * update controls_allowed_lat_pkt on health pkt to actually follow is_lat_active() which has the final word on whether we can allow lat or not. * Can't perform this test on toyota as we never really process a button disengagement for toyota * wow, we forgot about pcm hyundai can-fd * nuke nuke nuke * Revert "nuke nuke nuke" This reverts commit 9bf0de6. * update name * event driven update states * add get_pcm_main_cruise_available * split PCM and non-PCM main cruise tets * fix some * pcm main cruise availability mutation * toyota pass fake lkas btn pressed * more * make pcm acc main rising edge on init * only falling edge when actually 0 (need test for mutation) * misra * remove state flags, main button related * skip lkas related tests with toyota and subaru fake button * need for honda * static * mutation * misra * skip nidec pcm alt * engage mads if controls allowed rising * static * remove non pcm properties * fixup! engage mads if controls allowed rising * move back * fix static * move around * Hyundai openpilot longitudinal main cruise button state handling * main button unit test * acc_main_on mismatch unit tests * clean up old main cruise button unit tests * add more reasons * cleanup * rename * rearrange * Revert "rearrange" This reverts commit f07caaa. * more rearrange * rename * more * too slow * Revert "too slow" This reverts commit 31a249a. * too slow v2 * cleanup * rename * more cleanup * Parse more flags from alt exp, more tests, hyundai main cruise allowed * missed * mutation for controls allowed rising edge * ford mutation * Update tests/safety/test.sh Co-authored-by: DevTekVE <devtekve@gmail.com> * license * unused * remove * comment * Apply suggestions from code review Co-authored-by: DevTekVE <devtekve@gmail.com> * comment * refactor alternative experience handling with helper function * use always allowed mads button alt exp * rename * parenthesis * use alternative experience for unit tests inits * cleanup * rename * mutation tests for alternative experience flags * bump timer * test for disengage and no disengage lateral on brake * test allow MADS engage with brake pressed * rename * move around * button combo test * use acc_main_on directly from global * fix caught failures from last commit's fix * Revert "use acc_main_on directly from global" This reverts commit 346964f. * Properly fix lmao * Add support for LKAS button handling across Chrysler platforms Introduced LKAS button message parsing for multiple Chrysler platforms, including specific handling for center stack button messages. Updated tests and safety configurations to reflect these changes, ensuring compatibility with different vehicle variants. This enhances modularity and improves safety feature integration. * Dockerfile: point to sunnypilot/opendbc * Happy days :) * clean * testx * Revert "Happy days :)" This reverts commit 7ea27b5. * symlink prior building * comment * only parse mads lateral, not stock op's lateral * do not allow controls allowed if acc_main_on is off * expose system_enabled, do not allow controls allowed to steer if system_mads is off * fix hyundai tests with acc_main_on requirement * fix test with new controls allowed with system_mads off * fix replay drive * Change 'DISABLE_DISENGAGE_LATERAL_ON_BRAKE' to 'DISENGAGE_LATERAL_ON_BRAKE' The commit modifies the usage of the 'DISABLE_DISENGAGE_LATERAL_ON_BRAKE' variable globally and replaces it with 'DISENGAGE_LATERAL_ON_BRAKE'. This change promotes correct and clear semantics, since the variable now indicates a state rather than the negation of a state. * Adding some more debug printouts on replay drive * remove unified engagement mode in panda * treat MADS button as user entry * controls allow should be allowed at all times * squash! treat MADS button as user entry * heartbeat for mads * heartbeat mismatch exit control * remove always allow mads button from alt * move to safety_mads * check heartbeat directly in main * remove main cruise allowed from alt * uint * squash! check heartbeat directly in main * update tests * not needed * fix mads_exit_controls sometimes not assigning disengage reason * more disengage lateral on brake tests * extern * missesd * honda mutation test * again * rename * more dlob test * update name * fix tests * fix panda tests * Refactor MADS state management to simplify pointer usage. This change replaces many pointer-based state variables with direct ones, improving code readability and reducing complexity. It also standardizes the use of `const` for parameters and updates function implementations accordingly. These improvements enhance maintainability and reduce potential for pointer-related errors. * Simplify braking logic in m_mads_check_braking function Removed redundant conditions to streamline braking logic. This change maintains functionality while improving code readability and maintainability. Only necessary checks are now performed to determine disengagement. * Prevent lateral control engagement during braking Added a condition to disable lateral control engagement when braking with disengage-on-brake enabled. This change is marked as a demonstration and is not final for merging. Moved the disengage_reason to be set only when an actual disengagement occurred. * Refactor MADS state handling and fix type consistency Remove redundant `get_mads_state` inline definition and migrate it to a static function. Fix return type syntax in `get_mads_pending_disengage_reason`. Minor formatting adjustments improve readability and code clarity. Refactor disengagement logic with enhanced reason tracking Added distinction between active and pending disengagement reasons to improve system state tracking. Updated related enums, structs, and logic to ensure proper handling during control transitions. Added new safety tests to verify behavior under braking and ACC conditions. Refactoring lateral control permissions and brake checks in MADS This revision refactors the MADS safety code. The aim is to simplify and improve readability. Operations and checks for brake states and lateral control permissions have been consolidated into fewer methods. In addition, unused 'previous_disengage' state tracking has been removed from MADSState structure to avoid unnecessary state tracking. Moreover, the 'can_allow_controls_lat' function has been removed entirely and its functionality has been incorporated into other functions, reducing the function count and complexity of the code. The braking status is now tracked with BinaryStateTracking for consistency. These changes maintain the system's functionality while optimizing the code and improving maintainability. * Why MISRA, why!? WHY!???? I DIDNT EVEN TOUCH THIS FILE OR NOWHERE NEAR! * Some format * no more messing with misra * const * more generic names * revert to validate * are you srs * make gpio.h stock again and add to supression lists the check on gpio.h since we are not even touching it and we don't plan on ever doing so * hard code to skip heartbeat check * update comment * cleanup * Update tests/safety/test_honda.py --------- Co-authored-by: DevTekVE <devtekve@gmail.com> * MADS: Toyota: remove LKAS button support (commaai#64) * MADS: Toyota: remove LKAS button support * remove mads button test * MADS: Honda: Allow steering (commaai#66) * MADS: remove `controlsAllowedLat` to maintain compatibility with stock cereal (commaai#67) * MADS: remove unused field in `HEALTH_STRUCT` (commaai#68) * MADS: Cleanup migrated safety codes * Bump opendbc ref * Car safety: custom safety params (commaai#75) * init * use latest opendbc pr ref * Revert "Log divergent registers once (commaai#2182)" (commaai#79) This reverts commit a2d8ad9. * ci: change ref to `master` * Allow skipping flash and firmware checks if deprecated panda is detected (commaai#89) * flash: skip if deprecated panda is detected * fix * Revert "Allow skipping flash and firmware checks if deprecated panda is detec…" (commaai#90) This reverts commit ba4774c. * Revert deprecated pandas from Python side (commaai#92) * Revert deprecated pandas from Python side * lint pls * aight * UART: lower FIFO size (commaai#94) * test * macro * panda: fix upstream merge conflicts (commaai#97) * Revert "it's just unsupported" This reverts commit 7db3785. * Reapply "it's just unsupported" This reverts commit 94c6082. * Revert "Reapply "it's just unsupported"" This reverts commit 680c8f4. * MADS safety: enable heartbeat check and dedicated states (commaai#113) * init * rename * Re-add STM32F4 / black panda support Restores the F4 platform (board/stm32f4, bxcan driver) removed in 1ce986f and the black panda board removed in 3d27233, ported to the current declarations layout (drivers/drivers.h, board/sys/). - black-only F4 board detection; dos/white/grey/uno report UNKNOWN - F4-sized CAN ring buffers (CANPacket_t now carries 64 data bytes) - stop mode falls back to NVIC_SystemReset on F4 - python: HW_TYPE_BLACK supported, flash/DFU paths use detected MCU type Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Jason Wen <haibin.wen3@gmail.com> Co-authored-by: DevTekVE <devtekve@gmail.com> Co-authored-by: rav4kumar <meetkumardesai@gmail.com> Co-authored-by: liej6799 <liej6799@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Questions:
TODO: