From 373178e090df9579e5cf30f4911cbfb930fe8add Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 20 Aug 2024 09:53:50 -0400 Subject: [PATCH 1/4] HKG: Car Port for Genesis GV70 Electrified 2023 (HDA2) --- opendbc/car/hyundai/carstate.py | 5 ++++- opendbc/car/hyundai/fingerprints.py | 8 ++++++++ opendbc/car/hyundai/interface.py | 3 +++ opendbc/car/hyundai/values.py | 12 ++++++++++++ opendbc/car/torque_data/override.toml | 1 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/opendbc/car/hyundai/carstate.py b/opendbc/car/hyundai/carstate.py index a8f4bd9c39..178b9bfcc8 100644 --- a/opendbc/car/hyundai/carstate.py +++ b/opendbc/car/hyundai/carstate.py @@ -31,6 +31,7 @@ def __init__(self, CP): self.gear_msg_canfd = "GEAR_ALT" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS else \ "GEAR_ALT_2" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_2 else \ + "ACCELERATOR" if CP.flags & HyundaiFlags.CANFD_ALT_GEARS_3 else \ "GEAR_SHIFTER" if CP.carFingerprint in CANFD_CAR: self.shifter_values = can_define.dv[self.gear_msg_canfd]["GEAR"] @@ -333,7 +334,6 @@ def get_cam_can_parser(CP): def get_can_parser_canfd(self, CP): messages = [ - (self.gear_msg_canfd, 100), (self.accelerator_msg_canfd, 100), ("WHEEL_SPEEDS", 100), ("STEERING_SENSORS", 100), @@ -344,6 +344,9 @@ def get_can_parser_canfd(self, CP): ("DOORS_SEATBELTS", 4), ] + if not CP.flags & HyundaiFlags.CANFD_ALT_GEARS_3: + messages.append((self.gear_msg_canfd, 100)) + if CP.flags & HyundaiFlags.EV: messages += [ ("MANUAL_SPEED_LIMIT_ASSIST", 10), diff --git a/opendbc/car/hyundai/fingerprints.py b/opendbc/car/hyundai/fingerprints.py index d243ec566d..1c6fcfc112 100644 --- a/opendbc/car/hyundai/fingerprints.py +++ b/opendbc/car/hyundai/fingerprints.py @@ -1052,6 +1052,14 @@ b'\xf1\x00JK1_ SCC FHCUP 1.00 1.02 99110-AR000 ', ], }, + CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN: { + (Ecu.fwdCamera, 0x7c4, None): [ + b'\xf1\x00JK1EMFC AT USA LHD 1.00 1.00 99211-IT100 220919', + ], + (Ecu.fwdRadar, 0x7d0, None): [ + b'\xf1\x00JKev SCC ----- 1.00 1.01 99110-DS000 ', + ], + }, CAR.GENESIS_GV60_EV_1ST_GEN: { (Ecu.fwdCamera, 0x7c4, None): [ b'\xf1\x00JW1 MFC AT USA LHD 1.00 1.02 99211-CU000 211215', diff --git a/opendbc/car/hyundai/interface.py b/opendbc/car/hyundai/interface.py index 1f383bcc41..659157aca3 100644 --- a/opendbc/car/hyundai/interface.py +++ b/opendbc/car/hyundai/interface.py @@ -40,6 +40,9 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime ret.flags |= HyundaiFlags.CANFD_HDA2.value if 0x110 in fingerprint[CAN.CAM]: ret.flags |= HyundaiFlags.CANFD_HDA2_ALT_STEERING.value + # Some HDA2 cars do not have 0x130, GEAR signal is in 0x35 as an alternative + if 0x130 not in fingerprint[CAN.ECAN]: + ret.flags |= HyundaiFlags.CANFD_ALT_GEARS_3.value else: # non-HDA2 if 0x1cf not in fingerprint[CAN.ECAN]: diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 2394708de2..5257e407fa 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -95,6 +95,8 @@ class HyundaiFlags(IntFlag): MIN_STEER_32_MPH = 2 ** 23 + CANFD_ALT_GEARS_3 = 2 ** 24 + class Footnote(Enum): CANFD = CarFootnote( @@ -527,6 +529,16 @@ class CAR(Platforms): CarSpecs(mass=1950, wheelbase=2.87, steerRatio=14.6), flags=HyundaiFlags.RADAR_SCC, ) + # 2023 GV70 Electrified has Variable Gear Ratio (VGR) rack & pinion with rack mounted EPS. + # The overall gear/steering ratio is 13.27. + # https://www.genesis.com/content/dam/genesis-p2/au/assets/models/electrified-gv70/specs/Genesis_GV70_EV_August_2022_v0.1.pdf + GENESIS_GV70_ELECTRIFIED_1ST_GEN = HyundaiCanFDPlatformConfig( + [ + HyundaiCarDocs("Genesis GV70 Electrified (with HDA II) 2023", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q])), + ], + CarSpecs(mass=2295, wheelbase=2.87, steerRatio=13.27), + flags=HyundaiFlags.EV, + ) GENESIS_G80 = HyundaiPlatformConfig( [HyundaiCarDocs("Genesis G80 2018-19", "All", car_parts=CarParts.common([CarHarness.hyundai_h]))], CarSpecs(mass=2060, wheelbase=3.01, steerRatio=16.5), diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index a4fc2a479f..5876a2f4c9 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -63,6 +63,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_CUSTIN_1ST_GEN" = [2.5, 2.5, 0.1] "LEXUS_GS_F" = [2.5, 2.5, 0.08] "HYUNDAI_STARIA_4TH_GEN" = [1.8, 2.0, 0.15] +"GENESIS_GV70_ELECTRIFIED_1ST_GEN" = [2.5, 2.5, 0.1] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0] From 5fdae1772e9b58a77e4c6bb93e8db0a354dfeeb8 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 24 Sep 2024 00:00:26 -0400 Subject: [PATCH 2/4] add test routes --- opendbc/car/tests/routes.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opendbc/car/tests/routes.py b/opendbc/car/tests/routes.py index 8b6ea9dfaf..8775ed5af4 100644 --- a/opendbc/car/tests/routes.py +++ b/opendbc/car/tests/routes.py @@ -107,6 +107,8 @@ class CarTestRoute(NamedTuple): CarTestRoute("b5d6dc830ad63071|2022-12-12--21-28-25", HYUNDAI.GENESIS_GV60_EV_1ST_GEN, segment=12), CarTestRoute("70c5bec28ec8e345|2020-08-08--12-22-23", HYUNDAI.GENESIS_G70), CarTestRoute("ca4de5b12321bd98|2022-10-18--21-15-59", HYUNDAI.GENESIS_GV70_1ST_GEN), + CarTestRoute("afe09b9f5d3f3548/00000011--15fefe1c50", HYUNDAI.GENESIS_GV70_ELECTRIFIED_1ST_GEN), + CarTestRoute("afe09b9f5d3f3548/0000001b--a1129a4a15", HYUNDAI.GENESIS_GV70_ELECTRIFIED_1ST_GEN), # openpilot longitudinal enabled CarTestRoute("6b301bf83f10aa90|2020-11-22--16-45-07", HYUNDAI.GENESIS_G80), CarTestRoute("0bbe367c98fa1538|2023-09-16--00-16-49", HYUNDAI.HYUNDAI_CUSTIN_1ST_GEN), CarTestRoute("f0709d2bc6ca451f|2022-10-15--08-13-54", HYUNDAI.HYUNDAI_SANTA_CRUZ_1ST_GEN), From 053ded0c89ad0509a74fb317e884f8e72baef2ca Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 26 Sep 2024 13:18:31 -0400 Subject: [PATCH 3/4] remove --- opendbc/car/hyundai/interface.py | 3 --- opendbc/car/hyundai/values.py | 2 -- 2 files changed, 5 deletions(-) diff --git a/opendbc/car/hyundai/interface.py b/opendbc/car/hyundai/interface.py index 6c8f7acbe3..27df5b556d 100644 --- a/opendbc/car/hyundai/interface.py +++ b/opendbc/car/hyundai/interface.py @@ -40,9 +40,6 @@ def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experime ret.flags |= HyundaiFlags.CANFD_HDA2.value if 0x110 in fingerprint[CAN.CAM]: ret.flags |= HyundaiFlags.CANFD_HDA2_ALT_STEERING.value - # Some HDA2 cars do not have 0x130, GEAR signal is in 0x35 as an alternative - if 0x130 not in fingerprint[CAN.ECAN]: - ret.flags |= HyundaiFlags.CANFD_ALT_GEARS_3.value else: # non-HDA2 if 0x1cf not in fingerprint[CAN.ECAN]: diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index fd7fee7a43..946b3f55c6 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -95,8 +95,6 @@ class HyundaiFlags(IntFlag): MIN_STEER_32_MPH = 2 ** 23 - CANFD_ALT_GEARS_3 = 2 ** 24 - class Footnote(Enum): CANFD = CarFootnote( From 9af2e25c2eb9c43a51b7d93b6848cd298d56fe9f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 26 Sep 2024 13:55:40 -0400 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Jason Young <46612682+jyoung8607@users.noreply.github.com> --- opendbc/car/hyundai/values.py | 5 +---- opendbc/car/torque_data/override.toml | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/opendbc/car/hyundai/values.py b/opendbc/car/hyundai/values.py index 946b3f55c6..564d334106 100644 --- a/opendbc/car/hyundai/values.py +++ b/opendbc/car/hyundai/values.py @@ -527,14 +527,11 @@ class CAR(Platforms): CarSpecs(mass=1950, wheelbase=2.87, steerRatio=14.6), flags=HyundaiFlags.RADAR_SCC, ) - # 2023 GV70 Electrified has Variable Gear Ratio (VGR) rack & pinion with rack mounted EPS. - # The overall gear/steering ratio is 13.27. - # https://www.genesis.com/content/dam/genesis-p2/au/assets/models/electrified-gv70/specs/Genesis_GV70_EV_August_2022_v0.1.pdf GENESIS_GV70_ELECTRIFIED_1ST_GEN = HyundaiCanFDPlatformConfig( [ HyundaiCarDocs("Genesis GV70 Electrified (with HDA II) 2023", "Highway Driving Assist II", car_parts=CarParts.common([CarHarness.hyundai_q])), ], - CarSpecs(mass=2295, wheelbase=2.87, steerRatio=13.27), + CarSpecs(mass=2260, wheelbase=2.87, steerRatio=17.1), flags=HyundaiFlags.EV, ) GENESIS_G80 = HyundaiPlatformConfig( diff --git a/opendbc/car/torque_data/override.toml b/opendbc/car/torque_data/override.toml index 05b8333bd5..0b9b5e5b89 100644 --- a/opendbc/car/torque_data/override.toml +++ b/opendbc/car/torque_data/override.toml @@ -65,7 +65,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HYUNDAI_CUSTIN_1ST_GEN" = [2.5, 2.5, 0.1] "LEXUS_GS_F" = [2.5, 2.5, 0.08] "HYUNDAI_STARIA_4TH_GEN" = [1.8, 2.0, 0.15] -"GENESIS_GV70_ELECTRIFIED_1ST_GEN" = [2.5, 2.5, 0.1] +"GENESIS_GV70_ELECTRIFIED_1ST_GEN" = [1.9, 1.9, 0.09] # Dashcam or fallback configured as ideal car "MOCK" = [10.0, 10, 0.0]