From d634ddfe1e0bc55972058bef4d05d10ba547d4c4 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 1 Mar 2023 22:46:45 -0500 Subject: [PATCH 01/88] HKG: Car Port for Hyundai Palisade 2023 and Kia Telluride 2023 (non-HDA2) --- RELEASES.md | 2 + docs/CARS.md | 4 +- opendbc | 2 +- panda | 2 +- selfdrive/car/hyundai/carcontroller.py | 20 ++++++--- selfdrive/car/hyundai/carstate.py | 59 ++++++++++++++++--------- selfdrive/car/hyundai/hyundaican.py | 39 +++++++++++++--- selfdrive/car/hyundai/interface.py | 15 +++++-- selfdrive/car/hyundai/values.py | 20 ++++++++- selfdrive/car/torque_data/override.yaml | 1 + 10 files changed, 123 insertions(+), 41 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index f71810784ab66c..d8077fe4c3f3a0 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,8 @@ Version 0.9.2 (2023-03-XX) ======================== * Draw MPC path instead of model predicted path, this is a more accurate representation of what the car will do. +* Hyundai Palisade (without HDA II) 2023 support thanks to sunnyhaibin! +* Kia Telluride (without HDA II) 2023 support thanks to sunnyhaibin! Version 0.9.1 (2023-02-28) ======================== diff --git a/docs/CARS.md b/docs/CARS.md index 3bc918f784042f..2b101adf57e67b 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,7 +4,7 @@ A supported vehicle is one that just works when you install a comma three. All supported cars provide a better experience than any stock system. -# 237 Supported Cars +# 239 Supported Cars |Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Harness|Video| |---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -79,6 +79,7 @@ A supported vehicle is one that just works when you install a comma three. All s |Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai O|| |Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai I|| |Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Hyundai|Palisade (without HDA II) 2023[5](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai A|| |Hyundai|Santa Cruz 2022-23[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai N|| |Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai D|| |Hyundai|Santa Fe 2021-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| @@ -123,6 +124,7 @@ A supported vehicle is one that just works when you install a comma three. All s |Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai C|| |Kia|Stinger 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai K|| |Kia|Telluride 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai H|| +|Kia|Telluride (without HDA II) 2023[5](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Hyundai L|| |Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|Toyota|| |Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| |Lexus|ES Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|Toyota|| diff --git a/opendbc b/opendbc index 510bfc06954e31..0f1379a387bf63 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 510bfc06954e31257f8d8de17adf92f9a68a1b71 +Subproject commit 0f1379a387bf63508ce952ffd7102a2626c9bd06 diff --git a/panda b/panda index 1923b1418933e4..62c4780ec40572 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 1923b1418933e464ff7460a3e0a05d63aad0d53b +Subproject commit 62c4780ec405721ba309bfebd05b48cc1c695eff diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 25720384920bb9..8b8b0beafb961b 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -156,19 +156,25 @@ def update(self, CC, CS, now_nanos): can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, CS.buttons_counter+1, Buttons.RES_ACCEL)) self.last_button_frame = self.frame else: - can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active, - torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, - hud_control.leftLaneVisible, hud_control.rightLaneVisible, - left_lane_warning, right_lane_warning)) + if self.CP.flags & HyundaiFlags.CAN_CANFD: + can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active, + torque_fault, CS.lkas11, CC.enabled, + hud_control.leftLaneVisible, hud_control.rightLaneVisible, + left_lane_warning, right_lane_warning)) + else: + can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active, + torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, + hud_control.leftLaneVisible, hud_control.rightLaneVisible, + left_lane_warning, right_lane_warning)) if not self.CP.openpilotLongitudinalControl: if CC.cruiseControl.cancel: - can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP.carFingerprint)) + can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) elif CC.cruiseControl.resume: # send resume at a max freq of 10Hz if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: # send 25 messages at a time to increases the likelihood of resume being accepted - can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP.carFingerprint)] * 25) + can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25) if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: self.last_button_frame = self.frame @@ -180,7 +186,7 @@ def update(self, CC, CS, now_nanos): # 20 Hz LFA MFA message if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: - can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled)) + can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP)) # 5 Hz ACC options if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 22934c05b269ac..969c99975ef57f 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -99,10 +99,11 @@ def update(self, cp, cp_cam): ret.cruiseState.enabled = cp.vl["TCS13"]["ACC_REQ"] == 1 ret.cruiseState.standstill = False else: - ret.cruiseState.available = cp_cruise.vl["SCC11"]["MainMode_ACC"] == 1 + scc_bus = "SCC12" if self.CP.flags & HyundaiFlags.CAN_CANFD.value else "SCC11" + ret.cruiseState.available = cp_cruise.vl[scc_bus]["MainMode_ACC"] == 1 ret.cruiseState.enabled = cp_cruise.vl["SCC12"]["ACCMode"] != 0 - ret.cruiseState.standstill = cp_cruise.vl["SCC11"]["SCCInfoDisplay"] == 4. - ret.cruiseState.speed = cp_cruise.vl["SCC11"]["VSetDis"] * speed_conv + ret.cruiseState.standstill = cp_cruise.vl[scc_bus]["SCCInfoDisplay"] == 4. + ret.cruiseState.speed = cp_cruise.vl[scc_bus]["VSetDis"] * speed_conv # TODO: Find brake pressure ret.brake = 0 @@ -134,7 +135,7 @@ def update(self, cp, cp_cam): ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear)) - if not self.CP.openpilotLongitudinalControl: + if not self.CP.openpilotLongitudinalControl and not (self.CP.flags & HyundaiFlags.CAN_CANFD.value): aeb_src = "FCA11" if self.CP.flags & HyundaiFlags.USE_FCA.value else "SCC12" aeb_sig = "FCA_CmdAct" if self.CP.flags & HyundaiFlags.USE_FCA.value else "AEB_CmdAct" aeb_warning = cp_cruise.vl[aeb_src]["CF_VSM_Warn"] != 0 @@ -291,7 +292,6 @@ def get_can_parser(CP): ] checks = [ # address, frequency - ("MDPS12", 50), ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), @@ -303,8 +303,10 @@ def get_can_parser(CP): ("WHL_SPD11", 50), ("SAS11", 100), ] + freq_mdps12 = 100 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50 + checks.append(("MDPS12", freq_mdps12)) - if not CP.openpilotLongitudinalControl and CP.carFingerprint not in CAMERA_SCC_CAR: + if not CP.openpilotLongitudinalControl and CP.carFingerprint not in CAMERA_SCC_CAR and not (CP.flags & HyundaiFlags.CAN_CANFD.value): signals += [ ("MainMode_ACC", "SCC11"), ("VSetDis", "SCC11"), @@ -330,13 +332,25 @@ def get_can_parser(CP): ("CF_VSM_Warn", "SCC12"), ("CF_VSM_DecCmdAct", "SCC12"), ] + elif CP.flags & HyundaiFlags.CAN_CANFD.value: + signals += [ + ("MainMode_ACC", "SCC12"), + ("VSetDis", "SCC12"), + ("SCCInfoDisplay", "SCC12"), + ("ACC_ObjDist", "SCC12"), + ("ACCMode", "SCC12"), + ] + checks += [ + ("SCC12", 50), + ] if CP.enableBsm: signals += [ ("CF_Lca_IndLeft", "LCA11"), ("CF_Lca_IndRight", "LCA11"), ] - checks.append(("LCA11", 50)) + freq_lca11 = 20 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50 + checks.append(("LCA11", freq_lca11)) if CP.carFingerprint in (HYBRID_CAR | EV_CAR): if CP.carFingerprint in HYBRID_CAR: @@ -366,7 +380,8 @@ def get_can_parser(CP): signals.append(("CF_Lvr_Gear", "LVR12")) checks.append(("LVR12", 100)) - return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 0) + bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD.value else 0 + return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus) @staticmethod def get_cam_can_parser(CP): @@ -376,21 +391,24 @@ def get_cam_can_parser(CP): signals = [ # signal_name, signal_address ("CF_Lkas_LdwsActivemode", "LKAS11"), - ("CF_Lkas_LdwsSysState", "LKAS11"), - ("CF_Lkas_SysWarning", "LKAS11"), ("CF_Lkas_LdwsLHWarning", "LKAS11"), ("CF_Lkas_LdwsRHWarning", "LKAS11"), - ("CF_Lkas_HbaLamp", "LKAS11"), - ("CF_Lkas_FcwBasReq", "LKAS11"), - ("CF_Lkas_HbaSysState", "LKAS11"), - ("CF_Lkas_FcwOpt", "LKAS11"), - ("CF_Lkas_HbaOpt", "LKAS11"), - ("CF_Lkas_FcwSysState", "LKAS11"), - ("CF_Lkas_FcwCollisionWarning", "LKAS11"), - ("CF_Lkas_FusionState", "LKAS11"), ("CF_Lkas_FcwOpt_USM", "LKAS11"), - ("CF_Lkas_LdwsOpt_USM", "LKAS11"), ] + if CP.flags & HyundaiFlags.CAN_CANFD.value: + signals += [ + ("CF_Lkas_LdwsSysState", "LKAS11"), + ("CF_Lkas_SysWarning", "LKAS11"), + ("CF_Lkas_HbaLamp", "LKAS11"), + ("CF_Lkas_FcwBasReq", "LKAS11"), + ("CF_Lkas_HbaSysState", "LKAS11"), + ("CF_Lkas_FcwOpt", "LKAS11"), + ("CF_Lkas_HbaOpt", "LKAS11"), + ("CF_Lkas_FcwSysState", "LKAS11"), + ("CF_Lkas_FcwCollisionWarning", "LKAS11"), + ("CF_Lkas_FusionState", "LKAS11"), + ("CF_Lkas_LdwsOpt_USM", "LKAS11"), + ] checks = [ ("LKAS11", 100) ] @@ -422,7 +440,8 @@ def get_cam_can_parser(CP): ("CF_VSM_DecCmdAct", "SCC12"), ] - return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, 2) + bus = 6 if CP.flags & HyundaiFlags.CAN_CANFD else 2 + return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus) @staticmethod def get_can_parser_canfd(CP): diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 858f3d0876e34f..61a266f08bd8a6 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -1,5 +1,5 @@ import crcmod -from selfdrive.car.hyundai.values import CAR, CHECKSUM, CAMERA_SCC_CAR +from selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) @@ -78,23 +78,48 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, return packer.make_can_msg("LKAS11", 0, values) -def create_clu11(packer, frame, clu11, button, car_fingerprint): +def create_lkas11_new(packer, frame, apply_steer, steer_req, + torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): + values = lkas11 + values["CF_Lkas_LdwsLHWarning"] = left_lane_depart + values["CF_Lkas_LdwsRHWarning"] = right_lane_depart + values["CR_Lkas_StrToqReq"] = apply_steer + values["CF_Lkas_ActToi"] = steer_req + values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq + values["CF_Lkas_MsgCount"] = frame % 0xF + values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) + values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 + + dat = packer.make_can_msg("LKAS11", 4, values)[2] + + # CRC Checksum as seen on 2019 Hyundai Santa Fe + dat = dat[:6] + dat[7:8] + checksum = hyundai_checksum(dat) + + values["CF_Lkas_Chksum"] = checksum + + return packer.make_can_msg("LKAS11", 4, values) + + +def create_clu11(packer, frame, clu11, button, CP): values = clu11 values["CF_Clu_CruiseSwState"] = button values["CF_Clu_AliveCnt1"] = frame % 0x10 # send buttons to camera on camera-scc based cars - bus = 2 if car_fingerprint in CAMERA_SCC_CAR else 0 + bus = 2 if CP.carFingerprint in CAMERA_SCC_CAR else 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 return packer.make_can_msg("CLU11", bus, values) -def create_lfahda_mfc(packer, enabled, hda_set_speed=0): +def create_lfahda_mfc(packer, enabled, CP, hda_set_speed=0): values = { "LFA_Icon_State": 2 if enabled else 0, - "HDA_Active": 1 if hda_set_speed else 0, + #"HDA_Active": 1 if hda_set_speed else 0, "HDA_Icon_State": 2 if hda_set_speed else 0, - "HDA_VSetReq": hda_set_speed, + #"HDA_VSetReq": hda_set_speed, } - return packer.make_can_msg("LFAHDA_MFC", 0, values) + + bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 + return packer.make_can_msg("LFAHDA_MFC", bus, values) def create_acc_commands(packer, enabled, accel, upper_jerk, idx, lead_visible, set_speed, stopping, long_override): commands = [] diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 1dd91ac8883ed8..f1b63340e7d2da 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -45,6 +45,10 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): if candidate not in CANFD_RADAR_SCC_CAR: ret.flags |= HyundaiFlags.CANFD_CAMERA_SCC.value else: + # detect non-HDA2 with CAN and CAN-FD definitions + if 0x2a4 in fingerprint[5]: + ret.flags |= HyundaiFlags.CAN_CANFD.value + # Send LFA message on cars with HDA if 0x485 in fingerprint[2]: ret.flags |= HyundaiFlags.SEND_LFA.value @@ -73,7 +77,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): ret.mass = 4497. * CV.LB_TO_KG ret.wheelbase = 2.804 ret.steerRatio = 13.27 * 1.15 # 15% higher at the center seems reasonable - elif candidate == CAR.PALISADE: + elif candidate in (CAR.PALISADE, CAR.PALISADE_2023): ret.mass = 1999. + STD_CARGO_KG ret.wheelbase = 2.90 ret.steerRatio = 15.6 * 1.15 @@ -235,7 +239,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): else: ret.longitudinalTuning.kpV = [0.5] ret.longitudinalTuning.kiV = [0.0] - ret.experimentalLongitudinalAvailable = candidate not in (LEGACY_SAFETY_MODE_CAR | CAMERA_SCC_CAR) + ret.experimentalLongitudinalAvailable = candidate not in (LEGACY_SAFETY_MODE_CAR | CAMERA_SCC_CAR) and not (ret.flags & HyundaiFlags.CAN_CANFD) ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable ret.pcmCruise = not ret.openpilotLongitudinalControl @@ -250,7 +254,8 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): if candidate in CANFD_CAR: ret.enableBsm = 0x1e5 in fingerprint[get_e_can_bus(ret)] else: - ret.enableBsm = 0x58b in fingerprint[0] + bus = 4 if ret.flags & HyundaiFlags.CAN_CANFD else 0 + ret.enableBsm = 0x58b in fingerprint[bus] # *** panda safety config *** if candidate in CANFD_CAR: @@ -267,6 +272,10 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): if candidate in LEGACY_SAFETY_MODE_CAR: # these cars require a special panda safety mode due to missing counters and checksums in the messages ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundaiLegacy)] + elif ret.flags & HyundaiFlags.CAN_CANFD: + ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput), + get_safety_config(car.CarParams.SafetyModel.hyundai)] + ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD else: ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundai, 0)] diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 4b7a2952463250..5e47385d4f39c3 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -62,6 +62,7 @@ class HyundaiFlags(IntFlag): CANFD_ALT_GEARS_2 = 64 SEND_LFA = 128 USE_FCA = 256 + CAN_CANFD = 512 class CAR: @@ -88,6 +89,7 @@ class CAR: SONATA_LF = "HYUNDAI SONATA 2019" TUCSON = "HYUNDAI TUCSON 2019" PALISADE = "HYUNDAI PALISADE 2020" + PALISADE_2023 = "HYUNDAI PALISADE 2023" VELOSTER = "HYUNDAI VELOSTER 2019" SONATA_HYBRID = "HYUNDAI SONATA HYBRID 2021" IONIQ_5 = "HYUNDAI IONIQ 5 2022" @@ -179,6 +181,10 @@ def init_make(self, CP: car.CarParams): HyundaiCarInfo("Hyundai Palisade 2020-22", "All", "https://youtu.be/TAnDqjF4fDY?t=456", harness=Harness.hyundai_h), HyundaiCarInfo("Kia Telluride 2020-22", "All", harness=Harness.hyundai_h), ], + CAR.PALISADE_2023: [ + HyundaiCarInfo("Hyundai Palisade (without HDA II) 2023", "All", harness=Harness.hyundai_a), + HyundaiCarInfo("Kia Telluride (without HDA II) 2023", "All", harness=Harness.hyundai_l), + ], CAR.VELOSTER: HyundaiCarInfo("Hyundai Veloster 2019-20", min_enable_speed=5. * CV.MPH_TO_MS, harness=Harness.hyundai_e), CAR.SONATA_HYBRID: HyundaiCarInfo("Hyundai Sonata Hybrid 2020-22", "All", harness=Harness.hyundai_a), CAR.IONIQ_5: [ @@ -1649,10 +1655,21 @@ class Buttons: b'\xf1\x00SG2_ RDR ----- 1.00 1.01 99110-AT000 ', ], }, + CAR.PALISADE_2023: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.04 99211-S8150 220622', + b'\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9150 220708', + ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00LX2_ SCC ----- 1.00 1.01 99110-S8150 ', + b'\xf1\x00ON__ SCC ----- 1.00 1.01 99110-S9150 ', + b'\xf1\x00LX2_ SCC FHCUP 1.00 1.01 99110-S8150 ', + ], + }, } CHECKSUM = { - "crc8": [CAR.SANTA_FE, CAR.SONATA, CAR.PALISADE, CAR.KIA_SELTOS, CAR.ELANTRA_2021, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.SANTA_FE_2022, CAR.KIA_K5_2021, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.KIA_K5_HEV_2020], + "crc8": [CAR.SANTA_FE, CAR.SONATA, CAR.PALISADE, CAR.KIA_SELTOS, CAR.ELANTRA_2021, CAR.ELANTRA_HEV_2021, CAR.SONATA_HYBRID, CAR.SANTA_FE_2022, CAR.KIA_K5_2021, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022, CAR.KIA_K5_HEV_2020, CAR.PALISADE_2023], "6B": [CAR.KIA_SORENTO, CAR.HYUNDAI_GENESIS], } @@ -1735,4 +1752,5 @@ class Buttons: CAR.GENESIS_GV60_EV_1ST_GEN: dbc_dict('hyundai_canfd', None), CAR.KIA_SORENTO_4TH_GEN: dbc_dict('hyundai_canfd', None), CAR.KIA_NIRO_HEV_2ND_GEN: dbc_dict('hyundai_canfd', None), + CAR.PALISADE_2023: dbc_dict('hyundai_palisade_2023', None), } diff --git a/selfdrive/car/torque_data/override.yaml b/selfdrive/car/torque_data/override.yaml index cc1681bce156e0..fe97f3c81ad25e 100644 --- a/selfdrive/car/torque_data/override.yaml +++ b/selfdrive/car/torque_data/override.yaml @@ -40,6 +40,7 @@ KIA SORENTO PLUG-IN HYBRID 4TH GEN: [2.5, 2.5, 0.1] GENESIS GV60 ELECTRIC 1ST GEN: [2.5, 2.5, 0.1] KIA SORENTO 4TH GEN: [2.5, 2.5, 0.1] KIA NIRO HYBRID 2ND GEN: [2.42, 2.5, 0.12] +HYUNDAI PALISADE 2023: [2.5, 2.5, 0.13] # Dashcam or fallback configured as ideal car mock: [10.0, 10, 0.0] From 4356862f4a87a8d4794f0d6e81b82fa8a7bd35f3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 1 Mar 2023 23:04:05 -0500 Subject: [PATCH 02/88] don't forget dbc --- release/files_common | 1 + 1 file changed, 1 insertion(+) diff --git a/release/files_common b/release/files_common index 5b310d5c8089a6..ac7d7b6c5cb172 100644 --- a/release/files_common +++ b/release/files_common @@ -552,6 +552,7 @@ opendbc/honda_civic_ex_2022_can_generated.dbc opendbc/hyundai_canfd.dbc opendbc/hyundai_kia_generic.dbc +opendbc/hyundai_palisade_2023.dbc opendbc/hyundai_kia_mando_front_radar_generated.dbc opendbc/mazda_2017.dbc From 95bee73aee57c43c992b4d640676cd10488edb5c Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 00:31:50 -0500 Subject: [PATCH 03/88] Don't forward --- selfdrive/car/hyundai/hyundaican.py | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 61a266f08bd8a6..a7ee3f31c8ad88 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -80,23 +80,16 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): - values = lkas11 - values["CF_Lkas_LdwsLHWarning"] = left_lane_depart - values["CF_Lkas_LdwsRHWarning"] = right_lane_depart - values["CR_Lkas_StrToqReq"] = apply_steer - values["CF_Lkas_ActToi"] = steer_req - values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - values["CF_Lkas_MsgCount"] = frame % 0xF - values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) - values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 - - dat = packer.make_can_msg("LKAS11", 4, values)[2] - - # CRC Checksum as seen on 2019 Hyundai Santa Fe - dat = dat[:6] + dat[7:8] - checksum = hyundai_checksum(dat) - - values["CF_Lkas_Chksum"] = checksum + values = { + "CF_Lkas_LdwsLHWarning": left_lane_depart, + "CF_Lkas_LdwsRHWarning": right_lane_depart, + "CR_Lkas_StrToqReq": apply_steer, + "CF_Lkas_ActToi": steer_req, + "CF_Lkas_ToiFlt": torque_fault, # seems to allow actuation on CR_Lkas_StrToqReq + "CF_Lkas_MsgCount": frame % 0xF, + "CF_Lkas_LdwsActivemode": int(left_lane) + (int(right_lane) << 1), + "CF_Lkas_FcwOpt_USM": 2 if enabled else 1, + } return packer.make_can_msg("LKAS11", 4, values) From 19bd540e057e3281359b981739e4e408f52c351e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 17:57:50 -0500 Subject: [PATCH 04/88] Revert "Don't forward" This reverts commit 95bee73aee57c43c992b4d640676cd10488edb5c. --- selfdrive/car/hyundai/hyundaican.py | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index a7ee3f31c8ad88..61a266f08bd8a6 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -80,16 +80,23 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): - values = { - "CF_Lkas_LdwsLHWarning": left_lane_depart, - "CF_Lkas_LdwsRHWarning": right_lane_depart, - "CR_Lkas_StrToqReq": apply_steer, - "CF_Lkas_ActToi": steer_req, - "CF_Lkas_ToiFlt": torque_fault, # seems to allow actuation on CR_Lkas_StrToqReq - "CF_Lkas_MsgCount": frame % 0xF, - "CF_Lkas_LdwsActivemode": int(left_lane) + (int(right_lane) << 1), - "CF_Lkas_FcwOpt_USM": 2 if enabled else 1, - } + values = lkas11 + values["CF_Lkas_LdwsLHWarning"] = left_lane_depart + values["CF_Lkas_LdwsRHWarning"] = right_lane_depart + values["CR_Lkas_StrToqReq"] = apply_steer + values["CF_Lkas_ActToi"] = steer_req + values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq + values["CF_Lkas_MsgCount"] = frame % 0xF + values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) + values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 + + dat = packer.make_can_msg("LKAS11", 4, values)[2] + + # CRC Checksum as seen on 2019 Hyundai Santa Fe + dat = dat[:6] + dat[7:8] + checksum = hyundai_checksum(dat) + + values["CF_Lkas_Chksum"] = checksum return packer.make_can_msg("LKAS11", 4, values) From 0eda6692728dba1c93d8ce0527f6b60e559323f5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 17:58:29 -0500 Subject: [PATCH 05/88] try not modifying checksum --- selfdrive/car/hyundai/hyundaican.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 61a266f08bd8a6..55f2ba2d8b969e 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -90,14 +90,6 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 - dat = packer.make_can_msg("LKAS11", 4, values)[2] - - # CRC Checksum as seen on 2019 Hyundai Santa Fe - dat = dat[:6] + dat[7:8] - checksum = hyundai_checksum(dat) - - values["CF_Lkas_Chksum"] = checksum - return packer.make_can_msg("LKAS11", 4, values) From 0f7c065c036946acf63b2f3ee129e493a45530b6 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 18:59:58 -0500 Subject: [PATCH 06/88] forward counters --- selfdrive/car/hyundai/hyundaican.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 55f2ba2d8b969e..41679a3531cf81 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -86,7 +86,6 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - values["CF_Lkas_MsgCount"] = frame % 0xF values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 From c98ba3cd7777e0257f2df63b0419c3beab449837 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 19:18:57 -0500 Subject: [PATCH 07/88] try this? --- selfdrive/car/hyundai/carstate.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 969c99975ef57f..677b1746880620 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -408,6 +408,8 @@ def get_cam_can_parser(CP): ("CF_Lkas_FcwCollisionWarning", "LKAS11"), ("CF_Lkas_FusionState", "LKAS11"), ("CF_Lkas_LdwsOpt_USM", "LKAS11"), + ("CF_Lkas_Chksum", "LKAS11"), + ("CF_Lkas_MsgCount", "LKAS11"), ] checks = [ ("LKAS11", 100) From 640786d4fa77c828b94e1b53b76d109e788c0d6c Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 19:59:54 -0500 Subject: [PATCH 08/88] fill it up --- opendbc | 2 +- selfdrive/car/hyundai/carstate.py | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/opendbc b/opendbc index 0f1379a387bf63..b7c1f313b5299e 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 0f1379a387bf63508ce952ffd7102a2626c9bd06 +Subproject commit b7c1f313b5299ec1ae55dca9c8c7b50fda57d2c5 diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 677b1746880620..fa93f59cc0446e 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -396,6 +396,19 @@ def get_cam_can_parser(CP): ("CF_Lkas_FcwOpt_USM", "LKAS11"), ] if CP.flags & HyundaiFlags.CAN_CANFD.value: + signals += [ + ("CF_Lkas_ActToi", "LKAS11"), + ("CF_Lkas_Chksum", "LKAS11"), + ("CF_Lkas_MsgCount", "LKAS11"), + ("CF_Lkas_ToiFlt", "LKAS11"), + ("CR_Lkas_StrToqReq", "LKAS11"), + ("NEW_SIGNAL_1", "LKAS11"), + ("NEW_SIGNAL_2", "LKAS11"), + ("NEW_SIGNAL_3", "LKAS11"), + ("NEW_SIGNAL_4", "LKAS11"), + ("NEW_SIGNAL_5", "LKAS11"), + ] + else: signals += [ ("CF_Lkas_LdwsSysState", "LKAS11"), ("CF_Lkas_SysWarning", "LKAS11"), @@ -408,8 +421,6 @@ def get_cam_can_parser(CP): ("CF_Lkas_FcwCollisionWarning", "LKAS11"), ("CF_Lkas_FusionState", "LKAS11"), ("CF_Lkas_LdwsOpt_USM", "LKAS11"), - ("CF_Lkas_Chksum", "LKAS11"), - ("CF_Lkas_MsgCount", "LKAS11"), ] checks = [ ("LKAS11", 100) From 8115513bffe3af1502061fc3c7b276cd70fdedc6 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 21:10:34 -0500 Subject: [PATCH 09/88] limit it --- selfdrive/car/hyundai/hyundaican.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 41679a3531cf81..299cdff6ba6a96 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -81,12 +81,9 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 - values["CF_Lkas_LdwsLHWarning"] = left_lane_depart - values["CF_Lkas_LdwsRHWarning"] = right_lane_depart values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 return packer.make_can_msg("LKAS11", 4, values) From dcd952f057a3d5ee87a8127dad6076dbf7ba2f07 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 21:44:13 -0500 Subject: [PATCH 10/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index b7c1f313b5299e..c4a9682a713a94 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit b7c1f313b5299ec1ae55dca9c8c7b50fda57d2c5 +Subproject commit c4a9682a713a9458f395bcd697fb587661ab89c3 From faa6c4286b3f70e4a679ae9a4ce0d8bede24a03f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 2 Mar 2023 21:44:20 -0500 Subject: [PATCH 11/88] try this out --- selfdrive/car/hyundai/carcontroller.py | 11 +++++++---- selfdrive/car/hyundai/hyundaican.py | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 8b8b0beafb961b..a7615ddbc1dea9 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -53,6 +53,7 @@ def __init__(self, dbc_name, CP, VM): self.apply_steer_last = 0 self.car_fingerprint = CP.carFingerprint self.last_button_frame = 0 + self.lkas11_cnt = -1 def update(self, CC, CS, now_nanos): actuators = CC.actuators @@ -157,10 +158,12 @@ def update(self, CC, CS, now_nanos): self.last_button_frame = self.frame else: if self.CP.flags & HyundaiFlags.CAN_CANFD: - can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active, - torque_fault, CS.lkas11, CC.enabled, - hud_control.leftLaneVisible, hud_control.rightLaneVisible, - left_lane_warning, right_lane_warning)) + if self.lkas11_cnt != CS.lkas11["CF_Lkas_MsgCount"]: + can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active, + torque_fault, CS.lkas11, CC.enabled, + hud_control.leftLaneVisible, hud_control.rightLaneVisible, + left_lane_warning, right_lane_warning)) + self.lkas11_cnt = CS.lkas11["CF_Lkas_MsgCount"] else: can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active, torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 299cdff6ba6a96..41679a3531cf81 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -81,9 +81,12 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 + values["CF_Lkas_LdwsLHWarning"] = left_lane_depart + values["CF_Lkas_LdwsRHWarning"] = right_lane_depart values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq + values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 return packer.make_can_msg("LKAS11", 4, values) From fc3678b9be9185601f43a43e511e8b24bb2356f1 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 14:52:22 -0500 Subject: [PATCH 12/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index c4a9682a713a94..dfbb8a92e407fb 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit c4a9682a713a9458f395bcd697fb587661ab89c3 +Subproject commit dfbb8a92e407fb34730c6fcb87689f5cc211011c From b5016f71515ef2c736191bf1711d3e57bb715ece Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 14:53:25 -0500 Subject: [PATCH 13/88] pass through everything from cs --- selfdrive/car/hyundai/hyundaican.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 41679a3531cf81..221295d8038cab 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -81,13 +81,13 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 - values["CF_Lkas_LdwsLHWarning"] = left_lane_depart - values["CF_Lkas_LdwsRHWarning"] = right_lane_depart - values["CR_Lkas_StrToqReq"] = apply_steer - values["CF_Lkas_ActToi"] = steer_req - values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) - values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 + #values["CF_Lkas_LdwsLHWarning"] = left_lane_depart + #values["CF_Lkas_LdwsRHWarning"] = right_lane_depart + #values["CR_Lkas_StrToqReq"] = apply_steer + #values["CF_Lkas_ActToi"] = steer_req + #values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq + #values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) + #values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 return packer.make_can_msg("LKAS11", 4, values) From 7abebcf86182a7a5a5626b5b4dc9bf924e515734 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 14:57:46 -0500 Subject: [PATCH 14/88] don't use --- selfdrive/car/hyundai/carcontroller.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index a7615ddbc1dea9..d6fc363289262b 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -158,12 +158,10 @@ def update(self, CC, CS, now_nanos): self.last_button_frame = self.frame else: if self.CP.flags & HyundaiFlags.CAN_CANFD: - if self.lkas11_cnt != CS.lkas11["CF_Lkas_MsgCount"]: - can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active, - torque_fault, CS.lkas11, CC.enabled, - hud_control.leftLaneVisible, hud_control.rightLaneVisible, - left_lane_warning, right_lane_warning)) - self.lkas11_cnt = CS.lkas11["CF_Lkas_MsgCount"] + can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active, + torque_fault, CS.lkas11, CC.enabled, + hud_control.leftLaneVisible, hud_control.rightLaneVisible, + left_lane_warning, right_lane_warning)) else: can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active, torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, From a2a651f467b403012614ac9ecc01b578e7c860ec Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 16:29:18 -0500 Subject: [PATCH 15/88] only modify these --- selfdrive/car/hyundai/hyundaican.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 221295d8038cab..b0789329b9b9b2 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -83,11 +83,11 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, values = lkas11 #values["CF_Lkas_LdwsLHWarning"] = left_lane_depart #values["CF_Lkas_LdwsRHWarning"] = right_lane_depart - #values["CR_Lkas_StrToqReq"] = apply_steer - #values["CF_Lkas_ActToi"] = steer_req - #values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq + values["CR_Lkas_StrToqReq"] = apply_steer + values["CF_Lkas_ActToi"] = steer_req + values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq #values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) - #values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 + values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 return packer.make_can_msg("LKAS11", 4, values) From ca9bad02d16f6f4d1a34cccc4bf1af425334d2e5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 16:43:29 -0500 Subject: [PATCH 16/88] wait, we weren't sending this?! --- selfdrive/car/hyundai/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index d6fc363289262b..9a32e991970fe7 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -186,7 +186,7 @@ def update(self, CC, CS, now_nanos): hud_control.leadVisible, set_speed_in_units, stopping, CC.cruiseControl.override)) # 20 Hz LFA MFA message - if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: + if self.frame % 5 == 0 and (self.CP.flags & HyundaiFlags.SEND_LFA.value or self.CP.flags & HyundaiFlags.CAN_CANFD): can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP)) # 5 Hz ACC options From 5722959212255b2690baf11499433c5ab616f1ef Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 16:49:31 -0500 Subject: [PATCH 17/88] Send LFA on this one too! --- selfdrive/car/hyundai/carcontroller.py | 2 +- selfdrive/car/hyundai/interface.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 9a32e991970fe7..d6fc363289262b 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -186,7 +186,7 @@ def update(self, CC, CS, now_nanos): hud_control.leadVisible, set_speed_in_units, stopping, CC.cruiseControl.override)) # 20 Hz LFA MFA message - if self.frame % 5 == 0 and (self.CP.flags & HyundaiFlags.SEND_LFA.value or self.CP.flags & HyundaiFlags.CAN_CANFD): + if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP)) # 5 Hz ACC options diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index f1b63340e7d2da..e7469002ce7905 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -49,8 +49,9 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long): if 0x2a4 in fingerprint[5]: ret.flags |= HyundaiFlags.CAN_CANFD.value + lfa_bus = 6 if ret.flags & HyundaiFlags.CAN_CANFD else 2 # Send LFA message on cars with HDA - if 0x485 in fingerprint[2]: + if 0x485 in fingerprint[lfa_bus]: ret.flags |= HyundaiFlags.SEND_LFA.value # These cars use the FCA11 message for the AEB and FCW signals, all others use SCC12 From 71b51c7c400b4cbbf6c3cc5ab26aee7a3f0cd462 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 17:00:00 -0500 Subject: [PATCH 18/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index dfbb8a92e407fb..fe7f102d5d934e 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit dfbb8a92e407fb34730c6fcb87689f5cc211011c +Subproject commit fe7f102d5d934eaea51d6d27dd5f8900651b255b From fdac94bc395bdc61039a41f93f0673fb58552bc0 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 17:00:33 -0500 Subject: [PATCH 19/88] bump panda --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 62c4780ec40572..5392938bac3a47 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 62c4780ec405721ba309bfebd05b48cc1c695eff +Subproject commit 5392938bac3a4717795aa0b06e48e03c90d62a2d From 7521b9c1931678e692680ea03cf8f18a97dfa343 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 17:04:01 -0500 Subject: [PATCH 20/88] pass through LFAHDA_MPC and some modified --- selfdrive/car/hyundai/carcontroller.py | 2 +- selfdrive/car/hyundai/carstate.py | 18 ++++++++++++++++++ selfdrive/car/hyundai/hyundaican.py | 13 ++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index d6fc363289262b..3bcfadccd2d1d1 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -187,7 +187,7 @@ def update(self, CC, CS, now_nanos): # 20 Hz LFA MFA message if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: - can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP)) + can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP, CS.lfahda_mfc)) # 5 Hz ACC options if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index fa93f59cc0446e..c8a31581e6f4ac 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -149,6 +149,8 @@ def update(self, cp, cp_cam): # save the entire LKAS11 and CLU11 self.lkas11 = copy.copy(cp_cam.vl["LKAS11"]) + if self.CP.flags & HyundaiFlags.CAN_CANFD.value: + self.lfahda_mfc = copy.copy(cp_cam.vl["LFAHDA_MFC"]) self.clu11 = copy.copy(cp.vl["CLU11"]) self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE self.prev_cruise_buttons = self.cruise_buttons[-1] @@ -453,6 +455,22 @@ def get_cam_can_parser(CP): ("CF_VSM_DecCmdAct", "SCC12"), ] + if CP.flags & HyundaiFlags.CAN_CANFD.value: + signals += [ + ("CHECKSUM", "LFAHDA_MFC"), + ("NEW_SIGNAL_1", "LFAHDA_MFC"), + ("COUNTER", "LFAHDA_MFC"), + ("NEW_SIGNAL_2", "LFAHDA_MFC"), + ("NEW_SIGNAL_3", "LFAHDA_MFC"), + ("NEW_SIGNAL_4", "LFAHDA_MFC"), + ("HDA_Icon_State", "LFAHDA_MFC"), + ("NEW_SIGNAL_5", "LFAHDA_MFC"), + ("NEW_SIGNAL_6", "LFAHDA_MFC"), + ("LFA_Icon_State", "LFAHDA_MFC"), + ("NEW_SIGNAL_7", "LFAHDA_MFC"), + ] + checks.append(("LFAHDA_MFC", 20)) + bus = 6 if CP.flags & HyundaiFlags.CAN_CANFD else 2 return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index b0789329b9b9b2..ed396a0cd3ecc8 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -101,13 +101,12 @@ def create_clu11(packer, frame, clu11, button, CP): return packer.make_can_msg("CLU11", bus, values) -def create_lfahda_mfc(packer, enabled, CP, hda_set_speed=0): - values = { - "LFA_Icon_State": 2 if enabled else 0, - #"HDA_Active": 1 if hda_set_speed else 0, - "HDA_Icon_State": 2 if hda_set_speed else 0, - #"HDA_VSetReq": hda_set_speed, - } +def create_lfahda_mfc(packer, enabled, CP, lfahda_mfc, hda_set_speed=0): + values = lfahda_mfc + values["LFA_Icon_State"] = 2 if enabled else 0 + #"HDA_Active": 1 if hda_set_speed else 0, + values["HDA_Icon_State"] = 2 if hda_set_speed else 0 + #"HDA_VSetReq": hda_set_speed, bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 return packer.make_can_msg("LFAHDA_MFC", bus, values) From a16ad58d584e165fd3fe1577ac21678f21777f1f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 17:28:55 -0500 Subject: [PATCH 21/88] try sending these values now --- selfdrive/car/hyundai/hyundaican.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index ed396a0cd3ecc8..789e09b40deb01 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -81,12 +81,12 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 - #values["CF_Lkas_LdwsLHWarning"] = left_lane_depart - #values["CF_Lkas_LdwsRHWarning"] = right_lane_depart + values["CF_Lkas_LdwsLHWarning"] = left_lane_depart + values["CF_Lkas_LdwsRHWarning"] = right_lane_depart values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - #values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) + values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 return packer.make_can_msg("LKAS11", 4, values) From dc625402a3c3980b05990e3be4c4afa9302e991a Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 17:37:09 -0500 Subject: [PATCH 22/88] don't send this --- selfdrive/car/hyundai/hyundaican.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 789e09b40deb01..75194a1750ef63 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -86,7 +86,7 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) + #values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 return packer.make_can_msg("LKAS11", 4, values) From aeeb9b98e2a461a0129e82cff0d23c29be0f908f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 18:19:26 -0500 Subject: [PATCH 23/88] stop changing --- selfdrive/car/hyundai/hyundaican.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 75194a1750ef63..ed396a0cd3ecc8 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -81,8 +81,8 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 - values["CF_Lkas_LdwsLHWarning"] = left_lane_depart - values["CF_Lkas_LdwsRHWarning"] = right_lane_depart + #values["CF_Lkas_LdwsLHWarning"] = left_lane_depart + #values["CF_Lkas_LdwsRHWarning"] = right_lane_depart values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq From a99f8b40fa363b776c6da6cfb532ea14b4ab954e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 18:23:39 -0500 Subject: [PATCH 24/88] try sending checksum and counter this way --- selfdrive/car/hyundai/carcontroller.py | 2 +- selfdrive/car/hyundai/hyundaican.py | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 3bcfadccd2d1d1..a1053b7de07eea 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -187,7 +187,7 @@ def update(self, CC, CS, now_nanos): # 20 Hz LFA MFA message if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: - can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP, CS.lfahda_mfc)) + can_sends.append(hyundaican.create_lfahda_mfc(self.packer, self.frame, CC.enabled, self.CP, CS.lfahda_mfc)) # 5 Hz ACC options if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index ed396a0cd3ecc8..f831490b418abe 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -88,6 +88,15 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq #values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 + values["CF_Lkas_MsgCount"] = frame % 0xF + + dat = packer.make_can_msg("LKAS11", 0, values)[2] + + # CRC Checksum as seen on 2019 Hyundai Santa Fe + dat = dat[:6] + dat[7:8] + checksum = hyundai_checksum(dat) + + values["CF_Lkas_Chksum"] = checksum return packer.make_can_msg("LKAS11", 4, values) @@ -101,14 +110,22 @@ def create_clu11(packer, frame, clu11, button, CP): return packer.make_can_msg("CLU11", bus, values) -def create_lfahda_mfc(packer, enabled, CP, lfahda_mfc, hda_set_speed=0): +def create_lfahda_mfc(packer, frame, enabled, CP, lfahda_mfc, hda_set_speed=0): + bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 values = lfahda_mfc values["LFA_Icon_State"] = 2 if enabled else 0 #"HDA_Active": 1 if hda_set_speed else 0, values["HDA_Icon_State"] = 2 if hda_set_speed else 0 #"HDA_VSetReq": hda_set_speed, + values["COUNTER"] = frame % 0xF + + dat = packer.make_can_msg("LFAHDA_MFC", bus, values)[2] + + dat = dat[:6] + dat[7:8] + checksum = hyundai_checksum(dat) + + values["CHECKSUM"] = checksum - bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 return packer.make_can_msg("LFAHDA_MFC", bus, values) def create_acc_commands(packer, enabled, accel, upper_jerk, idx, lead_visible, set_speed, stopping, long_override): From ede80754f26089460530aa61e4e81d2afeec1c04 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 18:33:53 -0500 Subject: [PATCH 25/88] some cleanup --- selfdrive/car/hyundai/hyundaican.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index f831490b418abe..3832328b16ab43 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -81,22 +81,26 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 - #values["CF_Lkas_LdwsLHWarning"] = left_lane_depart - #values["CF_Lkas_LdwsRHWarning"] = right_lane_depart - values["CR_Lkas_StrToqReq"] = apply_steer - values["CF_Lkas_ActToi"] = steer_req - values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - #values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) - values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 - values["CF_Lkas_MsgCount"] = frame % 0xF - - dat = packer.make_can_msg("LKAS11", 0, values)[2] + values.update({ + #"CF_Lkas_LdwsLHWarning": left_lane_depart, + #"CF_Lkas_LdwsRHWarning": right_lane_depart, + "CR_Lkas_StrToqReq": apply_steer, + "CF_Lkas_ActToi": steer_req, + "CF_Lkas_ToiFlt": torque_fault, # seems to allow actuation on CR_Lkas_StrToqReq + #"CF_Lkas_LdwsActivemode": int(left_lane) + (int(right_lane) << 1), + "CF_Lkas_FcwOpt_USM": 2 if enabled else 1, + "CF_Lkas_MsgCount": frame % 0xF, + }) + + dat = packer.make_can_msg("LKAS11", 4, values)[2] # CRC Checksum as seen on 2019 Hyundai Santa Fe dat = dat[:6] + dat[7:8] checksum = hyundai_checksum(dat) - values["CF_Lkas_Chksum"] = checksum + values.update({ + "CF_Lkas_Chksum": checksum, + }) return packer.make_can_msg("LKAS11", 4, values) From 4d88dbd35ea2d9bea5344892c2052043229e130e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 18:39:57 -0500 Subject: [PATCH 26/88] more cleanup --- selfdrive/car/hyundai/carcontroller.py | 5 ++++- selfdrive/car/hyundai/hyundaican.py | 31 +++++++++++++++++--------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index a1053b7de07eea..5b037edbfdbe26 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -187,7 +187,10 @@ def update(self, CC, CS, now_nanos): # 20 Hz LFA MFA message if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: - can_sends.append(hyundaican.create_lfahda_mfc(self.packer, self.frame, CC.enabled, self.CP, CS.lfahda_mfc)) + if self.CP.flags & HyundaiFlags.CAN_CANFD: + can_sends.append(hyundaican.create_lfahda_mfc_new(self.packer, self.frame, CC.enabled, CS.lfahda_mfc)) + else: + can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP)) # 5 Hz ACC options if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 3832328b16ab43..822195e1112a04 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -114,23 +114,34 @@ def create_clu11(packer, frame, clu11, button, CP): return packer.make_can_msg("CLU11", bus, values) -def create_lfahda_mfc(packer, frame, enabled, CP, lfahda_mfc, hda_set_speed=0): - bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 +def create_lfahda_mfc(packer, enabled, hda_set_speed=0): + values = { + "LFA_Icon_State": 2 if enabled else 0, + "HDA_Active": 1 if hda_set_speed else 0, + "HDA_Icon_State": 2 if hda_set_speed else 0, + "HDA_VSetReq": hda_set_speed, + } + return packer.make_can_msg("LFAHDA_MFC", 0, values) + + +def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): values = lfahda_mfc - values["LFA_Icon_State"] = 2 if enabled else 0 - #"HDA_Active": 1 if hda_set_speed else 0, - values["HDA_Icon_State"] = 2 if hda_set_speed else 0 - #"HDA_VSetReq": hda_set_speed, - values["COUNTER"] = frame % 0xF + values.update({ + "LFA_Icon_State": 2 if enabled else 0, + "HDA_Icon_State": 2 if enabled else 0, + "COUNTER": frame % 0xF + }) - dat = packer.make_can_msg("LFAHDA_MFC", bus, values)[2] + dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] dat = dat[:6] + dat[7:8] checksum = hyundai_checksum(dat) - values["CHECKSUM"] = checksum + values.update({ + "CHECKSUM": checksum, + }) - return packer.make_can_msg("LFAHDA_MFC", bus, values) + return packer.make_can_msg("LFAHDA_MFC", 4, values) def create_acc_commands(packer, enabled, accel, upper_jerk, idx, lead_visible, set_speed, stopping, long_override): commands = [] From 38e5bdd2e9f5ae3e324cfc09945a77d29c6e43b6 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 19:14:26 -0500 Subject: [PATCH 27/88] 6b checksum --- selfdrive/car/hyundai/hyundaican.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 822195e1112a04..2264b7ed5c77c3 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -94,9 +94,8 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, dat = packer.make_can_msg("LKAS11", 4, values)[2] - # CRC Checksum as seen on 2019 Hyundai Santa Fe - dat = dat[:6] + dat[7:8] - checksum = hyundai_checksum(dat) + # Checksum of first 6 Bytes, as seen on 2018 Kia Sorento + checksum = sum(dat[:6]) % 256 values.update({ "CF_Lkas_Chksum": checksum, @@ -134,8 +133,8 @@ def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] - dat = dat[:6] + dat[7:8] - checksum = hyundai_checksum(dat) + # Checksum of first 6 Bytes, as seen on 2018 Kia Sorento + checksum = sum(dat[:6]) % 256 values.update({ "CHECKSUM": checksum, From c9a02088d80d4064579d37da4a714bb1bf16f496 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 20:13:32 -0500 Subject: [PATCH 28/88] should be byte 1-7 --- selfdrive/car/hyundai/hyundaican.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 2264b7ed5c77c3..c2c65f0446fc12 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -94,8 +94,8 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, dat = packer.make_can_msg("LKAS11", 4, values)[2] - # Checksum of first 6 Bytes, as seen on 2018 Kia Sorento - checksum = sum(dat[:6]) % 256 + # CRC Checksum + checksum = hyundai_checksum(dat[1:8]) values.update({ "CF_Lkas_Chksum": checksum, @@ -133,8 +133,8 @@ def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] - # Checksum of first 6 Bytes, as seen on 2018 Kia Sorento - checksum = sum(dat[:6]) % 256 + # CRC Checksum + checksum = hyundai_checksum(dat[1:8]) values.update({ "CHECKSUM": checksum, From eb35f6cc43b2915ef2dee3322ecccf3c17420b21 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 20:26:16 -0500 Subject: [PATCH 29/88] try this checksum --- selfdrive/car/hyundai/hyundaican.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index c2c65f0446fc12..fb69f8da633508 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -2,6 +2,7 @@ from selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) +hyundai_checksum_can_canfd = crcmod.mkCrcFun(0x1D, initCrc=0x0, rev=False, xorOut=0xA) def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, torque_fault, lkas11, sys_warning, sys_state, enabled, @@ -95,7 +96,7 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, dat = packer.make_can_msg("LKAS11", 4, values)[2] # CRC Checksum - checksum = hyundai_checksum(dat[1:8]) + checksum = hyundai_checksum_can_canfd(dat[1:8]) values.update({ "CF_Lkas_Chksum": checksum, @@ -134,7 +135,7 @@ def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] # CRC Checksum - checksum = hyundai_checksum(dat[1:8]) + checksum = hyundai_checksum_can_canfd(dat[1:8]) values.update({ "CHECKSUM": checksum, From c97875a2313376bf9a497000b397c5bfe5544fdd Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 20:35:48 -0500 Subject: [PATCH 30/88] hmm --- selfdrive/car/hyundai/hyundaican.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index fb69f8da633508..c462eb5ae4a1a5 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -2,7 +2,7 @@ from selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) -hyundai_checksum_can_canfd = crcmod.mkCrcFun(0x1D, initCrc=0x0, rev=False, xorOut=0xA) +hyundai_checksum_can_canfd = crcmod.mkCrcFun(0x11D, initCrc=0x0, rev=False, xorOut=0xA) def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, torque_fault, lkas11, sys_warning, sys_state, enabled, From 78a79a70837351f08147042a77d936857a7d4608 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 21:11:32 -0500 Subject: [PATCH 31/88] try the old one --- selfdrive/car/hyundai/hyundaican.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index c462eb5ae4a1a5..e2d141a9926f35 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -96,7 +96,7 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, dat = packer.make_can_msg("LKAS11", 4, values)[2] # CRC Checksum - checksum = hyundai_checksum_can_canfd(dat[1:8]) + checksum = hyundai_checksum(dat[1:8]) values.update({ "CF_Lkas_Chksum": checksum, @@ -135,7 +135,7 @@ def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] # CRC Checksum - checksum = hyundai_checksum_can_canfd(dat[1:8]) + checksum = hyundai_checksum(dat[1:8]) values.update({ "CHECKSUM": checksum, From 3644a3c4b68c428523592c5177a19b14f1c2ee07 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 21:39:15 -0500 Subject: [PATCH 32/88] suppress cluster error --- selfdrive/car/hyundai/hyundaican.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index e2d141a9926f35..09963f7f55b94d 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -129,6 +129,8 @@ def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): values.update({ "LFA_Icon_State": 2 if enabled else 0, "HDA_Icon_State": 2 if enabled else 0, + "NEW_SIGNAL_3": 0, # Possibly error on cluster + "NEW_SIGNAL_4": 0, # Possibly error on cluster "COUNTER": frame % 0xF }) From a6d087c431aaa1cbc4532c42a6caec11c2e28363 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 21:56:53 -0500 Subject: [PATCH 33/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index fe7f102d5d934e..7bd4e03ab69acd 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit fe7f102d5d934eaea51d6d27dd5f8900651b255b +Subproject commit 7bd4e03ab69acd781b220778ec7e30e24a64d346 From a7f17ce9195cc063808189512a651d147983219d Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 21:59:58 -0500 Subject: [PATCH 34/88] match stock --- selfdrive/car/hyundai/carstate.py | 2 ++ selfdrive/car/hyundai/hyundaican.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index c8a31581e6f4ac..3efaf7450d7007 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -409,6 +409,8 @@ def get_cam_can_parser(CP): ("NEW_SIGNAL_3", "LKAS11"), ("NEW_SIGNAL_4", "LKAS11"), ("NEW_SIGNAL_5", "LKAS11"), + ("NEW_SIGNAL_6", "LKAS11"), + ("NEW_SIGNAL_7", "LKAS11"), ] else: signals += [ diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 09963f7f55b94d..d0736cfe3aebae 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -83,13 +83,15 @@ def create_lkas11_new(packer, frame, apply_steer, steer_req, torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): values = lkas11 values.update({ - #"CF_Lkas_LdwsLHWarning": left_lane_depart, - #"CF_Lkas_LdwsRHWarning": right_lane_depart, + "CF_Lkas_LdwsLHWarning": left_lane_depart, + "CF_Lkas_LdwsRHWarning": right_lane_depart, "CR_Lkas_StrToqReq": apply_steer, "CF_Lkas_ActToi": steer_req, "CF_Lkas_ToiFlt": torque_fault, # seems to allow actuation on CR_Lkas_StrToqReq - #"CF_Lkas_LdwsActivemode": int(left_lane) + (int(right_lane) << 1), + "CF_Lkas_LdwsActivemode": int(left_lane) + (int(right_lane) << 1), "CF_Lkas_FcwOpt_USM": 2 if enabled else 1, + "NEW_SIGNAL_1": 0, + "NEW_SIGNAL_5": 100, "CF_Lkas_MsgCount": frame % 0xF, }) @@ -125,14 +127,11 @@ def create_lfahda_mfc(packer, enabled, hda_set_speed=0): def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): - values = lfahda_mfc - values.update({ + values = { "LFA_Icon_State": 2 if enabled else 0, "HDA_Icon_State": 2 if enabled else 0, - "NEW_SIGNAL_3": 0, # Possibly error on cluster - "NEW_SIGNAL_4": 0, # Possibly error on cluster "COUNTER": frame % 0xF - }) + } dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] From 549f51e010b328b68135e35c4680cec8021b2944 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 22:10:08 -0500 Subject: [PATCH 35/88] small cleanup --- selfdrive/car/hyundai/hyundaican.py | 1 - 1 file changed, 1 deletion(-) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index d0736cfe3aebae..2de4ba4a5d9f3b 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -2,7 +2,6 @@ from selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) -hyundai_checksum_can_canfd = crcmod.mkCrcFun(0x11D, initCrc=0x0, rev=False, xorOut=0xA) def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, torque_fault, lkas11, sys_warning, sys_state, enabled, From 0ae5ac4a92f51181b5fa87d997027b04d753eac9 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 22:10:37 -0500 Subject: [PATCH 36/88] lower delta up/down --- selfdrive/car/hyundai/values.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 5e47385d4f39c3..858a19f1904b37 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -46,6 +46,11 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 + elif CP.flags & HyundaiFlags.CAN_CANFD: + self.STEER_MAX = 384 + self.STEER_DELTA_UP = 2 + self.STEER_DELTA_DOWN = 3 + # Default for most HKG else: self.STEER_MAX = 384 From 44f141af05b14aaa6773844240977102e5ddc960 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 22:46:21 -0500 Subject: [PATCH 37/88] some cleanup --- selfdrive/car/hyundai/carcontroller.py | 15 +---- selfdrive/car/hyundai/carstate.py | 18 ------ selfdrive/car/hyundai/hyundaican.py | 85 ++++++++++---------------- 3 files changed, 35 insertions(+), 83 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 5b037edbfdbe26..e6a621cff5d4a2 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -157,16 +157,10 @@ def update(self, CC, CS, now_nanos): can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, CS.buttons_counter+1, Buttons.RES_ACCEL)) self.last_button_frame = self.frame else: - if self.CP.flags & HyundaiFlags.CAN_CANFD: - can_sends.append(hyundaican.create_lkas11_new(self.packer, self.frame, apply_steer, lat_active, - torque_fault, CS.lkas11, CC.enabled, - hud_control.leftLaneVisible, hud_control.rightLaneVisible, - left_lane_warning, right_lane_warning)) - else: - can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active, + can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, lat_active, torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, hud_control.leftLaneVisible, hud_control.rightLaneVisible, - left_lane_warning, right_lane_warning)) + left_lane_warning, right_lane_warning, self.CP)) if not self.CP.openpilotLongitudinalControl: if CC.cruiseControl.cancel: @@ -187,10 +181,7 @@ def update(self, CC, CS, now_nanos): # 20 Hz LFA MFA message if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: - if self.CP.flags & HyundaiFlags.CAN_CANFD: - can_sends.append(hyundaican.create_lfahda_mfc_new(self.packer, self.frame, CC.enabled, CS.lfahda_mfc)) - else: - can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, self.CP)) + can_sends.append(hyundaican.create_lfahda_mfc(self.packer, self.frame, CC.enabled, self.CP)) # 5 Hz ACC options if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 3efaf7450d7007..9c670ca4f26ddc 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -149,8 +149,6 @@ def update(self, cp, cp_cam): # save the entire LKAS11 and CLU11 self.lkas11 = copy.copy(cp_cam.vl["LKAS11"]) - if self.CP.flags & HyundaiFlags.CAN_CANFD.value: - self.lfahda_mfc = copy.copy(cp_cam.vl["LFAHDA_MFC"]) self.clu11 = copy.copy(cp.vl["CLU11"]) self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE self.prev_cruise_buttons = self.cruise_buttons[-1] @@ -457,22 +455,6 @@ def get_cam_can_parser(CP): ("CF_VSM_DecCmdAct", "SCC12"), ] - if CP.flags & HyundaiFlags.CAN_CANFD.value: - signals += [ - ("CHECKSUM", "LFAHDA_MFC"), - ("NEW_SIGNAL_1", "LFAHDA_MFC"), - ("COUNTER", "LFAHDA_MFC"), - ("NEW_SIGNAL_2", "LFAHDA_MFC"), - ("NEW_SIGNAL_3", "LFAHDA_MFC"), - ("NEW_SIGNAL_4", "LFAHDA_MFC"), - ("HDA_Icon_State", "LFAHDA_MFC"), - ("NEW_SIGNAL_5", "LFAHDA_MFC"), - ("NEW_SIGNAL_6", "LFAHDA_MFC"), - ("LFA_Icon_State", "LFAHDA_MFC"), - ("NEW_SIGNAL_7", "LFAHDA_MFC"), - ] - checks.append(("LFAHDA_MFC", 20)) - bus = 6 if CP.flags & HyundaiFlags.CAN_CANFD else 2 return CANParser(DBC[CP.carFingerprint]["pt"], signals, checks, bus) diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 2de4ba4a5d9f3b..994160bd28d6e7 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -6,16 +6,26 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, torque_fault, lkas11, sys_warning, sys_state, enabled, left_lane, right_lane, - left_lane_depart, right_lane_depart): + left_lane_depart, right_lane_depart, CP): + can_canfd = CP.flags & HyundaiFlags.CAN_CANFD + bus = 4 if can_canfd else 0 + values = lkas11 - values["CF_Lkas_LdwsSysState"] = sys_state - values["CF_Lkas_SysWarning"] = 3 if sys_warning else 0 values["CF_Lkas_LdwsLHWarning"] = left_lane_depart values["CF_Lkas_LdwsRHWarning"] = right_lane_depart values["CR_Lkas_StrToqReq"] = apply_steer values["CF_Lkas_ActToi"] = steer_req values["CF_Lkas_ToiFlt"] = torque_fault # seems to allow actuation on CR_Lkas_StrToqReq - values["CF_Lkas_MsgCount"] = frame % 0x10 + values["CF_Lkas_MsgCount"] = frame % (0xF if can_canfd else 0x10) + + if can_canfd: + values["CF_Lkas_LdwsActivemode"] = int(left_lane) + (int(right_lane) << 1) + values["CF_Lkas_FcwOpt_USM"] = 2 if enabled else 1 + values["NEW_SIGNAL_1"] = 0 + values["NEW_SIGNAL_5"] = 100 + else: + values["CF_Lkas_LdwsSysState"] = sys_state + values["CF_Lkas_SysWarning"] = 3 if sys_warning else 0 if car_fingerprint in (CAR.SONATA, CAR.PALISADE, CAR.KIA_NIRO_EV, CAR.KIA_NIRO_HEV_2021, CAR.SANTA_FE, CAR.IONIQ_EV_2020, CAR.IONIQ_PHEV, CAR.KIA_SELTOS, CAR.ELANTRA_2021, CAR.GENESIS_G70_2020, @@ -60,11 +70,11 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, # Genesis and Optima fault when forwarding while engaged values["CF_Lkas_LdwsActivemode"] = 2 - dat = packer.make_can_msg("LKAS11", 0, values)[2] + dat = packer.make_can_msg("LKAS11", bus, values)[2] if car_fingerprint in CHECKSUM["crc8"]: # CRC Checksum as seen on 2019 Hyundai Santa Fe - dat = dat[:6] + dat[7:8] + dat = dat[1:8] if can_canfd else dat[:6] + dat[7:8] checksum = hyundai_checksum(dat) elif car_fingerprint in CHECKSUM["6B"]: # Checksum of first 6 Bytes, as seen on 2018 Kia Sorento @@ -75,35 +85,7 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, values["CF_Lkas_Chksum"] = checksum - return packer.make_can_msg("LKAS11", 0, values) - - -def create_lkas11_new(packer, frame, apply_steer, steer_req, - torque_fault, lkas11, enabled, left_lane, right_lane, left_lane_depart, right_lane_depart): - values = lkas11 - values.update({ - "CF_Lkas_LdwsLHWarning": left_lane_depart, - "CF_Lkas_LdwsRHWarning": right_lane_depart, - "CR_Lkas_StrToqReq": apply_steer, - "CF_Lkas_ActToi": steer_req, - "CF_Lkas_ToiFlt": torque_fault, # seems to allow actuation on CR_Lkas_StrToqReq - "CF_Lkas_LdwsActivemode": int(left_lane) + (int(right_lane) << 1), - "CF_Lkas_FcwOpt_USM": 2 if enabled else 1, - "NEW_SIGNAL_1": 0, - "NEW_SIGNAL_5": 100, - "CF_Lkas_MsgCount": frame % 0xF, - }) - - dat = packer.make_can_msg("LKAS11", 4, values)[2] - - # CRC Checksum - checksum = hyundai_checksum(dat[1:8]) - - values.update({ - "CF_Lkas_Chksum": checksum, - }) - - return packer.make_can_msg("LKAS11", 4, values) + return packer.make_can_msg("LKAS11", bus, values) def create_clu11(packer, frame, clu11, button, CP): @@ -115,33 +97,30 @@ def create_clu11(packer, frame, clu11, button, CP): return packer.make_can_msg("CLU11", bus, values) -def create_lfahda_mfc(packer, enabled, hda_set_speed=0): - values = { - "LFA_Icon_State": 2 if enabled else 0, - "HDA_Active": 1 if hda_set_speed else 0, - "HDA_Icon_State": 2 if hda_set_speed else 0, - "HDA_VSetReq": hda_set_speed, - } - return packer.make_can_msg("LFAHDA_MFC", 0, values) - +def create_lfahda_mfc(packer, frame, enabled, CP): + can_canfd = CP.flags & HyundaiFlags.CAN_CANFD + bus = 4 if can_canfd else 0 -def create_lfahda_mfc_new(packer, frame, enabled, lfahda_mfc): values = { "LFA_Icon_State": 2 if enabled else 0, "HDA_Icon_State": 2 if enabled else 0, - "COUNTER": frame % 0xF } - dat = packer.make_can_msg("LFAHDA_MFC", 4, values)[2] + if can_canfd: + values.update({ + "COUNTER": frame % 0xF + }) + + dat = packer.make_can_msg("LFAHDA_MFC", bus, values)[2] - # CRC Checksum - checksum = hyundai_checksum(dat[1:8]) + # CRC Checksum + checksum = hyundai_checksum(dat[1:8]) - values.update({ - "CHECKSUM": checksum, - }) + values.update({ + "CHECKSUM": checksum, + }) - return packer.make_can_msg("LFAHDA_MFC", 4, values) + return packer.make_can_msg("LFAHDA_MFC", bus, values) def create_acc_commands(packer, enabled, accel, upper_jerk, idx, lead_visible, set_speed, stopping, long_override): commands = [] From 01ed0537064a25b87a475f453b61cdb8e5e5ac5f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 22:47:39 -0500 Subject: [PATCH 38/88] add test route --- selfdrive/car/tests/routes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py index 02e37492d335b3..935b09770d2af4 100644 --- a/selfdrive/car/tests/routes.py +++ b/selfdrive/car/tests/routes.py @@ -107,6 +107,7 @@ CarTestRoute("1d0d000db3370fd0|2023-01-04--22-28-42", HYUNDAI.KIA_SORENTO_4TH_GEN, segment=5), CarTestRoute("628935d7d3e5f4f7|2022-11-30--01-12-46", HYUNDAI.KIA_SORENTO_PHEV_4TH_GEN), CarTestRoute("9c917ba0d42ffe78|2020-04-17--12-43-19", HYUNDAI.PALISADE), + CarTestRoute("f2cf0de0119d2a16|2023-03-03--21-13-05", HYUNDAI.PALISADE_2023), CarTestRoute("05a8f0197fdac372|2022-10-19--14-14-09", HYUNDAI.IONIQ_5), # HDA2 CarTestRoute("3f29334d6134fcd4|2022-03-30--22-00-50", HYUNDAI.IONIQ_PHEV_2019), CarTestRoute("fa8db5869167f821|2021-06-10--22-50-10", HYUNDAI.IONIQ_PHEV), From 5dd3927de71e0801608f2c6729f0c5b9f77e7a75 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 22:50:00 -0500 Subject: [PATCH 39/88] merge rx checks --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 5392938bac3a47..9c983b6cbc0d72 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 5392938bac3a4717795aa0b06e48e03c90d62a2d +Subproject commit 9c983b6cbc0d72e748866ca84c7e9caa88bf5850 From cf86db4b3740a6811bc376a3e42ac03f62b80568 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 3 Mar 2023 23:08:01 -0500 Subject: [PATCH 40/88] bump panda --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 9c983b6cbc0d72..515b994de96dd1 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 9c983b6cbc0d72e748866ca84c7e9caa88bf5850 +Subproject commit 515b994de96dd1e89ade73ccc42c7345cf3adeea From 71e151c48b8f0ca3e69c05d999e3dc9f13ba9e00 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 5 Mar 2023 20:09:27 -0500 Subject: [PATCH 41/88] fix understeer --- selfdrive/car/hyundai/values.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 03e439db89eb8a..ae3e8c1cded5e0 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -43,8 +43,8 @@ def __init__(self, CP): # these cars have significantly more torque than most HKG; limit to 70% of max elif CP.flags & HyundaiFlags.ALT_LIMITS: self.STEER_MAX = 270 - self.STEER_DELTA_UP = 2 - self.STEER_DELTA_DOWN = 3 + self.STEER_DELTA_UP = 3 + self.STEER_DELTA_DOWN = 5 elif CP.flags & HyundaiFlags.CAN_CANFD: self.STEER_MAX = 384 From c9fb5e5587c9043ec38bbf79bc7ac7af7c362c70 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 6 Mar 2023 18:52:14 -0500 Subject: [PATCH 42/88] Revert "fix understeer" This reverts commit 71e151c48b8f0ca3e69c05d999e3dc9f13ba9e00. --- selfdrive/car/hyundai/values.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index ae3e8c1cded5e0..03e439db89eb8a 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -43,8 +43,8 @@ def __init__(self, CP): # these cars have significantly more torque than most HKG; limit to 70% of max elif CP.flags & HyundaiFlags.ALT_LIMITS: self.STEER_MAX = 270 - self.STEER_DELTA_UP = 3 - self.STEER_DELTA_DOWN = 5 + self.STEER_DELTA_UP = 2 + self.STEER_DELTA_DOWN = 3 elif CP.flags & HyundaiFlags.CAN_CANFD: self.STEER_MAX = 384 From ab8b5b48b45c26c08d8c04b862926c4bd6db8b4c Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 6 Mar 2023 18:52:31 -0500 Subject: [PATCH 43/88] less oversteer --- selfdrive/car/hyundai/values.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 03e439db89eb8a..b359730bc20249 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -48,8 +48,8 @@ def __init__(self, CP): elif CP.flags & HyundaiFlags.CAN_CANFD: self.STEER_MAX = 384 - self.STEER_DELTA_UP = 2 - self.STEER_DELTA_DOWN = 3 + self.STEER_DELTA_UP = 3 + self.STEER_DELTA_DOWN = 6 # Default for most HKG else: From db3c22fb0c8696af880479e51d372bcc66fbf727 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 6 Mar 2023 18:52:41 -0500 Subject: [PATCH 44/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index 7bd4e03ab69acd..9499dac6810e82 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 7bd4e03ab69acd781b220778ec7e30e24a64d346 +Subproject commit 9499dac6810e820b809aa6ef7e415be52085687e From 45538cbf68abf5f6ef674333e3cca3f430439472 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 8 Mar 2023 11:39:33 -0500 Subject: [PATCH 45/88] lower friction to test torqued --- selfdrive/car/torque_data/override.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/torque_data/override.yaml b/selfdrive/car/torque_data/override.yaml index fe97f3c81ad25e..818767411e483f 100644 --- a/selfdrive/car/torque_data/override.yaml +++ b/selfdrive/car/torque_data/override.yaml @@ -40,7 +40,7 @@ KIA SORENTO PLUG-IN HYBRID 4TH GEN: [2.5, 2.5, 0.1] GENESIS GV60 ELECTRIC 1ST GEN: [2.5, 2.5, 0.1] KIA SORENTO 4TH GEN: [2.5, 2.5, 0.1] KIA NIRO HYBRID 2ND GEN: [2.42, 2.5, 0.12] -HYUNDAI PALISADE 2023: [2.5, 2.5, 0.13] +HYUNDAI PALISADE 2023: [2.5, 2.5, 0.05] # Dashcam or fallback configured as ideal car mock: [10.0, 10, 0.0] From 08f6958fae629aa94b563b86a3c8795b633a40b2 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 8 Mar 2023 11:40:00 -0500 Subject: [PATCH 46/88] default values worked best --- selfdrive/car/hyundai/values.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index b359730bc20249..8d2215ad40465d 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -46,11 +46,6 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 - elif CP.flags & HyundaiFlags.CAN_CANFD: - self.STEER_MAX = 384 - self.STEER_DELTA_UP = 3 - self.STEER_DELTA_DOWN = 6 - # Default for most HKG else: self.STEER_MAX = 384 From 61000d96c2619fdea08f84c5b5f3e5f20f29ca84 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 8 Mar 2023 11:40:44 -0500 Subject: [PATCH 47/88] Revert "default values worked best" This reverts commit 08f6958fae629aa94b563b86a3c8795b633a40b2. --- selfdrive/car/hyundai/values.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 8d2215ad40465d..b359730bc20249 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -46,6 +46,11 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 + elif CP.flags & HyundaiFlags.CAN_CANFD: + self.STEER_MAX = 384 + self.STEER_DELTA_UP = 3 + self.STEER_DELTA_DOWN = 6 + # Default for most HKG else: self.STEER_MAX = 384 From 6ae76fedf9fbf16346015011237bcededdb66cb0 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 8 Mar 2023 14:56:21 -0500 Subject: [PATCH 48/88] higher factor at init --- selfdrive/car/torque_data/override.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/torque_data/override.yaml b/selfdrive/car/torque_data/override.yaml index 818767411e483f..733c92591444bb 100644 --- a/selfdrive/car/torque_data/override.yaml +++ b/selfdrive/car/torque_data/override.yaml @@ -40,7 +40,7 @@ KIA SORENTO PLUG-IN HYBRID 4TH GEN: [2.5, 2.5, 0.1] GENESIS GV60 ELECTRIC 1ST GEN: [2.5, 2.5, 0.1] KIA SORENTO 4TH GEN: [2.5, 2.5, 0.1] KIA NIRO HYBRID 2ND GEN: [2.42, 2.5, 0.12] -HYUNDAI PALISADE 2023: [2.5, 2.5, 0.05] +HYUNDAI PALISADE 2023: [3.0, 2.5, 0.05] # Dashcam or fallback configured as ideal car mock: [10.0, 10, 0.0] From 21743b11e24045d3cc60656512793a4bf4b71313 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 12 Mar 2023 14:08:26 -0400 Subject: [PATCH 49/88] add more FW --- selfdrive/car/hyundai/values.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index b359730bc20249..ac50c1c3187202 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1664,11 +1664,13 @@ class Buttons: (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.04 99211-S8150 220622', b'\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9150 220708', + b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.03 99211-S8150 220527', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00LX2_ SCC ----- 1.00 1.01 99110-S8150 ', b'\xf1\x00ON__ SCC ----- 1.00 1.01 99110-S9150 ', b'\xf1\x00LX2_ SCC FHCUP 1.00 1.01 99110-S8150 ', + b'\xf1\x00LX2_ SCC ----- 1.00 1.00 99110-S8150 ', ], }, } From 208e780729bb3c5475a260016896df0ad50af1e7 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 12 Mar 2023 14:40:31 -0400 Subject: [PATCH 50/88] Revert "add more FW" This reverts commit 21743b11e24045d3cc60656512793a4bf4b71313. --- selfdrive/car/hyundai/values.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index ac50c1c3187202..b359730bc20249 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1664,13 +1664,11 @@ class Buttons: (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.04 99211-S8150 220622', b'\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9150 220708', - b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.03 99211-S8150 220527', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00LX2_ SCC ----- 1.00 1.01 99110-S8150 ', b'\xf1\x00ON__ SCC ----- 1.00 1.01 99110-S9150 ', b'\xf1\x00LX2_ SCC FHCUP 1.00 1.01 99110-S8150 ', - b'\xf1\x00LX2_ SCC ----- 1.00 1.00 99110-S8150 ', ], }, } From 4f0ac09bd2d6a34c1ea9e23e807103dab88a56e1 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 18 Mar 2023 11:46:56 -0400 Subject: [PATCH 51/88] add more FW (mbbarnestn) --- selfdrive/car/hyundai/values.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index b359730bc20249..d76d5e301ff1c1 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1669,6 +1669,7 @@ class Buttons: b'\xf1\x00LX2_ SCC ----- 1.00 1.01 99110-S8150 ', b'\xf1\x00ON__ SCC ----- 1.00 1.01 99110-S9150 ', b'\xf1\x00LX2_ SCC FHCUP 1.00 1.01 99110-S8150 ', + b'\xf1\x00ON__ SCC FHCUP 1.00 1.01 99110-S9150 ', ], }, } From ca843fae84b3c03ca87c4c5a6f8e46533386a9d7 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 26 Mar 2023 20:25:59 -0400 Subject: [PATCH 52/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index 34d99bd64943d5..76a66f22cbc18d 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 34d99bd64943d5a83d3fcb5ab7371d63ede60cf0 +Subproject commit 76a66f22cbc18d98be64609e15aaf14276d28b6b From d3f0ec4b65a0cd531e411a4b7caa1ba568bf46f5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 26 Mar 2023 20:28:37 -0400 Subject: [PATCH 53/88] bump panda --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 7411a888443813..dd7c24e4b7146d 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 7411a88844381322d44211f00199b959d88f4b0c +Subproject commit dd7c24e4b7146d73513563591a6cf40676c40d01 From 8aa2fa66e5b3e8f84951940973ef11c8425fe46e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 11 Aug 2023 09:39:37 -0400 Subject: [PATCH 54/88] fix --- selfdrive/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 7647698e2f3664..3908f76c67e4b0 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -193,7 +193,7 @@ def init_make(self, CP: car.CarParams): HyundaiCarInfo("Kia Telluride (without HDA II) 2023", "All", car_parts=CarParts.common([CarHarness.hyundai_l])), ], CAR.VELOSTER: HyundaiCarInfo("Hyundai Veloster 2019-20", min_enable_speed=5. * CV.MPH_TO_MS, car_parts=CarParts.common([CarHarness.hyundai_e])), - CAR.SONATA_HYBRID: HyundaiCarInfo("Hyundai Sonata Hybrid 2020-22", "All", car_parts=CarParts.common([CarHarness.hyundai_e])), + CAR.SONATA_HYBRID: HyundaiCarInfo("Hyundai Sonata Hybrid 2020-22", "All", car_parts=CarParts.common([CarHarness.hyundai_a])), CAR.IONIQ_5: [ HyundaiCarInfo("Hyundai Ioniq 5 (Southeast Asia only) 2022-23", "All", car_parts=CarParts.common([CarHarness.hyundai_q])), HyundaiCarInfo("Hyundai Ioniq 5 (without HDA II) 2022-23", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_k])), From ac4f430301d28271b41b5b90cfed4a763452d985 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 11 Aug 2023 12:10:30 -0400 Subject: [PATCH 55/88] Update CARS.md --- docs/CARS.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/CARS.md b/docs/CARS.md index 9ec07a3e2247eb..05e32476426286 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,7 +4,7 @@ A supported vehicle is one that just works when you install a comma three. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified. -# 257 Supported Cars +# 259 Supported Cars |Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Hardware Needed
 |Video| |---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -91,6 +91,7 @@ A supported vehicle is one that just works when you install a comma three. All s |Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai O connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai I connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Hyundai|Palisade (without HDA II) 2023|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai A connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Cruz 2022-23[6](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai N connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai D connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2021-23|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai L connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| @@ -138,6 +139,7 @@ A supported vehicle is one that just works when you install a comma three. All s |Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai C connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Kia|Stinger 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai K connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Kia|Telluride 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Kia|Telluride (without HDA II) 2023|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai L connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|ES 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| From 6e944e6766f3ca00911a122dbc14ecd73d1a939e Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 11 Aug 2023 12:11:05 -0400 Subject: [PATCH 56/88] Fix --- selfdrive/car/hyundai/carstate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 4f77c4fecf5ccb..53742f26014f2b 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -235,8 +235,11 @@ def get_can_parser(CP): if CP.carFingerprint in CANFD_CAR: return CarState.get_can_parser_canfd(CP) + freq_mdps12 = 100 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50 + messages = [ # address, frequency + ("MDPS12", freq_mdps12), ("TCS13", 50), ("TCS15", 10), ("CLU11", 50), @@ -248,8 +251,6 @@ def get_can_parser(CP): ("WHL_SPD11", 50), ("SAS11", 100), ] - freq_mdps12 = 100 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50 - checks.append(("MDPS12", freq_mdps12)) if not CP.openpilotLongitudinalControl and CP.carFingerprint not in CAMERA_SCC_CAR and not (CP.flags & HyundaiFlags.CAN_CANFD.value): messages += [ From a887df083eeae7d66060cdd1f56a6af1a43c30cf Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 25 Aug 2023 10:32:44 -0400 Subject: [PATCH 57/88] Sync with CanBus helper --- selfdrive/car/hyundai/carstate.py | 4 ++-- selfdrive/car/hyundai/hyundaican.py | 7 ++++--- selfdrive/car/hyundai/interface.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 0c3c171b30a7cb..8277bef3cbffd3 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -285,7 +285,7 @@ def get_can_parser(self, CP): else: messages.append(("LVR12", 100)) - bus = 4 if CP.flags & HyundaiFlags.CAN_CANFD.value else 0 + bus = CanBus(CP).ECAN if CP.flags & HyundaiFlags.CAN_CANFD.value else 0 return CANParser(DBC[CP.carFingerprint]["pt"], messages, bus) @staticmethod @@ -306,7 +306,7 @@ def get_cam_can_parser(CP): if CP.flags & HyundaiFlags.USE_FCA.value: messages.append(("FCA11", 50)) - bus = 6 if CP.flags & HyundaiFlags.CAN_CANFD else 2 + bus = CanBus(CP).CAM if CP.flags & HyundaiFlags.CAN_CANFD else 2 return CANParser(DBC[CP.carFingerprint]["pt"], messages, bus) def get_can_parser_canfd(self, CP): diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 222478116f9628..3b51e76f6e314f 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -1,4 +1,5 @@ import crcmod +from selfdrive.car.hyundai.hyundaicanfd import CanBus from selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) @@ -8,7 +9,7 @@ def create_lkas11(packer, frame, car_fingerprint, apply_steer, steer_req, left_lane, right_lane, left_lane_depart, right_lane_depart, CP): can_canfd = CP.flags & HyundaiFlags.CAN_CANFD - bus = 4 if can_canfd else 0 + bus = CanBus(CP).ECAN if can_canfd else 0 lkas11_sigs = [ "CF_Lkas_LdwsActivemode", @@ -129,13 +130,13 @@ def create_clu11(packer, frame, clu11, button, CP): values["CF_Clu_CruiseSwState"] = button values["CF_Clu_AliveCnt1"] = frame % 0x10 # send buttons to camera on camera-scc based cars - bus = 2 if CP.carFingerprint in CAMERA_SCC_CAR else 4 if CP.flags & HyundaiFlags.CAN_CANFD else 0 + bus = 2 if CP.carFingerprint in CAMERA_SCC_CAR else CanBus(CP).ECAN if CP.flags & HyundaiFlags.CAN_CANFD else 0 return packer.make_can_msg("CLU11", bus, values) def create_lfahda_mfc(packer, frame, enabled, CP): can_canfd = CP.flags & HyundaiFlags.CAN_CANFD - bus = 4 if can_canfd else 0 + bus = CanBus(CP).ECAN if can_canfd else 0 values = { "LFA_Icon_State": 2 if enabled else 0, diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 1e58de8567f6c6..bb223a283c46dc 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -53,7 +53,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): if 0x2a4 in fingerprint[5]: ret.flags |= HyundaiFlags.CAN_CANFD.value - lfa_bus = 6 if ret.flags & HyundaiFlags.CAN_CANFD else 2 + lfa_bus = CAN.CAM if ret.flags & HyundaiFlags.CAN_CANFD else 2 # Send LFA message on cars with HDA if 0x485 in fingerprint[lfa_bus]: ret.flags |= HyundaiFlags.SEND_LFA.value @@ -267,7 +267,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): if candidate in CANFD_CAR: ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN] else: - bus = 4 if ret.flags & HyundaiFlags.CAN_CANFD else 0 + bus = CAN.ECAN if ret.flags & HyundaiFlags.CAN_CANFD else 0 ret.enableBsm = 0x58b in fingerprint[bus] # *** panda safety config *** From 6e72d77c14b47e0d664921ef5f060acbc8c4cc68 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Fri, 25 Aug 2023 11:50:02 -0400 Subject: [PATCH 58/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index 7aa2abfb58424a..291d01eb3ec2f4 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 7aa2abfb58424a14d0e9062cd6a4875cd82a2c25 +Subproject commit 291d01eb3ec2f47f004e289936c1971bc99126cc From 8c20f19f0454d7787b64022d43873ef13b462384 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 26 Aug 2023 23:33:57 -0400 Subject: [PATCH 59/88] Use generated DBC for common messages --- opendbc | 2 +- release/files_common | 4 ++-- selfdrive/car/hyundai/values.py | 34 ++++++++++++++++----------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/opendbc b/opendbc index 291d01eb3ec2f4..5194849f38eb53 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 291d01eb3ec2f47f004e289936c1971bc99126cc +Subproject commit 5194849f38eb53f7aa5821a1e6c52ccd652eca47 diff --git a/release/files_common b/release/files_common index bab298610b35ff..f6c812cfca663e 100644 --- a/release/files_common +++ b/release/files_common @@ -555,9 +555,9 @@ opendbc/honda_insight_ex_2019_can_generated.dbc opendbc/acura_ilx_2016_nidec.dbc opendbc/honda_civic_ex_2022_can_generated.dbc -opendbc/hyundai_canfd.dbc +opendbc/hyundai_canfd_generated.dbc opendbc/hyundai_kia_generic.dbc -opendbc/hyundai_palisade_2023.dbc +opendbc/hyundai_palisade_2023_generated.dbc opendbc/hyundai_kia_mando_front_radar_generated.dbc opendbc/mazda_2017.dbc diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index b732ea53fc035e..388c0b1948452b 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -2010,22 +2010,22 @@ def match_fw_to_car_fuzzy(live_fw_versions) -> Set[str]: CAR.PALISADE: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar_generated'), CAR.VELOSTER: dbc_dict('hyundai_kia_generic', None), CAR.KIA_CEED: dbc_dict('hyundai_kia_generic', None), - CAR.KIA_EV6: dbc_dict('hyundai_canfd', None), + CAR.KIA_EV6: dbc_dict('hyundai_canfd_generated', None), CAR.SONATA_HYBRID: dbc_dict('hyundai_kia_generic', 'hyundai_kia_mando_front_radar_generated'), - CAR.TUCSON_4TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.TUCSON_HYBRID_4TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.IONIQ_5: dbc_dict('hyundai_canfd', None), - CAR.IONIQ_6: dbc_dict('hyundai_canfd', None), - CAR.SANTA_CRUZ_1ST_GEN: dbc_dict('hyundai_canfd', None), - CAR.KIA_SPORTAGE_5TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.KIA_SPORTAGE_HYBRID_5TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.GENESIS_GV70_1ST_GEN: dbc_dict('hyundai_canfd', None), - CAR.KIA_SORENTO_PHEV_4TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.GENESIS_GV60_EV_1ST_GEN: dbc_dict('hyundai_canfd', None), - CAR.KIA_SORENTO_4TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.KIA_NIRO_HEV_2ND_GEN: dbc_dict('hyundai_canfd', None), - CAR.KIA_NIRO_EV_2ND_GEN: dbc_dict('hyundai_canfd', None), - CAR.GENESIS_GV80: dbc_dict('hyundai_canfd', None), - CAR.KIA_CARNIVAL_4TH_GEN: dbc_dict('hyundai_canfd', None), - CAR.PALISADE_2023: dbc_dict('hyundai_palisade_2023', None), + CAR.TUCSON_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.TUCSON_HYBRID_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.IONIQ_5: dbc_dict('hyundai_canfd_generated', None), + CAR.IONIQ_6: dbc_dict('hyundai_canfd_generated', None), + CAR.SANTA_CRUZ_1ST_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_SPORTAGE_5TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_SPORTAGE_HYBRID_5TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.GENESIS_GV70_1ST_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_SORENTO_PHEV_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.GENESIS_GV60_EV_1ST_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_SORENTO_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_NIRO_HEV_2ND_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_NIRO_EV_2ND_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.GENESIS_GV80: dbc_dict('hyundai_canfd_generated', None), + CAR.KIA_CARNIVAL_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.PALISADE_2023: dbc_dict('hyundai_palisade_2023_generated', None), } From ef6374303b4b70e8739000d731561c65c8a1342b Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 26 Aug 2023 23:55:22 -0400 Subject: [PATCH 60/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index 5194849f38eb53..6093b5ba443219 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 5194849f38eb53f7aa5821a1e6c52ccd652eca47 +Subproject commit 6093b5ba443219ccb6751e190918341fe6e8621e From ac208d78b4c27e81628a4ce12a2dc483d0788b55 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 26 Aug 2023 23:59:04 -0400 Subject: [PATCH 61/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index 6093b5ba443219..31edd5bbb9f5af 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 6093b5ba443219ccb6751e190918341fe6e8621e +Subproject commit 31edd5bbb9f5af5a24a98ddec482dcd1474aa2fa From 3b5d63a25674b8f845bf6eec7e7eb41cc6b3841f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 27 Aug 2023 02:04:21 -0400 Subject: [PATCH 62/88] Cleanup and fixes --- selfdrive/car/hyundai/carcontroller.py | 1 - selfdrive/car/hyundai/carstate.py | 19 ++++++++--------- selfdrive/car/hyundai/hyundaican.py | 10 +++------ selfdrive/car/hyundai/interface.py | 28 +++++++++++++------------- selfdrive/car/hyundai/values.py | 3 +++ 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index e4c34cc559cc33..7d94a31b1aeb8d 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -55,7 +55,6 @@ def __init__(self, dbc_name, CP, VM): self.apply_steer_last = 0 self.car_fingerprint = CP.carFingerprint self.last_button_frame = 0 - self.lkas11_cnt = -1 def update(self, CC, CS, now_nanos): actuators = CC.actuators diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 1556c5605cf4e0..35a3f60f4062ad 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -255,15 +255,16 @@ def get_can_parser(self, CP): ("SAS11", 100), ] - if not CP.openpilotLongitudinalControl and CP.carFingerprint not in CAMERA_SCC_CAR and not (CP.flags & HyundaiFlags.CAN_CANFD.value): - messages += [ - ("SCC11", 50), - ("SCC12", 50), - ] - if CP.flags & HyundaiFlags.USE_FCA.value: - messages.append(("FCA11", 50)) - elif CP.flags & HyundaiFlags.CAN_CANFD.value: - messages.append(("SCC12", 50)) + if not CP.openpilotLongitudinalControl: + if CP.flags & HyundaiFlags.CAN_CANFD.value: + messages.append(("SCC12", 50)) + elif CP.carFingerprint not in CAMERA_SCC_CAR: + messages += [ + ("SCC11", 50), + ("SCC12", 50), + ] + if CP.flags & HyundaiFlags.USE_FCA.value: + messages.append(("FCA11", 50)) if CP.enableBsm: freq_lca11 = 20 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50 diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index 0454ca4eed139a..df821d768ba789 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -1,6 +1,6 @@ import crcmod from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus -from openpilot.selfdrive.car.hyundai.values import CAR, CHECKSUM, CAMERA_SCC_CAR +from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, CHECKSUM, CAMERA_SCC_CAR hyundai_checksum = crcmod.mkCrcFun(0x11D, initCrc=0xFD, rev=False, xorOut=0xdf) @@ -144,18 +144,14 @@ def create_lfahda_mfc(packer, frame, enabled, CP): } if can_canfd: - values.update({ - "COUNTER": frame % 0xF - }) + values["COUNTER"] = frame % 0xF dat = packer.make_can_msg("LFAHDA_MFC", bus, values)[2] # CRC Checksum checksum = hyundai_checksum(dat[1:8]) - values.update({ - "CHECKSUM": checksum, - }) + values["CHECKSUM"] = checksum return packer.make_can_msg("LFAHDA_MFC", bus, values) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 7c119f724b265b..4c5e3c30fc181b 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -5,7 +5,7 @@ from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CANFD_CAR, CAMERA_SCC_CAR, CANFD_RADAR_SCC_CAR, \ EV_CAR, HYBRID_CAR, LEGACY_SAFETY_MODE_CAR, UNSUPPORTED_LONGITUDINAL_CAR, \ - Buttons + Buttons, CAN_CANFD_CAR from openpilot.selfdrive.car.hyundai.radar_interface import RADAR_START_ADDR from openpilot.selfdrive.car import create_button_events, get_safety_config from openpilot.selfdrive.car.interfaces import CarInterfaceBase @@ -50,14 +50,15 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.flags |= HyundaiFlags.CANFD_ALT_GEARS.value if candidate not in CANFD_RADAR_SCC_CAR: ret.flags |= HyundaiFlags.CANFD_CAMERA_SCC.value - else: - # detect non-HDA2 with CAN and CAN-FD definitions - if 0x2a4 in fingerprint[5]: + # detect cars with hybrid definitions of CAN and CAN-FD + if candidate in CAN_CANFD_CAR: ret.flags |= HyundaiFlags.CAN_CANFD.value - - lfa_bus = CAN.CAM if ret.flags & HyundaiFlags.CAN_CANFD else 2 + # Send LFA message on cars with HDA + if 0x485 in fingerprint[CAN.CAM]: + ret.flags |= HyundaiFlags.SEND_LFA.value + else: # Send LFA message on cars with HDA - if 0x485 in fingerprint[lfa_bus]: + if 0x485 in fingerprint[2]: ret.flags |= HyundaiFlags.SEND_LFA.value # These cars use the FCA11 message for the AEB and FCW signals, all others use SCC12 @@ -256,7 +257,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): else: ret.longitudinalTuning.kpV = [0.5] ret.longitudinalTuning.kiV = [0.0] - ret.experimentalLongitudinalAvailable = candidate not in (UNSUPPORTED_LONGITUDINAL_CAR | CAMERA_SCC_CAR) and not (ret.flags & HyundaiFlags.CAN_CANFD) + ret.experimentalLongitudinalAvailable = candidate not in (UNSUPPORTED_LONGITUDINAL_CAR | CAMERA_SCC_CAR | CAN_CANFD_CAR) ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable ret.pcmCruise = not ret.openpilotLongitudinalControl @@ -268,7 +269,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.longitudinalActuatorDelayUpperBound = 0.5 # *** feature detection *** - if candidate in CANFD_CAR: + if candidate in (CANFD_CAR - CAN_CANFD_CAR): ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN] else: bus = CAN.ECAN if ret.flags & HyundaiFlags.CAN_CANFD else 0 @@ -276,7 +277,8 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): # *** panda safety config *** if candidate in CANFD_CAR: - cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ] + cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ] if ret.flags & HyundaiFlags.CAN_CANFD else \ + [get_safety_config(car.CarParams.SafetyModel.hyundai), ] if CAN.ECAN >= 4: cfgs.insert(0, get_safety_config(car.CarParams.SafetyModel.noOutput)) ret.safetyConfigs = cfgs @@ -287,14 +289,12 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_CANFD_ALT_BUTTONS if ret.flags & HyundaiFlags.CANFD_CAMERA_SCC: ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_CAMERA_SCC + if ret.flags & HyundaiFlags.CAN_CANFD: + ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD else: if candidate in LEGACY_SAFETY_MODE_CAR: # these cars require a special panda safety mode due to missing counters and checksums in the messages ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundaiLegacy)] - elif ret.flags & HyundaiFlags.CAN_CANFD: - ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.noOutput), - get_safety_config(car.CarParams.SafetyModel.hyundai)] - ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD else: ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hyundai, 0)] diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 5b1a7f0c870565..0aa3bb8c86ee0c 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1967,6 +1967,9 @@ def match_fw_to_car_fuzzy(live_fw_versions) -> Set[str]: CAR.GENESIS_GV60_EV_1ST_GEN, CAR.KIA_SORENTO_4TH_GEN, CAR.KIA_NIRO_HEV_2ND_GEN, CAR.KIA_NIRO_EV_2ND_GEN, CAR.GENESIS_GV80, CAR.KIA_CARNIVAL_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN} +# These cars have hybrid definitions of CAN and CAN-FD +CAN_CANFD_CAR = {CAR.PALISADE_2023, } + # The radar does SCC on these cars when HDA I, rather than the camera CANFD_RADAR_SCC_CAR = {CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.KIA_SORENTO_4TH_GEN, CAR.GENESIS_GV80, CAR.KIA_CARNIVAL_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN} From cf1ae516f01be599894956ffc2a43ffcc6f4cda3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 27 Aug 2023 02:35:18 -0400 Subject: [PATCH 63/88] Should be here --- selfdrive/car/hyundai/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 4c5e3c30fc181b..edeae4764cc8e9 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -253,11 +253,11 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): if candidate in CANFD_CAR: ret.longitudinalTuning.kpV = [0.1] ret.longitudinalTuning.kiV = [0.0] - ret.experimentalLongitudinalAvailable = candidate in (HYBRID_CAR | EV_CAR) and candidate not in CANFD_RADAR_SCC_CAR + ret.experimentalLongitudinalAvailable = candidate in (HYBRID_CAR | EV_CAR) and candidate not in (CANFD_RADAR_SCC_CAR | CAN_CANFD_CAR) else: ret.longitudinalTuning.kpV = [0.5] ret.longitudinalTuning.kiV = [0.0] - ret.experimentalLongitudinalAvailable = candidate not in (UNSUPPORTED_LONGITUDINAL_CAR | CAMERA_SCC_CAR | CAN_CANFD_CAR) + ret.experimentalLongitudinalAvailable = candidate not in (UNSUPPORTED_LONGITUDINAL_CAR | CAMERA_SCC_CAR) ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable ret.pcmCruise = not ret.openpilotLongitudinalControl From aca2330dd53d85c6a433dfbfbb2a4b9bb5e4a956 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 27 Aug 2023 03:02:17 -0400 Subject: [PATCH 64/88] consolidate in method --- selfdrive/car/hyundai/carcontroller.py | 72 +++++++++++++++----------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 7d94a31b1aeb8d..f68435db61d2c4 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -56,6 +56,41 @@ def __init__(self, dbc_name, CP, VM): self.car_fingerprint = CP.carFingerprint self.last_button_frame = 0 + def create_button_messages(self, CC, CS, can_sends, can=False, can_fd=False): + if can: + if CC.cruiseControl.cancel: + can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) + elif CC.cruiseControl.resume: + # send resume at a max freq of 10Hz + if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: + # send 25 messages at a time to increases the likelihood of resume being accepted + can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25) + if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: + self.last_button_frame = self.frame + elif can_fd: + if (self.frame - self.last_button_frame) * DT_CTRL > 0.25: + # cruise cancel + if CC.cruiseControl.cancel: + if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: + can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info)) + self.last_button_frame = self.frame + else: + for _ in range(20): + can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL)) + self.last_button_frame = self.frame + + # cruise standstill resume + elif CC.cruiseControl.resume: + if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: + # TODO: resume for alt button cars + pass + else: + for _ in range(20): + can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL)) + self.last_button_frame = self.frame + + return can_sends + def update(self, CC, CS, now_nanos): actuators = CC.actuators hud_control = CC.hudControl @@ -102,9 +137,11 @@ def update(self, CC, CS, now_nanos): if self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: can_sends.append([0x7b1, 0, b"\x02\x3E\x80\x00\x00\x00\x00\x00", self.CAN.ECAN]) + hda2 = self.CP.flags & HyundaiFlags.CANFD_HDA2 + hda2_can_canfd = hda2 and self.CP.flags & HyundaiFlags.CAN_CANFD + # CAN-FD platforms - if self.CP.carFingerprint in CANFD_CAR: - hda2 = self.CP.flags & HyundaiFlags.CANFD_HDA2 + if self.CP.carFingerprint in CANFD_CAR or hda2_can_canfd: hda2_long = hda2 and self.CP.openpilotLongitudinalControl # steering control @@ -131,26 +168,7 @@ def update(self, CC, CS, now_nanos): self.accel_last = accel else: # button presses - if (self.frame - self.last_button_frame) * DT_CTRL > 0.25: - # cruise cancel - if CC.cruiseControl.cancel: - if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: - can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info)) - self.last_button_frame = self.frame - else: - for _ in range(20): - can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL)) - self.last_button_frame = self.frame - - # cruise standstill resume - elif CC.cruiseControl.resume: - if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: - # TODO: resume for alt button cars - pass - else: - for _ in range(20): - can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL)) - self.last_button_frame = self.frame + can_sends.extend(self.create_button_messages(CC, CS, can_sends, can=hda2_can_canfd, can_fd=not hda2_can_canfd)) else: can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, apply_steer_req, torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, @@ -158,15 +176,7 @@ def update(self, CC, CS, now_nanos): left_lane_warning, right_lane_warning, self.CP)) if not self.CP.openpilotLongitudinalControl: - if CC.cruiseControl.cancel: - can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) - elif CC.cruiseControl.resume: - # send resume at a max freq of 10Hz - if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: - # send 25 messages at a time to increases the likelihood of resume being accepted - can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25) - if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: - self.last_button_frame = self.frame + can_sends.extend(self.create_button_messages(CC, CS, can_sends, can=True)) if self.frame % 2 == 0 and self.CP.openpilotLongitudinalControl: # TODO: unclear if this is needed From 5a34070061d287b376f50308a2ea98f4700a28f2 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 27 Aug 2023 03:25:02 -0400 Subject: [PATCH 65/88] Gate the list --- selfdrive/car/hyundai/carstate.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 35a3f60f4062ad..8f9c988e67092d 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -8,7 +8,8 @@ from opendbc.can.can_define import CANDefine from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CAN_GEARS, CAMERA_SCC_CAR, \ - CANFD_CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams + CANFD_CAR, EV_CAR, HYBRID_CAR, Buttons, CarControllerParams, \ + CAN_CANFD_CAR from openpilot.selfdrive.car.interfaces import CarStateBase PREV_BUTTON_SAMPLES = 8 @@ -27,7 +28,7 @@ def __init__(self, CP): self.gear_msg_canfd = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \ "GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \ "GEAR_SHIFTER" - if CP.carFingerprint in CANFD_CAR: + if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_CAR): self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"] elif self.CP.carFingerprint in CAN_GEARS["use_cluster_gears"]: self.shifter_values = can_define.dv["CLU15"]["CF_Clu_Gear"] @@ -53,7 +54,7 @@ def __init__(self, CP): self.params = CarControllerParams(CP) def update(self, cp, cp_cam): - if self.CP.carFingerprint in CANFD_CAR: + if self.CP.carFingerprint in (CANFD_CAR - CAN_CANFD_CAR): return self.update_canfd(cp, cp_cam) ret = car.CarState.new_message() @@ -235,7 +236,7 @@ def update_canfd(self, cp, cp_cam): return ret def get_can_parser(self, CP): - if CP.carFingerprint in CANFD_CAR: + if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_CAR): return self.get_can_parser_canfd(CP) freq_mdps12 = 100 if CP.flags & HyundaiFlags.CAN_CANFD.value else 50 @@ -292,7 +293,7 @@ def get_can_parser(self, CP): @staticmethod def get_cam_can_parser(CP): - if CP.carFingerprint in CANFD_CAR: + if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_CAR): return CarState.get_cam_can_parser_canfd(CP) messages = [ From ee34c6e7937bd1330ac09cf9fb1faa9f568a64d5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 27 Aug 2023 03:44:05 -0400 Subject: [PATCH 66/88] Gate it by default --- selfdrive/car/hyundai/carcontroller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index f68435db61d2c4..1ab552341f8205 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -6,7 +6,7 @@ from openpilot.selfdrive.car import apply_driver_steer_torque_limits, common_fault_avoidance from openpilot.selfdrive.car.hyundai import hyundaicanfd, hyundaican from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus -from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR +from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR, CAN_CANFD_CAR VisualAlert = car.CarControl.HUDControl.VisualAlert LongCtrlState = car.CarControl.Actuators.LongControlState @@ -141,7 +141,7 @@ def update(self, CC, CS, now_nanos): hda2_can_canfd = hda2 and self.CP.flags & HyundaiFlags.CAN_CANFD # CAN-FD platforms - if self.CP.carFingerprint in CANFD_CAR or hda2_can_canfd: + if self.CP.carFingerprint in (CANFD_CAR - CAN_CANFD_CAR) or hda2_can_canfd: hda2_long = hda2 and self.CP.openpilotLongitudinalControl # steering control From f324df0ca1b2002ab1201449662c226d071788c5 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sun, 27 Aug 2023 03:49:17 -0400 Subject: [PATCH 67/88] Update docs --- docs/CARS.md | 4 +++- selfdrive/car/hyundai/interface.py | 2 +- selfdrive/car/hyundai/values.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CARS.md b/docs/CARS.md index 9ded53f2013fea..b0534f1172de15 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,7 +4,7 @@ A supported vehicle is one that just works when you install a comma three. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified. -# 258 Supported Cars +# 260 Supported Cars |Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Hardware Needed
 |Video| |---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -91,6 +91,7 @@ A supported vehicle is one that just works when you install a comma three. All s |Hyundai|Kona Electric 2022|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai O connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai I connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Hyundai|Palisade (without HDA II) 2023[6](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai A connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Cruz 2022-23[6](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai N connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai D connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2021-23|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai L connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| @@ -139,6 +140,7 @@ A supported vehicle is one that just works when you install a comma three. All s |Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai C connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Kia|Stinger 2022|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai K connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Kia|Telluride 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Kia|Telluride (without HDA II) 2023[6](#footnotes)|All|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai L connector
- 1 RJ45 cable (7 ft)
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|ES 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|ES 2019-22|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma power v2
- 1 comma three
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index edeae4764cc8e9..2841b5268c8fd4 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -290,7 +290,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): if ret.flags & HyundaiFlags.CANFD_CAMERA_SCC: ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_CAMERA_SCC if ret.flags & HyundaiFlags.CAN_CANFD: - ret.safetyConfigs[1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD + ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_CAN_CANFD else: if candidate in LEGACY_SAFETY_MODE_CAR: # these cars require a special panda safety mode due to missing counters and checksums in the messages diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 0aa3bb8c86ee0c..ba67783e41ab8d 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1965,7 +1965,7 @@ def match_fw_to_car_fuzzy(live_fw_versions) -> Set[str]: CANFD_CAR = {CAR.KIA_EV6, CAR.IONIQ_5, CAR.IONIQ_6, CAR.TUCSON_4TH_GEN, CAR.TUCSON_HYBRID_4TH_GEN, CAR.KIA_SPORTAGE_HYBRID_5TH_GEN, CAR.SANTA_CRUZ_1ST_GEN, CAR.KIA_SPORTAGE_5TH_GEN, CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.GENESIS_GV60_EV_1ST_GEN, CAR.KIA_SORENTO_4TH_GEN, CAR.KIA_NIRO_HEV_2ND_GEN, CAR.KIA_NIRO_EV_2ND_GEN, - CAR.GENESIS_GV80, CAR.KIA_CARNIVAL_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN} + CAR.GENESIS_GV80, CAR.KIA_CARNIVAL_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN, CAR.PALISADE_2023} # These cars have hybrid definitions of CAN and CAN-FD CAN_CANFD_CAR = {CAR.PALISADE_2023, } From 51781a247ad9458e0bf6b9dc903f4c13f294a306 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 28 Aug 2023 18:46:20 -0400 Subject: [PATCH 68/88] Revert for now --- selfdrive/car/hyundai/carcontroller.py | 66 +++++++++++--------------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 1ab552341f8205..939ec4636a8f27 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -56,41 +56,6 @@ def __init__(self, dbc_name, CP, VM): self.car_fingerprint = CP.carFingerprint self.last_button_frame = 0 - def create_button_messages(self, CC, CS, can_sends, can=False, can_fd=False): - if can: - if CC.cruiseControl.cancel: - can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) - elif CC.cruiseControl.resume: - # send resume at a max freq of 10Hz - if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: - # send 25 messages at a time to increases the likelihood of resume being accepted - can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25) - if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: - self.last_button_frame = self.frame - elif can_fd: - if (self.frame - self.last_button_frame) * DT_CTRL > 0.25: - # cruise cancel - if CC.cruiseControl.cancel: - if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: - can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info)) - self.last_button_frame = self.frame - else: - for _ in range(20): - can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL)) - self.last_button_frame = self.frame - - # cruise standstill resume - elif CC.cruiseControl.resume: - if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: - # TODO: resume for alt button cars - pass - else: - for _ in range(20): - can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL)) - self.last_button_frame = self.frame - - return can_sends - def update(self, CC, CS, now_nanos): actuators = CC.actuators hud_control = CC.hudControl @@ -168,7 +133,26 @@ def update(self, CC, CS, now_nanos): self.accel_last = accel else: # button presses - can_sends.extend(self.create_button_messages(CC, CS, can_sends, can=hda2_can_canfd, can_fd=not hda2_can_canfd)) + if (self.frame - self.last_button_frame) * DT_CTRL > 0.25: + # cruise cancel + if CC.cruiseControl.cancel: + if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: + can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info)) + self.last_button_frame = self.frame + else: + for _ in range(20): + can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL)) + self.last_button_frame = self.frame + + # cruise standstill resume + elif CC.cruiseControl.resume: + if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS: + # TODO: resume for alt button cars + pass + else: + for _ in range(20): + can_sends.append(hyundaicanfd.create_buttons(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.RES_ACCEL)) + self.last_button_frame = self.frame else: can_sends.append(hyundaican.create_lkas11(self.packer, self.frame, self.car_fingerprint, apply_steer, apply_steer_req, torque_fault, CS.lkas11, sys_warning, sys_state, CC.enabled, @@ -176,7 +160,15 @@ def update(self, CC, CS, now_nanos): left_lane_warning, right_lane_warning, self.CP)) if not self.CP.openpilotLongitudinalControl: - can_sends.extend(self.create_button_messages(CC, CS, can_sends, can=True)) + if CC.cruiseControl.cancel: + can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) + elif CC.cruiseControl.resume: + # send resume at a max freq of 10Hz + if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: + # send 25 messages at a time to increases the likelihood of resume being accepted + can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25) + if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: + self.last_button_frame = self.frame if self.frame % 2 == 0 and self.CP.openpilotLongitudinalControl: # TODO: unclear if this is needed From c38ac769a7f75f69b96ff66b06459812e76d9f8d Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 28 Aug 2023 19:05:30 -0400 Subject: [PATCH 69/88] bump opendbc --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index bf5e9f723ae856..839f68fee5958a 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit bf5e9f723ae856d47ffb6c1736cae68ffb00cd72 +Subproject commit 839f68fee5958ab94b5f0de7d0921c731e1eb9e0 From 0cf6c5fbeb3b0489448cbcebeb53a3e3f2c76626 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 28 Aug 2023 23:42:44 -0400 Subject: [PATCH 70/88] Fix button method --- selfdrive/car/hyundai/carcontroller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 619b6099457a83..ff0e8374972390 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -175,12 +175,12 @@ def create_button_messages(self, CC: car.CarControl, CS: car.CarState, use_clu11 can_sends = [] if use_clu11: if CC.cruiseControl.cancel: - can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP.carFingerprint)) + can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP)) elif CC.cruiseControl.resume: # send resume at a max freq of 10Hz if (self.frame - self.last_button_frame) * DT_CTRL > 0.1: # send 25 messages at a time to increases the likelihood of resume being accepted - can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP.carFingerprint)] * 25) + can_sends.extend([hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.RES_ACCEL, self.CP)] * 25) if (self.frame - self.last_button_frame) * DT_CTRL >= 0.15: self.last_button_frame = self.frame else: From 5cbeeed9e465b7af8703020828f4ebbff3796085 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 29 Aug 2023 11:31:37 -0400 Subject: [PATCH 71/88] try this --- selfdrive/car/hyundai/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 4c5769b1f97c9e..0cc5da1d28e18d 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -106,7 +106,7 @@ def update(self, CC, CS, now_nanos): hda2_can_canfd = hda2 and self.CP.flags & HyundaiFlags.CAN_CANFD # CAN-FD platforms - if self.CP.carFingerprint in (CANFD_CAR - CAN_CANFD_CAR) or hda2_can_canfd: + if self.CP.carFingerprint in CANFD_CAR and (self.CP.carFingerprint not in CAN_CANFD_CAR or hda2_can_canfd): hda2_long = hda2 and self.CP.openpilotLongitudinalControl # steering control From d2bad37478271c1421d5ad526e5ce1c693647efb Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 29 Aug 2023 17:29:57 -0400 Subject: [PATCH 72/88] flipped safety mode :p --- selfdrive/car/hyundai/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index 2841b5268c8fd4..a002f941f64334 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -277,8 +277,8 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): # *** panda safety config *** if candidate in CANFD_CAR: - cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ] if ret.flags & HyundaiFlags.CAN_CANFD else \ - [get_safety_config(car.CarParams.SafetyModel.hyundai), ] + cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundai), ] if ret.flags & HyundaiFlags.CAN_CANFD else \ + [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ] if CAN.ECAN >= 4: cfgs.insert(0, get_safety_config(car.CarParams.SafetyModel.noOutput)) ret.safetyConfigs = cfgs From 9c16023e688556b5352f9c9ce4145f1a46c8b397 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 29 Aug 2023 17:40:49 -0400 Subject: [PATCH 73/88] H7 reset --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 4fa48fe3657045..15b574086ceb9c 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 4fa48fe3657045a3583f9f3e865a100c7e6de58c +Subproject commit 15b574086ceb9ccdcda6a9982ac04f3a22fd1b5b From 54e5f13918c59463e144e4d1c4b23276cccff1ef Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 30 Aug 2023 19:18:07 -0400 Subject: [PATCH 74/88] This platform is radar SCC --- selfdrive/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index ba67783e41ab8d..4cdeb16375a376 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -1972,7 +1972,7 @@ def match_fw_to_car_fuzzy(live_fw_versions) -> Set[str]: # The radar does SCC on these cars when HDA I, rather than the camera CANFD_RADAR_SCC_CAR = {CAR.GENESIS_GV70_1ST_GEN, CAR.KIA_SORENTO_PHEV_4TH_GEN, CAR.KIA_SORENTO_4TH_GEN, CAR.GENESIS_GV80, - CAR.KIA_CARNIVAL_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN} + CAR.KIA_CARNIVAL_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN, CAR.PALISADE_2023} # The camera does SCC on these cars, rather than the radar CAMERA_SCC_CAR = {CAR.KONA_EV_2022, } From c0955a25cd8c81b5011d60fc16f0ae27e29339b6 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 30 Aug 2023 19:43:55 -0400 Subject: [PATCH 75/88] fix --- selfdrive/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 8a38f134931422..554d527968f638 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -2071,6 +2071,6 @@ def match_fw_to_car_fuzzy(live_fw_versions) -> Set[str]: CAR.GENESIS_GV80: dbc_dict('hyundai_canfd_generated', None), CAR.KIA_CARNIVAL_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), CAR.KIA_SORENTO_HEV_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), - CAR.KIA_SORENTO_HEV_4TH_GEN: dbc_dict('hyundai_canfd_generated', None), + CAR.KONA_EV_2ND_GEN: dbc_dict('hyundai_canfd_generated', None), CAR.PALISADE_2023: dbc_dict('hyundai_palisade_2023_generated', None), } From e14c5baecdb88bd169237fda2853ca448b446554 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 30 Aug 2023 23:26:15 -0400 Subject: [PATCH 76/88] bump safety param --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 5feacb3f944e85..1eb6d42593a64d 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 5feacb3f944e852127e1e4d545f2c0bd92e7df6d +Subproject commit 1eb6d42593a64df73d151004250bdcdfb55589f3 From f1aebe5127a4ec659648cdb30d08c0103098090b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 7 Sep 2023 14:11:02 -0700 Subject: [PATCH 77/88] lower lateral limits --- selfdrive/car/hyundai/interface.py | 2 +- selfdrive/car/hyundai/values.py | 6 +++--- selfdrive/car/torque_data/override.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py index d23a74beb06416..6b6b7d8f95e198 100644 --- a/selfdrive/car/hyundai/interface.py +++ b/selfdrive/car/hyundai/interface.py @@ -311,7 +311,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): elif candidate in EV_CAR: ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_EV_GAS - if candidate in (CAR.KONA, CAR.KONA_EV, CAR.KONA_HEV, CAR.KONA_EV_2022): + if candidate in (CAR.KONA, CAR.KONA_EV, CAR.KONA_HEV, CAR.KONA_EV_2022, CAR.PALISADE_2023): ret.flags |= HyundaiFlags.ALT_LIMITS.value ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_ALT_LIMITS diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 196f3ae3a4bc79..41fd45ace708d7 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -49,9 +49,9 @@ def __init__(self, CP): self.STEER_DELTA_DOWN = 3 elif CP.flags & HyundaiFlags.CAN_CANFD: - self.STEER_MAX = 384 - self.STEER_DELTA_UP = 3 - self.STEER_DELTA_DOWN = 6 + self.STEER_MAX = 270 + self.STEER_DELTA_UP = 2 + self.STEER_DELTA_DOWN = 3 # Default for most HKG else: diff --git a/selfdrive/car/torque_data/override.yaml b/selfdrive/car/torque_data/override.yaml index ac054458e9a5f6..acb5050c656d01 100644 --- a/selfdrive/car/torque_data/override.yaml +++ b/selfdrive/car/torque_data/override.yaml @@ -59,7 +59,7 @@ LEXUS IS 2023: [2.0, 2.0, 0.1] KIA SORENTO HYBRID 4TH GEN: [2.5, 2.5, 0.1] HYUNDAI KONA ELECTRIC 2ND GEN: [2.5, 2.5, 0.1] HYUNDAI IONIQ 6 2023: [2.5, 2.5, 0.1] -HYUNDAI PALISADE 2023: [3.0, 2.5, 0.05] +HYUNDAI PALISADE 2023: [2.32, 2.32, 0.05] # Dashcam or fallback configured as ideal car mock: [10.0, 10, 0.0] From ab0a21149dafcb60717b4bb13a8a586da42d3368 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 15 Nov 2023 22:37:37 -0500 Subject: [PATCH 78/88] fix checksum arg --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 846b857b1f6e05..70ff4564dc9afb 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 846b857b1f6e05fb166733d2777f93d3e077cc5d +Subproject commit 70ff4564dc9afb0f90faefc5af7061523459010a From b8074cfe6d2ef6da83b75630029333a8ede8fcfe Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 15 Nov 2023 22:39:28 -0500 Subject: [PATCH 79/88] remove unused --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 70ff4564dc9afb..217a8a9adfff61 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 70ff4564dc9afb0f90faefc5af7061523459010a +Subproject commit 217a8a9adfff619993c4a3c4bbf5c4b15e830c6d From a0d1d04141d5e8a897d91040435a6289f7ab9442 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 15 Nov 2023 22:51:30 -0500 Subject: [PATCH 80/88] sync dbc with generator --- opendbc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc b/opendbc index ad78100a41b7ed..6cd3ea52e69438 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit ad78100a41b7ed407307c0034cca16139f18b9e8 +Subproject commit 6cd3ea52e69438ec5023be1ed6a000d4df9c116f From 1792e9ab43763ec5577b26fe762c352c5e52be1c Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 7 Feb 2024 19:59:06 -0500 Subject: [PATCH 81/88] Add more FW versions --- selfdrive/car/hyundai/values.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 269522dfb72c3e..6b4bdd7aa55d5d 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -2108,12 +2108,14 @@ def match_fw_to_car_fuzzy(live_fw_versions) -> Set[str]: (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.04 99211-S8150 220622', b'\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9150 220708', + b'\xf1\x00ON MFC AT USA LHD 1.00 1.00 99211-S9160 230303', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00LX2_ SCC ----- 1.00 1.01 99110-S8150 ', b'\xf1\x00ON__ SCC ----- 1.00 1.01 99110-S9150 ', b'\xf1\x00LX2_ SCC FHCUP 1.00 1.01 99110-S8150 ', b'\xf1\x00ON__ SCC FHCUP 1.00 1.01 99110-S9150 ', + b'\xf1\x00ON__ SCC FHCUP 1.00 1.00 99110-S9160 ', ], }, } From c596a50ca685c8b42f84e2f60fc324411b35b8e8 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 00:02:57 -0400 Subject: [PATCH 82/88] Missed --- selfdrive/car/torque_data/override.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/torque_data/override.toml b/selfdrive/car/torque_data/override.toml index 993eb3fb3c0fa5..e4ef2847098c45 100644 --- a/selfdrive/car/torque_data/override.toml +++ b/selfdrive/car/torque_data/override.toml @@ -68,6 +68,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_CUSTIN_1ST_GEN" = [2.5, 2.5, 0.1] "LEXUS_GS_F" = [2.5, 2.5, 0.08] "HYUNDAI_STARIA_4TH_GEN" = [1.8, 2.0, 0.15] +"HYUNDAI_PALISADE_2023" = [2.32, 2.32, 0.05] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From c311b6c9509a43c12d78feb53f0a8bc90eb285b3 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 00:03:48 -0400 Subject: [PATCH 83/88] Update docs --- docs/CARS.md | 4 +++- selfdrive/car/hyundai/values.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/CARS.md b/docs/CARS.md index 43bd8a8b30e414..f3b034b51b3254 100644 --- a/docs/CARS.md +++ b/docs/CARS.md @@ -4,7 +4,7 @@ A supported vehicle is one that just works when you install a comma device. All supported cars provide a better experience than any stock system. Supported vehicles reference the US market unless otherwise specified. -# 288 Supported Cars +# 290 Supported Cars |Make|Model|Supported Package|ACC|No ACC accel below|No ALC below|Steering Torque|Resume from stop|Hardware Needed
 |Video| |---|---|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| @@ -106,6 +106,7 @@ A supported vehicle is one that just works when you install a comma device. All |Hyundai|Kona Electric (with HDA II, Korea only) 2023[5](#footnotes)|Smart Cruise Control (SCC)|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai R connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Kona Hybrid 2020|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai I connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Palisade 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Hyundai|Palisade (without HDA II) 2023-24[5](#footnotes)|Highway Driving Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai A connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Cruz 2022-24[5](#footnotes)|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai N connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2019-20|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai D connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Hyundai|Santa Fe 2021-23|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai L connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| @@ -162,6 +163,7 @@ A supported vehicle is one that just works when you install a comma device. All |Kia|Stinger 2018-20|Smart Cruise Control (SCC)|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai C connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Kia|Stinger 2022-23|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai K connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Kia|Telluride 2020-22|All|openpilot available[1](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai H connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| +|Kia|Telluride (without HDA II) 2023-24[5](#footnotes)|Highway Driving Assist|Stock|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 Hyundai L connector
- 1 RJ45 cable (7 ft)
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|CT Hybrid 2017-18|Lexus Safety System+|openpilot available[2](#footnotes)|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|ES 2017-18|All|openpilot available[2](#footnotes)|19 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-empty.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| |Lexus|ES 2019-24|All|openpilot|0 mph|0 mph|[![star](assets/icon-star-full.svg)](##)|[![star](assets/icon-star-full.svg)](##)|
Parts- 1 RJ45 cable (7 ft)
- 1 Toyota A connector
- 1 comma 3X
- 1 comma power v2
- 1 harness box
- 1 mount
- 1 right angle OBD-C cable (1.5 ft)
Buy Here
|| diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 3c269d725ffd9a..6365f73e7899e5 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -307,8 +307,8 @@ class CAR(Platforms): ) HYUNDAI_PALISADE_2023 = HyundaiCanFDPlatformConfig( [ - HyundaiCarDocs("Hyundai Palisade (without HDA II) 2023-24", "All", car_parts=CarParts.common([CarHarness.hyundai_a])), - HyundaiCarDocs("Kia Telluride (without HDA II) 2023-24", "All", car_parts=CarParts.common([CarHarness.hyundai_l])), + HyundaiCarDocs("Hyundai Palisade (without HDA II) 2023-24", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_a])), + HyundaiCarDocs("Kia Telluride (without HDA II) 2023-24", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_l])), ], HYUNDAI_PALISADE.specs, flags=HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.CAN_CANFD_HYBRID | HyundaiFlags.RADAR_SCC, From 0f66f9170e4a7a83f85982ca10eb9a7243b84e29 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 00:17:56 -0400 Subject: [PATCH 84/88] Update RELEASES.md --- RELEASES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index b90bd9f1d783b4..8f5d61f8290390 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,8 @@ Version 0.9.8 (2024-XX-XX) ======================== * Added toggle to enable driver monitoring even when openpilot is not engaged +* Hyundai Palisade (without HDA II) 2023-24 support thanks to sunnyhaibin! +* Kia Telluride (without HDA II) 2023-24 support thanks to sunnyhaibin! Version 0.9.7 (2024-06-13) ======================== From ae1525284e2115475a69b6affd32be7e5de41ac2 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 00:20:53 -0400 Subject: [PATCH 85/88] Add back fingerprints from sync --- selfdrive/car/hyundai/fingerprints.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/selfdrive/car/hyundai/fingerprints.py b/selfdrive/car/hyundai/fingerprints.py index e489a3cf641216..d4fbbf3b0e5998 100644 --- a/selfdrive/car/hyundai/fingerprints.py +++ b/selfdrive/car/hyundai/fingerprints.py @@ -467,6 +467,21 @@ b'\xf1\x00ON MFC AT USA LHD 1.00 1.04 99211-S9100 211227', ], }, + CAR.HYUNDAI_PALISADE_2023: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00LX2 MFC AT USA LHD 1.00 1.04 99211-S8150 220622', + b'\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9150 220708', + b'\xf1\x00ON MFC AT USA LHD 1.00 1.00 99211-S9160 230303', + b'\xf1\x00ON MFC AT USA LHD 1.00 1.01 99211-S9160 230802', + ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00LX2_ SCC ----- 1.00 1.01 99110-S8150 ', + b'\xf1\x00ON__ SCC ----- 1.00 1.01 99110-S9150 ', + b'\xf1\x00LX2_ SCC FHCUP 1.00 1.01 99110-S8150 ', + b'\xf1\x00ON__ SCC FHCUP 1.00 1.01 99110-S9150 ', + b'\xf1\x00ON__ SCC FHCUP 1.00 1.00 99110-S9160 ', + ], + }, CAR.HYUNDAI_VELOSTER: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00JS__ SCC H-CUP 1.00 1.02 95650-J3200 ', From 6b8daf48c595fd6d1f42fd6ed55fbf4ec53919cf Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 00:41:40 -0400 Subject: [PATCH 86/88] Fix typo --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 93463f967788e2..05923f68f72805 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 93463f967788e26587cf810a2f560ad62bed6b73 +Subproject commit 05923f68f7280548c56ec0c1756616d2ae1b2494 From d54f695334fa66359fce5df351174c48766006ed Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 01:00:57 -0400 Subject: [PATCH 87/88] More --- selfdrive/car/hyundai/carstate.py | 2 +- selfdrive/car/hyundai/values.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py index 1a05668d1564d2..9721ee5ccffb3f 100644 --- a/selfdrive/car/hyundai/carstate.py +++ b/selfdrive/car/hyundai/carstate.py @@ -304,7 +304,7 @@ def get_can_parser(self, CP): else: messages.append(("LVR12", 100)) - bus = CanBus(CP).ECAN if CP.flags & HyundaiFlags.CAN_CANFD.value else 0 + bus = CanBus(CP).ECAN if CP.flags & HyundaiFlags.CAN_CANFD_HYBRID.value else 0 return CANParser(DBC[CP.carFingerprint]["pt"], messages, bus) @staticmethod diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index 6365f73e7899e5..ba7540bd3fabda 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -46,7 +46,7 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 - elif CP.flags & HyundaiFlags.CAN_CANFD: + elif CP.flags & HyundaiFlags.CAN_CANFD_HYBRID: self.STEER_MAX = 270 self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 From a49d4b93a43a6aba725f7eb5a4bd53469c52c5c0 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Mon, 17 Jun 2024 01:21:32 -0400 Subject: [PATCH 88/88] Driver torque mismatch fix --- panda | 2 +- selfdrive/car/hyundai/values.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/panda b/panda index 05923f68f72805..d53e847478f9a1 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 05923f68f7280548c56ec0c1756616d2ae1b2494 +Subproject commit d53e847478f9a185f3bc5ae562589b2ac6fc937b diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py index ba7540bd3fabda..58c3ace95f1deb 100644 --- a/selfdrive/car/hyundai/values.py +++ b/selfdrive/car/hyundai/values.py @@ -25,7 +25,7 @@ def __init__(self, CP): self.STEER_THRESHOLD = 150 self.STEER_STEP = 1 # 100 Hz - if CP.carFingerprint in CANFD_CAR: + if CP.carFingerprint in (CANFD_CAR - CAN_CANFD_HYBRID_CAR): self.STEER_MAX = 270 self.STEER_DRIVER_ALLOWANCE = 250 self.STEER_DRIVER_MULTIPLIER = 2 @@ -46,14 +46,11 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 - elif CP.flags & HyundaiFlags.CAN_CANFD_HYBRID: - self.STEER_MAX = 270 - self.STEER_DELTA_UP = 2 - self.STEER_DELTA_DOWN = 3 - # Default for most HKG else: self.STEER_MAX = 384 + if CAN_CANFD_HYBRID_CAR: + self.STEER_DRIVER_ALLOWANCE = 250 class HyundaiFlags(IntFlag):