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

HKG: Car Port for Kia Sportage Plug-in Hybrid 2023 #1138

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions opendbc/car/hyundai/fingerprints.py
Copy link

@dhimmel dhimmel Oct 30, 2024

Choose a reason for hiding this comment

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

Here is a route that @sunnyhaibin requested in a discord thread, which evaluates sunnyhaibin/openpilot-1@e10a809 on a 2023 Kia Sportage PHEV.

The route id is 428412ad82894ba3/00000040--6ea91f379f/1 (also on comma connect). This route includes some interstate driving where the driver grasp not detected appeared.

Copy link

Choose a reason for hiding this comment

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

@jyoung8607 is this PR reviewable now after @sunnyhaibin's commits to address the lateral control authority and alerts along with the test route above?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In part. I'll try to write up some comments later today.

Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@
b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.00 99211-P1040 663',
b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.00 99211-P1060 665',
b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.00 99211-P1070 690',
b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.01 99211-P1060 680',
],
(Ecu.fwdRadar, 0x7d0, None): [
b'\xf1\x00NQ5__ 1.00 1.02 99110-P1000 ',
Expand Down
6 changes: 6 additions & 0 deletions opendbc/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime
ret.flags |= HyundaiFlags.ALT_LIMITS.value
ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_ALT_LIMITS

# TODO: Enforce in panda safety
if candidate in CAR.KIA_SPORTAGE_5TH_GEN:
for fw in car_fw:
if fw.ecu == "fwdCamera" and fw.fwVersion == b'\xf1\x00NQ5 FR_CMR AT USA LHD 1.00 1.01 99211-P1060 680':
ret.flags |= HyundaiFlags.ALT_LIMITS_2.value

ret.centerToFront = ret.wheelbase * 0.4

return ret
Expand Down
10 changes: 9 additions & 1 deletion opendbc/car/hyundai/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,18 @@ def __init__(self, CP):
self.STEER_STEP = 1 # 100 Hz

if CP.carFingerprint in CANFD_CAR:
self.STEER_MAX = 270
self.STEER_DRIVER_ALLOWANCE = 250
self.STEER_DRIVER_MULTIPLIER = 2
self.STEER_THRESHOLD = 250
self.STEER_DELTA_UP = 2
self.STEER_DELTA_DOWN = 3

if CP.flags & HyundaiFlags.ALT_LIMITS_2:
self.STEER_MAX = 170

else:
self.STEER_MAX = 270

# To determine the limit for your car, find the maximum value that the stock LKAS will request.
# If the max stock LKAS request is <384, add your car to this list.
elif CP.carFingerprint in (CAR.GENESIS_G80, CAR.GENESIS_G90, CAR.HYUNDAI_ELANTRA, CAR.HYUNDAI_ELANTRA_GT_I30, CAR.HYUNDAI_IONIQ,
Expand Down Expand Up @@ -95,6 +100,8 @@ class HyundaiFlags(IntFlag):

MIN_STEER_32_MPH = 2 ** 23

ALT_LIMITS_2 = 2 ** 24


class Footnote(Enum):
CANFD = CarFootnote(
Expand Down Expand Up @@ -436,6 +443,7 @@ class CAR(Platforms):
[
HyundaiCarDocs("Kia Sportage 2023-24", car_parts=CarParts.common([CarHarness.hyundai_n])),
HyundaiCarDocs("Kia Sportage Hybrid 2023", car_parts=CarParts.common([CarHarness.hyundai_n])),
HyundaiCarDocs("Kia Sportage Plug-in Hybrid 2023", car_parts=CarParts.common([CarHarness.hyundai_n])),
],
# weight from SX and above trims, average of FWD and AWD version, steering ratio according to Kia News https://www.kiamedia.com/us/en/models/sportage/2023/specifications
CarSpecs(mass=1725, wheelbase=2.756, steerRatio=13.6),
Expand Down
Loading