This commit is contained in:
firestar5683
2026-08-08 22:43:47 -05:00
parent 425ba0faf4
commit 47ba1544d3
2 changed files with 22 additions and 0 deletions
@@ -774,6 +774,11 @@ KIA_EV6_CENTER_TAPER_LAT = 0.16
KIA_EV6_CENTER_TAPER_LAT_WIDTH = 0.04
KIA_EV6_CENTER_TAPER_SPEED = 17.0
KIA_EV6_CENTER_TAPER_SPEED_WIDTH = 2.8
KIA_EV6_CENTER_FRICTION_THRESHOLD_GAIN = 0.08
KIA_EV6_CENTER_FRICTION_THRESHOLD_LAT = 0.30
KIA_EV6_CENTER_FRICTION_THRESHOLD_LAT_WIDTH = 0.07
KIA_EV6_CENTER_FRICTION_THRESHOLD_SPEED = 18.0
KIA_EV6_CENTER_FRICTION_THRESHOLD_SPEED_WIDTH = 2.5
KIA_EV6_LOW_SPEED_CENTER_TAPER_MAX = 0.19
KIA_EV6_LOW_SPEED_CENTER_TAPER_LAT = 0.08
KIA_EV6_LOW_SPEED_CENTER_TAPER_LAT_WIDTH = 0.02
@@ -2942,6 +2947,13 @@ def get_kia_ev6_friction_threshold(v_ego: float, desired_lateral_accel: float =
_flm_vehicle_knob("hyundai_kia_ev6.unwind_threshold_increase_right", KIA_EV6_UNWIND_THRESHOLD_INCREASE_RIGHT),
) *
transition_envelope * unwind_weight)
center_speed_weight = _kia_ev6_sigmoid((v_ego - KIA_EV6_CENTER_FRICTION_THRESHOLD_SPEED) /
KIA_EV6_CENTER_FRICTION_THRESHOLD_SPEED_WIDTH)
center_lat_weight = _kia_ev6_sigmoid((KIA_EV6_CENTER_FRICTION_THRESHOLD_LAT - abs(desired_lateral_accel)) /
KIA_EV6_CENTER_FRICTION_THRESHOLD_LAT_WIDTH)
threshold_scale += (_flm_vehicle_knob("hyundai_kia_ev6.center_friction_threshold_gain",
KIA_EV6_CENTER_FRICTION_THRESHOLD_GAIN) *
center_speed_weight * center_lat_weight)
return base_threshold * min(max(threshold_scale, 0.82), 1.16)
@@ -3332,6 +3344,7 @@ FLM_SUPPORTED_VEHICLE_KNOBS = {
"hyundai_kia_ev6.turn_in_threshold_reduction_right": {"profile": "hyundai_kia_ev6", "min": 0.0, "max": 0.40, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": KIA_EV6_TURN_IN_THRESHOLD_REDUCTION_RIGHT},
"hyundai_kia_ev6.unwind_threshold_increase_left": {"profile": "hyundai_kia_ev6", "min": 0.0, "max": 0.80, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": KIA_EV6_UNWIND_THRESHOLD_INCREASE_LEFT},
"hyundai_kia_ev6.unwind_threshold_increase_right": {"profile": "hyundai_kia_ev6", "min": 0.0, "max": 0.80, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": KIA_EV6_UNWIND_THRESHOLD_INCREASE_RIGHT},
"hyundai_kia_ev6.center_friction_threshold_gain": {"profile": "hyundai_kia_ev6", "min": 0.0, "max": 0.20, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": KIA_EV6_CENTER_FRICTION_THRESHOLD_GAIN},
"toyota_prius.ff_gain_left": {"profile": "toyota_prius", "min": 0.0, "max": 0.25, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": PRIUS_FF_GAIN_LEFT},
"toyota_prius.ff_gain_right": {"profile": "toyota_prius", "min": 0.0, "max": 0.25, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": PRIUS_FF_GAIN_RIGHT},
"toyota_prius.turn_in_boost_left": {"profile": "toyota_prius", "min": -0.10, "max": 0.60, "precision": 0.001, "deltaType": "absolute", "safeLiveTrial": True, "defaultValue": PRIUS_TURN_IN_BOOST_LEFT},
@@ -1074,6 +1074,15 @@ class TestLatControl:
assert right_turn_in == left_turn_in < base < right_unwind == left_unwind
assert get_kia_ev6_friction_threshold(25.0, 0.0, 0.0) >= get_hkg_canfd_base_friction_threshold(25.0)
def test_kia_ev6_center_friction_threshold_is_high_speed_only(self):
low_speed = get_kia_ev6_friction_threshold(10.0, 0.0, 0.0)
high_speed_center = get_kia_ev6_friction_threshold(34.0, 0.0, 0.0)
high_speed_curve = get_kia_ev6_friction_threshold(34.0, 0.55, 0.0)
assert low_speed == pytest.approx(get_hkg_canfd_base_friction_threshold(10.0), abs=0.002)
assert high_speed_center > get_hkg_canfd_base_friction_threshold(34.0)
assert high_speed_curve < high_speed_center
def test_kia_ev6_friction_scale_curve(self):
base = get_kia_ev6_friction_scale(25.0, 0.5, 0.8)
left_turn_in = get_kia_ev6_friction_scale(6.0, 0.5, 0.8)