Dampen Ioniq 6 steering corrections at highway speed

This commit is contained in:
firestar5683
2026-11-25 21:51:00 -06:00
parent 7ff81a0ffb
commit 542b4f463a
3 changed files with 23 additions and 4 deletions
+10 -3
View File
@@ -133,6 +133,7 @@ IONIQ_6_HIGHWAY_OUTPUT_TAPER_SPEED = 23.5
IONIQ_6_HIGHWAY_OUTPUT_TAPER_SPEED_WIDTH = 2.0
IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_MAX = 0.18
IONIQ_6_STANDARD_HIGHWAY_TRANSITION_EXTRA_TAPER = 0.10
IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_LAT = 1.05
@@ -673,13 +674,17 @@ def get_ioniq_6_highway_output_taper_scale(desired_lateral_accel: float, v_ego:
reduction = IONIQ_6_HIGHWAY_OUTPUT_TAPER_MAX * speed_weight * center_weight
return 1.0 - reduction
def get_ioniq_6_highway_transition_output_taper_scale(desired_lateral_accel: float, desired_lateral_jerk: float, v_ego: float) -> float:
def get_ioniq_6_highway_transition_output_taper_scale(desired_lateral_accel: float, desired_lateral_jerk: float, v_ego: float,
*, damp_standard_highway: bool = False) -> float:
speed_weight = _ioniq_6_sigmoid((v_ego - IONIQ_6_HIGHWAY_OUTPUT_TAPER_SPEED) / IONIQ_6_HIGHWAY_OUTPUT_TAPER_SPEED_WIDTH)
center_weight = _ioniq_6_sigmoid((IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_LAT - abs(desired_lateral_accel)) /
IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_LAT_WIDTH)
jerk_weight = _ioniq_6_sigmoid((abs(desired_lateral_jerk) - IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_JERK) /
IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_JERK_WIDTH)
reduction = IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_MAX * speed_weight * center_weight * jerk_weight
max_reduction = IONIQ_6_HIGHWAY_TRANSITION_OUTPUT_TAPER_MAX
if damp_standard_highway:
max_reduction += IONIQ_6_STANDARD_HIGHWAY_TRANSITION_EXTRA_TAPER * np.interp(v_ego, [25.0, 30.0], [0.0, 1.0])
reduction = max_reduction * speed_weight * center_weight * jerk_weight
return 1.0 - reduction
def get_ioniq_6_low_speed_angle_assist_torque(desired_angle_deg: float, actual_angle_deg: float,
@@ -925,7 +930,9 @@ class Ioniq6TorquePolicy:
output_torque = self.surface_math.low_speed_output(self.surface, self.surface_math.SurfaceInput(
CS.vEgo, setpoint, desired_lateral_jerk, desired_angle, actual_angle, output_torque, False, directional_taper))
output_torque *= get_ioniq_6_highway_output_taper_scale(setpoint, CS.vEgo)
output_torque *= get_ioniq_6_highway_transition_output_taper_scale(setpoint, desired_lateral_jerk, CS.vEgo)
output_torque *= get_ioniq_6_highway_transition_output_taper_scale(
setpoint, desired_lateral_jerk, CS.vEgo,
damp_standard_highway=not (self.is_2025 or CS.steeringPressed or self.prev_steering_pressed))
if self.is_2025:
output_torque *= get_ioniq_6_2025_center_output_scale(setpoint, CS.vEgo)
output_limit = get_ioniq_6_2025_low_speed_output_limit(setpoint, desired_lateral_jerk, CS.vEgo)
@@ -65,6 +65,18 @@ def _rows(car, sequence, *, profile='2023', matched_frozen_cp=False, passive=Fal
class Ioniq6PolicyTests(unittest.TestCase):
def test_highway_transition_taper_is_scoped_to_standard_assisted_steering(self):
fn = tune.get_ioniq_6_highway_transition_output_taper_scale
self.assertEqual(fn(0.15, 0.6, 25.0), fn(0.15, 0.6, 25.0, damp_standard_highway=True))
self.assertGreater(fn(0.15, 0.6, 34.0) - fn(0.15, 0.6, 34.0, damp_standard_highway=True), 0.08)
self.assertLess(fn(2.0, 0.6, 34.0) - fn(2.0, 0.6, 34.0, damp_standard_highway=True), 0.002)
sequence = [(True, 34.0, 0.2, 0.0002, pressed) for pressed in [False] * 80 + [True, False, False]]
for profile in ('2023', '2025'):
with self.subTest(profile=profile), mock.patch.object(tune, fn.__name__, wraps=fn) as taper:
_rows(HYUNDAI.HYUNDAI_IONIQ_6, sequence, profile=profile, matched_frozen_cp=True)
calls = [call.kwargs['damp_standard_highway'] for call in taper.call_args_list]
self.assertEqual(calls[-4:], [True, False, False, True] if profile == '2023' else [False] * 4)
def test_ioniq_drive_loop_uses_original_flat_proportional_gain(self):
cp = interfaces[HYUNDAI.HYUNDAI_IONIQ_6].get_non_essential_params(HYUNDAI.HYUNDAI_IONIQ_6)
cp.lateralTuning.torque.latAccelFactor = 3.0
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "4aa69c8ccd4db6c592aa7626e1c75533788b1c35fbbb2724d76cef24538d8303", "schema_version": 1}
{"protected_inventory_sha256": "167f0e5159b94b878faf96c30505f35697f53ccf0a8176c73fe6c35aa759de6d", "schema_version": 1}