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

added 2019 Optima SX support #20

Merged
merged 4 commits into from
Jan 15, 2019
Merged
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
2 changes: 1 addition & 1 deletion selfdrive/car/hyundai/hyundaican.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create_lkas11(packer, car_fingerprint, apply_steer, steer_req, cnt, enabled,
dat = [ord(i) for i in dat]
checksum = sum(dat[:6]) % 256
elif car_fingerprint in CHECKSUM["7B"]:
# Checksum of first 6 Bytes and last Byte as seen on 2018 Kia Stinger
# Checksum of first 6 Bytes and last Byte as seen on 2018 Kia Stinger and 2019 Kia Optima
dat = [ord(i) for i in dat]
checksum = (sum(dat[:6]) + dat[7]) % 256

Expand Down
16 changes: 10 additions & 6 deletions selfdrive/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ def get_params(candidate, fingerprint):
# scale unknown params for other cars
mass_civic = 2923 * CV.LB_TO_KG + std_cargo
wheelbase_civic = 2.70
centerToFront_civic = wheelbase_civic * 0.4
centerToFront_civic = wheelbase_civic * 0.45
centerToRear_civic = wheelbase_civic - centerToFront_civic
rotationalInertia_civic = 2500
tireStiffnessFront_civic = 192150
tireStiffnessRear_civic = 202500

ret.steerReactance = 0.7
ret.steerReactance = 1.0
ret.steerInductance = 1.0
ret.steerResistance = 1.0
ret.eonToFront = 0.5
ret.steerActuatorDelay = 0.11
ret.steerActuatorDelay = 0.10
ret.steerKf = 0.00006
ret.steerRateCost = 0.70
ret.steerRateCost = 0.50
tire_stiffness_factor = 0.90
ret.steerKiBP, ret.steerKpBP = [[0.], [0.]]
ret.steerKpV, ret.steerKiV = [[0.10], [0.05]]
ret.steerKpV, ret.steerKiV = [[0.12], [0.06]]
ret.minSteerSpeed = 0.

if candidate == CAR.ELANTRA:
Expand All @@ -96,6 +96,10 @@ def get_params(candidate, fingerprint):
ret.wheelbase = 3.01
ret.steerRatio = 14.0 # guess
ret.minSteerSpeed = 38 * CV.MPH_TO_MS
elif candidate == CAR.KIA_OPTIMA:
ret.mass = 3558 * CV.LB_TO_KG
ret.wheelbase = 2.80
ret.steerRatio = 13.75 # fact
elif candidate == CAR.KIA_SORENTO:
ret.mass = 1985
ret.wheelbase = 2.78
Expand All @@ -121,7 +125,7 @@ def get_params(candidate, fingerprint):
ret.longitudinalKiBP = [0.]
ret.longitudinalKiV = [0.]

ret.centerToFront = ret.wheelbase * 0.4
ret.centerToFront = ret.wheelbase * 0.45

centerToRear = ret.wheelbase - ret.centerToFront

Expand Down
24 changes: 16 additions & 8 deletions selfdrive/car/hyundai/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class CAR:
ELANTRA = "HYUNDAI ELANTRA LIMITED ULTIMATE 2017" # First User @TK211X <-- Ported by @ku7 (Second, First Hyundai in World)
GENESIS = "HYUNDAI GENESIS 2018" # First User @xx979xx <-- Ported by @xx979xx
GENESIS_2 = "HYUNDAI GENESIS 2018 TYPE 2" # First User @andrewhlr <-- Ported by @andrewhlr and @ku7
KIA_OPTIMA = "KIA OPTIMA SX 2019" # First User @blender0
KIA_SORENTO = "KIA SORENTO GT LINE 2018" # First User @ku7 <-- Ported by @ku7 (First Kia in World)
KIA_STINGER = "KIA STINGER GT2 2018" # First User @killian <-- Ported by @ku7 (Third)
SANTA_FE = "HYUNDAI SANTA FE LIMITED 2019" # First User @rickbias <-- Ported by @rickbias
Expand All @@ -35,6 +36,9 @@ class Buttons:
CAR.GENESIS_2: [{
67: 8, 68: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 7, 593: 8, 608: 8, 688: 5, 809: 8, 854: 7, 870: 7, 871: 8, 872: 5, 897: 8, 902: 8, 903: 6, 916: 8, 1024: 2, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1184: 8, 1265: 4, 1280: 1, 1281: 3, 1287: 4, 1292: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1334: 8, 1335: 8, 1345: 8, 1363: 8, 1369: 8, 1370: 8, 1378: 4, 1379: 8, 1384: 5, 1407: 8, 1419: 8, 1427: 6, 1434: 2, 1456: 4
}],
CAR.KIA_OPTIMA: [{
64: 8, 66: 8, 67: 8, 68: 8, 127: 8, 273: 8, 274: 8, 275: 8, 339: 8, 356: 4, 399: 8, 447: 8, 512: 6, 544: 8, 593: 8, 608: 8, 688: 5, 790: 8, 809: 8, 832: 8, 884: 8, 897: 8, 899: 8, 902: 8, 903: 6, 909: 8, 916: 8, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1151: 6, 1168: 7, 1170: 8, 1186: 2, 1191: 2, 1253: 8, 1254: 8, 1255: 8, 1265: 4, 1280: 1, 1282: 4, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1342: 6, 1345: 8, 1348: 8, 1349: 8, 1351: 8, 1353: 8, 1363: 8, 1365: 8, 1366: 8, 1367: 8, 1369: 8, 1407: 8, 1414: 3, 1415: 8, 1419: 8, 1425: 2, 1427: 6, 1440: 8, 1456: 4, 1470: 8, 1472: 8, 1486: 8, 1487: 8, 1491: 8, 1530: 8, 1532: 5, 1952: 8, 1960: 8, 1988: 8, 1996: 8, 2001: 8, 2004: 8, 2008: 8, 2009: 8, 2012: 8, 2016: 8, 2017: 8, 2024: 8, 2025: 8
}],
CAR.KIA_SORENTO: [{
67: 8, 68: 8, 127: 8, 304: 8, 320: 8, 339: 8, 356: 4, 544: 8, 593: 8, 608: 8, 688: 5, 809: 8, 832: 8, 854: 7, 870: 7, 871: 8, 872: 8, 897: 8, 902: 8, 903: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1064: 8, 1078: 4, 1107: 5, 1136: 8, 1151: 6, 1168: 7, 1170: 8, 1173: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1331: 8, 1332: 8, 1333: 8, 1342: 6, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1370: 8, 1371: 8, 1384: 8, 1407: 8, 1411: 8, 1419: 8, 1425: 2, 1427: 6, 1444: 8, 1456: 4, 1470: 8, 1489: 1
}],
Expand All @@ -51,23 +55,27 @@ class Buttons:

CAMERA_MSGS = [832, 1156, 1191, 1342]

# Lane Keep Assist related Features and Limitations
# Checksum Types
CHECKSUM = {
"6B": [CAR.KIA_SORENTO, CAR.GENESIS], # 6 Bytes used in Checksum
"7B": [CAR.KIA_STINGER, CAR.ELANTRA], # 7 Bytes used in Checksum
"crc8": [CAR.SANTA_FE], # CRC Checksum
"6B": [CAR.KIA_SORENTO, CAR.GENESIS], # 6 Bytes used in Checksum
"7B": [CAR.KIA_STINGER, CAR.ELANTRA, CAR.OPTIMA], # 7 Bytes used in Checksum
"crc8": [CAR.SANTA_FE], # CRC Checksum
}

# Lane Keep Assist related Features and Limitations
FEATURES = {
"icon_basic": [CAR.GENESIS], # Anything but 2 for LKAS_Icon causes MDPS Fault
"soft_disable_137": [CAR.GENESIS], # Any steer message sent below 13.7m/s faults MDPS
"soft_disable_168": [CAR.GENESIS_2], # Any steer message below 16.5m/s faults MDPS
"icon_basic": [CAR.GENESIS], # Anything but 2 for LKAS_Icon causes MDPS Fault
"soft_disable_137": [CAR.GENESIS], # Any steer message sent below 13.7m/s faults MDPS
"soft_disable_168": [CAR.GENESIS_2], # Any steer message below 16.5m/s faults MDPS
"use_cluster_gears": [CAR.ELANTRA, CAR.KIA_SORENTO], # Use Cluster for Gear Selection, rather than Transmission
"dnf_mdps": [CAR.SANTA_FE, CAR.SANTA_FE_2], # Do not forward a modified MDPS message.. different checksum
"dnf_mdps": [CAR.SANTA_FE, CAR.SANTA_FE_2], # Do not forward a modified MDPS message.. different checksum
}

DBC = {
CAR.ELANTRA: dbc_dict('hyundai_kia_generic', None),
CAR.GENESIS: dbc_dict('hyundai_kia_generic', None),
CAR.GENESIS_2: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_OPTIMA: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_SORENTO: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_STINGER: dbc_dict('hyundai_kia_generic', None),
CAR.SANTA_FE: dbc_dict('hyundai_kia_generic', None),
Expand Down