From 3e63820cc0e003890c90825269075780eeb14bfa Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Tue, 4 Aug 2026 22:47:17 -0500 Subject: [PATCH] GV70 --- selfdrive/controls/lib/latcontrol_torque.py | 3 +++ .../controls/lib/latcontrol_vehicle_tunes.py | 27 +++++++++++++++++++ selfdrive/controls/tests/test_latcontrol.py | 11 ++++++++ 3 files changed, 41 insertions(+) diff --git a/selfdrive/controls/lib/latcontrol_torque.py b/selfdrive/controls/lib/latcontrol_torque.py index d3cd823128..74affd1752 100644 --- a/selfdrive/controls/lib/latcontrol_torque.py +++ b/selfdrive/controls/lib/latcontrol_torque.py @@ -85,6 +85,7 @@ class LatControlTorque(LatControl): self.is_bolt_2017 = CP.carFingerprint in BOLT_2017_CARS self.is_volt_standard = CP.carFingerprint in VOLT_STANDARD_CARS self.is_genesis_g90 = CP.carFingerprint in GENESIS_G90_CARS + self.is_genesis_gv70 = CP.carFingerprint in GENESIS_GV70_CARS self.is_palisade = CP.carFingerprint in PALISADE_CARS self.is_prius = CP.carFingerprint in PRIUS_CARS self.is_rav4_prime = CP.carFingerprint in RAV4_PRIME_CARS @@ -299,6 +300,8 @@ class LatControlTorque(LatControl): friction_threshold = get_gm_base_friction_threshold(CS.vEgo) else: friction_threshold = get_standard_friction_threshold(CS.vEgo) + if self.is_genesis_gv70: + friction_threshold = get_genesis_gv70_friction_threshold(CS.vEgo, setpoint, desired_lateral_jerk) friction_scale = 1.0 if bolt_2022_2023_tuned_path_active: ff *= get_bolt_2022_2023_ff_scale(setpoint, desired_lateral_jerk, CS.vEgo) diff --git a/selfdrive/controls/lib/latcontrol_vehicle_tunes.py b/selfdrive/controls/lib/latcontrol_vehicle_tunes.py index 2480b298b5..2584d3420a 100644 --- a/selfdrive/controls/lib/latcontrol_vehicle_tunes.py +++ b/selfdrive/controls/lib/latcontrol_vehicle_tunes.py @@ -87,6 +87,9 @@ SILVERADO_CARS = ( GENESIS_G90_CARS = ( HYUNDAI_CAR.GENESIS_G90, ) +GENESIS_GV70_CARS = ( + HYUNDAI_CAR.GENESIS_GV70_ELECTRIFIED_1ST_GEN, +) PALISADE_CARS = ( HYUNDAI_CAR.HYUNDAI_PALISADE, HYUNDAI_CAR.HYUNDAI_PALISADE_2023, @@ -163,6 +166,16 @@ RAM_1500_CARS = ( RAM_1500_BASE_LAT_ACCEL_FACTOR_MULT = 1.20 +GENESIS_GV70_FRICTION_THRESHOLD_GAIN = 0.08 +GENESIS_GV70_FRICTION_SPEED_ONSET = 8.0 * CV.MPH_TO_MS +GENESIS_GV70_FRICTION_SPEED_ONSET_WIDTH = 4.0 * CV.MPH_TO_MS +GENESIS_GV70_FRICTION_SPEED_CUTOFF = 40.0 * CV.MPH_TO_MS +GENESIS_GV70_FRICTION_SPEED_CUTOFF_WIDTH = 6.0 * CV.MPH_TO_MS +GENESIS_GV70_FRICTION_CENTER_LAT = 0.20 +GENESIS_GV70_FRICTION_CENTER_LAT_WIDTH = 0.08 +GENESIS_GV70_FRICTION_CALM_JERK = 0.30 +GENESIS_GV70_FRICTION_CALM_JERK_WIDTH = 0.08 + BOLT_2017_LATERAL_TESTING_GROUND_ID = testing_ground.id_3 BOLT_2017_STEER_RATIO_TEST_SCALE = 1.045 BOLT_2017_STEER_RATIO_ONSET_SPEED = 20.0 * CV.MPH_TO_MS @@ -2270,6 +2283,20 @@ def get_genesis_g90_friction_scale(v_ego: float, desired_lateral_accel: float, d return min(max(friction_scale, 0.92), 1.12) +def get_genesis_gv70_friction_threshold(v_ego: float, desired_lateral_accel: float = 0.0, + desired_lateral_jerk: float = 0.0) -> float: + base_threshold = get_hkg_canfd_base_friction_threshold(v_ego) + speed_onset = _sigmoid((v_ego - GENESIS_GV70_FRICTION_SPEED_ONSET) / GENESIS_GV70_FRICTION_SPEED_ONSET_WIDTH) + speed_cutoff = _sigmoid((GENESIS_GV70_FRICTION_SPEED_CUTOFF - v_ego) / GENESIS_GV70_FRICTION_SPEED_CUTOFF_WIDTH) + center_weight = _sigmoid((GENESIS_GV70_FRICTION_CENTER_LAT - abs(desired_lateral_accel)) / + GENESIS_GV70_FRICTION_CENTER_LAT_WIDTH) + calm_jerk_weight = _sigmoid((GENESIS_GV70_FRICTION_CALM_JERK - abs(desired_lateral_jerk)) / + GENESIS_GV70_FRICTION_CALM_JERK_WIDTH) + gain = (GENESIS_GV70_FRICTION_THRESHOLD_GAIN * speed_onset * speed_cutoff * + center_weight * calm_jerk_weight) + return base_threshold * (1.0 + gain) + + def _ioniq_5_sigmoid(x: float) -> float: return _sigmoid(x) diff --git a/selfdrive/controls/tests/test_latcontrol.py b/selfdrive/controls/tests/test_latcontrol.py index 2d96bc4d2d..8902627f6c 100644 --- a/selfdrive/controls/tests/test_latcontrol.py +++ b/selfdrive/controls/tests/test_latcontrol.py @@ -60,6 +60,7 @@ from openpilot.selfdrive.controls.lib.latcontrol_torque import ( get_genesis_g90_ff_scale, get_genesis_g90_friction_scale, get_genesis_g90_friction_threshold, + get_genesis_gv70_friction_threshold, get_elantra_non_scc_ff_scale, get_palisade_ff_scale, get_palisade_friction_scale, @@ -656,6 +657,16 @@ class TestLatControl: assert get_standard_friction_threshold(6.0) == 0.30 assert get_standard_friction_threshold(40.0) == 0.30 + def test_genesis_gv70_friction_threshold_only_fades_calm_center_corrections(self): + base = get_hkg_canfd_base_friction_threshold(12.0) + center = get_genesis_gv70_friction_threshold(12.0, 0.0, 0.0) + turn = get_genesis_gv70_friction_threshold(12.0, 0.7, 0.8) + high_speed_center = get_genesis_gv70_friction_threshold(40.0, 0.0, 0.0) + + assert center > base + assert turn == pytest.approx(base, rel=0.01) + assert high_speed_center < center + def test_ioniq_5_ff_scale_curve(self): assert get_ioniq_5_ff_scale(0.0, 0.0, 20.0) == 1.0 steady_left = get_ioniq_5_ff_scale(0.7, 0.0, 12.0)