IQ.Pilot Release Commit @ b79954e

This commit is contained in:
IQ.Lvbs CI [bot]
2026-07-25 18:44:03 -05:00
parent f94087822f
commit 563022daa3
179 changed files with 696 additions and 610 deletions

View File

@@ -12,8 +12,7 @@ from iqdbc.car import structs
from openpilot.common.realtime import DT_CTRL
from iqdbc.safety import ALTERNATIVE_EXPERIENCE
from openpilot.selfdrive.selfdrived.events import ET
from iqdbc.car.hyundai.values import HyundaiFlags
from iqdbc.iqpilot.car.hyundai.values import HyundaiFlagsIQ, HyundaiSafetyFlagsIQ
from iqdbc.car.hyundai.values import HyundaiFlags, HyundaiFlagsIQ, HyundaiSafetyFlagsIQ
from openpilot.selfdrive.selfdrived.state import SOFT_DISABLE_TIME
from cereal import log, custom
@@ -255,7 +254,8 @@ _BTN = structs.CarState.ButtonEvent.Type
_GEAR = structs.CarState.GearShifter
_CRUISE_SET_TAPS = frozenset((_BTN.accelCruise, _BTN.resumeCruise, _BTN.decelCruise, _BTN.setCruise))
_HYUNDAI_LDA_MASK = HyundaiFlags.HAS_LDA_BUTTON | HyundaiFlags.CANFD
_LATERAL_TOGGLE_BUTTONS = (_BTN.lkas, _BTN.lfaButton)
_HYUNDAI_LDA_MASK = HyundaiFlags.CANFD
# While a lateral-only session rides through a pause, these stock blockers are
# swapped for their silent IQ twins. Order here is not load-bearing (each row
@@ -295,7 +295,7 @@ class SteeringAssistanceBehavior:
def _apply_brand_capabilities(self):
brand = self.CP.brand
self.no_main_cruise = brand in BRANDS_WITHOUT_MAIN_CRUISE_TOGGLE
lda_capable = bool(self.CP.flags & _HYUNDAI_LDA_MASK)
lda_capable = bool(self.CP.flags & _HYUNDAI_LDA_MASK) or bool(self.CP_IQ.flags & HyundaiFlagsIQ.HAS_LFA_BUTTON)
self.hkg_allow = brand == "hyundai" and lda_capable
def _reload_preferences(self, full: bool = False):
@@ -461,7 +461,7 @@ class SteeringAssistanceBehavior:
for be in cs.buttonEvents:
if be.type == _BTN.cancel and long_dropped_out:
self._emit(_Q.speedManually)
if not (be.type == _BTN.lkas and be.pressed and self._lateral_offered(cs)):
if not (be.type in _LATERAL_TOGGLE_BUTTONS and be.pressed and self._lateral_offered(cs)):
continue
if not self.enabled:
self._emit(_Q.alcEngaged)

View File

@@ -6,7 +6,7 @@ from types import SimpleNamespace
from cereal import custom
from iqdbc.car import structs
from iqdbc.car.hyundai.values import HyundaiFlags
from iqdbc.car.hyundai.values import HyundaiFlags, HyundaiFlagsIQ
from openpilot.iqpilot.sab.behavior import SteeringAssistanceBehavior
from openpilot.iqpilot.selfdrive.selfdrived.events import IQEvents
from openpilot.selfdrive.selfdrived.events import Events
@@ -39,7 +39,7 @@ class MockParams:
def make_selfdrive(cp_flags: int, brand: str = "hyundai", main_cruise_allowed: bool = False,
aol_enabled: bool = True):
aol_enabled: bool = True, cp_iq_flags: int = 0):
cp = SimpleNamespace(
brand=brand,
flags=cp_flags,
@@ -47,7 +47,7 @@ def make_selfdrive(cp_flags: int, brand: str = "hyundai", main_cruise_allowed: b
notCar=False,
safetyModel=structs.CarParams.SafetyModel.noOutput,
)
cp_iq = SimpleNamespace(flags=0)
cp_iq = SimpleNamespace(flags=cp_iq_flags)
return SimpleNamespace(
CP=cp,
CP_IQ=cp_iq,
@@ -100,10 +100,12 @@ def make_vw_car_state(cruise_available: bool, cruise_fault_lateral: bool = False
def test_hyundai_lkas_button_can_arm_guidance_before_lateral_available():
selfdrive = make_selfdrive(HyundaiFlags.HAS_LDA_BUTTON)
selfdrive = make_selfdrive(0, cp_iq_flags=HyundaiFlagsIQ.HAS_LFA_BUTTON)
guidance = SteeringAssistanceBehavior(selfdrive)
car_state = make_car_state()
car_state.buttonEvents = [structs.CarState.ButtonEvent(pressed=True, type=ButtonType.lfaButton)]
guidance.update_events(make_car_state())
guidance.update_events(car_state)
assert selfdrive.events_iq.has(EventNameIQ.alcEngaged)