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: Explicitly parse gear shifter values for EV, HEV, PHEV #30648

Closed
wants to merge 6 commits into from

Conversation

sunnyhaibin
Copy link
Contributor

@sunnyhaibin sunnyhaibin commented Dec 8, 2023

Description
When the car is In manumatic or different drive modes (e.g. Sport, Snow), openpilot currently does not recognize the signals and returns with "Gear not D" event and exits controls.

Solution
This PR adds support to parse different forward gear signals and adds additional undefined forward gear signals in the DBC.

Route ID

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

Requires

Comment on lines +32 to +33
elif self.CP.carFingerprint in (HYBRID_CAR | EV_CAR):
self.shifter_values = can_define.dv["ELECT_GEAR"]["Elect_Gear_Shifter"]
Copy link
Contributor

@sshane sshane Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just makes this gear GearShifter.sport from GearShifter.unknown. The wrongGear alert still checks if it's drive. You need to add the extra gear to create_common_events

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sshane Updated.

@@ -29,6 +29,8 @@ def __init__(self, CP):
"GEAR_SHIFTER"
if CP.carFingerprint in CANFD_CAR:
self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"]
elif self.CP.carFingerprint in (HYBRID_CAR | EV_CAR):
self.shifter_values = can_define.dv["ELECT_GEAR"]["Elect_Gear_Shifter"]
elif self.CP.carFingerprint in CAN_GEARS["use_cluster_gears"]:
self.shifter_values = can_define.dv["CLU15"]["CF_Clu_Gear"]
elif self.CP.carFingerprint in CAN_GEARS["use_tcu_gears"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove # preferred and elect gear methods use same definitioncomment below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sshane Updated.

@sshane sshane added bugfix car vehicle-specific hyundai labels Dec 21, 2023
Copy link
Contributor

This PR has had no activity for 30 days. It will be automatically closed in 7 days if there is no activity.

@github-actions github-actions bot added the stale label Jan 22, 2024
@sunnyhaibin
Copy link
Contributor Author

@sshane can we mark this with ignore-stale tag?

@github-actions github-actions bot removed the stale label Jan 26, 2024
@adeebshihadeh
Copy link
Contributor

Now that the big car dataset is out, you should be able to verify this the same way we would do. There's some example notebooks in tools/car_porting. If you have any questions about the process, let's discuss in #dev-openpilot-private.

Copy link
Contributor

It looks like you didn't use one of the Pull Request templates. Please check the contributing docs. Also make sure that you didn't modify any of the checkboxes or headings within the template.

Copy link
Contributor

This PR has had no activity for 30 days. It will be automatically closed in 7 days if there is no activity.

@sshane
Copy link
Contributor

sshane commented Aug 20, 2024

We've moved the car interfacing code to our opendbc repository, which is now the new home for car ports and fingerprints. Please re-open your pull request against opendbc at your convenience by using this command below. This will transform all changes under selfdrive/car/ to opendbc_repo/opendbc/car/. Make sure you have initialized submodules beforehand and have checked out the latest opendbc commit.

PR_NUMBER=33045
curl -L https://github.com/commaai/openpilot/pull/$PR_NUMBER.patch | sed -e 's/selfdrive\/car/opendbc_repo\/opendbc\/car/g' | git apply -v --reject

Simply replace the PR number with your own. Once done, add the files, fix any conflicts, and open a new PR. Alternatively, you may start a new PR from scratch if that is easier for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants