diff --git a/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py b/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py index 696d6c20b..a2a2042eb 100644 --- a/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py +++ b/opendbc_repo/opendbc/car/hyundai/hyundaicanfd.py @@ -2,7 +2,7 @@ import copy import numpy as np from opendbc.car import CanBusBase, CanData from opendbc.car.crc import CRC16_XMODEM -from opendbc.car.hyundai.values import CAR, HyundaiFlags +from opendbc.car.hyundai.values import HyundaiFlags def _set_value(msg: bytearray, sig, ival: int) -> None: @@ -134,15 +134,10 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_torque, else: if CP.flags & HyundaiFlags.CANFD_ANGLE_STEERING: if CP.flags & HyundaiFlags.SEND_LFA: - # Sportage HEV 2026 tracks more reliably and stays fault-free on the stock-style - # LFA angle request path. Other SEND_LFA angle cars still use ADAS_CMD. - if CP.carFingerprint == CAR.KIA_SPORTAGE_HEV_2026: - ret.append(_create_angle_lfa_msg(packer, CAN, lfa_values, apply_angle, lat_active, apply_torque)) - else: - # Some CAN-FD angle-steering trims still expect the stock-style LFA status/UI - # message to remain present even though angle actuation comes through ADAS_CMD. - ret.append(packer.make_can_msg("LFA", CAN.ECAN, lfa_values)) - ret.append(_create_angle_adas_cmd_msg(packer, CAN, apply_angle, lat_active, apply_torque)) + # Some CAN-FD angle-steering trims still expect the stock-style LFA status/UI + # message to remain present even though angle actuation comes through ADAS_CMD. + ret.append(packer.make_can_msg("LFA", CAN.ECAN, lfa_values)) + ret.append(_create_angle_adas_cmd_msg(packer, CAN, apply_angle, lat_active, apply_torque)) else: ret.append(_create_angle_lfa_msg(packer, CAN, lfa_values, apply_angle, lat_active, apply_torque)) else: diff --git a/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py b/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py index 77f2cd448..1621346e7 100644 --- a/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py +++ b/opendbc_repo/opendbc/car/hyundai/tests/test_hyundai.py @@ -811,7 +811,7 @@ class TestHyundaiFingerprint: assert parser.vl["FCA12"]["FCA_DrvSetState"] == 2 assert parser.vl["FCA12"]["FCA_USM"] == 2 - def test_sportage_angle_steering_uses_lfa_only_with_send_lfa(self): + def test_sportage_angle_steering_uses_lfa_and_adas_cmd_with_send_lfa(self): fingerprint = gen_empty_fingerprint() cam_can = CanBus(None, fingerprint).CAM fingerprint[cam_can][0xCB] = 24 @@ -825,6 +825,7 @@ class TestHyundaiFingerprint: msgs = hyundaicanfd.create_steering_messages(packer, CP, can_bus, True, True, 1.0, 12.3) assert [(packer.dbc.addr_to_msg[addr].name, bus) for addr, _, bus in msgs] == [ ("LFA", can_bus.ECAN), + ("ADAS_CMD_35_10ms", can_bus.ECAN), ] def test_ioniq_6_lfa_helper_preserves_stock_ui_fields(self): diff --git a/selfdrive/controls/lib/latcontrol_torque.py b/selfdrive/controls/lib/latcontrol_torque.py index f17e23792..0812afa79 100644 --- a/selfdrive/controls/lib/latcontrol_torque.py +++ b/selfdrive/controls/lib/latcontrol_torque.py @@ -289,6 +289,8 @@ IONIQ_6_DIRECTIONAL_TAPER_FLOOR_LEFT = 0.48 IONIQ_6_DIRECTIONAL_TAPER_FLOOR_RIGHT = 0.52 IONIQ_6_DIRECTIONAL_TAPER_UNWIND_FLOOR_LEFT = 0.10 IONIQ_6_DIRECTIONAL_TAPER_UNWIND_FLOOR_RIGHT = 0.04 +IONIQ_6_DIRECTIONAL_TAPER_JERK_ONSET = 0.35 +IONIQ_6_DIRECTIONAL_TAPER_JERK_WIDTH = 0.08 IONIQ_6_HEAVY_DIRECTIONAL_TAPER_LAT_START = 0.82 IONIQ_6_HEAVY_DIRECTIONAL_TAPER_LAT_WIDTH = 0.12 IONIQ_6_HEAVY_DIRECTIONAL_TAPER_BASE_LEFT = 0.10 @@ -947,7 +949,8 @@ def get_ioniq_6_directional_taper_scale(desired_lateral_accel: float, desired_la band_weight = onset * cutoff heavy_band_weight = _ioniq_6_sigmoid((abs_lateral_accel - IONIQ_6_HEAVY_DIRECTIONAL_TAPER_LAT_START) / IONIQ_6_HEAVY_DIRECTIONAL_TAPER_LAT_WIDTH) phase = _ioniq_6_transition_phase(desired_lateral_accel, desired_lateral_jerk) - unwind_weight = max(-phase, 0.0) + unwind_weight = max(-phase, 0.0) * _ioniq_6_sigmoid((abs(desired_lateral_jerk) - IONIQ_6_DIRECTIONAL_TAPER_JERK_ONSET) / + IONIQ_6_DIRECTIONAL_TAPER_JERK_WIDTH) base_reduction = _ioniq_6_side_value(desired_lateral_accel, IONIQ_6_DIRECTIONAL_TAPER_BASE_LEFT, IONIQ_6_DIRECTIONAL_TAPER_BASE_RIGHT) unwind_reduction = _ioniq_6_side_value(desired_lateral_accel, IONIQ_6_DIRECTIONAL_TAPER_UNWIND_LEFT, IONIQ_6_DIRECTIONAL_TAPER_UNWIND_RIGHT) heavy_base_reduction = _ioniq_6_side_value(desired_lateral_accel, IONIQ_6_HEAVY_DIRECTIONAL_TAPER_BASE_LEFT, IONIQ_6_HEAVY_DIRECTIONAL_TAPER_BASE_RIGHT) diff --git a/selfdrive/controls/tests/test_latcontrol.py b/selfdrive/controls/tests/test_latcontrol.py index 6379c8374..4293ae874 100644 --- a/selfdrive/controls/tests/test_latcontrol.py +++ b/selfdrive/controls/tests/test_latcontrol.py @@ -254,6 +254,8 @@ class TestLatControl: assert get_ioniq_6_directional_taper_scale(-0.5, 0.7) <= get_ioniq_6_directional_taper_scale(-0.5, 0.0) assert get_ioniq_6_directional_taper_scale(-1.2, 0.0) < get_ioniq_6_directional_taper_scale(1.2, 0.0) < 1.0 assert get_ioniq_6_directional_taper_scale(-1.2, 0.7) <= get_ioniq_6_directional_taper_scale(-1.2, 0.0) + assert get_ioniq_6_directional_taper_scale(-1.2, 0.25) > get_ioniq_6_directional_taper_scale(-1.2, 0.7) + assert get_ioniq_6_directional_taper_scale(1.2, -0.25) > get_ioniq_6_directional_taper_scale(1.2, -0.7) def test_ioniq_6_output_taper_curve(self): assert get_ioniq_6_output_taper_scale(0.0, 0.0, 25.0) < get_ioniq_6_output_taper_scale(0.0, 0.0, 8.0) <= 1.0