This commit is contained in:
firestar5683
2026-08-04 22:47:17 -05:00
parent d21e13ba8f
commit 3e63820cc0
3 changed files with 41 additions and 0 deletions
@@ -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)
@@ -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)
@@ -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)