From 54b7f5961c2e108bdff2385fcef59c55f903b4e9 Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 22 Oct 2024 11:29:57 -0400 Subject: [PATCH 01/77] init --- opendbc/car/hyundai/carstate.py | 2 +- opendbc/car/hyundai/fingerprints.py | 8 ++++++++ opendbc/car/hyundai/values.py | 6 ++++++ opendbc/car/torque_data/override.toml | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 9406d858fb..cc74796b8c 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -218,7 +218,7 @@ def update_canfd(self, cp, cp_cam) -> structs.CarState: # TODO: alt signal usage may be described by cp.vl['BLINKERS']['USE_ALT_LAMP'] left_blinker_sig, right_blinker_sig = "LEFT_LAMP", "RIGHT_LAMP" - if self.CP.carFingerprint == CAR.HYUNDAI_KONA_EV_2ND_GEN: + if self.CP.carFingerprint in (CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.HYUNDAI_SONATA_2024): left_blinker_sig, right_blinker_sig = "LEFT_LAMP_ALT", "RIGHT_LAMP_ALT" ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][left_blinker_sig], cp.vl["BLINKERS"][right_blinker_sig]) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 7496e2bff0..59384c0b60 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -196,6 +196,14 @@ b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.07 99211-L1000 211223', ], }, + CAR.HYUNDAI_SONATA_2024: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.01 99211-L1800 230512' + ], + }, CAR.HYUNDAI_SONATA_LF: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00LF__ SCC F-CUP 1.00 1.00 96401-C2200 ', diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 2eeb337636..0b5b609eaa 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -271,6 +271,12 @@ class CAR(Platforms): CarSpecs(mass=1513, wheelbase=2.84, steerRatio=13.27 * 1.15, tireStiffnessFactor=0.65), # 15% higher at the center seems reasonable flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.CHECKSUM_CRC8, ) + HYUNDAI_SONATA_2024 = HyundaiCanFDPlatformConfig( + [HyundaiCarDocs("Hyundai Sonata 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], + CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81 * 1.15, tireStiffnessFactor=0.65), + # TODO: confirm steerRatio increase + # TODO: confirm tireStiffnessFactor + ) HYUNDAI_SONATA_LF = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2018-19", car_parts=CarParts.common([CarHarness.hyundai_e]))], CarSpecs(mass=1536, wheelbase=2.804, steerRatio=13.27 * 1.15), # 15% higher at the center seems reasonable diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index aad06e8e3e..936bb69fb2 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -72,6 +72,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_STARIA_4TH_GEN" = [1.8, 2.0, 0.15] "GENESIS_GV70_ELECTRIFIED_1ST_GEN" = [1.9, 1.9, 0.09] "GENESIS_G80_2ND_GEN_FL" = [2.5819356441497803, 2.5, 0.11244568973779678] +"HYUNDAI_SONATA_2024" = [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From 7a276a63691d010746a1acd99f0d7f3de21c8ca9 Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 12 Nov 2024 14:11:07 -0500 Subject: [PATCH 02/77] Update routes.py --- opendbc/car/tests/routes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 2e1eca29a0..3252b22bfb 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -130,6 +130,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("6a42c1197b2a8179|2023-09-21--10-23-44", HYUNDAI.KIA_OPTIMA_H_G4_FL), CarTestRoute("c75a59efa0ecd502|2021-03-11--20-52-55", HYUNDAI.KIA_SELTOS), CarTestRoute("5b7c365c50084530|2020-04-15--16-13-24", HYUNDAI.HYUNDAI_SONATA), + CarTestRoute("4267ea8a353cdb36/00000262--8a427003c7", HYUNDAI.HYUNDAI_SONATA_2024), CarTestRoute("b2a38c712dcf90bd|2020-05-18--18-12-48", HYUNDAI.HYUNDAI_SONATA_LF), CarTestRoute("c344fd2492c7a9d2|2023-12-11--09-03-23", HYUNDAI.HYUNDAI_STARIA_4TH_GEN), CarTestRoute("fb3fd42f0baaa2f8|2022-03-30--15-25-05", HYUNDAI.HYUNDAI_TUCSON), From f6f32d6e940c122630ef029704076cb03be32919 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 21 Nov 2024 17:51:19 -0500 Subject: [PATCH 03/77] remove todo --- opendbc/car/hyundai/values.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 213c50ebfb..d4ff1f2c53 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -274,8 +274,6 @@ class CAR(Platforms): HYUNDAI_SONATA_2024 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81 * 1.15, tireStiffnessFactor=0.65), - # TODO: confirm steerRatio increase - # TODO: confirm tireStiffnessFactor ) HYUNDAI_SONATA_LF = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2018-19", car_parts=CarParts.common([CarHarness.hyundai_e]))], From e87ae0190cc9e6d822dfe17b6bdc6d4c82e84df5 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 21 Nov 2024 17:51:46 -0500 Subject: [PATCH 04/77] use default tireStiffnessFactor --- opendbc/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index d4ff1f2c53..1f39d13306 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -273,7 +273,7 @@ class CAR(Platforms): ) HYUNDAI_SONATA_2024 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], - CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81 * 1.15, tireStiffnessFactor=0.65), + CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81 * 1.15), ) HYUNDAI_SONATA_LF = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2018-19", car_parts=CarParts.common([CarHarness.hyundai_e]))], From 062d866e09acef0e2f86ab4ebd6d3d5eb988d6b9 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 21 Nov 2024 17:52:00 -0500 Subject: [PATCH 05/77] remove steerRatio factor --- opendbc/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 1f39d13306..4b726757d3 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -273,7 +273,7 @@ class CAR(Platforms): ) HYUNDAI_SONATA_2024 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], - CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81 * 1.15), + CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81), ) HYUNDAI_SONATA_LF = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2018-19", car_parts=CarParts.common([CarHarness.hyundai_e]))], From 6344abc79b2e823b09a0b40ed7e29e4627aa06b1 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 28 Nov 2024 18:06:34 -0500 Subject: [PATCH 06/77] add new messages --- opendbc/dbc/hyundai_canfd.dbc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index 1ef67c044a..1802ef92f6 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -658,6 +658,19 @@ BO_ 1264 LOCAL_TIME: 8 XXX SG_ MINUTES : 21|6@0+ (1,0) [0|63] "" XXX SG_ SECONDS : 31|8@0+ (1,0) [0|59] "" XXX +BO_ 353 NEW_MSG_161: 32 XXX + SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX + SG_ LKA_ICON : 30|2@1+ (1,0) [0|3] "" XXX + SG_ SSC_CONDITIONS_NOT_MET : 154|1@0+ (1,0) [0|1] "" XXX + SG_ LFA_ICON : 224|1@0+ (1,0) [0|1] "" XXX + +BO_ 354 NEW_MSG_162: 32 XXX + SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX + SG_ FAULT_1 : 219|1@0+ (1,0) [0|1] "" XXX + SG_ FAULT_2 : 246|1@0+ (1,0) [0|1] "" XXX + CM_ 272 "Alternative LKAS message, used on cars such as 2023 Ioniq 6, 2nd gen Kona. Matches LKAS except size is 32 bytes"; CM_ 676 "Contains signals with detailed lane line information. Used by ADAS ECU on HDA 2 vehicles to operate LFA."; CM_ 866 "Contains signals with detailed lane line information. Used by ADAS ECU on HDA 2 vehicles to operate LFA. Used on cars that use message 272."; From 3743da824d60556d2acae7a401662732326149c6 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 28 Nov 2024 18:11:50 -0500 Subject: [PATCH 07/77] block faults --- opendbc/car/hyundai/carcontroller.py | 1 + opendbc/car/hyundai/carstate.py | 8 +++++++- opendbc/car/hyundai/hyundaicanfd.py | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index b0ef691edc..c66379051e 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -117,6 +117,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) + can_sends.append(hyundaicanfd.block_faults(self.packer, self.CAN, CC.enabled, CS.block_faults)) # blinkers if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index e436c872d0..8dfffc30b2 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -50,6 +50,7 @@ def __init__(self, CP): self.buttons_counter = 0 self.cruise_info = {} + self.block_faults = {} # On some cars, CLU15->CF_Clu_VehicleSpeed can oscillate faster than the dash updates. Sample at 5 Hz self.cluster_speed = 0 @@ -267,6 +268,8 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT), *create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise})] + self.block_faults = copy.copy(cp_cam.vl["NEW_MSG_162"]) + return ret def get_can_parsers_canfd(self, CP): @@ -314,7 +317,10 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("SCC_CONTROL", 50), ] - + cam_messages += [ + ("NEW_MSG_162", 20), + ] + return { Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], pt_messages, CanBus(CP).ECAN), Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], cam_messages, CanBus(CP).CAM), diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index d3488ff531..cc3db25070 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -119,6 +119,14 @@ def create_lfahda_cluster(packer, CAN, enabled): } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) +def block_faults(packer, CAN, enabled, block_faults): + values = {s: block_faults[s] for s in block_faults.keys()} + values.update({ + "FAULT_1": 0, + "FAULT_2": 0, + }) + return packer.make_can_msg("NEW_MSG_162", CAN.ECAN, values) + def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control): jerk = 5 From 480c475d176fa7c048a7b1cc0de0556fd7ff4645 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 28 Nov 2024 18:38:12 -0500 Subject: [PATCH 08/77] fix whitespace --- opendbc/car/hyundai/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 8dfffc30b2..9425debe79 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -320,7 +320,7 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("NEW_MSG_162", 20), ] - + return { Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], pt_messages, CanBus(CP).ECAN), Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], cam_messages, CanBus(CP).CAM), From 264c08db9fe9f1bab1d704863e8f474362f2ec2f Mon Sep 17 00:00:00 2001 From: royjr Date: Sun, 1 Dec 2024 17:21:20 -0500 Subject: [PATCH 09/77] fix fp --- opendbc/car/hyundai/fingerprints.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 4a050cbadc..df8cd21f46 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -199,10 +199,11 @@ }, CAR.HYUNDAI_SONATA_2024: { (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', + b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', ], (Ecu.fwdCamera, 0x7c4, None): [ - b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.01 99211-L1800 230512' + b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.01 99211-L1800 230512', + b'\xf1\x00DN8 MFC AT KOR LHD 1.00 1.01 99211-L1800 230512', ], }, CAR.HYUNDAI_SONATA_LF: { From 029cf05951c9027930b604d4ce83f7d815af788b Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 7 Dec 2024 16:11:30 -0500 Subject: [PATCH 10/77] Update carcontroller.py --- opendbc/car/hyundai/carcontroller.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index c66379051e..aab3122be0 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -115,9 +115,11 @@ def update(self, CC, CS, now_nanos): self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING)) # LFA and HDA icons - if self.frame % 5 == 0 and (not hda2 or hda2_long): + if self.frame % 5 == 0 and (not hda2 or hda2_long) and self.car_fingerprint not in (CAR.HYUNDAI_SONATA_2024,): can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) - can_sends.append(hyundaicanfd.block_faults(self.packer, self.CAN, CC.enabled, CS.block_faults)) + if self.frame % 5 == 0 and (not hda2 or hda2_long) and self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024,): + can_sends.append(hyundaicanfd.create_msg_161(self.packer, self.CAN, CC.enabled, CS.msg_161)) + can_sends.append(hyundaicanfd.create_msg_162(self.packer, self.CAN, CC.enabled, CS.msg_162)) # blinkers if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: From 205c6a489636a6a3d2c4f45ac478267d6ab5a17f Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 7 Dec 2024 16:12:49 -0500 Subject: [PATCH 11/77] Update carstate.py --- opendbc/car/hyundai/carstate.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 9425debe79..06fd94214e 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -50,7 +50,8 @@ def __init__(self, CP): self.buttons_counter = 0 self.cruise_info = {} - self.block_faults = {} + self.msg_161 = {} + self.msg_162 = {} # On some cars, CLU15->CF_Clu_VehicleSpeed can oscillate faster than the dash updates. Sample at 5 Hz self.cluster_speed = 0 @@ -230,8 +231,9 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][left_blinker_sig], cp.vl["BLINKERS"][right_blinker_sig]) if self.CP.enableBsm: - ret.leftBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"]["FL_INDICATOR"] != 0 - ret.rightBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"]["FR_INDICATOR"] != 0 + alt = "_ALT" if self.CP.carFingerprint == CAR.HYUNDAI_SONATA_2024 else "" + ret.leftBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"][f"FL_INDICATOR{alt}"] != 0 + ret.rightBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"][f"FR_INDICATOR{alt}"] != 0 # cruise state # CAN FD cars enable on main button press, set available if no TCS faults preventing engagement @@ -268,7 +270,9 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT), *create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise})] - self.block_faults = copy.copy(cp_cam.vl["NEW_MSG_162"]) + if self.CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024,): + self.msg_161 = copy.copy(cp_cam.vl["MSG_161"]) + self.msg_162 = copy.copy(cp_cam.vl["MSG_162"]) return ret @@ -317,9 +321,11 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("SCC_CONTROL", 50), ] - cam_messages += [ - ("NEW_MSG_162", 20), - ] + if self.CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024,): + cam_messages += [ + ("MSG_161", 20), + ("MSG_162", 20), + ] return { Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], pt_messages, CanBus(CP).ECAN), From adc668f4964f7f7a5cac6bc471108949ce40e3e9 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 7 Dec 2024 16:13:35 -0500 Subject: [PATCH 12/77] Update hyundaicanfd.py --- opendbc/car/hyundai/hyundaicanfd.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index cc3db25070..62d8f1694b 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -119,14 +119,30 @@ def create_lfahda_cluster(packer, CAN, enabled): } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) -def block_faults(packer, CAN, enabled, block_faults): - values = {s: block_faults[s] for s in block_faults.keys()} +def create_msg_161(packer, CAN, enabled, msg_161): + values = msg_161.copy() values.update({ - "FAULT_1": 0, - "FAULT_2": 0, + "LFA_ICON": 2 if enabled else 0, + "LKA_ICON": 4 if enabled else 0, + "LANELINE_LEFT": 2 if enabled else 0, + "LANELINE_RIGHT": 2 if enabled else 0, + "CENTERLINE": 1 if enabled else 0, + "DAW_ICON": 0, }) - return packer.make_can_msg("NEW_MSG_162", CAN.ECAN, values) - + if values.get("ALERTS_5") == 5: # use_switch_or_pedal_to_accelerate + values["ALERTS_5"] = 0 + if values.get("ALERTS_2") == 5: # coffee + values.update({"ALERTS_2": 0, "SOUNDS_2": 0}) + return packer.make_can_msg("MSG_161", CAN.ECAN, values) + +def create_msg_162(packer, CAN, enabled, msg_162): + values = msg_162.copy() + values.update({ + "FAULT_LSS": 0, + "FAULT_HDA": 0, + "FAULT_DAS": 0, + }) + return packer.make_can_msg("MSG_162", CAN.ECAN, values) def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control): jerk = 5 From d8c0c389e7f1d8bdabe80b7fd4091dd7fbdf0c53 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 7 Dec 2024 16:14:10 -0500 Subject: [PATCH 13/77] Update hyundai_canfd.dbc --- opendbc/dbc/hyundai_canfd.dbc | 123 ++++++++++++++++++++++++++++++---- 1 file changed, 111 insertions(+), 12 deletions(-) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index 1802ef92f6..9d28bc84c4 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -599,6 +599,8 @@ BO_ 442 BLINDSPOTS_REAR_CORNERS: 24 XXX SG_ FL_INDICATOR : 46|6@0+ (1,0) [0|1] "" XXX SG_ FR_INDICATOR : 54|6@0+ (1,0) [0|63] "" XXX SG_ RIGHT_BLOCKED : 64|1@0+ (1,0) [0|1] "" XXX + SG_ FL_INDICATOR_ALT : 138|1@0+ (1,0) [0|1] "" XXX + SG_ FR_INDICATOR_ALT : 141|1@0+ (1,0) [0|1] "" XXX BO_ 874 BLINDSPOTS_FRONT_CORNER_2: 16 XXX SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX @@ -658,18 +660,115 @@ BO_ 1264 LOCAL_TIME: 8 XXX SG_ MINUTES : 21|6@0+ (1,0) [0|63] "" XXX SG_ SECONDS : 31|8@0+ (1,0) [0|59] "" XXX -BO_ 353 NEW_MSG_161: 32 XXX - SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX - SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX - SG_ LKA_ICON : 30|2@1+ (1,0) [0|3] "" XXX - SG_ SSC_CONDITIONS_NOT_MET : 154|1@0+ (1,0) [0|1] "" XXX - SG_ LFA_ICON : 224|1@0+ (1,0) [0|1] "" XXX - -BO_ 354 NEW_MSG_162: 32 XXX - SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX - SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX - SG_ FAULT_1 : 219|1@0+ (1,0) [0|1] "" XXX - SG_ FAULT_2 : 246|1@0+ (1,0) [0|1] "" XXX +BO_ 353 MSG_161: 32 CCNC + SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX + SG_ FCA_ICON : 24|3@1+ (1,0) [0|7] "" XXX + SG_ FCA_ALT_ICON : 27|3@1+ (1,0) [0|7] "" XXX + SG_ LKA_ICON : 30|3@1+ (1,0) [0|3] "" XXX + SG_ HBA_ICON : 33|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_1 : 36|4@1+ (1,0) [0|15] "" XXX + SG_ ZEROS_2 : 40|2@1+ (1,0) [0|3] "" XXX + SG_ FCA_IMAGE : 42|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_3 : 45|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_4 : 48|3@1+ (1,0) [0|7] "" XXX + SG_ BCA_LEFT : 51|3@1+ (1,0) [0|7] "" XXX + SG_ BCA_RIGHT : 54|3@1+ (1,0) [0|7] "" XXX + SG_ LCA_LEFT_ARROW : 57|3@1+ (1,0) [0|7] "" XXX + SG_ LCA_RIGHT_ARROW : 60|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_5 : 63|1@0+ (1,0) [0|1] "" XXX + SG_ CENTERLINE : 64|2@1+ (1,0) [0|3] "" XXX + SG_ TARGET : 66|3@1+ (1,0) [0|7] "" XXX + SG_ TARGET_POSITION : 69|11@1+ (1,0) [0|7] "" XXX + SG_ LANELINE_LEFT : 80|4@1+ (1,0) [0|15] "" XXX + SG_ LANELINE_LEFT_POSITION : 84|6@1+ (1,0) [0|15] "" XXX + SG_ LANELINE_RIGHT : 90|4@1+ (1,0) [0|15] "" XXX + SG_ LANELINE_RIGHT_POSITION : 94|6@1+ (1,0) [0|3] "" XXX + SG_ LANELINE_CURVATURE : 100|5@1- (1,15) [0|31] "" XXX + SG_ LANE_HIGHLIGHT : 105|4@1+ (1,0) [0|15] "" XXX + SG_ LANE_HIGHLIGHT_DISTANCE : 109|11@1+ (1,0) [0|7] "" XXX + SG_ LANE_LEFT : 120|3@1+ (1,0) [0|7] "" XXX + SG_ LANE_RIGHT : 123|3@1+ (1,0) [0|7] "" XXX + SG_ LANE_ZOOM : 126|2@1+ (1,0) [0|3] "" XXX + SG_ ALERTS_1 : 128|6@1+ (1,0) [0|63] "" XXX + SG_ ALERTS_2 : 134|5@1+ (1,0) [0|3] "" XXX + SG_ ALERTS_3 : 139|4@1+ (1,0) [0|15] "" XXX + SG_ ALERTS_4 : 143|9@1+ (1,0) [0|511] "" XXX + SG_ ALERTS_5 : 152|5@1+ (1,0) [0|7] "" XXX + SG_ MUTE : 157|3@1+ (1,0) [0|7] "" XXX + SG_ SOUNDS_1 : 160|4@1+ (1,0) [0|3] "" XXX + SG_ SOUNDS_2 : 164|4@1+ (1,0) [0|3] "" XXX + SG_ SOUNDS_3 : 168|4@1+ (1,0) [0|15] "" XXX + SG_ SOUNDS_4 : 172|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_6 : 175|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_7 : 176|5@1+ (1,0) [0|31] "" XXX + SG_ SETSPEED_HUD : 181|3@1+ (1,0) [0|3] "" XXX + SG_ DISTANCE_LEAD : 184|5@1+ (1,0) [0|31] "" XXX + SG_ DISTANCE_CAR : 189|3@1+ (1,0) [0|7] "" XXX + SG_ DISTANCE_SPACING : 192|4@1+ (1,0) [0|15] "" XXX + SG_ DISTANCE : 196|4@1+ (1,0) [0|7] "" XXX + SG_ SETSPEED_SPEED : 200|8@1+ (1,0) [0|255] "" XXX + SG_ SETSPEED : 208|4@1+ (1,0) [0|3] "" XXX + SG_ HDA_ICON : 212|4@1+ (1,0) [0|3] "" XXX + SG_ SLA_ICON : 216|4@1+ (1,0) [0|15] "" XXX + SG_ NAV_ICON : 220|4@1+ (1,0) [0|3] "" XXX + SG_ LFA_ICON : 224|4@1+ (1,0) [0|3] "" XXX + SG_ LCA_LEFT_ICON : 228|4@1+ (1,0) [0|15] "" XXX + SG_ LCA_RIGHT_ICON : 232|4@1+ (1,0) [0|15] "" XXX + SG_ BACKGROUND : 236|4@1+ (1,0) [0|15] "" XXX + SG_ DAW_ICON : 240|3@1+ (1,0) [0|7] "" XXX + SG_ CAR_CIRCLE : 243|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_8 : 246|2@1+ (1,0) [0|3] "" XXX + SG_ ZEROS_9 : 248|8@1+ (1,0) [0|255] "" XXX + +BO_ 354 MSG_162: 32 CCNC + SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX + SG_ SPEEDLIMIT_STYLE : 24|4@1+ (1,0) [0|7] "" XXX + SG_ SPEEDLIMIT_FLASH : 28|4@1+ (1,0) [0|15] "" XXX + SG_ SPEEDLIMIT : 32|8@1+ (1,0) [0|255] "" XXX + SG_ SIGNS : 40|8@1+ (1,0) [0|15] "" XXX + SG_ SPEEDLIMIT_WEATHER : 48|4@1+ (1,0) [0|15] "" XXX + SG_ VIBRATE : 52|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_1 : 55|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_2 : 56|8@1+ (1,0) [0|255] "" XXX + SG_ LEAD : 64|5@1+ (1,0) [0|31] "" XXX + SG_ LEAD_DISTANCE : 69|11@1+ (1,0) [0|2047] "" XXX + SG_ LEAD_LATERAL : 80|7@1+ (1,0) [0|127] "" XXX + SG_ ZEROS_3 : 87|1@0+ (1,0) [0|1] "" XXX + SG_ LEAD_ALT : 88|5@1+ (1,0) [0|31] "" XXX + SG_ LEAD_ALT_DISTANCE : 93|11@1+ (1,0) [0|2047] "" XXX + SG_ LEAD_ALT_LATERAL : 104|7@1+ (1,0) [0|127] "" XXX + SG_ ZEROS_4 : 111|1@0+ (1,0) [0|1] "" XXX + SG_ LEAD_LEFT : 112|5@1+ (1,0) [0|31] "" XXX + SG_ LEAD_LEFT_DISTANCE : 117|11@1+ (1,0) [0|2047] "" XXX + SG_ LEAD_LEFT_LATERAL : 128|7@1+ (1,0) [0|127] "" XXX + SG_ ZEROS_5 : 135|1@0+ (1,0) [0|1] "" XXX + SG_ LEAD_RIGHT : 136|5@1+ (1,0) [0|31] "" XXX + SG_ LEAD_RIGHT_DISTANCE : 141|11@1+ (1,0) [0|2047] "" XXX + SG_ LEAD_RIGHT_LATERAL : 152|7@1+ (1,0) [0|127] "" XXX + SG_ ZEROS_6 : 159|1@0+ (1,0) [0|1] "" XXX + SG_ ZEROS_7 : 160|8@1+ (1,0) [0|255] "" XXX + SG_ ZEROS_8 : 168|8@1+ (1,0) [0|255] "" XXX + SG_ ZEROS_9 : 176|8@1+ (1,0) [0|255] "" XXX + SG_ ZEROS_10 : 184|8@1+ (1,0) [0|255] "" XXX + SG_ ZEROS_11 : 192|8@1+ (1,0) [0|255] "" XXX + SG_ ZEROS_12 : 200|8@1+ (1,0) [0|255] "" XXX + SG_ ZEROS_13 : 208|5@1+ (1,0) [0|31] "" XXX + SG_ FAULT_FSS : 213|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_FCA : 216|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_LSS : 219|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_SLA : 222|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_DAW : 225|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_HBA : 228|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_SCC : 231|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_LFA : 234|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_HDA : 237|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_LCA : 240|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_HDP : 243|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_DAS : 246|3@1+ (1,0) [0|7] "" XXX + SG_ FAULT_ESS : 249|3@1+ (1,0) [0|7] "" XXX + SG_ ZEROS_14 : 252|4@1+ (1,0) [0|15] "" XXX CM_ 272 "Alternative LKAS message, used on cars such as 2023 Ioniq 6, 2nd gen Kona. Matches LKAS except size is 32 bytes"; CM_ 676 "Contains signals with detailed lane line information. Used by ADAS ECU on HDA 2 vehicles to operate LFA."; From 446b0c4b0d03b594bb5e37a26ee4e46458f5326d Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 10 Dec 2024 08:17:56 -0500 Subject: [PATCH 14/77] new --- opendbc/car/hyundai/carcontroller.py | 4 +- opendbc/car/hyundai/hyundaicanfd.py | 83 +++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 9 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index aab3122be0..e25cd09f10 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -118,8 +118,8 @@ def update(self, CC, CS, now_nanos): if self.frame % 5 == 0 and (not hda2 or hda2_long) and self.car_fingerprint not in (CAR.HYUNDAI_SONATA_2024,): can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) if self.frame % 5 == 0 and (not hda2 or hda2_long) and self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024,): - can_sends.append(hyundaicanfd.create_msg_161(self.packer, self.CAN, CC.enabled, CS.msg_161)) - can_sends.append(hyundaicanfd.create_msg_162(self.packer, self.CAN, CC.enabled, CS.msg_162)) + can_sends.append(hyundaicanfd.create_msg_161(self.packer, self.CAN, CC.enabled, CS.msg_161, self.CP, hud_control, CS, CC, self.frame)) + can_sends.append(hyundaicanfd.create_msg_162(self.packer, self.CAN, CC.enabled, CS.msg_162, self.CP, hud_control)) # blinkers if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 62d8f1694b..bdc1c626fb 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -1,4 +1,5 @@ from opendbc.car import CanBusBase +from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip from opendbc.car.hyundai.values import HyundaiFlags @@ -119,29 +120,97 @@ def create_lfahda_cluster(packer, CAN, enabled): } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) -def create_msg_161(packer, CAN, enabled, msg_161): +def create_msg_161(packer, CAN, enabled, msg_161, car_params, hud_control, car_state, car_control, frame): values = msg_161.copy() + + # HIDE ALERTS + if values.get("ALERTS_5") == 5: # USE SWITCH OR PEDAL TO ACCELERATE + values["ALERTS_5"] = 0 + if values.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK + values.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) + + # LANELINES + curvature = { + i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i + for i in range(-15, 16) + } values.update({ + "LANELINE_CURVATURE": curvature.get(max(-15, min(int(car_state.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, "LANELINE_LEFT": 2 if enabled else 0, "LANELINE_RIGHT": 2 if enabled else 0, "CENTERLINE": 1 if enabled else 0, - "DAW_ICON": 0, }) - if values.get("ALERTS_5") == 5: # use_switch_or_pedal_to_accelerate - values["ALERTS_5"] = 0 - if values.get("ALERTS_2") == 5: # coffee - values.update({"ALERTS_2": 0, "SOUNDS_2": 0}) + + # LCA + if enabled: + speed_below_threshold = car_state.out.vEgo < 8.94 + values.update({ + "LCA_LEFT_ICON": 0 if car_state.out.leftBlindspot or speed_below_threshold else 2 if car_control.leftBlinker else 1, + "LCA_RIGHT_ICON": 0 if car_state.out.rightBlindspot or speed_below_threshold else 2 if car_control.rightBlinker else 1, + "LCA_LEFT_ARROW": 2 if car_control.leftBlinker else 0, + "LCA_RIGHT_ARROW": 2 if car_control.rightBlinker else 0, + }) + + # LANE DEPARTURE + if hud_control.leftLaneDepart: + values["LANELINE_LEFT"] = 4 if (frame // 50) % 2 == 0 else 1 + if hud_control.rightLaneDepart: + values["LANELINE_RIGHT"] = 4 if (frame // 50) % 2 == 0 else 1 + + if car_params.openpilotLongitudinalControl: + # HIDE ALERTS + if values.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET + values["ALERTS_5"] = 0 + + # SETSPEED + values["SETSPEED"] = 3 if enabled else 1 + values["SETSPEED_HUD"] = 2 if enabled else 1 + values["SETSPEED_SPEED"] = 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s + + # DISTANCE + if 1 <= hud_control.leadDistanceBars <= 3: + values["DISTANCE"] = hud_control.leadDistanceBars + values["DISTANCE_SPACING"] = 1 if enabled else 0 + values["DISTANCE_LEAD"] = 2 if enabled and hud_control.leadVisible else 1 if enabled else 0 + values["DISTANCE_CAR"] = 2 if enabled else 1 + values["ALERTS_3"] = hud_control.leadDistanceBars + 6 + else: + values["DISTANCE"] = 0 + values["DISTANCE_SPACING"] = 0 + values["DISTANCE_LEAD"] = 0 + values["DISTANCE_CAR"] = 0 + + # BACKGROUND + values["BACKGROUND"] = 1 if enabled else 7 + return packer.make_can_msg("MSG_161", CAN.ECAN, values) -def create_msg_162(packer, CAN, enabled, msg_162): +def create_msg_162(packer, CAN, enabled, msg_162, car_params, hud_control): values = msg_162.copy() + + # HIDE FAULTS values.update({ "FAULT_LSS": 0, "FAULT_HDA": 0, "FAULT_DAS": 0, }) + + # LANE DEPARTURE + if hud_control.leftLaneDepart or hud_control.rightLaneDepart: + values["VIBRATE"] = 1 + + if car_params.openpilotLongitudinalControl: + # *** TODO *** LEAD_DISTANCE/LEAD_LATERAL + # LEAD + if hud_control.leadVisible: + values["LEAD"] = 2 if enabled else 1 + values["LEAD_DISTANCE"] = 100 + else: + values["LEAD"] = 0 + values["LEAD_DISTANCE"] = 0 + return packer.make_can_msg("MSG_162", CAN.ECAN, values) def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control): From 26787f8b49abccf4c7b94ca11ca519874bc106f3 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 00:51:35 -0500 Subject: [PATCH 15/77] combine --- opendbc/car/hyundai/carcontroller.py | 10 +-- opendbc/car/hyundai/carstate.py | 22 +++--- opendbc/car/hyundai/hyundaicanfd.py | 104 +++++++++++++-------------- 3 files changed, 67 insertions(+), 69 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index e25cd09f10..235ffa047b 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -115,11 +115,11 @@ def update(self, CC, CS, now_nanos): self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING)) # LFA and HDA icons - if self.frame % 5 == 0 and (not hda2 or hda2_long) and self.car_fingerprint not in (CAR.HYUNDAI_SONATA_2024,): - can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) - if self.frame % 5 == 0 and (not hda2 or hda2_long) and self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024,): - can_sends.append(hyundaicanfd.create_msg_161(self.packer, self.CAN, CC.enabled, CS.msg_161, self.CP, hud_control, CS, CC, self.frame)) - can_sends.append(hyundaicanfd.create_msg_162(self.packer, self.CAN, CC.enabled, CS.msg_162, self.CP, hud_control)) + if self.frame % 5 == 0 and (not hda2 or hda2_long): + if self.car_fingerprint == CAR.HYUNDAI_SONATA_HEV_2024: + can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) + else: + can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) # blinkers if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 06fd94214e..e92b0eaf7c 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -50,6 +50,8 @@ def __init__(self, CP): self.buttons_counter = 0 self.cruise_info = {} + + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_HEV_2024,) self.msg_161 = {} self.msg_162 = {} @@ -224,14 +226,14 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > self.params.STEER_THRESHOLD, 5) ret.steerFaultTemporary = cp.vl["MDPS"]["LKA_FAULT"] != 0 - # TODO: alt signal usage may be described by cp.vl['BLINKERS']['USE_ALT_LAMP'] - left_blinker_sig, right_blinker_sig = "LEFT_LAMP", "RIGHT_LAMP" - if self.CP.carFingerprint in (CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.HYUNDAI_SONATA_2024): - left_blinker_sig, right_blinker_sig = "LEFT_LAMP_ALT", "RIGHT_LAMP_ALT" - ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][left_blinker_sig], - cp.vl["BLINKERS"][right_blinker_sig]) + if self.ccnc_car: + self.msg_161 = copy.copy(cp_cam.vl["MSG_161"]) + self.msg_162 = copy.copy(cp_cam.vl["MSG_162"]) + + alt = "_ALT" if self.ccnc_car else "" + ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][f"LEFT_LAMP{alt}"], + cp.vl["BLINKERS"][f"RIGHT_LAMP{alt}"]) if self.CP.enableBsm: - alt = "_ALT" if self.CP.carFingerprint == CAR.HYUNDAI_SONATA_2024 else "" ret.leftBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"][f"FL_INDICATOR{alt}"] != 0 ret.rightBlindspot = cp.vl["BLINDSPOTS_REAR_CORNERS"][f"FR_INDICATOR{alt}"] != 0 @@ -270,10 +272,6 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.buttonEvents = [*create_button_events(self.cruise_buttons[-1], prev_cruise_buttons, BUTTONS_DICT), *create_button_events(self.main_buttons[-1], prev_main_buttons, {1: ButtonType.mainCruise})] - if self.CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024,): - self.msg_161 = copy.copy(cp_cam.vl["MSG_161"]) - self.msg_162 = copy.copy(cp_cam.vl["MSG_162"]) - return ret def get_can_parsers_canfd(self, CP): @@ -321,7 +319,7 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("SCC_CONTROL", 50), ] - if self.CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024,): + if self.ccnc_car: cam_messages += [ ("MSG_161", 20), ("MSG_162", 20), diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index bdc1c626fb..ad6f1ad9a6 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -120,21 +120,33 @@ def create_lfahda_cluster(packer, CAN, enabled): } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) -def create_msg_161(packer, CAN, enabled, msg_161, car_params, hud_control, car_state, car_control, frame): - values = msg_161.copy() +def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): + ret = [] + + msg_161 = car_state.msg_161.copy() + msg_162 = car_state.msg_162.copy() + enabled = car_control.enabled + hud_control = car_control.hudControl + + # HIDE FAULTS + msg_162.update({ + "FAULT_LSS": 0, + "FAULT_HDA": 0, + "FAULT_DAS": 0, + }) # HIDE ALERTS - if values.get("ALERTS_5") == 5: # USE SWITCH OR PEDAL TO ACCELERATE - values["ALERTS_5"] = 0 - if values.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK - values.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) + if msg_161.get("ALERTS_5") == 5: # USE SWITCH OR PEDAL TO ACCELERATE + msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK + msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) # LANELINES curvature = { i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i for i in range(-15, 16) } - values.update({ + msg_161.update({ "LANELINE_CURVATURE": curvature.get(max(-15, min(int(car_state.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, @@ -146,7 +158,7 @@ def create_msg_161(packer, CAN, enabled, msg_161, car_params, hud_control, car_s # LCA if enabled: speed_below_threshold = car_state.out.vEgo < 8.94 - values.update({ + msg_161.update({ "LCA_LEFT_ICON": 0 if car_state.out.leftBlindspot or speed_below_threshold else 2 if car_control.leftBlinker else 1, "LCA_RIGHT_ICON": 0 if car_state.out.rightBlindspot or speed_below_threshold else 2 if car_control.rightBlinker else 1, "LCA_LEFT_ARROW": 2 if car_control.leftBlinker else 0, @@ -154,64 +166,52 @@ def create_msg_161(packer, CAN, enabled, msg_161, car_params, hud_control, car_s }) # LANE DEPARTURE - if hud_control.leftLaneDepart: - values["LANELINE_LEFT"] = 4 if (frame // 50) % 2 == 0 else 1 - if hud_control.rightLaneDepart: - values["LANELINE_RIGHT"] = 4 if (frame // 50) % 2 == 0 else 1 + if hud_control.leftLaneDepart or hud_control.rightLaneDepart: + msg_162["VIBRATE"] = 1 + if hud_control.leftLaneDepart: + msg_161["LANELINE_LEFT"] = 4 if (frame // 50) % 2 == 0 else 1 + if hud_control.rightLaneDepart: + msg_161["LANELINE_RIGHT"] = 4 if (frame // 50) % 2 == 0 else 1 + if car_params.openpilotLongitudinalControl: # HIDE ALERTS - if values.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET - values["ALERTS_5"] = 0 + if msg_161.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET + msg_161["ALERTS_5"] = 0 + + # BACKGROUND + msg_161["BACKGROUND"] = 1 if enabled else 7 # SETSPEED - values["SETSPEED"] = 3 if enabled else 1 - values["SETSPEED_HUD"] = 2 if enabled else 1 - values["SETSPEED_SPEED"] = 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s + msg_161["SETSPEED"] = 3 if enabled else 1 + msg_161["SETSPEED_HUD"] = 2 if enabled else 1 + msg_161["SETSPEED_SPEED"] = 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s # DISTANCE if 1 <= hud_control.leadDistanceBars <= 3: - values["DISTANCE"] = hud_control.leadDistanceBars - values["DISTANCE_SPACING"] = 1 if enabled else 0 - values["DISTANCE_LEAD"] = 2 if enabled and hud_control.leadVisible else 1 if enabled else 0 - values["DISTANCE_CAR"] = 2 if enabled else 1 - values["ALERTS_3"] = hud_control.leadDistanceBars + 6 + msg_161["DISTANCE"] = hud_control.leadDistanceBars + msg_161["DISTANCE_SPACING"] = 1 if enabled else 0 + msg_161["DISTANCE_LEAD"] = 2 if enabled and hud_control.leadVisible else 1 if enabled else 0 + msg_161["DISTANCE_CAR"] = 2 if enabled else 1 + msg_161["ALERTS_3"] = hud_control.leadDistanceBars + 6 else: - values["DISTANCE"] = 0 - values["DISTANCE_SPACING"] = 0 - values["DISTANCE_LEAD"] = 0 - values["DISTANCE_CAR"] = 0 - - # BACKGROUND - values["BACKGROUND"] = 1 if enabled else 7 + msg_161["DISTANCE"] = 0 + msg_161["DISTANCE_SPACING"] = 0 + msg_161["DISTANCE_LEAD"] = 0 + msg_161["DISTANCE_CAR"] = 0 - return packer.make_can_msg("MSG_161", CAN.ECAN, values) - -def create_msg_162(packer, CAN, enabled, msg_162, car_params, hud_control): - values = msg_162.copy() - - # HIDE FAULTS - values.update({ - "FAULT_LSS": 0, - "FAULT_HDA": 0, - "FAULT_DAS": 0, - }) - - # LANE DEPARTURE - if hud_control.leftLaneDepart or hud_control.rightLaneDepart: - values["VIBRATE"] = 1 - - if car_params.openpilotLongitudinalControl: - # *** TODO *** LEAD_DISTANCE/LEAD_LATERAL # LEAD if hud_control.leadVisible: - values["LEAD"] = 2 if enabled else 1 - values["LEAD_DISTANCE"] = 100 + msg_162["LEAD"] = 2 if enabled else 1 + msg_162["LEAD_DISTANCE"] = 100 else: - values["LEAD"] = 0 - values["LEAD_DISTANCE"] = 0 + msg_162["LEAD"] = 0 + msg_162["LEAD_DISTANCE"] = 0 + + ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) + ret.append(packer.make_can_msg("MSG_162", CAN.ECAN, msg_162)) - return packer.make_can_msg("MSG_162", CAN.ECAN, values) + return ret def create_acc_control(packer, CAN, enabled, accel_last, accel, stopping, gas_override, set_speed, hud_control): jerk = 5 From 9c4a244f3a6128a84248a6b0789d6023d591754e Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 01:10:55 -0500 Subject: [PATCH 16/77] more --- opendbc/car/hyundai/hyundaicanfd.py | 30 ++++++++++++----------------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index ad6f1ad9a6..e6920eb54f 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -142,10 +142,7 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) # LANELINES - curvature = { - i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i - for i in range(-15, 16) - } + curvature = {i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i for i in range(-15, 16)} msg_161.update({ "LANELINE_CURVATURE": curvature.get(max(-15, min(int(car_state.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "LFA_ICON": 2 if enabled else 0, @@ -179,13 +176,13 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): if msg_161.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET msg_161["ALERTS_5"] = 0 - # BACKGROUND - msg_161["BACKGROUND"] = 1 if enabled else 7 - - # SETSPEED - msg_161["SETSPEED"] = 3 if enabled else 1 - msg_161["SETSPEED_HUD"] = 2 if enabled else 1 - msg_161["SETSPEED_SPEED"] = 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s + # BACKGROUND,SETSPEED + msg_161.update({ + "BACKGROUND": 1 if enabled else 7, + "SETSPEED": 3 if enabled else 1, + "SETSPEED_HUD": 2 if enabled else 1, + "SETSPEED_SPEED": 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, + }) # DISTANCE if 1 <= hud_control.leadDistanceBars <= 3: @@ -200,13 +197,10 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): msg_161["DISTANCE_LEAD"] = 0 msg_161["DISTANCE_CAR"] = 0 - # LEAD - if hud_control.leadVisible: - msg_162["LEAD"] = 2 if enabled else 1 - msg_162["LEAD_DISTANCE"] = 100 - else: - msg_162["LEAD"] = 0 - msg_162["LEAD_DISTANCE"] = 0 + msg_162.update({ + "LEAD": 2 if enabled else 1 if hud_control.leadVisible else 0, + "LEAD_DISTANCE": 100 if hud_control.leadVisible else 0, + }) ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) ret.append(packer.make_can_msg("MSG_162", CAN.ECAN, msg_162)) From 5a583ccd248846866906bcdff2e74b0fedbad326 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 01:21:54 -0500 Subject: [PATCH 17/77] wrong car --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 235ffa047b..0e4daa97b1 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint == CAR.HYUNDAI_SONATA_HEV_2024: + if self.car_fingerprint == CAR.HYUNDAI_SONATA_2024: can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index e92b0eaf7c..d3543f1b55 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,7 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_HEV_2024,) + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024,) self.msg_161 = {} self.msg_162 = {} From f485cd9e4c39c860712798554cb89bccbb545c20 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 01:53:47 -0500 Subject: [PATCH 18/77] HYUNDAI_SONATA_HEV_2024 --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 2 +- opendbc/car/hyundai/fingerprints.py | 8 ++++++++ opendbc/car/hyundai/values.py | 4 ++++ opendbc/car/tests/routes.py | 1 + opendbc/car/torque_data/override.toml | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 0e4daa97b1..07f8252d0d 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint == CAR.HYUNDAI_SONATA_2024: + if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024,): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index d3543f1b55..6c7002152c 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,7 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024,) + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024,) self.msg_161 = {} self.msg_162 = {} diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index c9d8e49d6c..4a5ffb1e78 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -951,6 +951,14 @@ b'\xf1\x00DN8HMFC AT USA LHD 1.00 1.07 99211-L1000 211223', ], }, + CAR.HYUNDAI_SONATA_HEV_2024: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00DN8HMFC AT USA LHD 1.00 1.01 99211-L1800 230512', + ], + }, CAR.KIA_SORENTO: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00UMP LKAS AT KOR LHD 1.00 1.00 95740-C5550 S30', diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 4b726757d3..0c16d89bf6 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -311,6 +311,10 @@ class CAR(Platforms): HYUNDAI_SONATA.specs, flags=HyundaiFlags.MANDO_RADAR | HyundaiFlags.CHECKSUM_CRC8 | HyundaiFlags.HYBRID, ) + HYUNDAI_SONATA_HEV_2024 = HyundaiCanFDPlatformConfig( + [HyundaiCarDocs("Hyundai Sonata Hybrid 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], + CarSpecs(mass=1616, wheelbase=2.84, steerRatio=13.27), + ) HYUNDAI_IONIQ_5 = HyundaiCanFDPlatformConfig( [ HyundaiCarDocs("Hyundai Ioniq 5 (Non-US only) 2022-24", "All", car_parts=CarParts.common([CarHarness.hyundai_q])), diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 3252b22bfb..6f2da3ec8c 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -181,6 +181,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("82e9cdd3f43bf83e|2021-05-15--02-42-51", HYUNDAI.HYUNDAI_ELANTRA_2021), CarTestRoute("715ac05b594e9c59|2021-06-20--16-21-07", HYUNDAI.HYUNDAI_ELANTRA_HEV_2021), CarTestRoute("7120aa90bbc3add7|2021-08-02--07-12-31", HYUNDAI.HYUNDAI_SONATA_HYBRID), + CarTestRoute("bc40c72b728178f2/00000006--ee76ae8c42", HYUNDAI.HYUNDAI_SONATA_HEV_2024), CarTestRoute("715ac05b594e9c59|2021-10-27--23-24-56", HYUNDAI.GENESIS_G70_2020), CarTestRoute("6b0d44d22df18134|2023-05-06--10-36-55", HYUNDAI.GENESIS_GV80), diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index 936bb69fb2..ec90903b80 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -73,6 +73,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "GENESIS_GV70_ELECTRIFIED_1ST_GEN" = [1.9, 1.9, 0.09] "GENESIS_G80_2ND_GEN_FL" = [2.5819356441497803, 2.5, 0.11244568973779678] "HYUNDAI_SONATA_2024" = [2.5, 2.5, 0.1] +"HYUNDAI_SONATA_HEV_2024" = [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From 6de4cda6d95128bbdadea516e50ff265ccb1c5e2 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 01:59:35 -0500 Subject: [PATCH 19/77] HYUNDAI_KONA_2ND_GEN --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 2 +- opendbc/car/hyundai/fingerprints.py | 10 ++++++++++ opendbc/car/hyundai/values.py | 4 ++++ opendbc/car/tests/routes.py | 1 + opendbc/car/torque_data/override.toml | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 07f8252d0d..318697c077 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024,): + if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN,): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 6c7002152c..2c7e0eb7ec 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,7 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024,) + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN,) self.msg_161 = {} self.msg_162 = {} diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 4a5ffb1e78..f649400225 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -544,6 +544,16 @@ b'\xf1\x00OS9 LKAS AT USA LHD 1.00 1.00 95740-J9300 g21', ], }, + CAR.HYUNDAI_KONA_2ND_GEN: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00SX2_ RDR ----- 1.00 1.02 99110-BE000 ', + b'\xf1\x00SX2_ RDR ----- 1.00 1.02 99110-BE500 ', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00SX2 MFC AT USA LHD 1.00 1.03 99211-BE000 230517', + b'\xf1\x00SX2 MFC AT USA LHD 1.00 1.07 99211-BE000 240611', + ], + }, CAR.KIA_CEED: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00CD__ SCC F-CUP 1.00 1.02 99110-J7000 ', diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 0c16d89bf6..9192b32c14 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -222,6 +222,10 @@ class CAR(Platforms): CarSpecs(mass=1275, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385), flags=HyundaiFlags.CLUSTER_GEARS | HyundaiFlags.ALT_LIMITS, ) + HYUNDAI_KONA_2ND_GEN = HyundaiCanFDPlatformConfig( + [HyundaiCarDocs("Hyundai Kona 2024", car_parts=CarParts.common([CarHarness.hyundai_l]))], + CarSpecs(mass=1590, wheelbase=2.66, steerRatio=13.6, tireStiffnessFactor=0.385), + ) HYUNDAI_KONA_EV = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Kona Electric 2018-21", car_parts=CarParts.common([CarHarness.hyundai_g]))], CarSpecs(mass=1685, wheelbase=2.6, steerRatio=13.42, tireStiffnessFactor=0.385), diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 6f2da3ec8c..49b8d049b7 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -152,6 +152,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("012c95f06918eca4|2023-01-15--11-19-36", HYUNDAI.HYUNDAI_IONIQ), # openpilot longitudinal enabled CarTestRoute("ab59fe909f626921|2021-10-18--18-34-28", HYUNDAI.HYUNDAI_IONIQ_HEV_2022), CarTestRoute("22d955b2cd499c22|2020-08-10--19-58-21", HYUNDAI.HYUNDAI_KONA), + CarTestRoute("8f4a9150d36961c8/00000001--960c4735d5", HYUNDAI.HYUNDAI_KONA_2ND_GEN), CarTestRoute("efc48acf44b1e64d|2021-05-28--21-05-04", HYUNDAI.HYUNDAI_KONA_EV), CarTestRoute("f90d3cd06caeb6fa|2023-09-06--17-15-47", HYUNDAI.HYUNDAI_KONA_EV), # openpilot longitudinal enabled CarTestRoute("ff973b941a69366f|2022-07-28--22-01-19", HYUNDAI.HYUNDAI_KONA_EV_2022, segment=11), diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index ec90903b80..6ee290147a 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -74,6 +74,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "GENESIS_G80_2ND_GEN_FL" = [2.5819356441497803, 2.5, 0.11244568973779678] "HYUNDAI_SONATA_2024" = [2.5, 2.5, 0.1] "HYUNDAI_SONATA_HEV_2024" = [2.5, 2.5, 0.1] +"HYUNDAI_KONA_2ND_GEN" = [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From f7c4efce67e3fe78a490e96fb2aeec5c1bb7b6df Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 02:00:58 -0500 Subject: [PATCH 20/77] HYUNDAI_KONA_EV_2ND_GEN --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 318697c077..43fb590a15 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN,): + if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN,): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 2c7e0eb7ec..abe75c1870 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,7 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN,) + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN,) self.msg_161 = {} self.msg_162 = {} From ced3afd41ee395ff285f361cae65341e5e2683d8 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 02:05:16 -0500 Subject: [PATCH 21/77] KIA_SORENTO_2024 --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 2 +- opendbc/car/hyundai/fingerprints.py | 8 ++++++++ opendbc/car/hyundai/values.py | 4 ++++ opendbc/car/tests/routes.py | 1 + opendbc/car/torque_data/override.toml | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 43fb590a15..b06d64ab0e 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN,): + if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024,): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index abe75c1870..406f72c8c4 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,7 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN,) + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024,) self.msg_161 = {} self.msg_162 = {} diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index f649400225..7f378447ff 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -1135,6 +1135,14 @@ b'\xf1\x00MQ4_ SCC FHCUP 1.00 1.08 99110-P2000 ', ], }, + CAR.KIA_SORENTO_2024: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00MQ4 MFC AT AUS RHD 1.01 1.04 99210-P2550 231127', + ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00MQ4_ RDR ----- 1.00 1.01 99110-P2500 ', + ], + }, CAR.KIA_SORENTO_HEV_4TH_GEN: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00MQ4HMFC AT KOR LHD 1.00 1.04 99210-P2000 200330', diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 9192b32c14..c5213ee8a0 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -469,6 +469,10 @@ class CAR(Platforms): CarSpecs(mass=3957 * CV.LB_TO_KG, wheelbase=2.81, steerRatio=13.5), # average of the platforms flags=HyundaiFlags.RADAR_SCC, ) + KIA_SORENTO_2024 = HyundaiCanFDPlatformConfig( + [HyundaiCarDocs("Kia Sorento 2024", car_parts=CarParts.common([CarHarness.hyundai_a]))], + CarSpecs(mass=3957 * CV.LB_TO_KG, wheelbase=2.81, steerRatio=13.5), + ) KIA_SORENTO_HEV_4TH_GEN = HyundaiCanFDPlatformConfig( [ HyundaiCarDocs("Kia Sorento Hybrid 2021-23", "All", car_parts=CarParts.common([CarHarness.hyundai_a])), diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 49b8d049b7..c742573bac 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -138,6 +138,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("36e10531feea61a4|2022-07-25--13-37-42", HYUNDAI.HYUNDAI_TUCSON_4TH_GEN), # hybrid CarTestRoute("5875672fc1d4bf57|2020-07-23--21-33-28", HYUNDAI.KIA_SORENTO), CarTestRoute("1d0d000db3370fd0|2023-01-04--22-28-42", HYUNDAI.KIA_SORENTO_4TH_GEN, segment=5), + CarTestRoute("60380edf6d76cb45/00000004--e450afc26c", HYUNDAI.KIA_SORENTO_2024), CarTestRoute("fc19648042eb6896|2023-08-16--11-43-27", HYUNDAI.KIA_SORENTO_HEV_4TH_GEN, segment=14), CarTestRoute("628935d7d3e5f4f7|2022-11-30--01-12-46", HYUNDAI.KIA_SORENTO_HEV_4TH_GEN), # plug-in hybrid CarTestRoute("9c917ba0d42ffe78|2020-04-17--12-43-19", HYUNDAI.HYUNDAI_PALISADE), diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index 6ee290147a..be56ee510f 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -75,6 +75,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_SONATA_2024" = [2.5, 2.5, 0.1] "HYUNDAI_SONATA_HEV_2024" = [2.5, 2.5, 0.1] "HYUNDAI_KONA_2ND_GEN" = [2.5, 2.5, 0.1] +"KIA_SORENTO_2024" = [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From a6142165df781731b8140240acb6b540b1e83c2f Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 02:11:19 -0500 Subject: [PATCH 22/77] KIA_K5_2025 --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 2 +- opendbc/car/hyundai/fingerprints.py | 8 ++++++++ opendbc/car/hyundai/values.py | 4 ++++ opendbc/car/tests/routes.py | 1 + opendbc/car/torque_data/override.toml | 1 + 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index b06d64ab0e..24645ccd87 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024,): + if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024, CAR.KIA_K5_2025,): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 406f72c8c4..492cdb1bcd 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,7 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024,) + self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024, CAR.KIA_K5_2025,) self.msg_161 = {} self.msg_162 = {} diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 7f378447ff..0cd3a18c89 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -616,6 +616,14 @@ b'\xf1\x00DL ESC \t 102"\x08\x10 58910-L3800', ], }, + CAR.KIA_K5_2025: { + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DL3_ RDR ----- 1.00 1.01 99110-L2500 ', + ], + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00DL3 MFC AT USA LHD 1.00 1.04 99210-L2500 240117', + ], + }, CAR.KIA_K5_HEV_2020: { (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00DLhe SCC FHCUP 1.00 1.02 99110-L7000 ', diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index c5213ee8a0..1155924f5b 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -366,6 +366,10 @@ class CAR(Platforms): CarSpecs(mass=3381 * CV.LB_TO_KG, wheelbase=2.85, steerRatio=13.27, tireStiffnessFactor=0.5), # 2021 Kia K5 Steering Ratio (all trims) flags=HyundaiFlags.CHECKSUM_CRC8, ) + KIA_K5_2025 = HyundaiCanFDPlatformConfig( + [HyundaiCarDocs("Kia K5 2025", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_m]))], + CarSpecs(mass=3230 * CV.LB_TO_KG, wheelbase=2.85, steerRatio=13.27), + ) KIA_K5_HEV_2020 = HyundaiPlatformConfig( [HyundaiCarDocs("Kia K5 Hybrid 2020-22", car_parts=CarParts.common([CarHarness.hyundai_a]))], KIA_K5_2021.specs, diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index c742573bac..c044a35032 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -166,6 +166,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("68d6a96e703c00c9|2022-09-10--16-09-39", HYUNDAI.KIA_EV6), # HDA1 CarTestRoute("9b25e8c1484a1b67|2023-04-13--10-41-45", HYUNDAI.KIA_EV6), CarTestRoute("007d5e4ad9f86d13|2021-09-30--15-09-23", HYUNDAI.KIA_K5_2021), + CarTestRoute("todo", HYUNDAI.KIA_K5_2025), CarTestRoute("c58dfc9fc16590e0|2023-01-14--13-51-48", HYUNDAI.KIA_K5_HEV_2020), CarTestRoute("78ad5150de133637|2023-09-13--16-15-57", HYUNDAI.KIA_K8_HEV_1ST_GEN), CarTestRoute("50c6c9b85fd1ff03|2020-10-26--17-56-06", HYUNDAI.KIA_NIRO_EV), diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index be56ee510f..87797dbd08 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -76,6 +76,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_SONATA_HEV_2024" = [2.5, 2.5, 0.1] "HYUNDAI_KONA_2ND_GEN" = [2.5, 2.5, 0.1] "KIA_SORENTO_2024" = [2.5, 2.5, 0.1] +"KIA_K5_2025" = [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From 920d3105e44a02c51e0f4d59d8b96b610dc0beb5 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 02:14:10 -0500 Subject: [PATCH 23/77] < 160 --- opendbc/car/hyundai/carcontroller.py | 9 ++++++++- opendbc/car/hyundai/carstate.py | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 24645ccd87..7215790232 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,14 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024, CAR.KIA_K5_2025,): + if self.car_fingerprint in ( + CAR.HYUNDAI_SONATA_2024, + CAR.HYUNDAI_SONATA_HEV_2024, + CAR.HYUNDAI_KONA_2ND_GEN, + CAR.HYUNDAI_KONA_EV_2ND_GEN, + CAR.KIA_SORENTO_2024, + CAR.KIA_K5_2025, + ): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 492cdb1bcd..f91b9bbc0b 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -51,7 +51,14 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in (CAR.HYUNDAI_SONATA_2024, CAR.HYUNDAI_SONATA_HEV_2024, CAR.HYUNDAI_KONA_2ND_GEN, CAR.HYUNDAI_KONA_EV_2ND_GEN, CAR.KIA_SORENTO_2024, CAR.KIA_K5_2025,) + self.ccnc_car = CP.carFingerprint in ( + CAR.HYUNDAI_SONATA_2024, + CAR.HYUNDAI_SONATA_HEV_2024, + CAR.HYUNDAI_KONA_2ND_GEN, + CAR.HYUNDAI_KONA_EV_2ND_GEN, + CAR.KIA_SORENTO_2024, + CAR.KIA_K5_2025, + ) self.msg_161 = {} self.msg_162 = {} From b640a7679ea97ba4552dfb7b86d8fa54f16d98f0 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 02:16:50 -0500 Subject: [PATCH 24/77] ws --- opendbc/car/hyundai/carcontroller.py | 10 +++++----- opendbc/car/hyundai/carstate.py | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 7215790232..b72155e499 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -117,11 +117,11 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): if self.car_fingerprint in ( - CAR.HYUNDAI_SONATA_2024, - CAR.HYUNDAI_SONATA_HEV_2024, - CAR.HYUNDAI_KONA_2ND_GEN, - CAR.HYUNDAI_KONA_EV_2ND_GEN, - CAR.KIA_SORENTO_2024, + CAR.HYUNDAI_SONATA_2024, + CAR.HYUNDAI_SONATA_HEV_2024, + CAR.HYUNDAI_KONA_2ND_GEN, + CAR.HYUNDAI_KONA_EV_2ND_GEN, + CAR.KIA_SORENTO_2024, CAR.KIA_K5_2025, ): can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index f91b9bbc0b..ba6489933e 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -52,11 +52,11 @@ def __init__(self, CP): self.cruise_info = {} self.ccnc_car = CP.carFingerprint in ( - CAR.HYUNDAI_SONATA_2024, - CAR.HYUNDAI_SONATA_HEV_2024, - CAR.HYUNDAI_KONA_2ND_GEN, - CAR.HYUNDAI_KONA_EV_2ND_GEN, - CAR.KIA_SORENTO_2024, + CAR.HYUNDAI_SONATA_2024, + CAR.HYUNDAI_SONATA_HEV_2024, + CAR.HYUNDAI_KONA_2ND_GEN, + CAR.HYUNDAI_KONA_EV_2ND_GEN, + CAR.KIA_SORENTO_2024, CAR.KIA_K5_2025, ) self.msg_161 = {} From c5fc68ba85b388875ea1979604bc12ea42d39d3f Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 02:35:32 -0500 Subject: [PATCH 25/77] HyundaiFlags.CCNC --- opendbc/car/hyundai/carcontroller.py | 9 +-------- opendbc/car/hyundai/carstate.py | 14 +++----------- opendbc/car/hyundai/values.py | 9 ++++++++- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index 83a6cc3c68..c6e7970966 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,14 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.car_fingerprint in ( - CAR.HYUNDAI_SONATA_2024, - CAR.HYUNDAI_SONATA_HEV_2024, - CAR.HYUNDAI_KONA_2ND_GEN, - CAR.HYUNDAI_KONA_EV_2ND_GEN, - CAR.KIA_SORENTO_2024, - CAR.KIA_K5_2025, - ): + if HyundaiFlags.CCNC: can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index b241efb5d9..f2fd0bc2e4 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -53,14 +53,6 @@ def __init__(self, CP): self.cruise_info = {} - self.ccnc_car = CP.carFingerprint in ( - CAR.HYUNDAI_SONATA_2024, - CAR.HYUNDAI_SONATA_HEV_2024, - CAR.HYUNDAI_KONA_2ND_GEN, - CAR.HYUNDAI_KONA_EV_2ND_GEN, - CAR.KIA_SORENTO_2024, - CAR.KIA_K5_2025, - ) self.msg_161 = {} self.msg_162 = {} @@ -235,11 +227,11 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > self.params.STEER_THRESHOLD, 5) ret.steerFaultTemporary = cp.vl["MDPS"]["LKA_FAULT"] != 0 - if self.ccnc_car: + if HyundaiFlags.CCNC: self.msg_161 = copy.copy(cp_cam.vl["MSG_161"]) self.msg_162 = copy.copy(cp_cam.vl["MSG_162"]) - alt = "_ALT" if self.ccnc_car else "" + alt = "_ALT" if HyundaiFlags.CCNC else "" ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][f"LEFT_LAMP{alt}"], cp.vl["BLINKERS"][f"RIGHT_LAMP{alt}"]) if self.CP.enableBsm: @@ -328,7 +320,7 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("SCC_CONTROL", 50), ] - if self.ccnc_car: + if HyundaiFlags.CCNC: cam_messages += [ ("MSG_161", 20), ("MSG_162", 20), diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 1155924f5b..2ab78884fb 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -98,6 +98,8 @@ class HyundaiFlags(IntFlag): MIN_STEER_32_MPH = 2 ** 23 + CCNC = 2 ** 24 + class Footnote(Enum): CANFD = CarFootnote( @@ -225,6 +227,7 @@ class CAR(Platforms): HYUNDAI_KONA_2ND_GEN = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Hyundai Kona 2024", car_parts=CarParts.common([CarHarness.hyundai_l]))], CarSpecs(mass=1590, wheelbase=2.66, steerRatio=13.6, tireStiffnessFactor=0.385), + flags=HyundaiFlags.CCNC, ) HYUNDAI_KONA_EV = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Kona Electric 2018-21", car_parts=CarParts.common([CarHarness.hyundai_g]))], @@ -240,7 +243,7 @@ class CAR(Platforms): [HyundaiCarDocs("Hyundai Kona Electric (with HDA II, Korea only) 2023", video_link="https://www.youtube.com/watch?v=U2fOCmcQ8hw", car_parts=CarParts.common([CarHarness.hyundai_r]))], CarSpecs(mass=1740, wheelbase=2.66, steerRatio=13.6, tireStiffnessFactor=0.385), - flags=HyundaiFlags.EV | HyundaiFlags.CANFD_NO_RADAR_DISABLE, + flags=HyundaiFlags.EV | HyundaiFlags.CANFD_NO_RADAR_DISABLE | HyundaiFlags.CCNC, ) HYUNDAI_KONA_HEV = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Kona Hybrid 2020", car_parts=CarParts.common([CarHarness.hyundai_i]))], # TODO: check packages, @@ -278,6 +281,7 @@ class CAR(Platforms): HYUNDAI_SONATA_2024 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], CarSpecs(mass=1556, wheelbase=2.84, steerRatio=12.81), + flags=HyundaiFlags.CCNC, ) HYUNDAI_SONATA_LF = HyundaiPlatformConfig( [HyundaiCarDocs("Hyundai Sonata 2018-19", car_parts=CarParts.common([CarHarness.hyundai_e]))], @@ -318,6 +322,7 @@ class CAR(Platforms): HYUNDAI_SONATA_HEV_2024 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Hyundai Sonata Hybrid 2024", "All", car_parts=CarParts.common([CarHarness.hyundai_a]))], CarSpecs(mass=1616, wheelbase=2.84, steerRatio=13.27), + flags=HyundaiFlags.CCNC, ) HYUNDAI_IONIQ_5 = HyundaiCanFDPlatformConfig( [ @@ -369,6 +374,7 @@ class CAR(Platforms): KIA_K5_2025 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Kia K5 2025", "Highway Driving Assist", car_parts=CarParts.common([CarHarness.hyundai_m]))], CarSpecs(mass=3230 * CV.LB_TO_KG, wheelbase=2.85, steerRatio=13.27), + flags=HyundaiFlags.CCNC, ) KIA_K5_HEV_2020 = HyundaiPlatformConfig( [HyundaiCarDocs("Kia K5 Hybrid 2020-22", car_parts=CarParts.common([CarHarness.hyundai_a]))], @@ -476,6 +482,7 @@ class CAR(Platforms): KIA_SORENTO_2024 = HyundaiCanFDPlatformConfig( [HyundaiCarDocs("Kia Sorento 2024", car_parts=CarParts.common([CarHarness.hyundai_a]))], CarSpecs(mass=3957 * CV.LB_TO_KG, wheelbase=2.81, steerRatio=13.5), + flags=HyundaiFlags.CCNC, ) KIA_SORENTO_HEV_4TH_GEN = HyundaiCanFDPlatformConfig( [ From 43bbb5af8214f56ecb9547556117988a115c7647 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 05:12:23 -0500 Subject: [PATCH 26/77] cleaner --- opendbc/car/hyundai/hyundaicanfd.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index e6920eb54f..b777a5d76d 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -170,33 +170,27 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): if hud_control.rightLaneDepart: msg_161["LANELINE_RIGHT"] = 4 if (frame // 50) % 2 == 0 else 1 - + # OPENPILOT LONGITUDINAL if car_params.openpilotLongitudinalControl: + # HIDE ALERTS if msg_161.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET msg_161["ALERTS_5"] = 0 - # BACKGROUND,SETSPEED + # BACKGROUND, SETSPEED, DISTANCE msg_161.update({ "BACKGROUND": 1 if enabled else 7, "SETSPEED": 3 if enabled else 1, "SETSPEED_HUD": 2 if enabled else 1, "SETSPEED_SPEED": 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, + "DISTANCE": hud_control.leadDistanceBars, + "DISTANCE_SPACING": 1 if enabled else 0, + "DISTANCE_LEAD": 2 if enabled and hud_control.leadVisible else 1 if enabled else 0, + "DISTANCE_CAR": 2 if enabled else 1, + "ALERTS_3": hud_control.leadDistanceBars + 6, }) - # DISTANCE - if 1 <= hud_control.leadDistanceBars <= 3: - msg_161["DISTANCE"] = hud_control.leadDistanceBars - msg_161["DISTANCE_SPACING"] = 1 if enabled else 0 - msg_161["DISTANCE_LEAD"] = 2 if enabled and hud_control.leadVisible else 1 if enabled else 0 - msg_161["DISTANCE_CAR"] = 2 if enabled else 1 - msg_161["ALERTS_3"] = hud_control.leadDistanceBars + 6 - else: - msg_161["DISTANCE"] = 0 - msg_161["DISTANCE_SPACING"] = 0 - msg_161["DISTANCE_LEAD"] = 0 - msg_161["DISTANCE_CAR"] = 0 - + # LEAD msg_162.update({ "LEAD": 2 if enabled else 1 if hud_control.leadVisible else 0, "LEAD_DISTANCE": 100 if hud_control.leadVisible else 0, From fb224af386b028eb2bf7218c18cff2fe1cc5c89b Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 05:27:29 -0500 Subject: [PATCH 27/77] shorter --- opendbc/car/hyundai/hyundaicanfd.py | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index b777a5d76d..277ea65c0f 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -120,13 +120,13 @@ def create_lfahda_cluster(packer, CAN, enabled): } return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) -def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): +def create_ccnc(packer, CAN, frame, CP, CC, CS): ret = [] - msg_161 = car_state.msg_161.copy() - msg_162 = car_state.msg_162.copy() - enabled = car_control.enabled - hud_control = car_control.hudControl + msg_161 = CS.msg_161.copy() + msg_162 = CS.msg_162.copy() + enabled = CC.enabled + hud = CC.hudControl # HIDE FAULTS msg_162.update({ @@ -141,10 +141,10 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): if msg_161.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) - # LANELINES + # LANELINES, ICONS curvature = {i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i for i in range(-15, 16)} msg_161.update({ - "LANELINE_CURVATURE": curvature.get(max(-15, min(int(car_state.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, + "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, "LANELINE_LEFT": 2 if enabled else 0, @@ -154,24 +154,24 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): # LCA if enabled: - speed_below_threshold = car_state.out.vEgo < 8.94 + speed_below_threshold = CS.out.vEgo < 8.94 msg_161.update({ - "LCA_LEFT_ICON": 0 if car_state.out.leftBlindspot or speed_below_threshold else 2 if car_control.leftBlinker else 1, - "LCA_RIGHT_ICON": 0 if car_state.out.rightBlindspot or speed_below_threshold else 2 if car_control.rightBlinker else 1, - "LCA_LEFT_ARROW": 2 if car_control.leftBlinker else 0, - "LCA_RIGHT_ARROW": 2 if car_control.rightBlinker else 0, + "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or speed_below_threshold else 2 if CC.leftBlinker else 1, + "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or speed_below_threshold else 2 if CC.rightBlinker else 1, + "LCA_LEFT_ARROW": 2 if CC.leftBlinker else 0, + "LCA_RIGHT_ARROW": 2 if CC.rightBlinker else 0, }) - # LANE DEPARTURE - if hud_control.leftLaneDepart or hud_control.rightLaneDepart: + # LDW + if hud.leftLaneDepart or hud.rightLaneDepart: msg_162["VIBRATE"] = 1 - if hud_control.leftLaneDepart: + if hud.leftLaneDepart: msg_161["LANELINE_LEFT"] = 4 if (frame // 50) % 2 == 0 else 1 - if hud_control.rightLaneDepart: + if hud.rightLaneDepart: msg_161["LANELINE_RIGHT"] = 4 if (frame // 50) % 2 == 0 else 1 - # OPENPILOT LONGITUDINAL - if car_params.openpilotLongitudinalControl: + # OP LONG + if CP.openpilotLongitudinalControl: # HIDE ALERTS if msg_161.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET @@ -182,18 +182,18 @@ def create_ccnc(packer, CAN, frame, car_params, car_control, car_state): "BACKGROUND": 1 if enabled else 7, "SETSPEED": 3 if enabled else 1, "SETSPEED_HUD": 2 if enabled else 1, - "SETSPEED_SPEED": 25 if (s := round(car_state.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, - "DISTANCE": hud_control.leadDistanceBars, + "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, + "DISTANCE": hud.leadDistanceBars, "DISTANCE_SPACING": 1 if enabled else 0, - "DISTANCE_LEAD": 2 if enabled and hud_control.leadVisible else 1 if enabled else 0, + "DISTANCE_LEAD": 2 if enabled and hud.leadVisible else 1 if enabled else 0, "DISTANCE_CAR": 2 if enabled else 1, - "ALERTS_3": hud_control.leadDistanceBars + 6, + "ALERTS_3": hud.leadDistanceBars + 6, }) # LEAD msg_162.update({ - "LEAD": 2 if enabled else 1 if hud_control.leadVisible else 0, - "LEAD_DISTANCE": 100 if hud_control.leadVisible else 0, + "LEAD": 2 if enabled else 1 if hud.leadVisible else 0, + "LEAD_DISTANCE": 100 if hud.leadVisible else 0, }) ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) From 7c60363135268b21aa04a751c6f1dfaa8e9d0ba3 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 05:33:52 -0500 Subject: [PATCH 28/77] combined LANELINE --- opendbc/car/hyundai/hyundaicanfd.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 277ea65c0f..488ad9ec8f 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -147,8 +147,8 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, - "LANELINE_LEFT": 2 if enabled else 0, - "LANELINE_RIGHT": 2 if enabled else 0, + "LANELINE_LEFT": 4 if hud.leftLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.leftLaneDepart else 2 if enabled else 0, + "LANELINE_RIGHT": 4 if hud.rightLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.rightLaneDepart else 2 if enabled else 0, "CENTERLINE": 1 if enabled else 0, }) @@ -165,10 +165,6 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # LDW if hud.leftLaneDepart or hud.rightLaneDepart: msg_162["VIBRATE"] = 1 - if hud.leftLaneDepart: - msg_161["LANELINE_LEFT"] = 4 if (frame // 50) % 2 == 0 else 1 - if hud.rightLaneDepart: - msg_161["LANELINE_RIGHT"] = 4 if (frame // 50) % 2 == 0 else 1 # OP LONG if CP.openpilotLongitudinalControl: From 848e8ab3e326b3b5a574fec92bfad7bf1cbbc2bf Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 05:43:41 -0500 Subject: [PATCH 29/77] lca_min --- opendbc/car/hyundai/hyundaicanfd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 488ad9ec8f..9e69458d0a 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -154,10 +154,10 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # LCA if enabled: - speed_below_threshold = CS.out.vEgo < 8.94 + lca_min = CS.out.vEgo < 8.94 msg_161.update({ - "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or speed_below_threshold else 2 if CC.leftBlinker else 1, - "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or speed_below_threshold else 2 if CC.rightBlinker else 1, + "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or lca_min else 2 if CC.leftBlinker else 1, + "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or lca_min else 2 if CC.rightBlinker else 1, "LCA_LEFT_ARROW": 2 if CC.leftBlinker else 0, "LCA_RIGHT_ARROW": 2 if CC.rightBlinker else 0, }) From 5144e9915ce25e85ba225d039b8b97d620477080 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 05:53:06 -0500 Subject: [PATCH 30/77] combined lca --- opendbc/car/hyundai/hyundaicanfd.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 9e69458d0a..89d472f6c9 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -141,27 +141,23 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): if msg_161.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) - # LANELINES, ICONS + # LANELINES, ICONS, LCA curvature = {i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i for i in range(-15, 16)} + lca_min = CS.out.vEgo < 8.94 + msg_161.update({ - "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, + "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or lca_min or not enabled else 2 if CC.leftBlinker else 1, + "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or lca_min or not enabled else 2 if CC.rightBlinker else 1, + "LCA_LEFT_ARROW": 2 if CC.leftBlinker and enabled else 0, + "LCA_RIGHT_ARROW": 2 if CC.rightBlinker and enabled else 0, "LANELINE_LEFT": 4 if hud.leftLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.leftLaneDepart else 2 if enabled else 0, "LANELINE_RIGHT": 4 if hud.rightLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.rightLaneDepart else 2 if enabled else 0, + "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, "CENTERLINE": 1 if enabled else 0, }) - # LCA - if enabled: - lca_min = CS.out.vEgo < 8.94 - msg_161.update({ - "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or lca_min else 2 if CC.leftBlinker else 1, - "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or lca_min else 2 if CC.rightBlinker else 1, - "LCA_LEFT_ARROW": 2 if CC.leftBlinker else 0, - "LCA_RIGHT_ARROW": 2 if CC.rightBlinker else 0, - }) - # LDW if hud.leftLaneDepart or hud.rightLaneDepart: msg_162["VIBRATE"] = 1 From b31006fc35669b82611986acee3395830c1979f1 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 05:53:26 -0500 Subject: [PATCH 31/77] should be ok --- opendbc/car/hyundai/hyundaicanfd.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 89d472f6c9..d69351de5a 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -143,13 +143,11 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # LANELINES, ICONS, LCA curvature = {i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i for i in range(-15, 16)} - lca_min = CS.out.vEgo < 8.94 - msg_161.update({ "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, - "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or lca_min or not enabled else 2 if CC.leftBlinker else 1, - "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or lca_min or not enabled else 2 if CC.rightBlinker else 1, + "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.leftBlinker else 1, + "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.rightBlinker else 1, "LCA_LEFT_ARROW": 2 if CC.leftBlinker and enabled else 0, "LCA_RIGHT_ARROW": 2 if CC.rightBlinker and enabled else 0, "LANELINE_LEFT": 4 if hud.leftLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.leftLaneDepart else 2 if enabled else 0, From 6df2b93b511d2f78d8edc7ab76444aed758fbe66 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 06:04:11 -0500 Subject: [PATCH 32/77] faster? --- opendbc/car/hyundai/hyundaicanfd.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index d69351de5a..3f38d2d44a 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -129,15 +129,13 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): hud = CC.hudControl # HIDE FAULTS - msg_162.update({ - "FAULT_LSS": 0, - "FAULT_HDA": 0, - "FAULT_DAS": 0, - }) + for f in ("FAULT_LSS", "FAULT_HDA", "FAULT_DAS"): + msg_162[f] = 0 # HIDE ALERTS if msg_161.get("ALERTS_5") == 5: # USE SWITCH OR PEDAL TO ACCELERATE msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) From 8e3d143168b2d0b6af99699372e1581840d58119 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 06:05:38 -0500 Subject: [PATCH 33/77] better comments --- opendbc/car/hyundai/hyundaicanfd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 3f38d2d44a..c26b96eeb8 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -133,10 +133,10 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): msg_162[f] = 0 # HIDE ALERTS - if msg_161.get("ALERTS_5") == 5: # USE SWITCH OR PEDAL TO ACCELERATE + if msg_161.get("ALERTS_5") == 5: # USE_SWITCH_OR_PEDAL_TO_ACCELERATE msg_161["ALERTS_5"] = 0 - if msg_161.get("ALERTS_2") == 5: # CONSIDER TAKING A BREAK + if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) # LANELINES, ICONS, LCA @@ -162,7 +162,7 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): if CP.openpilotLongitudinalControl: # HIDE ALERTS - if msg_161.get("ALERTS_5") == 4: # SMART CRUISE CONTROL CONDITIONS NOT MET + if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET msg_161["ALERTS_5"] = 0 # BACKGROUND, SETSPEED, DISTANCE From e5d8546194b75143a903706cef5211103ccb6802 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 13:39:33 -0500 Subject: [PATCH 34/77] fwdCamera then fwdRadar --- opendbc/car/hyundai/fingerprints.py | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index ce257eb9b4..6593c2052d 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -198,13 +198,13 @@ ], }, CAR.HYUNDAI_SONATA_2024: { - (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', - ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00DN8 MFC AT USA LHD 1.00 1.01 99211-L1800 230512', b'\xf1\x00DN8 MFC AT KOR LHD 1.00 1.01 99211-L1800 230512', ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', + ], }, CAR.HYUNDAI_SONATA_LF: { (Ecu.fwdRadar, 0x7d0, None): [ @@ -545,14 +545,14 @@ ], }, CAR.HYUNDAI_KONA_2ND_GEN: { - (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x00SX2_ RDR ----- 1.00 1.02 99110-BE000 ', - b'\xf1\x00SX2_ RDR ----- 1.00 1.02 99110-BE500 ', - ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00SX2 MFC AT USA LHD 1.00 1.03 99211-BE000 230517', b'\xf1\x00SX2 MFC AT USA LHD 1.00 1.07 99211-BE000 240611', ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00SX2_ RDR ----- 1.00 1.02 99110-BE000 ', + b'\xf1\x00SX2_ RDR ----- 1.00 1.02 99110-BE500 ', + ], }, CAR.KIA_CEED: { (Ecu.fwdRadar, 0x7d0, None): [ @@ -618,12 +618,12 @@ ], }, CAR.KIA_K5_2025: { - (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x00DL3_ RDR ----- 1.00 1.01 99110-L2500 ', - ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00DL3 MFC AT USA LHD 1.00 1.04 99210-L2500 240117', ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DL3_ RDR ----- 1.00 1.01 99110-L2500 ', + ], }, CAR.KIA_K5_HEV_2020: { (Ecu.fwdRadar, 0x7d0, None): [ @@ -702,12 +702,12 @@ ], }, CAR.HYUNDAI_KONA_EV_2ND_GEN: { - (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x00SXev RDR ----- 1.00 1.00 99110-BF000 ', - ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00SX2EMFC AT KOR LHD 1.00 1.00 99211-BF000 230410', ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00SXev RDR ----- 1.00 1.00 99110-BF000 ', + ], }, CAR.KIA_NIRO_EV: { (Ecu.fwdRadar, 0x7d0, None): [ @@ -971,12 +971,12 @@ ], }, CAR.HYUNDAI_SONATA_HEV_2024: { - (Ecu.fwdRadar, 0x7d0, None): [ - b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', - ], (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00DN8HMFC AT USA LHD 1.00 1.01 99211-L1800 230512', ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', + ], }, CAR.KIA_SORENTO: { (Ecu.fwdCamera, 0x7c4, None): [ From 37f3d239beec8362120e23c5827f853b4c0fcacd Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 14 Dec 2024 17:32:42 -0500 Subject: [PATCH 35/77] fix lead distance --- opendbc/car/hyundai/hyundaicanfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index c26b96eeb8..36c41b939c 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -181,7 +181,7 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # LEAD msg_162.update({ "LEAD": 2 if enabled else 1 if hud.leadVisible else 0, - "LEAD_DISTANCE": 100 if hud.leadVisible else 0, + "LEAD_DISTANCE": 150, }) ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) From 3ac1ddd22f810958bd5644585196d6b637c25457 Mon Sep 17 00:00:00 2001 From: royjr Date: Sun, 15 Dec 2024 09:55:42 -0500 Subject: [PATCH 36/77] fix lead --- opendbc/car/hyundai/hyundaicanfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 36c41b939c..b45ee1d706 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -180,7 +180,7 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # LEAD msg_162.update({ - "LEAD": 2 if enabled else 1 if hud.leadVisible else 0, + "LEAD": 2 if enabled and hud.leadVisible else 1 if hud.leadVisible else 0, "LEAD_DISTANCE": 150, }) From 79c6253ad2fb297d239857d6d6535ae1ef1539db Mon Sep 17 00:00:00 2001 From: royjr Date: Sun, 15 Dec 2024 09:56:10 -0500 Subject: [PATCH 37/77] add left/right lane --- opendbc/car/hyundai/hyundaicanfd.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index b45ee1d706..698068caaf 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -148,6 +148,8 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.rightBlinker else 1, "LCA_LEFT_ARROW": 2 if CC.leftBlinker and enabled else 0, "LCA_RIGHT_ARROW": 2 if CC.rightBlinker and enabled else 0, + "LANE_LEFT": 1 if CC.leftBlinker and enabled else 0, + "LANE_RIGHT": 1 if CC.rightBlinker and enabled else 0, "LANELINE_LEFT": 4 if hud.leftLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.leftLaneDepart else 2 if enabled else 0, "LANELINE_RIGHT": 4 if hud.rightLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.rightLaneDepart else 2 if enabled else 0, "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, From 87c1723967767d16ab25434fcabe97bbd55b7bc7 Mon Sep 17 00:00:00 2001 From: royjr Date: Sun, 15 Dec 2024 10:08:36 -0500 Subject: [PATCH 38/77] not needed --- opendbc/car/hyundai/hyundaicanfd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 698068caaf..2a6689a446 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -146,10 +146,10 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LKA_ICON": 4 if enabled else 0, "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.leftBlinker else 1, "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.rightBlinker else 1, - "LCA_LEFT_ARROW": 2 if CC.leftBlinker and enabled else 0, - "LCA_RIGHT_ARROW": 2 if CC.rightBlinker and enabled else 0, - "LANE_LEFT": 1 if CC.leftBlinker and enabled else 0, - "LANE_RIGHT": 1 if CC.rightBlinker and enabled else 0, + "LCA_LEFT_ARROW": 2 if CC.leftBlinker else 0, + "LCA_RIGHT_ARROW": 2 if CC.rightBlinker else 0, + "LANE_LEFT": 1 if CC.leftBlinker else 0, + "LANE_RIGHT": 1 if CC.rightBlinker else 0, "LANELINE_LEFT": 4 if hud.leftLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.leftLaneDepart else 2 if enabled else 0, "LANELINE_RIGHT": 4 if hud.rightLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.rightLaneDepart else 2 if enabled else 0, "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, From 49ef8a0edc859a205cb72e8b24ac456ab0da6dff Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 16 Dec 2024 19:36:20 -0500 Subject: [PATCH 39/77] add kona ev fp --- opendbc/car/hyundai/fingerprints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index 6593c2052d..ceade13e9b 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -704,6 +704,7 @@ CAR.HYUNDAI_KONA_EV_2ND_GEN: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00SX2EMFC AT KOR LHD 1.00 1.00 99211-BF000 230410', + b'\xf1\x00SX2EMFC AT USA LHD 1.00 1.02 99211-BF000 230823', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00SXev RDR ----- 1.00 1.00 99110-BF000 ', From 95f73ae2f158492fe8e28f6096fd3ee9a73df84e Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 16 Dec 2024 21:21:39 -0500 Subject: [PATCH 40/77] add camera data --- opendbc/dbc/hyundai_canfd.dbc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index 9d28bc84c4..d3780328c1 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -770,6 +770,29 @@ BO_ 354 MSG_162: 32 CCNC SG_ FAULT_ESS : 249|3@1+ (1,0) [0|7] "" XXX SG_ ZEROS_14 : 252|4@1+ (1,0) [0|15] "" XXX +BO_ 437 MSG_1B5: 32 XXX + SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX + SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX + SG_ LEFT : 24|2@1+ (1,0) [0|3] "" XXX + SG_ LEFT_LDW : 27|1@0+ (1,0) [0|1] "" XXX + SG_ LEFT_1 : 29|9@1+ (1,0) [0|511] "" XXX + SG_ LEFT_2 : 38|5@1+ (1,0) [0|31] "" XXX + SG_ LEFT_3 : 43|10@1- (1,0) [0|1023] "" XXX + SG_ LEFT_4 : 64|16@1- (1,0) [0|65535] "" XXX + SG_ LEFT_5 : 80|16@1- (1,0) [0|65535] "" XXX + SG_ RIGHT : 96|2@1+ (1,0) [0|3] "" XXX + SG_ RIGHT_LDW : 99|1@0+ (1,0) [0|1] "" XXX + SG_ RIGHT_1 : 101|9@1+ (1,0) [0|511] "" XXX + SG_ RIGHT_2 : 110|5@1+ (1,0) [0|31] "" XXX + SG_ RIGHT_3 : 115|10@1- (1,0) [0|1023] "" XXX + SG_ RIGHT_4 : 128|16@1- (1,0) [0|65535] "" XXX + SG_ RIGHT_5 : 144|16@1- (1,0) [0|65535] "" XXX + SG_ LEAD : 192|2@1+ (1,0) [0|3] "" XXX + SG_ LEAD_1 : 194|6@1+ (1,0) [0|63] "" XXX + SG_ LEAD_2 : 200|11@1- (1,0) [0|4095] "" XXX + SG_ LEAD_3 : 211|1@0+ (1,0) [0|1] "" XXX + SG_ LEAD_DISTANCE : 213|11@1+ (1,0) [0|2047] "" XXX + CM_ 272 "Alternative LKAS message, used on cars such as 2023 Ioniq 6, 2nd gen Kona. Matches LKAS except size is 32 bytes"; CM_ 676 "Contains signals with detailed lane line information. Used by ADAS ECU on HDA 2 vehicles to operate LFA."; CM_ 866 "Contains signals with detailed lane line information. Used by ADAS ECU on HDA 2 vehicles to operate LFA. Used on cars that use message 272."; From 4fd8b2df6a8c755418427eb7c137e54eda495dc1 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 16 Dec 2024 21:45:47 -0500 Subject: [PATCH 41/77] fancy lead --- opendbc/car/hyundai/hyundaicanfd.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 2a6689a446..9c8f4f218f 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -2,6 +2,9 @@ from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip from opendbc.car.hyundai.values import HyundaiFlags +import cereal.messaging as messaging + +sm = messaging.SubMaster(['radarState'], ignore_avg_freq=['radarState']) class CanBus(CanBusBase): @@ -181,10 +184,13 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): }) # LEAD - msg_162.update({ - "LEAD": 2 if enabled and hud.leadVisible else 1 if hud.leadVisible else 0, - "LEAD_DISTANCE": 150, - }) + sm.update() + if sm.updated['radarState']: + lead_one = sm['radarState'].leadOne + if lead_one.dRel != 0: + msg_162["LEAD_DISTANCE"] = max(0, min(int(lead_one.dRel * 3.28084 * 3), 1000)) + msg_162["LEAD_LATERAL"] = - max(-45, min(int(lead_one.yRel * 1), 45)) + msg_162["LEAD"] = 2 if enabled and hud.leadVisible else 1 if hud.leadVisible else 0 ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) ret.append(packer.make_can_msg("MSG_162", CAN.ECAN, msg_162)) From 95719e2cf6ae54b0e8f2f14d768f68665bdd3199 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 16 Dec 2024 23:27:40 -0500 Subject: [PATCH 42/77] check flags too --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index c6e7970966..bcea987d12 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if HyundaiFlags.CCNC: + if self.CP.flags & HyundaiFlags.CCNC: can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index f2fd0bc2e4..15841c859f 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -227,11 +227,11 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > self.params.STEER_THRESHOLD, 5) ret.steerFaultTemporary = cp.vl["MDPS"]["LKA_FAULT"] != 0 - if HyundaiFlags.CCNC: + if self.CP.flags & HyundaiFlags.CCNC: self.msg_161 = copy.copy(cp_cam.vl["MSG_161"]) self.msg_162 = copy.copy(cp_cam.vl["MSG_162"]) - alt = "_ALT" if HyundaiFlags.CCNC else "" + alt = "_ALT" if self.CP.flags & HyundaiFlags.CCNC else "" ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][f"LEFT_LAMP{alt}"], cp.vl["BLINKERS"][f"RIGHT_LAMP{alt}"]) if self.CP.enableBsm: @@ -320,7 +320,7 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("SCC_CONTROL", 50), ] - if HyundaiFlags.CCNC: + if CP.flags & HyundaiFlags.CCNC: cam_messages += [ ("MSG_161", 20), ("MSG_162", 20), From 2a6d2d7f11f79c77a199ea4445d7d69639af3f0d Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 16 Dec 2024 23:35:03 -0500 Subject: [PATCH 43/77] no hda2 --- opendbc/car/hyundai/carcontroller.py | 2 +- opendbc/car/hyundai/carstate.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/carcontroller.py b/opendbc/car/hyundai/carcontroller.py index bcea987d12..772bebee3d 100644 --- a/opendbc/car/hyundai/carcontroller.py +++ b/opendbc/car/hyundai/carcontroller.py @@ -116,7 +116,7 @@ def update(self, CC, CS, now_nanos): # LFA and HDA icons if self.frame % 5 == 0 and (not hda2 or hda2_long): - if self.CP.flags & HyundaiFlags.CCNC: + if self.CP.flags & HyundaiFlags.CCNC and not hda2: can_sends.extend(hyundaicanfd.create_ccnc(self.packer, self.CAN, self.frame, self.CP, CC, CS)) else: can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 15841c859f..848dab8bb4 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -227,11 +227,11 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.steeringPressed = self.update_steering_pressed(abs(ret.steeringTorque) > self.params.STEER_THRESHOLD, 5) ret.steerFaultTemporary = cp.vl["MDPS"]["LKA_FAULT"] != 0 - if self.CP.flags & HyundaiFlags.CCNC: + if self.CP.flags & HyundaiFlags.CCNC and not self.CP.flags & HyundaiFlags.CANFD_HDA2: self.msg_161 = copy.copy(cp_cam.vl["MSG_161"]) self.msg_162 = copy.copy(cp_cam.vl["MSG_162"]) - alt = "_ALT" if self.CP.flags & HyundaiFlags.CCNC else "" + alt = "_ALT" if self.CP.flags & HyundaiFlags.CCNC and not self.CP.flags & HyundaiFlags.CANFD_HDA2 else "" ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_lamp(50, cp.vl["BLINKERS"][f"LEFT_LAMP{alt}"], cp.vl["BLINKERS"][f"RIGHT_LAMP{alt}"]) if self.CP.enableBsm: @@ -320,7 +320,7 @@ def get_can_parsers_canfd(self, CP): cam_messages += [ ("SCC_CONTROL", 50), ] - if CP.flags & HyundaiFlags.CCNC: + if self.CP.flags & HyundaiFlags.CCNC and not self.CP.flags & HyundaiFlags.CANFD_HDA2: cam_messages += [ ("MSG_161", 20), ("MSG_162", 20), From 1fcbb451b084a1c98db38755cfda42d28d3e56d1 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 16 Dec 2024 23:42:04 -0500 Subject: [PATCH 44/77] Revert "fancy lead" This reverts commit 4fd8b2df6a8c755418427eb7c137e54eda495dc1. --- opendbc/car/hyundai/hyundaicanfd.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 9c8f4f218f..2a6689a446 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -2,9 +2,6 @@ from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip from opendbc.car.hyundai.values import HyundaiFlags -import cereal.messaging as messaging - -sm = messaging.SubMaster(['radarState'], ignore_avg_freq=['radarState']) class CanBus(CanBusBase): @@ -184,13 +181,10 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): }) # LEAD - sm.update() - if sm.updated['radarState']: - lead_one = sm['radarState'].leadOne - if lead_one.dRel != 0: - msg_162["LEAD_DISTANCE"] = max(0, min(int(lead_one.dRel * 3.28084 * 3), 1000)) - msg_162["LEAD_LATERAL"] = - max(-45, min(int(lead_one.yRel * 1), 45)) - msg_162["LEAD"] = 2 if enabled and hud.leadVisible else 1 if hud.leadVisible else 0 + msg_162.update({ + "LEAD": 2 if enabled and hud.leadVisible else 1 if hud.leadVisible else 0, + "LEAD_DISTANCE": 150, + }) ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) ret.append(packer.make_can_msg("MSG_162", CAN.ECAN, msg_162)) From fa03f8904650f237fa542aa0d9129df79962a87f Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 17 Dec 2024 14:38:43 -0500 Subject: [PATCH 45/77] block alert on stock long as well --- opendbc/car/hyundai/hyundaicanfd.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 2a6689a446..621c0f81f4 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -133,6 +133,9 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): msg_162[f] = 0 # HIDE ALERTS + if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET + msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_5") == 5: # USE_SWITCH_OR_PEDAL_TO_ACCELERATE msg_161["ALERTS_5"] = 0 @@ -163,10 +166,6 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # OP LONG if CP.openpilotLongitudinalControl: - # HIDE ALERTS - if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET - msg_161["ALERTS_5"] = 0 - # BACKGROUND, SETSPEED, DISTANCE msg_161.update({ "BACKGROUND": 1 if enabled else 7, From 25faeeb77a8edc1eda3f302162cff6f6aad6fe32 Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 18 Dec 2024 10:29:39 -0500 Subject: [PATCH 46/77] blah --- opendbc/car/hyundai/hyundaicanfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 621c0f81f4..35488b004c 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -1,4 +1,4 @@ -from opendbc.car import CanBusBase +blahfrom opendbc.car import CanBusBase from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip from opendbc.car.hyundai.values import HyundaiFlags From c3cce9126d6dcc38975f0586d72bceac803aa278 Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 18 Dec 2024 10:29:45 -0500 Subject: [PATCH 47/77] Revert "blah" This reverts commit 25faeeb77a8edc1eda3f302162cff6f6aad6fe32. --- opendbc/car/hyundai/hyundaicanfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 35488b004c..621c0f81f4 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -1,4 +1,4 @@ -blahfrom opendbc.car import CanBusBase +from opendbc.car import CanBusBase from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip from opendbc.car.hyundai.values import HyundaiFlags From 10d09bb74a8903244e22c4b719ed321a32908e03 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 08:30:08 -0500 Subject: [PATCH 48/77] add sonata hev fp --- opendbc/car/hyundai/fingerprints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index ceade13e9b..ad88c2c48f 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -974,6 +974,7 @@ CAR.HYUNDAI_SONATA_HEV_2024: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00DN8HMFC AT USA LHD 1.00 1.01 99211-L1800 230512', + b'\xf1\x00DN8HMFC AT KOR LHD 1.00 1.01 99211-L1800 230512', ], (Ecu.fwdRadar, 0x7d0, None): [ b'\xf1\x00DN8_ RDR ----- 1.00 1.00 99110-L1800 ', From 951210df848cb4e38c32c34b93da106c1f5fbedf Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 10:11:50 -0500 Subject: [PATCH 49/77] sorento metric fix --- opendbc/car/hyundai/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 848dab8bb4..e0eeec2215 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -97,7 +97,7 @@ def update(self, can_parsers) -> structs.CarState: # Mimic how dash converts to imperial. # Sorento is the only platform where CF_Clu_VehicleSpeed is already imperial when not is_metric # TODO: CGW_USM1->CF_Gway_DrLockSoundRValue may describe this - if not self.is_metric and self.CP.carFingerprint not in (CAR.KIA_SORENTO,): + if not self.is_metric and self.CP.carFingerprint not in (CAR.KIA_SORENTO, KIA_SORENTO_2024,): self.cluster_speed = math.floor(self.cluster_speed * CV.KPH_TO_MPH + CV.KPH_TO_MPH) ret.vEgoCluster = self.cluster_speed * speed_conv From e5b005c5ad9e57fb83f16c2375c0130329e489a4 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 11:09:12 -0500 Subject: [PATCH 50/77] whoops --- opendbc/car/hyundai/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index e0eeec2215..c42ca25397 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -97,7 +97,7 @@ def update(self, can_parsers) -> structs.CarState: # Mimic how dash converts to imperial. # Sorento is the only platform where CF_Clu_VehicleSpeed is already imperial when not is_metric # TODO: CGW_USM1->CF_Gway_DrLockSoundRValue may describe this - if not self.is_metric and self.CP.carFingerprint not in (CAR.KIA_SORENTO, KIA_SORENTO_2024,): + if not self.is_metric and self.CP.carFingerprint not in (CAR.KIA_SORENTO, CAR.KIA_SORENTO_2024,): self.cluster_speed = math.floor(self.cluster_speed * CV.KPH_TO_MPH + CV.KPH_TO_MPH) ret.vEgoCluster = self.cluster_speed * speed_conv From fc6fda1d777dabd8df059e4eb820b19840f33811 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 11:23:17 -0500 Subject: [PATCH 51/77] this hurts --- opendbc/car/hyundai/hyundaicanfd.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 621c0f81f4..e4d8e90db8 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -142,33 +142,20 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) - # LANELINES, ICONS, LCA - curvature = {i: (31 if i == -1 else 13 - abs(i + 15)) if i < 0 else 15 + i for i in range(-15, 16)} + # ICONS, LANELINES msg_161.update({ "LFA_ICON": 2 if enabled else 0, "LKA_ICON": 4 if enabled else 0, - "LCA_LEFT_ICON": 0 if CS.out.leftBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.leftBlinker else 1, - "LCA_RIGHT_ICON": 0 if CS.out.rightBlindspot or CS.out.vEgo < 8.94 or not enabled else 2 if CC.rightBlinker else 1, - "LCA_LEFT_ARROW": 2 if CC.leftBlinker else 0, - "LCA_RIGHT_ARROW": 2 if CC.rightBlinker else 0, - "LANE_LEFT": 1 if CC.leftBlinker else 0, - "LANE_RIGHT": 1 if CC.rightBlinker else 0, - "LANELINE_LEFT": 4 if hud.leftLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.leftLaneDepart else 2 if enabled else 0, - "LANELINE_RIGHT": 4 if hud.rightLaneDepart and (frame // 50) % 2 == 0 else 1 if hud.rightLaneDepart else 2 if enabled else 0, - "LANELINE_CURVATURE": curvature.get(max(-15, min(int(CS.out.steeringAngleDeg / 3), 15)), 14) if enabled else 15, + "LANELINE_LEFT": 2 if enabled else 0, + "LANELINE_RIGHT": 2 if enabled else 0, "CENTERLINE": 1 if enabled else 0, }) - # LDW - if hud.leftLaneDepart or hud.rightLaneDepart: - msg_162["VIBRATE"] = 1 - # OP LONG if CP.openpilotLongitudinalControl: - # BACKGROUND, SETSPEED, DISTANCE + # SETSPEED, DISTANCE msg_161.update({ - "BACKGROUND": 1 if enabled else 7, "SETSPEED": 3 if enabled else 1, "SETSPEED_HUD": 2 if enabled else 1, "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, From 2333093df8c02439f2dc5452158d74683f7900dc Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 19:15:48 -0500 Subject: [PATCH 52/77] fix 161 --- opendbc/car/hyundai/hyundaicanfd.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index e4d8e90db8..fa2c449190 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -144,11 +144,10 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # ICONS, LANELINES msg_161.update({ - "LFA_ICON": 2 if enabled else 0, - "LKA_ICON": 4 if enabled else 0, + "CENTERLINE": 1 if enabled else 0, "LANELINE_LEFT": 2 if enabled else 0, "LANELINE_RIGHT": 2 if enabled else 0, - "CENTERLINE": 1 if enabled else 0, + "LFA_ICON": 2 if enabled else 0, }) # OP LONG From 9d15ca507ee7afbf66b8f05e80d2acdaf441929a Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 19:21:54 -0500 Subject: [PATCH 53/77] add LFAHDA_CLUSTER --- opendbc/car/hyundai/hyundaicanfd.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index fa2c449190..4fd3290d2b 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -150,6 +150,12 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LFA_ICON": 2 if enabled else 0, }) + # LFAHDA_CLUSTER + lfahda_cluster = { + "NEW_SIGNAL_5": 1, + "LFA_ICON": 2 if enabled else 0, + } + # OP LONG if CP.openpilotLongitudinalControl: @@ -171,6 +177,7 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LEAD_DISTANCE": 150, }) + ret.append(packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, lfahda_cluster)) ret.append(packer.make_can_msg("MSG_161", CAN.ECAN, msg_161)) ret.append(packer.make_can_msg("MSG_162", CAN.ECAN, msg_162)) From e8e008d72c4275a58e2e56742e0ee1c860116d81 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 19:32:45 -0500 Subject: [PATCH 54/77] fix LFA --- opendbc/car/hyundai/hyundaicanfd.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 4fd3290d2b..13dae134cf 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -39,16 +39,14 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer): ret = [] + # TODO: gate these changes to ccnc values = { - "LKA_MODE": 2, - "LKA_ICON": 2 if enabled else 1, - "TORQUE_REQUEST": apply_steer, - "LKA_ASSIST": 0, + "NEW_SIGNAL_1": 3 if lat_active else 1, + "TORQUE_REQUEST": apply_steer if lat_active else 0, "STEER_REQ": 1 if lat_active else 0, - "STEER_MODE": 0, - "HAS_LANE_SAFETY": 0, # hide LKAS settings - "NEW_SIGNAL_1": 0, - "NEW_SIGNAL_2": 0, + "NEW_SIGNAL_4": 9, + # TODO: NEW_SIGNAL_3 is 10-32+ sometimes + "NEW_SIGNAL_3": 10 if lat_active else 100, } if CP.flags & HyundaiFlags.CANFD_HDA2: From 96c3b83238b40b74b563804ac327bbb6c481142e Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 19 Dec 2024 20:51:08 -0500 Subject: [PATCH 55/77] new signal for LFAHDA_CLUSTER --- opendbc/dbc/hyundai_canfd.dbc | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index d3780328c1..fa1d31c9d5 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -340,6 +340,7 @@ BO_ 480 LFAHDA_CLUSTER: 16 ADRV SG_ NEW_SIGNAL_2 : 30|1@0+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_3 : 49|1@0+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_4 : 24|1@0+ (1,0) [0|1] "" XXX + SG_ NEW_SIGNAL_5 : 25|1@0+ (1,0) [0|1] "" XXX BO_ 490 ADRV_0x1ea: 32 ADRV SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX From 6a0439dd04fac8a4ac728c6779e43227ac09242b Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 20 Dec 2024 00:10:22 -0500 Subject: [PATCH 56/77] new signal for LFA --- opendbc/dbc/hyundai_canfd.dbc | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index fa1d31c9d5..a179172c31 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -160,6 +160,7 @@ BO_ 298 LFA: 16 ADRV SG_ LKA_ASSIST : 62|1@1+ (1,0) [0|1] "" XXX SG_ LKA_MODE : 24|3@1+ (1,0) [0|7] "" XXX SG_ NEW_SIGNAL_2 : 70|2@0+ (1,0) [0|3] "" XXX + SG_ NEW_SIGNAL_4 : 72|4@1+ (1,0) [0|15] "" XXX SG_ HAS_LANE_SAFETY : 80|1@0+ (1,0) [0|1] "" XXX SG_ NEW_SIGNAL_3 : 111|8@0+ (1,0) [0|255] "" XXX From 8a048e7de79f21b18c759b10d5b4aae97aeba3cf Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 20 Dec 2024 00:11:31 -0500 Subject: [PATCH 57/77] hide for now --- opendbc/car/hyundai/hyundaicanfd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 13dae134cf..2e6a0027bd 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -146,6 +146,7 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LANELINE_LEFT": 2 if enabled else 0, "LANELINE_RIGHT": 2 if enabled else 0, "LFA_ICON": 2 if enabled else 0, + "LKA_ICON": 4 if enabled else 0, }) # LFAHDA_CLUSTER From 5e0a1d98136cd3ccaeb0ce6f5e5a6dadd11b747d Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 20 Dec 2024 00:12:27 -0500 Subject: [PATCH 58/77] ew --- opendbc/car/hyundai/hyundaicanfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 2e6a0027bd..bc82337847 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -46,7 +46,7 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer): "STEER_REQ": 1 if lat_active else 0, "NEW_SIGNAL_4": 9, # TODO: NEW_SIGNAL_3 is 10-32+ sometimes - "NEW_SIGNAL_3": 10 if lat_active else 100, + "NEW_SIGNAL_3": 10 if lat_active else 100, } if CP.flags & HyundaiFlags.CANFD_HDA2: From a5f5b805a927431e4d83d82c7ebd7b5758db0abc Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 20 Dec 2024 02:22:04 -0500 Subject: [PATCH 59/77] keep hidden --- opendbc/car/hyundai/hyundaicanfd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index bc82337847..a97f374258 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -146,7 +146,7 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): "LANELINE_LEFT": 2 if enabled else 0, "LANELINE_RIGHT": 2 if enabled else 0, "LFA_ICON": 2 if enabled else 0, - "LKA_ICON": 4 if enabled else 0, + "LKA_ICON": 0, }) # LFAHDA_CLUSTER From fc22d28b80260fb18c257e1bced0d33c03a521b6 Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 20 Dec 2024 02:59:46 -0500 Subject: [PATCH 60/77] gate LFA --- opendbc/car/hyundai/hyundaicanfd.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index a97f374258..fdf00038d7 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -39,15 +39,26 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer): ret = [] - # TODO: gate these changes to ccnc - values = { - "NEW_SIGNAL_1": 3 if lat_active else 1, - "TORQUE_REQUEST": apply_steer if lat_active else 0, - "STEER_REQ": 1 if lat_active else 0, - "NEW_SIGNAL_4": 9, - # TODO: NEW_SIGNAL_3 is 10-32+ sometimes - "NEW_SIGNAL_3": 10 if lat_active else 100, - } + if CP.flags & HyundaiFlags.CCNC: + values = { + "NEW_SIGNAL_1": 3 if lat_active else 1, + "TORQUE_REQUEST": apply_steer if lat_active else 0, + "STEER_REQ": 1 if lat_active else 0, + "NEW_SIGNAL_4": 9, + "NEW_SIGNAL_3": 10 if lat_active else 100, # TODO: value between 10-32+ sometimes + } + else: + values = { + "LKA_MODE": 2, + "LKA_ICON": 2 if enabled else 1, + "TORQUE_REQUEST": apply_steer, + "LKA_ASSIST": 0, + "STEER_REQ": 1 if lat_active else 0, + "STEER_MODE": 0, + "HAS_LANE_SAFETY": 0, # hide LKAS settings + "NEW_SIGNAL_1": 0, + "NEW_SIGNAL_2": 0, + } if CP.flags & HyundaiFlags.CANFD_HDA2: hda2_lkas_msg = "LKAS_ALT" if CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING else "LKAS" From 931370d37f24a4c49a7190881135422b0fc029f4 Mon Sep 17 00:00:00 2001 From: royjr Date: Fri, 20 Dec 2024 11:39:50 -0500 Subject: [PATCH 61/77] stop lfa beeps --- opendbc/car/hyundai/hyundaicanfd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index fdf00038d7..150a7e370a 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -151,6 +151,9 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) + if msg_161.get("SOUNDS_4") == 2 and msg_161.get("LFA_ICON") in (3, 0,): # LFA BEEPS + msg_161["SOUNDS_4"] = 0 + # ICONS, LANELINES msg_161.update({ "CENTERLINE": 1 if enabled else 0, From f3443201e94e0cacf08055a8d3ccfbfdbc273099 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 21 Dec 2024 00:00:05 -0500 Subject: [PATCH 62/77] hide WATCH_FOR_SURROUNDING_VEHICLES --- opendbc/car/hyundai/hyundaicanfd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 150a7e370a..f6bd05acde 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -142,6 +142,9 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): msg_162[f] = 0 # HIDE ALERTS + if msg_161.get("ALERTS_5") == 2: # WATCH_FOR_SURROUNDING_VEHICLES + msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET msg_161["ALERTS_5"] = 0 From e6dd01aa0c6ad14c27789aa9c36724390a993dff Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 21 Dec 2024 00:06:23 -0500 Subject: [PATCH 63/77] only if enabled --- opendbc/car/hyundai/hyundaicanfd.py | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index f6bd05acde..306800c098 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -137,25 +137,27 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): enabled = CC.enabled hud = CC.hudControl - # HIDE FAULTS - for f in ("FAULT_LSS", "FAULT_HDA", "FAULT_DAS"): - msg_162[f] = 0 + if enabled: - # HIDE ALERTS - if msg_161.get("ALERTS_5") == 2: # WATCH_FOR_SURROUNDING_VEHICLES - msg_161["ALERTS_5"] = 0 + # HIDE FAULTS + for f in ("FAULT_LSS", "FAULT_HDA", "FAULT_DAS"): + msg_162[f] = 0 - if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET - msg_161["ALERTS_5"] = 0 + # HIDE ALERTS + if msg_161.get("ALERTS_5") == 2: # WATCH_FOR_SURROUNDING_VEHICLES + msg_161["ALERTS_5"] = 0 - if msg_161.get("ALERTS_5") == 5: # USE_SWITCH_OR_PEDAL_TO_ACCELERATE - msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET + msg_161["ALERTS_5"] = 0 - if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK - msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) + if msg_161.get("ALERTS_5") == 5: # USE_SWITCH_OR_PEDAL_TO_ACCELERATE + msg_161["ALERTS_5"] = 0 - if msg_161.get("SOUNDS_4") == 2 and msg_161.get("LFA_ICON") in (3, 0,): # LFA BEEPS - msg_161["SOUNDS_4"] = 0 + if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK + msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) + + if msg_161.get("SOUNDS_4") == 2 and msg_161.get("LFA_ICON") in (3, 0,): # LFA BEEPS + msg_161["SOUNDS_4"] = 0 # ICONS, LANELINES msg_161.update({ From b74a35711b2a8b6f6f5f8ed184722b9044056e20 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 21 Dec 2024 17:33:52 -0500 Subject: [PATCH 64/77] Revert "only if enabled" This reverts commit e6dd01aa0c6ad14c27789aa9c36724390a993dff. --- opendbc/car/hyundai/hyundaicanfd.py | 30 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 306800c098..f6bd05acde 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -137,27 +137,25 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): enabled = CC.enabled hud = CC.hudControl - if enabled: + # HIDE FAULTS + for f in ("FAULT_LSS", "FAULT_HDA", "FAULT_DAS"): + msg_162[f] = 0 - # HIDE FAULTS - for f in ("FAULT_LSS", "FAULT_HDA", "FAULT_DAS"): - msg_162[f] = 0 + # HIDE ALERTS + if msg_161.get("ALERTS_5") == 2: # WATCH_FOR_SURROUNDING_VEHICLES + msg_161["ALERTS_5"] = 0 - # HIDE ALERTS - if msg_161.get("ALERTS_5") == 2: # WATCH_FOR_SURROUNDING_VEHICLES - msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET + msg_161["ALERTS_5"] = 0 - if msg_161.get("ALERTS_5") == 4: # SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET - msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_5") == 5: # USE_SWITCH_OR_PEDAL_TO_ACCELERATE + msg_161["ALERTS_5"] = 0 - if msg_161.get("ALERTS_5") == 5: # USE_SWITCH_OR_PEDAL_TO_ACCELERATE - msg_161["ALERTS_5"] = 0 + if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK + msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) - if msg_161.get("ALERTS_2") == 5: # CONSIDER_TAKING_A_BREAK - msg_161.update({"ALERTS_2": 0, "SOUNDS_2": 0, "DAW_ICON": 0}) - - if msg_161.get("SOUNDS_4") == 2 and msg_161.get("LFA_ICON") in (3, 0,): # LFA BEEPS - msg_161["SOUNDS_4"] = 0 + if msg_161.get("SOUNDS_4") == 2 and msg_161.get("LFA_ICON") in (3, 0,): # LFA BEEPS + msg_161["SOUNDS_4"] = 0 # ICONS, LANELINES msg_161.update({ From e04bac7fd35adbf0acc1a82d1c2fef0a82579091 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 00:08:10 -0500 Subject: [PATCH 65/77] fix alerts --- opendbc/dbc/hyundai_canfd.dbc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index a179172c31..99db597652 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -694,8 +694,8 @@ BO_ 353 MSG_161: 32 CCNC SG_ LANE_ZOOM : 126|2@1+ (1,0) [0|3] "" XXX SG_ ALERTS_1 : 128|6@1+ (1,0) [0|63] "" XXX SG_ ALERTS_2 : 134|5@1+ (1,0) [0|3] "" XXX - SG_ ALERTS_3 : 139|4@1+ (1,0) [0|15] "" XXX - SG_ ALERTS_4 : 143|9@1+ (1,0) [0|511] "" XXX + SG_ ALERTS_3 : 139|5@1+ (1,0) [0|15] "" XXX + SG_ ALERTS_4 : 144|8@1+ (1,0) [0|511] "" XXX SG_ ALERTS_5 : 152|5@1+ (1,0) [0|7] "" XXX SG_ MUTE : 157|3@1+ (1,0) [0|7] "" XXX SG_ SOUNDS_1 : 160|4@1+ (1,0) [0|3] "" XXX From 481ff8b997397ef162ac46aa770f13fc49eec3d3 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 00:11:10 -0500 Subject: [PATCH 66/77] add 161 comments --- opendbc/dbc/hyundai_canfd.dbc | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index 99db597652..3221eb4bbf 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -854,3 +854,43 @@ VAL_ 1041 DRIVER_SEATBELT 0 "Unlatched" 1 "Latched"; VAL_ 1041 PASSENGER_SEATBELT 0 "Unlatched" 1 "Latched"; VAL_ 1144 DRIVE_MODE2 3 "Set Sport" 1 "Set Normal" 2 "Set Eco"; VAL_ 1240 DISTANCE_UNIT 1 "Miles" 0 "Kilometers"; +VAL_ 353 FCA_ICON 0 "HIDDEN" 1 "ORANGE" 2 "RED"; +VAL_ 353 FCA_ALT_ICON 0 "HIDDEN" 1 "ORANGE" 3 "RED"; +VAL_ 353 LKA_ICON 0 "HIDDEN" 1 "ORANGE" 3 "GRAY" 4 "GREEN"; +VAL_ 353 HBA_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN"; +VAL_ 353 FCA_IMAGE 0 "HIDDEN" 2 "VISIBLE"; +VAL_ 353 BCA_LEFT 0 "HIDDEN" 1 "VISIBLE" 2 "VISIBLE+ICON"; +VAL_ 353 BCA_RIGHT 0 "HIDDEN" 1 "VISIBLE" 2 "VISIBLE+ICON"; +VAL_ 353 LCA_LEFT_ARROW 0 "HIDDEN" 1 "VISIBLE"; +VAL_ 353 LCA_RIGHT_ARROW 0 "HIDDEN" 1 "VISIBLE"; +VAL_ 353 CENTERLINE 0 "HIDDEN" 1 "GREEN"; +VAL_ 353 TARGET 0 "HIDDEN" 1 "BLUE" 3 "WHITE"; +VAL_ 353 LANELINE_LEFT 0 "GRAY" 1 "HIDDEN" 2 "WHITE" 4 "ORANGE" 6 "GREEN"; +VAL_ 353 LANELINE_RIGHT 0 "GRAY" 1 "HIDDEN" 2 "WHITE" 4 "ORANGE" 6 "GREEN"; +VAL_ 353 LANE_HIGHLIGHT 0 "HIDDEN" 1 "GREEN" 2 "WHITE" 3 "BLUE" 4 "ORANGE" 5 "RED"; +VAL_ 353 LANE_LEFT 0 "HIDDEN" 1 "GREEN"; +VAL_ 353 LANE_RIGHT 0 "HIDDEN" 1 "GREEN"; +VAL_ 353 LANE_ZOOM 0 "ZOOM" 1 "HIDDEN"; +VAL_ 353 ALERTS_1 0 "HIDDEN" 1 "WARNING_ONLY_CAR_CENTER" 2 "WARNING_ONLY_CAR_LEFT" 3 "WARNING_ONLY_CAR_RIGHT" 4 "WARNING_ONLY_LEFT" 5 "WARNING_ONLY_RIGHT" 11 "EMERGENCY_BRAKING_CAR_CENTER" 12 "EMERGENCY_BRAKING_CAR_LEFT" 13 "EMERGENCY_BRAKING_CAR_RIGHT" 14 "EMERGENCY_BRAKING_LEFT" 15 "EMERGENCY_BRAKING_RIGHT" 21 "EMERGENCY_STEERING_CAR_LEFT" 22 "EMERGENCY_STEERING_CAR_RIGHT" 23 "EMERGENCY_STEERING_CAR_LEFT_AWAY" 24 "EMERGENCY_STEERING_CAR_RIGHT_AWAY" 25 "EMERGENCY_STEERING_REAR_LEFT" 26 "EMERGENCY_STEERING_REAR_RIGHT" 33 "DRIVE_CAREFULLY"; +VAL_ 353 ALERTS_2 0 "HIDDEN" 1 "KEEP_HANDS_ON_STEERING_WHEEL" 2 "KEEP_HANDS_ON_STEERING_WHEEL_RED" 3 "LANE_FOLLOWING_ASSIST_DEACTIVATED" 4 "HIGHWAY_DRIVING_ASSIST_DEACTIVATED" 5 "CONSIDER_TAKING_A_BREAK" 6 "PRESS_OK_BUTTON_TO_ENABLE_LANE_CHANGE_ASSIST" 7 "COLLISION_RISK_VEHICLE_TAKING_EMERGENCY_CONTROL" 8 "TAKE_CONTROL_OF_THE_VEHICLE_IMMEDIATELY_VEHICLE_IS_STOPPING" 9 "TAKE_CONTROL_OF_THE_VEHICLE_IMMEDIATELY" 11 "HIGHWAY_DRIVING_PILOT_SYSTEM_DEACTIVATED_AUDIBLE" 12 "KEEP_YOUR_EYES_ON_THE_ROAD" 13 "HIGHWAY_DRIVING_PILOT_CONDITIONS_NOT_MET_AUDIBLE" 14 "COLLISION_RISK_VEHICLE_TAKING_EMERGENCY_CONTROL" 15 "SET_THE_WIPER_AND_LIGHT_CONTROLS_TO_AUTO" 16 "BE_PREPARED_TO_TAKE_CONTROL_OF_THE_VEHICLE_AT_ANY_TIME" 21 "TAKE_CONTROL_OF_THE_VEHICLE_IMMEDIATELY_VEHICLE_IS_STOPPING" 10 "TAKE_CONTROL_OF_THE_VEHICLE_IMMEDIATELY"; +VAL_ 353 ALERTS_3 1 "AUTOMATICALLY_ADJUSTING_TO_THE_POSTED_SPEED_LIMIT" 2 "SET_SPEED_CHANGED" 3 "AUTOMATICALLY_ADJUSTING_TO_THE_POSTED_SPEED_LIMIT" 4 "SET_SPEED_CHANGED" 7 "DISTANCE_1" 8 "DISTANCE_2" 9 "DISTANCE_3" 10 "DISTANCE_4" 17 "DRIVE_CAREFULLY" 18 "CHECK_SURROUNDINGS" 19 "CONDITIONS_NOT_MET" 20 "LANES_NOT_DETECTED" 21 "CURVE_TOO_SHARP" 22 "LANE_TOO_NARROW" 23 "ROAD_TYPE_NOT_SUPPORTED" 24 "UNAVAILABLE_WITH_HAZARD_LIGHTS_ON" 25 "VEHICLE_SPEED_IS_TOO_LOW" 26 "KEEP_HANDS_ON_STEERING_WHEEL" 27 "LANE_TYPE_NOT_SUPPORTED" 28 "LANE_ASSIST_CANCELED_STEERING_INPUT_DETECTED" 0 "HIDDEN"; +VAL_ 353 ALERTS_4 0 "HIDDEN" 1 "TAKE_FOOT_OFF_THE_ACCELERATOR_PEDAL" 2 "TAKE_FOOT_OFF_THE_BRAKE_PEDAL" 3 "UNAVAILABLE_WHILE_HIGHWAY_DRIVING_PILOT_SYSTEM_IS_ACTIVE" 4 "TO_EXIT_HDP_GRASP_THE_STEERING_WHEEL_THEN_PRESS_AND_HOLD_THE_HDP_BUTTON" 5 "ACCELERATOR_PEDAL_OPERATION_LIMITED_FOR_SAFETY" 6 "TURN_OFF_HAZARD_WARNING_LIGHTS_AND_TURN_SIGNAL" 7 "KEEP_THE_DRIVERS_SEAT_IN_A_SAFE_DRIVING_POSITION" 16 "SET_SPEED_CHANGED" 17 "ACTIVATING_WINDSHIELD_DEFOG_TO_MAINTAIN_THE_DRIVERS_VIEW" 18 "SET_THE_WIPER_AND_LIGHT_CONTROLS_TO_AUTO" 19 "VEHICLE_SPEED_REDUCED_FOR_SAFETY_MERGING_LANES_AHEAD" 20 "SPEED_REDUCED_FOR_SAFETY_CONSTRUCTION_ZONE_DETECTED" 21 "VEHICLE_SPEED_LIMITED_SENSOR_DETECTION_RANGE_LIMITED" 22 "PREPARE_TO_TAKE_CONTROL_UNSUPPORTED_ROAD_TYPE_AHEAD" 23 "PREPARE_TO_TAKE_CONTROL_ENTRANCE_AND_EXIT_RAMPS_AHEAD" 24 "PREPARE_TO_TAKE_CONTROL_TOLLGATE_AHEAD" 25 "PREPARE_TO_TAKE_CONTROL_ROAD_EVENT_AHEAD" 26 "CLEARING_PATH_FOR_EMERGENCY_VEHICLE" 27 "VEHICLE_IS_TOO_SLOW_COMPARED_TO_TRAFFIC_FLOW" 28 "AFTER_SUNSET_HDP_IS_AVAILABLE_IN_AN_INSIDE_LANE_BEHIND_A_LEADING_VEHICLE" 29 "VEHICLE_SPEED_LIMITED_MERGING_LANES_AHEAD" 30 "VEHICLE_SPEED_LIMITED_CONSTRUCTION_ZONE_DETECTED" 31 "VEHICLE_SPEED_TEMPORARILY_LIMITED_FOR_SAFETY" 32 "PRESS_AND_HOLD_THE_BUTTON_TO_ACTIVATE_HIGHWAY_DRIVING_PILOT" 40 "HIGHWAY_DRIVING_PILOT_SYSTEM_IS_AVAILABLE" 64 "RESTART_VEHICLE_AFTER_EMERGENCY_STOP" 65 "CONNECTED_SERVICES_UNAVAILABLE" 66 "AVAILABLE_AFTER_VEHICLE_SOFTWARE_IS_UPDATED" 67 "ROAD_TYPE_NOT_SUPPORTED" 68 "ONLY_AVAILABLE_WHILE_DRIVING_ON_HIGHWAY_LANES" 69 "UNAVAILABLE_WHILE_OTHER_WARNINGS_ARE_ACTIVE" 70 "CANNOT_ACTIVATE_AT_ENTRANCE_EXIT_RAMPS" 71 "LANE_UNSUPPORTED" 72 "NOT_AVAILABLE_IN_THIS_COUNTRY" 79 "CHECKING_THE_DETECTION_RANGE_OF_THE_SENSOR" 80 "SHIFT_TO_D" 81 "ENGINE_STOPPED_BY_AUTO_STOP" 82 "INCREASE_DISTANCE_FROM_VEHICLE_AHEAD" 83 "VEHICLE_SPEED_IS_TOO_HIGH" 84 "CENTER_VEHICLE_IN_THE_LANE" 85 "PARKING_ASSIST_IS_ACTIVE" 86 "ESC_ACTIVIATION_REQUIRED" 87 "UNFOLD_SIDE_VIEW_MIRRORS" 88 "UNAVAILABLE_IN_THE_OUTER_LANE_AFTER_SUNSET" 89 "VEHICLE_SPEED_LIMITED_AFTER_SUNSET_FOR_SAFETY" 90 "LEADING_VEHICLE_NOT_DETECTED" 104 "AGGRESSIVE_BRAKING_OR_STEERING_DETECTED" 110 "SENSOR_AUTO_CALIBRATION_IN_PROGRESS_THIS_MAY_TAKE_SEVERAL_MINUTES" 111 "HIGHWAY_DRIVING_PILOT_WILL_BE_AVAILABLE_SHORTLY" 112 "IF_STEERING_WHEEL_IS_USED_HDP_WILL_BE_DEACTIVATED" 120 "IMPACT_DETECTED" 128 "UNSUITABLE_USE_OF_ACCELERATOR_PEDAL_DETECTED" 129 "GEAR_SHIFTER_USE_DETECTED" 130 "UNSUITABLE_BRAKE_PEDAL_USE_DETECTED" 131 "VEHICLE_START_BUTTON_PRESSED" 132 "VEHICLE_HAS_BEEN_STOPPED_FOR_TOO_LONG" 141 "TRAFFIC_CONGESTION_HAS_CLEARED" 142 "ENTRANCE_AND_EXIT_RAMPS_AHEAD" 143 "UNSUPPORTED_LANE_AHEAD" 144 "UNSUPPORTED_ROAD_TYPE_AHEAD" 145 "LANE_DEPARTURE_DETECTED" 146 "MAXIMUM_SPEED_EXCEEDED" 147 "HIGHWAY_DRIVING_PILOT_LIMITED_ABNORMAL_VEHICLE_CONTROLLER_STATUS" 148 "WIPER_LIGHT_CONTROL_SETTINGS_ARE_UNSUITABLE_FOR_USE_WITH_HDP" 149 "WINDSHIELD_DEFOG_SYSTEM_STATUS_IS_UNSUITABLE_FOR_USE_WITH_HDP" 150 "HAZARD_WARNING_LIGHTS_OR_TURN_SIGNAL_OPERATION_DETECTED" 151 "PERFORMING_EVASIVE_STEERING_OBSTACLES_DETECTED_AHEAD" 152 "HIGHWAY_DRIVING_PILOT_LIMITED_SENSOR_DETECTION_RANGE_LIMITED" 160 "CHECK_HIGHWAY_DRIVING_PILOT_SYSTEM" 161 "SAFETY_FUNCTION_ACTIVATED" 176 "CAMERA_OBSCURED" 177 "RADAR_BLOCKED" 178 "LIDAR_BLOCKED" 179 "AIRBAG_WARNING_LIGHT_IS_ON" 180 "ATTACHED_TRAILED_DETECTED" 181 "HIGH_OUTSIDE_TEMPERATURE" 182 "LOW_OUTSIDE_TEMPERATURE" 190 "UNAVAILABLE_DUE_TO_THE_ROAD_EVENT_INFORMATION_RECEIVED" 191 "UNAVAILABLE_NEAR_TOLLGATES" 192 "DRIVERS_SEAT_IS_NOT_IN_A_SAFE_DRIVING_POSITION" 193 "VEHICLE_DRIVING_THE_WRONG_WAY_DETECTED_AHEAD" 194 "EMERGENCY_VEHICLE_DETECTED" 195 "OBSTACLE_DETECTED_AHEAD" 196 "SENSOR_BLOCKED_DUE_TO_RAIN_SNOW_OR_ROAD_DEBRIS" 197 "SLIPPERY_ROAD_SURFACE_DETECTED" 198 "CONSTRUCTION_ZONE_DETECTED_AHEAD" 199 "PEDESTRIAN_DETECTED_AHEAD" 200 "UNSUITABLE_DRIVERS_SEAT_POSITION_DETECTED" 201 "FOLDED_SIDE_VIEW_MIRRORS_DETECTED" 208 "VEHICLE_POSITION_NOT_DETECTED" 209 "LANE_NOT_DETECTED" 210 "DRIVER_NOT_DETECTED" 211 "KEEP_YOUR_EYES_ON_THE_ROAD" 212 "LEADING_VEHICLE_REQUIRED_AFTER_SUNSET" 213 "TBD" 240 "LOW_FUEL" 241 "LOW_TIRE_PRESSURE" 242 "DOOR_OPEN" 243 "TRUNK_OPEN" 244 "HOOD_OPEN" 245 "SEAT_BELT_NOT_FASTENED" 246 "PARKING_BRAKE_ACTIVATED" 247 "LOW_EV_BATTERY" 248 "HDP_DEACTIVATION_DELAYED_RISK_OF_COLLISION_DETECTED" 249 "LIFTGATE_OPENED"; +VAL_ 353 ALERTS_5 0 "HIDDEN" 1 "DRIVERS_GRASP_NOT_DETECTED_DRIVING_SPEED_WILL_BE_LIMITED" 2 "WATCH_FOR_SURROUNDING_VEHICLES" 3 "SMART_CRUISE_CONTROL_DEACTIVATED" 4 "SMART_CRUISE_CONTROL_CONDITIONS_NOT_MET" 5 "USE_SWITCH_OR_PEDAL_TO_ACCELERATE" 6 "DRIVER_ASSISTNCE_SYSTEM_LIMITED_TRAILER_ATTACHED" 7 "DRIVER_ASSISTNCE_SYSTEM_LIMITED_DRIVER_FULL_FACE_NOT_VISIBLE" 11 "LEADING_VEHICLE_IS_DRIVING_AWAY" 12 "STOP_VEHICLE_THEN_TRY_AGAIN" 19 "ACTIVATING_HIGHWAY_DRIVING_PILOT_SYSTEM" 20 "CONTINUING_USE_OF_HIGHWAY_DRIVING_PILOT_WILL_RESULT_IN_DEVIATION_FROM_THE_NAVIGATION_ROUTE" 21 "HIGHWAY_DRIVING_PILOT_SYSTEM_DEACTIVATED_SILENT" 22 "HIGHWAY_DRIVING_PILOT_SYSTEM_NOT_APPLIED" 23 "HIGHWAY_DRIVING_PILOT_CONDITIONS_NOT_MET_SILENT"; +VAL_ 353 MUTE 0 "NONE" 1 "MUTED"; +VAL_ 353 SOUNDS_1 0 "NONE" 3 "FAST BEEP" 6 "CONSTANT BEEP"; +VAL_ 353 SOUNDS_2 0 "NONE" 2 "SINGLE CHIME" 3 "CONSTANT CHIME" 6 "FAST BEEP"; +VAL_ 353 SOUNDS_3 0 "NONE" 3 "SOFT CHIME" 5 "SINGLE CHIME"; +VAL_ 353 SOUNDS_4 0 "NONE" 2 "DOUBLE CHIME"; +VAL_ 353 SETSPEED_HUD 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 3 "WHITE" 5 "CYAN"; +VAL_ 353 DISTANCE_CAR 0 "HIDDEN" 1 "GRAY" 2 "WHITE" 3 "CYAN A"; +VAL_ 353 DISTANCE_SPACING 0 "HIDDEN" 1 "BLUE" 3 "WHITE" 5 "CYAN"; +VAL_ 353 SETSPEED 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 3 "WHITE" 6 "CYAN"; +VAL_ 353 HDA_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 3 "WHITE" 5 "CYAN HDP"; +VAL_ 353 SLA_ICON 0 "HIDDEN" 1 "WHITE UP" 2 "WHITE DOWN" 3 "GREEN UP" 4 "GREEN DOWN"; +VAL_ 353 NAV_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 4 "WHITE"; +VAL_ 353 LFA_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 3 "WHITE" 5 "CYAN"; +VAL_ 353 LCA_LEFT_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 4 "WHITE"; +VAL_ 353 LCA_RIGHT_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 4 "WHITE"; +VAL_ 353 BACKGROUND 0 "HIDDEN" 1 "BLUE" 3 "ORANGE" 4 "FLASHING ORANGE" 6 "FLASHING RED" 7 "GRAY"; +VAL_ 353 DAW_ICON 0 "HIDDEN" 1 "ORANGE"; +VAL_ 353 CAR_CIRCLE 0 "HIDDEN" 1 "GRAY" 2 "CYAN"; From 0379af4eccfdb8f836f7cbdd0eec151494632c0e Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 00:37:15 -0500 Subject: [PATCH 67/77] missed this --- opendbc/dbc/hyundai_canfd.dbc | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index 3221eb4bbf..203720978d 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -882,6 +882,7 @@ VAL_ 353 SOUNDS_2 0 "NONE" 2 "SINGLE CHIME" 3 "CONSTANT CHIME" 6 "FAST BEEP"; VAL_ 353 SOUNDS_3 0 "NONE" 3 "SOFT CHIME" 5 "SINGLE CHIME"; VAL_ 353 SOUNDS_4 0 "NONE" 2 "DOUBLE CHIME"; VAL_ 353 SETSPEED_HUD 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 3 "WHITE" 5 "CYAN"; +VAL_ 353 DISTANCE_LEAD 0 "HIDDEN" 1 "GRAY" 2 "WHITE"; VAL_ 353 DISTANCE_CAR 0 "HIDDEN" 1 "GRAY" 2 "WHITE" 3 "CYAN A"; VAL_ 353 DISTANCE_SPACING 0 "HIDDEN" 1 "BLUE" 3 "WHITE" 5 "CYAN"; VAL_ 353 SETSPEED 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 3 "WHITE" 6 "CYAN"; From 6289a0dfd48c2cf055674007d8d1f45ab58c4ee3 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 00:39:01 -0500 Subject: [PATCH 68/77] hide DRIVE_CAREFULLY --- opendbc/car/hyundai/hyundaicanfd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index f6bd05acde..9a088d0a8b 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -142,6 +142,9 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): msg_162[f] = 0 # HIDE ALERTS + if msg_161.get("ALERTS_3") == 17: # DRIVE_CAREFULLY + msg_161["ALERTS_3"] = 0 + if msg_161.get("ALERTS_5") == 2: # WATCH_FOR_SURROUNDING_VEHICLES msg_161["ALERTS_5"] = 0 From def9487d4f4e9b902fc7dd6895ce358fa6f8b959 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 11:36:55 -0500 Subject: [PATCH 69/77] this was stupid --- opendbc/car/hyundai/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index c42ca25397..848dab8bb4 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -97,7 +97,7 @@ def update(self, can_parsers) -> structs.CarState: # Mimic how dash converts to imperial. # Sorento is the only platform where CF_Clu_VehicleSpeed is already imperial when not is_metric # TODO: CGW_USM1->CF_Gway_DrLockSoundRValue may describe this - if not self.is_metric and self.CP.carFingerprint not in (CAR.KIA_SORENTO, CAR.KIA_SORENTO_2024,): + if not self.is_metric and self.CP.carFingerprint not in (CAR.KIA_SORENTO,): self.cluster_speed = math.floor(self.cluster_speed * CV.KPH_TO_MPH + CV.KPH_TO_MPH) ret.vEgoCluster = self.cluster_speed * speed_conv From 47c83366e08218d4aae85a7c90658ef80c3011ee Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 11:47:15 -0500 Subject: [PATCH 70/77] sorento fix v2 --- opendbc/car/hyundai/carstate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 848dab8bb4..814f103819 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -220,6 +220,9 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) ret.standstill = ret.wheelSpeeds.fl <= STANDSTILL_THRESHOLD and ret.wheelSpeeds.rr <= STANDSTILL_THRESHOLD + if self.is_metric and self.CP.carFingerprint in (CAR.KIA_SORENTO_2024,): + ret.vEgoCluster = ret.vEgo * CV.MPH_TO_KPH + ret.steeringRateDeg = cp.vl["STEERING_SENSORS"]["STEERING_RATE"] ret.steeringAngleDeg = cp.vl["STEERING_SENSORS"]["STEERING_ANGLE"] * -1 ret.steeringTorque = cp.vl["MDPS"]["STEERING_COL_TORQUE"] From d23a3b4cd794c83e72d9d62cf42d62e923375c54 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 19:36:06 -0500 Subject: [PATCH 71/77] Revert "sorento fix v2" This reverts commit 47c83366e08218d4aae85a7c90658ef80c3011ee. --- opendbc/car/hyundai/carstate.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index 814f103819..848dab8bb4 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -220,9 +220,6 @@ def update_canfd(self, can_parsers) -> structs.CarState: ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) ret.standstill = ret.wheelSpeeds.fl <= STANDSTILL_THRESHOLD and ret.wheelSpeeds.rr <= STANDSTILL_THRESHOLD - if self.is_metric and self.CP.carFingerprint in (CAR.KIA_SORENTO_2024,): - ret.vEgoCluster = ret.vEgo * CV.MPH_TO_KPH - ret.steeringRateDeg = cp.vl["STEERING_SENSORS"]["STEERING_RATE"] ret.steeringAngleDeg = cp.vl["STEERING_SENSORS"]["STEERING_ANGLE"] * -1 ret.steeringTorque = cp.vl["MDPS"]["STEERING_COL_TORQUE"] From 2b3598a44b2887c068ca10f21c8476c6d97ba7ac Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 20:14:51 -0500 Subject: [PATCH 72/77] sorento fix v3 --- opendbc/car/hyundai/hyundaicanfd.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index 9a088d0a8b..fa4a9a86d9 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -1,7 +1,7 @@ from opendbc.car import CanBusBase from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip -from opendbc.car.hyundai.values import HyundaiFlags +from opendbc.car.hyundai.values import HyundaiFlags, CAR class CanBus(CanBusBase): @@ -178,11 +178,13 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # OP LONG if CP.openpilotLongitudinalControl: + setspeed_factor = 1 if CS.is_metric and CP.carFingerprint in (CAR.KIA_SORENTO_2024,) else CV.KPH_TO_MPH + # SETSPEED, DISTANCE msg_161.update({ "SETSPEED": 3 if enabled else 1, "SETSPEED_HUD": 2 if enabled else 1, - "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * CV.KPH_TO_MPH)) > 100 else s, + "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * setspeed_factor)) > 100 else s, "DISTANCE": hud.leadDistanceBars, "DISTANCE_SPACING": 1 if enabled else 0, "DISTANCE_LEAD": 2 if enabled and hud.leadVisible else 1 if enabled else 0, From 279ef4c3dff95d9ffc0e5ed9ecbcecd19daa19c2 Mon Sep 17 00:00:00 2001 From: royjr Date: Mon, 23 Dec 2024 23:21:17 -0500 Subject: [PATCH 73/77] metric v4 --- opendbc/car/hyundai/hyundaicanfd.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/opendbc/car/hyundai/hyundaicanfd.py b/opendbc/car/hyundai/hyundaicanfd.py index fa4a9a86d9..26816a44b7 100644 --- a/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc/car/hyundai/hyundaicanfd.py @@ -1,7 +1,7 @@ from opendbc.car import CanBusBase from opendbc.car.common.conversions import Conversions as CV from opendbc.car.common.numpy_fast import clip -from opendbc.car.hyundai.values import HyundaiFlags, CAR +from opendbc.car.hyundai.values import HyundaiFlags class CanBus(CanBusBase): @@ -178,13 +178,11 @@ def create_ccnc(packer, CAN, frame, CP, CC, CS): # OP LONG if CP.openpilotLongitudinalControl: - setspeed_factor = 1 if CS.is_metric and CP.carFingerprint in (CAR.KIA_SORENTO_2024,) else CV.KPH_TO_MPH - # SETSPEED, DISTANCE msg_161.update({ "SETSPEED": 3 if enabled else 1, "SETSPEED_HUD": 2 if enabled else 1, - "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * setspeed_factor)) > 100 else s, + "SETSPEED_SPEED": 25 if (s := round(CS.out.vCruiseCluster * (1 if CS.is_metric else CV.KPH_TO_MPH))) > 100 else s, "DISTANCE": hud.leadDistanceBars, "DISTANCE_SPACING": 1 if enabled else 0, "DISTANCE_LEAD": 2 if enabled and hud.leadVisible else 1 if enabled else 0, From 4fa745fefc0040ef667576935ef7de7ea07dd66f Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 24 Dec 2024 00:52:38 -0500 Subject: [PATCH 74/77] add 162 comments --- opendbc/dbc/hyundai_canfd.dbc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/opendbc/dbc/hyundai_canfd.dbc b/opendbc/dbc/hyundai_canfd.dbc index 203720978d..765257e3c6 100644 --- a/opendbc/dbc/hyundai_canfd.dbc +++ b/opendbc/dbc/hyundai_canfd.dbc @@ -726,7 +726,7 @@ BO_ 353 MSG_161: 32 CCNC BO_ 354 MSG_162: 32 CCNC SG_ CHECKSUM : 0|16@1+ (1,0) [0|65535] "" XXX SG_ COUNTER : 16|8@1+ (1,0) [0|255] "" XXX - SG_ SPEEDLIMIT_STYLE : 24|4@1+ (1,0) [0|7] "" XXX + SG_ COUNTRY : 24|4@1+ (1,0) [0|7] "" XXX SG_ SPEEDLIMIT_FLASH : 28|4@1+ (1,0) [0|15] "" XXX SG_ SPEEDLIMIT : 32|8@1+ (1,0) [0|255] "" XXX SG_ SIGNS : 40|8@1+ (1,0) [0|15] "" XXX @@ -895,3 +895,25 @@ VAL_ 353 LCA_RIGHT_ICON 0 "HIDDEN" 1 "GRAY" 2 "GREEN" 4 "WHITE"; VAL_ 353 BACKGROUND 0 "HIDDEN" 1 "BLUE" 3 "ORANGE" 4 "FLASHING ORANGE" 6 "FLASHING RED" 7 "GRAY"; VAL_ 353 DAW_ICON 0 "HIDDEN" 1 "ORANGE"; VAL_ 353 CAR_CIRCLE 0 "HIDDEN" 1 "GRAY" 2 "CYAN"; +VAL_ 354 COUNTRY 0 "HIDDEN" 1 "SOUTH_KOREA" 4 "INTL" 5 "JAPAN" 6 "CANADA" 7 "USA" 8 "CHINA" 9 "INTL"; +VAL_ 354 SPEEDLIMIT_FLASH 0 "HIDDEN" 1 "ERROR" 2 "NORMAL" 4 "RED"; +VAL_ 354 SIGNS 0 "HIDDEN" 1 "PEDESTRIAN_CROSSING" 2 "SCHOOL_CROSSWALK" 8 "STOP" 9 "YIELD" 16 "DO_NOT_PASS" 19 "DO_NOT_ENTER" 24 "ROUNDABOUT" 26 "RIGHT_CURVE_AHEAD" 27 "LEFT_CURVE_AHEAD" 28 "SLIGHT_RIGHT_CURVE_AHEAD" 29 "SLIGHT_LEFT_CURVE_AHEAD"; +VAL_ 354 SPEEDLIMIT_WEATHER 0 "HIDDEN" 1 "RAIN" 2 "SNOW" 3 "RAIN+SNOW" 4 "TRAILER"; +VAL_ 354 VIBRATE 0 "NONE" 1 "VIBRATE"; +VAL_ 354 LEAD 0 "HIDDEN" 1 "GRAY BOX" 2 "WHITE BOX" 3 "GRAY CAR" 4 "WHITE CAR" 5 "GRAY TRUCK" 6 "WHITE TRUCK" 7 "GRAY PERSON" 8 "WHITE PERSON" 9 "GRAY BICYCLE" 10 "WHITE BICYCLE" 11 "GRAY MOTORCYCLE" 12 "WHITE MOTORCYCLE" 13 "DARK CONE" 14 "ORANGE CONE"; +VAL_ 354 LEAD_ALT 0 "HIDDEN" 1 "GRAY BOX" 2 "WHITE BOX" 3 "DIM CONE" 4 "ORANGE CONE"; +VAL_ 354 LEAD_LEFT 0 "HIDDEN" 1 "GRAY BOX" 2 "WHITE BOX" 3 "GRAY CAR" 4 "WHITE CAR" 5 "GRAY TRUCK" 6 "WHITE TRUCK" 7 "GRAY PERSON" 8 "WHITE PERSON" 9 "GRAY BICYCLE" 10 "WHITE BICYCLE" 11 "GRAY MOTORCYCLE" 12 "WHITE MOTORCYCLE" 13 "DARK CONE" 14 "ORANGE CONE"; +VAL_ 354 LEAD_RIGHT 0 "HIDDEN" 1 "GRAY BOX" 2 "WHITE BOX" 3 "GRAY CAR" 4 "WHITE CAR" 5 "GRAY TRUCK" 6 "WHITE TRUCK" 7 "GRAY PERSON" 8 "WHITE PERSON" 9 "GRAY BICYCLE" 10 "WHITE BICYCLE" 11 "GRAY MOTORCYCLE" 12 "WHITE MOTORCYCLE" 13 "DARK CONE" 14 "ORANGE CONE"; +VAL_ 354 FAULT_FSS 0 "HIDDEN" 1 "CHECK_FORWARD_SAFETY_SYSTEM" 2 "FORWARD_SAFETY_SYSTEM_LIMITED_CAMERA_OBSCURED" 3 "FORWARD_SAFETY_SYSTEM_LIMITED_RADAR_BLOCKED"; +VAL_ 354 FAULT_FCA 0 "HIDDEN" 1 "CHECK_FORWARD_SIDE_SAFETY_SYSTEM" 2 "FORWARD_SIDE_SAFETY_SYSTEM_LIMITED_CAMERA_OBSCURED" 3 "FORWARD_SIDE_SAFETY_SYSTEM_LIMITED_RADAR_BLOCKED"; +VAL_ 354 FAULT_LSS 0 "HIDDEN" 1 "CHECK_LANE_SAFETY_SYSTEM" 2 "LANE_SAFETY_SYSTEM_DISABLED_CAMERA_OBSCURED"; +VAL_ 354 FAULT_SLA 0 "HIDDEN" 1 "CHECK_SPEED_LIMIT_SYSTEM" 2 "SPEED_LIMIT_SYSTEM_DISABLED_CAMERA_OBSCURED"; +VAL_ 354 FAULT_DAW 0 "HIDDEN" 1 "CHECK_INATTENTIVE_DRIVING_WARNING_SYSTEM" 2 "INATTENTIVE_DRIVING_WARNING_SYSTEM_DISABLED_CAMERA_OBSCURED"; +VAL_ 354 FAULT_HBA 0 "HIDDEN" 1 "CHECK_HIGH_BEAM_ASSIST_SYSTEM"; +VAL_ 354 FAULT_SCC 0 "HIDDEN" 1 "CHECK_SMART_CRUISE_CONTROL_SYSTEM" 2 "SMART_CRUISE_CONTROL_DISABLED_RADAR_BLOCKED"; +VAL_ 354 FAULT_LFA 0 "HIDDEN" 1 "CHECK_LANE_FOLLOWING_SYSTEM_ASSIST_SYSTEM"; +VAL_ 354 FAULT_HDA 0 "HIDDEN" 1 "CHECK_HIGHWAY_DRIVING_ASSIST_SYSTEM"; +VAL_ 354 FAULT_LCA 0 "HIDDEN" 1 "CHECK_LANE_CHANGE_ASSIST_FUNCTION" 2 "LANE_CHANGE_ASSIST_FUNCTION_DISABLED_CAMERA_OBSCURED" 3 "LANE_CHANGE_ASSIST_FUNCTION_DISABLED_RADAR_BLOCKED"; +VAL_ 354 FAULT_HDP 0 "HIDDEN" 1 "CHECK_HIGHWAY_DRIVING_PILOT_SYSTEM" 2 "HIGHWAY_DRIVING_PILOT_DISABLED_CAMERA_OBSCURED" 3 "HIGHWAY_DRIVING_PILOT_DISABLED_RADAR_BLOCKED" 4 "HIGHWAY_DRIVING_PILOT_DISABLED_LIDAR_BLOCKED"; +VAL_ 354 FAULT_DAS 0 "HIDDEN" 1 "CHECK_DRIVER_ASSISTANCE_SYSTEM" 2 "DRIVER_ASSISTANCE_SYSTEM_LIMITED_CAMERA_OBSCURED" 3 "DRIVER_ASSISTANCE_SYSTEM_LIMITED_RADAR_BLOCKED" 4 "DRIVER_ASSISTANCE_SYSTEM_LIMITED_CAMERA_OBSCURED_AND_RADAR_BLOCKED"; +VAL_ 354 FAULT_ESS 0 "HIDDEN" 1 "CHECK_EMERGENCY_STOPPING_FUNCTION" 2 "EMERGENCY_STOPPING_FUNCTION_DISABLED_CAMERA_OBSCURED" 3 "EMERGENCY_STOPPING_FUNCTION_DISABLED_RADAR_BLOCKED"; From aacb0ec4121b81c917bbc29c3977b2589b2ee2e6 Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 26 Dec 2024 12:52:11 -0500 Subject: [PATCH 75/77] increase STEER_MAX for CCNC --- opendbc/car/hyundai/values.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 2ab78884fb..4503a1712b 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -33,6 +33,9 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 + if CP.flags & HyundaiFlags.CCNC: + self.STEER_MAX = 384 + # To determine the limit for your car, find the maximum value that the stock LKAS will request. # If the max stock LKAS request is <384, add your car to this list. elif CP.carFingerprint in (CAR.GENESIS_G80, CAR.GENESIS_G90, CAR.HYUNDAI_ELANTRA, CAR.HYUNDAI_ELANTRA_GT_I30, CAR.HYUNDAI_IONIQ, From 4ab074a2869662d0e2cacebf3b6b2870eb068d7f Mon Sep 17 00:00:00 2001 From: royjr Date: Tue, 7 Jan 2025 23:27:31 -0500 Subject: [PATCH 76/77] lower STEER_MAX --- opendbc/car/hyundai/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index cf80622dce..73a539a87c 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -34,7 +34,7 @@ def __init__(self, CP): self.STEER_DELTA_DOWN = 3 if CP.flags & HyundaiFlags.CCNC: - self.STEER_MAX = 384 + self.STEER_MAX = 327 # To determine the limit for your car, find the maximum value that the stock LKAS will request. # If the max stock LKAS request is <384, add your car to this list. From 3d174673e6a08158885517ca51c05e030a696cc3 Mon Sep 17 00:00:00 2001 From: royjr Date: Sat, 11 Jan 2025 18:37:42 -0500 Subject: [PATCH 77/77] back to 270 for now --- opendbc/car/hyundai/values.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 73a539a87c..6a5bad2722 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -33,9 +33,6 @@ def __init__(self, CP): self.STEER_DELTA_UP = 2 self.STEER_DELTA_DOWN = 3 - if CP.flags & HyundaiFlags.CCNC: - self.STEER_MAX = 327 - # To determine the limit for your car, find the maximum value that the stock LKAS will request. # If the max stock LKAS request is <384, add your car to this list. elif CP.carFingerprint in (CAR.GENESIS_G80, CAR.GENESIS_G90, CAR.HYUNDAI_ELANTRA, CAR.HYUNDAI_ELANTRA_GT_I30, CAR.HYUNDAI_IONIQ,