-
Notifications
You must be signed in to change notification settings - Fork 64
feat(hyundai): add ADAS_DRV_INTERCEPT message integration #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master-new
Are you sure you want to change the base?
Conversation
- Introduced a new `_hyundai_canfd_sunnypilot.dbc` file for `ADAS_DRV_INTERCEPT`. - Added support for toggling ADAS drive intercept functionality. - Adjusted carcontroller to handle ADAS_DRV_INTERCEPT toggling for testing.
Reviewer's GuideThis PR integrates the ADAS_DRV_INTERCEPT message end-to-end by adding a new DBC file, a helper to pack the message, and toggling logic in the carcontroller for testing purposes. ER diagram for new _hyundai_canfd_sunnypilot.dbc integrationerDiagram
HYUNDAI_CANFD {
int id
string message
}
ADAS_DRV_INTERCEPT {
int status
}
HYUNDAI_CANFD ||--o{ ADAS_DRV_INTERCEPT : contains
Class diagram for ADAS_DRV_INTERCEPT message integrationclassDiagram
class CarController {
+create_canfd_msgs(apply_steer_req, apply_torque, set_speed_in_units, ...)
}
class hyundaicanfd {
+create_adas_drv_intercept_msg(packer, CAN, enabled)
}
CarController --> hyundaicanfd : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
- Introduced `AdasDrvEcuInterceptor` to enable ADAS ECU interception. - Updated car controller, radar interface, and CAN parsers for integration. - Added new flags and parameters to manage feature toggling.
- Added abstract base classes for ECU interceptors, car state, car controller, and radar interface. - Introduced `AdasDrvEcuInterceptor` implementation for specific Hyundai ADAS ECU needs.
- Added `__init__` methods to initialize parent class with CarParams. - Improves consistency and readiness for extended functionality.
- Sets `alphaLongitudinalAvailable` to `True` for improved ADAS capabilities. - Supports future enhancements around ADAS ECU interceptor toggling.
- Reorganized class hierarchy to adjust initialization and behavior. - Ensures better compatibility with existing controllers and ADAS features.
- Added `HYUNDAI_CANFD_ADAS_INTERCEPTOR_MESSAGES` definition for improved ADAS feature support. - Integrated interceptor message into various Hyundai CAN FD message sets.
- Added ADAS_ECU_INTERCEPTOR flag handling to enhance SCC compatibility. - Improved radar and interceptor logic for better feature integration.
@@ -242,6 +246,7 @@ static safety_config hyundai_canfd_init(uint16_t param) { | |||
HYUNDAI_CANFD_LKA_STEERING_COMMON_TX_MSGS(0, 1) | |||
HYUNDAI_CANFD_LFA_STEERING_COMMON_TX_MSGS(1) | |||
HYUNDAI_CANFD_SCC_CONTROL_COMMON_TX_MSGS(1, true) | |||
HYUNDAI_CANFD_ADAS_INTERCEPTOR_MESSAGES(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding it here was the only thing that made it unblocked from panda side on my setup. I need to revisit really the others because I was just testing to see what would work without much thinking
|
||
@property | ||
def enabled(self): | ||
return self.CP_SP.flags & HyundaiFlagsSP.ADAS_ECU_INTERCEPTOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a prior commit I had this mistakenly set to self.CP_SP.flags & HyundaiFlagsSP.ENHANCED_SCC
and it was reporting on the intercept message a status of 1. That does not make sense to me. I did not dive deeper because in the end I wanted it to be 1 for my test, I just updated it to the right flag. But why did the ESCC show up ? shouldn't have been the case, my car does not have ESCC per se. So it's confusing. Must revisit this
opendbc/car/hyundai/interface.py
Outdated
@@ -165,11 +165,20 @@ def _get_params_sp(stock_cp: structs.CarParams, ret: structs.CarParamsSP, candid | |||
# TODO-SP: add route with ESCC message for process replay | |||
if ESCC_MSG in fingerprint[0]: | |||
ret.flags |= HyundaiFlagsSP.ENHANCED_SCC.value | |||
else: | |||
IS_ADAS_DRV_ECU_INTERCEPTOR_ENABLED = True # Faking it like this for now, I haven't built a way to detect it yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will setup a heartbeat from the interceptor to send back at a given cadence it's own status for 2 reasons:
- signal it's present on the system
- understand what it knew at any time from the logs since they'd be on can bus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Updated `_hyundai_canfd_sunnypilot.dbc` with new ADAS message definitions. - Introduced `ADAS_DRV_INTERCEPT_OPT` and `INTERCEPTOR_HEARTBEAT` for improved safety mode handling. - Enhanced interceptor detection with `ADAS_INTERCEPTOR_HEARTBEAT_MSG` integration. - Refined ADAS interceptor handling for better parameter and capability management.
Note
requires:
Route with interceptor worked long for a bit but lat was controlled by Adas ecu, the set speed was updated on comma but not on cluster, the cluster was being updated by the Adas because I could see the speed set there
e1107f9d04dfb1e2/00000331--7c6dfa955d
_hyundai_canfd_sunnypilot.dbc
file forADAS_DRV_INTERCEPT
.Summary by Sourcery
Add support for the ADAS_DRV_INTERCEPT message by introducing a new DBC file, a message creation function, and integrating the toggling of ADAS driving ECU intercept in the carcontroller.
New Features:
_hyundai_canfd_sunnypilot.dbc
file defining the ADAS_DRV_INTERCEPT messageEnhancements: