Skip to content
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

Hyundai CAN: new gear shifter signal for EV, HEV, PHEV #1530

Merged
merged 2 commits into from
Dec 11, 2024

Conversation

sunnyhaibin
Copy link
Contributor

@sunnyhaibin sunnyhaibin commented Nov 26, 2024

Description

When the vehicle is in manual or alternative drive modes (e.g., Sport), openpilot currently fails to recognize the signals and returns with an “Gear not D” event, exiting the controls.

Added Jupyter notebook for validating Sport gear for CAN hybrid and electric vehicles.

Solution

This pull request implements support for parsing various forward gear signals and adds additional undefined forward gear signals to the DBC.

Validation

Route ID

  • e1107f9d04dfb1e2|2024-02-16--14-51-43
  • 26a38e4bf36bb74a|2023-11-15--10-11-14

Reopen of

@sunnyhaibin
Copy link
Contributor Author

After running against all 9000+ segments, only 2 results with the Sport gear on ELECT_GEAR | Elect_Gear_Shifter are found:

https://github.com/sunnyhaibin/openpilot-1/blob/6b7b72e94005030fa1a7378a44b5c5bd43f61451/tools/car_porting/examples/hkg_can_gear_message.ipynb

Analyzing segment 1220/9107    
Non-Drive gear found in segment 201c5aaced09a24a/2023-05-20--12-39-01/15/s   for HYUNDAI IONIQ PHEV 2020
  ELECT_GEAR      gear=4.0
Analyzing segment 1224/9107    
Non-Drive gear found in segment b28e9dbe4004e915/2023-06-11--19-55-28/2/s    for HYUNDAI IONIQ PHEV 2020
  ELECT_GEAR      gear=4.0
Analyzing segment 9107/9107 ...
Analysis finished. Total segments analyzed: 9107

@adeebshihadeh
Copy link
Contributor

So that's good to know, but the critical question to ask in the validation is "where and how does the new signal mismatch the current one?".

@adeebshihadeh adeebshihadeh changed the title Hyundai CAN: Explicitly parse gear shifter values for EV, HEV, PHEV Hyundai CAN: new gear shifter signal for EV, HEV, PHEV Nov 29, 2024
@sunnyhaibin
Copy link
Contributor Author

sunnyhaibin commented Dec 11, 2024

@adeebshihadeh We are currently already using ELECT_GEAR for the gear selector positions in master, for CAN Hybrid and EV:

if self.CP.flags & (HyundaiFlags.HYBRID | HyundaiFlags.EV):
gear = cp.vl["ELECT_GEAR"]["Elect_Gear_Shifter"]

So, this PR is to match the definitions used during the init with the same message we already use to parse the gear positions (changes from this PR): https://github.com/sunnypilot/opendbc/blob/b4dfdf7cff4a0d62db6d4465f43314141e516c1c/opendbc/car/hyundai/carstate.py#L37-L38

@adeebshihadeh adeebshihadeh merged commit e9e6e33 into commaai:master Dec 11, 2024
4 checks passed
@adeebshihadeh adeebshihadeh deleted the hyundai-phev-gear branch December 11, 2024 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
car related to opendbc/car/ DBC signals hyundai
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants