Skip to content

Commit

Permalink
Hyundai Ioniq SE 2020 (commaai#1786)
Browse files Browse the repository at this point in the history
* Update values.py

* Update carcontroller.py

* Update values.py

* Update interface.py

* Update carcontroller.py

* add test route

* readme

Co-authored-by: baldwalker <[email protected]>
  • Loading branch information
adeebshihadeh and baldwalker committed Jun 26, 2020
1 parent 57f2996 commit 57deb3a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Community Maintained Cars and Features
| Holden | Astra 2017<sup>1</sup> | Adaptive Cruise | openpilot | 0mph | 7mph |
| Hyundai | Elantra 2017-19 | SCC + LKAS | Stock | 19mph | 34mph |
| Hyundai | Genesis 2015-16 | SCC + LKAS | Stock | 19mph | 37mph |
| Hyundai | Ioniq Electric Premium SE 2020| SCC + LKAS | Stock | 0mph | 32mph |
| Hyundai | Ioniq Electric Limited 2019 | SCC + LKAS | Stock | 0mph | 32mph |
| Hyundai | Kona 2017-19 | SCC + LKAS | Stock | 22mph | 0mph |
| Hyundai | Kona EV 2019 | SCC + LKAS | Stock | 0mph | 0mph |
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/hyundai/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def update(self, enabled, CS, frame, actuators, pcm_cancel_cmd, visual_alert,
self.last_lead_distance = 0

# 20 Hz LFA MFA message
if frame % 5 == 0 and self.car_fingerprint in [CAR.SONATA, CAR.PALISADE]:
if frame % 5 == 0 and self.car_fingerprint in [CAR.SONATA, CAR.PALISADE, CAR.IONIQ]:
can_sends.append(create_lfa_mfa(self.packer, frame, enabled))

return can_sends
4 changes: 2 additions & 2 deletions selfdrive/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False,
tire_stiffness_factor = 0.385
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]
elif candidate == CAR.IONIQ_EV_LTD:
elif candidate in [CAR.IONIQ, CAR.IONIQ_EV_LTD]:
ret.lateralTuning.pid.kf = 0.00006
ret.mass = 1490. + STD_CARGO_KG #weight per hyundai site https://www.hyundaiusa.com/ioniq-electric/specifications.aspx
ret.wheelbase = 2.7
Expand All @@ -145,7 +145,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False,
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.25], [0.05]]

# these cars require a special panda safety mode due to missing counters and checksums in the messages
if candidate in [CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_LTD]:
if candidate in [CAR.HYUNDAI_GENESIS, CAR.IONIQ_EV_LTD, CAR.IONIQ]:
ret.safetyModel = car.CarParams.SafetyModel.hyundaiLegacy

ret.centerToFront = ret.wheelbase * 0.4
Expand Down
9 changes: 7 additions & 2 deletions selfdrive/car/hyundai/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CAR:
GENESIS_G80 = "GENESIS G80 2017"
GENESIS_G90 = "GENESIS G90 2017"
HYUNDAI_GENESIS = "HYUNDAI GENESIS 2015-2016"
IONIQ = "HYUNDAI IONIQ ELECTRIC PREMIUM SE 2020"
IONIQ_EV_LTD = "HYUNDAI IONIQ ELECTRIC LIMITED 2019"
KIA_FORTE = "KIA FORTE E 2018"
KIA_OPTIMA = "KIA OPTIMA SX 2019 & 2016"
Expand Down Expand Up @@ -113,6 +114,9 @@ class Buttons:
CAR.IONIQ_EV_LTD: [{
127: 8, 304: 8, 320: 8, 339: 8, 352: 8, 356: 4, 544: 7, 593: 8, 688: 5, 832: 8, 881: 8, 882: 8, 897: 8, 902: 8, 903: 8, 916: 8, 1040: 8, 1056: 8, 1057: 8, 1078: 4, 1136: 8, 1151: 6, 1168: 7, 1173: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1291: 8, 1292: 8, 1294: 8, 1322: 8, 1342: 6, 1345: 8, 1348: 8, 1355: 8, 1363: 8, 1369: 8, 1407: 8, 1419: 8, 1425: 2, 1426: 8, 1427: 6, 1429: 8, 1430: 8, 1456: 4, 1470: 8, 1507: 8, 1535: 8
}],
CAR.IONIQ: [{
127: 8, 304: 8, 320: 8, 339: 8, 352: 8, 356: 4, 524: 8, 544: 7, 593: 8, 688: 5, 832: 8, 881: 8, 882: 8, 897: 8, 902: 8, 903: 8, 905: 8, 909: 8, 916: 8, 1040: 8, 1042: 8, 1056: 8, 1057: 8, 1078: 4, 1136: 8, 1151: 6, 1155: 8, 1156: 8, 1157: 4, 1164: 8, 1168: 7, 1173: 8, 1183: 8, 1186: 2, 1191: 2, 1225: 8, 1265: 4, 1280: 1, 1287: 4, 1290: 8, 1291: 8, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1342: 6, 1345: 8, 1348: 8, 1355: 8, 1363: 8, 1369: 8, 1379: 8, 1407: 8, 1419: 8, 1426: 8, 1427: 6, 1429: 8, 1430: 8, 1456: 4, 1470: 8, 1473: 8, 1507: 8, 1535: 8, 1988: 8, 1996: 8, 2000: 8, 2004: 8, 2005: 8, 2008: 8, 2012: 8, 2013: 8
}],
CAR.KONA: [{
67: 8, 127: 8, 304: 8, 320: 8, 339: 8, 354: 3, 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, 909: 8, 916: 8, 1040: 8, 1078: 4, 1107: 5, 1136: 8, 1156: 8, 1170: 8, 1173: 8, 1191: 2, 1265: 4, 1280: 1, 1287: 4, 1292: 8, 1294: 8, 1312: 8, 1322: 8, 1342: 6, 1345: 8, 1348: 8, 1363: 8, 1369: 8, 1384: 8, 1394: 8, 1407: 8, 1414: 3, 1419: 8, 1427: 6, 1456: 4, 1470: 8, 2004: 8, 2009: 8, 2012: 8
}],
Expand Down Expand Up @@ -204,10 +208,10 @@ class Buttons:
FEATURES = {
"use_cluster_gears": [CAR.ELANTRA, CAR.KONA, CAR.ELANTRA_GT_I30], # Use Cluster for Gear Selection, rather than Transmission
"use_tcu_gears": [CAR.KIA_OPTIMA, CAR.SONATA_2019], # Use TCU Message for Gear Selection
"use_elect_gears": [CAR.KIA_OPTIMA_H, CAR.IONIQ_EV_LTD, CAR.KONA_EV], # Use TCU Message for Gear Selection
"use_elect_gears": [CAR.KIA_OPTIMA_H, CAR.IONIQ_EV_LTD, CAR.KONA_EV, CAR.IONIQ], # Use TCU Message for Gear Selection
}

EV_HYBRID = [CAR.IONIQ_EV_LTD]
EV_HYBRID = [CAR.IONIQ_EV_LTD, CAR.IONIQ]

DBC = {
CAR.ELANTRA: dbc_dict('hyundai_kia_generic', None),
Expand All @@ -216,6 +220,7 @@ class Buttons:
CAR.GENESIS_G90: dbc_dict('hyundai_kia_generic', None),
CAR.HYUNDAI_GENESIS: dbc_dict('hyundai_kia_generic', None),
CAR.IONIQ_EV_LTD: dbc_dict('hyundai_kia_generic', None),
CAR.IONIQ: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_FORTE: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_OPTIMA: dbc_dict('hyundai_kia_generic', None),
CAR.KIA_OPTIMA_H: dbc_dict('hyundai_kia_generic', None),
Expand Down
4 changes: 4 additions & 0 deletions selfdrive/test/test_car_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@ def get_route_log(route_name):
'carFingerprint': HYUNDAI.IONIQ_EV_LTD,
'enableCamera': True,
},
"2c5cf2dd6102e5da|2020-06-26--16-00-08": {
'carFingerprint': HYUNDAI.IONIQ,
'enableCamera': True,
},
"f7b6be73e3dfd36c|2019-05-12--18-07-16": {
'carFingerprint': TOYOTA.AVALON,
'enableCamera': False,
Expand Down

0 comments on commit 57deb3a

Please sign in to comment.