Skip to content

Commit

Permalink
Add second alt limits (will open another PR on this)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Sep 23, 2024
1 parent bd167fd commit 3787b6d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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
9 changes: 8 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 = 170
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

0 comments on commit 3787b6d

Please sign in to comment.