Honor Palisade LKAS wheel action assignments

This commit is contained in:
firestar5683
2026-11-27 22:44:26 -06:00
parent c194a0c092
commit 20bef284c6
5 changed files with 54 additions and 5 deletions
+3 -2
View File
@@ -148,12 +148,13 @@ def disarming_fault(events, CS, *, temporary_ui_process_failure: bool = False,
class AolCardIntent:
def __init__(self, settings: AolSettings, *, explicit_latch: bool = False, lkas_button_supported: bool = True,
independent_cruise_buttons: bool = False, preserve_unassigned_cancel: bool = False,
confirm_main_available: bool = False):
confirm_main_available: bool = False, respect_lkas_wheel_action: bool = False):
self.settings = settings
self.explicit_latch = explicit_latch
self.independent_cruise_buttons = independent_cruise_buttons
self.preserve_unassigned_cancel = preserve_unassigned_cancel
self.confirm_main_available = confirm_main_available
self.respect_lkas_wheel_action = respect_lkas_wheel_action
self._pending_main_arm_ns = 0
self.lkas_button_supported = lkas_button_supported
self.allowed_latch = False
@@ -339,7 +340,7 @@ class AolCardIntent:
self.independent_cruise_buttons and self.settings.main_wheel_action)
lkas_toggle = (not independent_buttons or lkas_managed) and not (
getattr(self, 'allow_manumatic', False) or
(self.independent_cruise_buttons and self.settings.lkas_wheel_action))
((self.independent_cruise_buttons or self.respect_lkas_wheel_action) and self.settings.lkas_wheel_action))
previously_held = (self._main_held and main_toggle) or (self._lkas_held and lkas_toggle)
cancel_pressed = False
for event in CS.buttonEvents:
@@ -99,3 +99,49 @@ def test_tucson_lkas_bookmark_does_not_double_as_lateral_toggle(action, keeps_la
press(owner, cs, 'lkas', 10, engaged=True)
assert lateral(owner) == keeps_lateral
assert owner.pause_lateral != keeps_lateral
@pytest.mark.parametrize('topology', ['hdai', 'hdaii'])
@pytest.mark.parametrize('alpha_long', [False, True])
@pytest.mark.parametrize('action', [0, 8, 9])
def test_mixed_palisade_lkas_bookmark_owns_only_the_wheel_action(tmp_path, topology, alpha_long, action):
from opendbc.car.hyundai.blended_stock_aol import qualified, qualified_alpha
from opendbc.car.hyundai.tests.test_palisade_2023 import params as palisade_params
from openpilot.starpilot.controllers.wheel_actions import WheelPublisher
cp = palisade_params(topology)
cp.alternativeExperience = 32
if alpha_long:
cp.openpilotLongitudinalControl = True
cp.pcmCruise = False
cp.alphaLongitudinalAvailable = True
cp.safetyConfigs[0].safetyParam |= 4
assert (qualified_alpha if alpha_long else qualified)(cp, marked_only=True)
saved = SavedParams({'AlwaysOnLateral': b'1', 'LKASButtonControl': str(action).encode(), 'MainCruiseButtonControl': b'0'})
(tmp_path/'LKASButtonControl').write_bytes(saved.get('LKASButtonControl'))
saved.get_param_path = lambda key: str(tmp_path/key)
owner = create_intent(cp, read_settings(saved))
cs = structs.CarState(canValid=True, gearShifter='drive', cruiseState={'available': True, 'enabled': True})
now = 3_000_000_000
publisher = WheelPublisher()
owner.update(cs, now_ns=now, fault_active=False)
assert publisher.observe(saved, cp, cs, now_ns=now, drive_id=1_000_000_000) == (('', 0),)
if action == 8:
press(owner, cs, 'lkas', now + 1)
assert not owner.allowed_latch and owner.physical_arm_ns == 0
cs.buttonEvents = []
owner.observe_full_engagement(cs, enabled=False, active=False, source_ns=now + 3,
observation_valid=True, now_ns=now + 3, fault_active=False)
owner.observe_full_engagement(cs, enabled=True, active=True, source_ns=now + 4,
observation_valid=True, now_ns=now + 4, fault_active=False)
assert lateral(owner)
edge = owner._last_latch_edge_ns
cs.buttonEvents = [structs.CarState.ButtonEvent(type='lkas', pressed=True)]
owner.update(cs, now_ns=now + 10_000_000, fault_active=False, standard_enabled=True)
actions = publisher.observe(saved, cp, cs, now_ns=now + 10_000_000, drive_id=1_000_000_000)
assert actions == ((('LKASButtonControl', 8),) if action == 8 else ())
assert lateral(owner) == (action == 8)
if action == 8:
assert not owner.pause_lateral and owner._last_latch_edge_ns == edge
owner.update(cs, now_ns=now + 20_000_000, fault_active=True, standard_enabled=True)
assert not lateral(owner)
+2 -1
View File
@@ -324,7 +324,8 @@ def create_intent(CP, settings):
mixed_hda2_stock = _mixed_hda2_stock(CP)
return AolCardIntent(settings, explicit_latch=policy_for(CP).explicit_latch,
independent_cruise_buttons=independent_cruise_buttons,
preserve_unassigned_cancel=mixed_hda2_stock, confirm_main_available=mixed_hda2_stock)
preserve_unassigned_cancel=mixed_hda2_stock, confirm_main_available=mixed_hda2_stock,
respect_lkas_wheel_action=qualified_blended_stock(CP))
def ordinary_axis_request_allowed(CP, CS) -> bool:
@@ -7,9 +7,10 @@ class ClassicLongCardIntent(AolCardIntent):
defer_full_engagement_on_gas = True
def __init__(self, cp, settings):
blended_alpha = qualified_alpha(cp)
super().__init__(settings, explicit_latch=True, independent_cruise_buttons=(
independent_buttons_qualified(cp, marked_only=False)),
preserve_unassigned_cancel=qualified_alpha(cp))
preserve_unassigned_cancel=blended_alpha, respect_lkas_wheel_action=blended_alpha)
self.requires_fault_observation = True
self.observe_stock_engagement = True
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "ea77d364e7cd20d324e534277f28fec667e0d542533120c5dded36be5cfcc6df", "schema_version": 1}
{"protected_inventory_sha256": "1b36278aa0f48e3fced1834e5784dd3b4533b64ae60335db294d23c5bb1beac7", "schema_version": 1}