Compare commits

...

13 Commits

Author SHA1 Message Date
Dom 66fe0a3bac Show active End to End slowdown on the compact rail 2026-11-29 10:28:58 -06:00
Dom 72ed2d20ee Keep the lead indicator gray without a lead 2026-11-29 10:03:23 -06:00
firestar5683 c880136da8 Repair CI fixtures after Card and UI changes 2026-11-29 00:26:51 -06:00
firestar5683 e7b1b1626d Avoid unused Sonata Hybrid CAN receipt decoding 2026-11-29 00:09:23 -06:00
firestar5683 5261f20cfd Repair CI fixtures after Card and UI changes 2026-11-29 00:07:46 -06:00
firestar5683 70dfdfca6f Repair CI fixtures after Card and UI changes 2026-11-28 23:53:31 -06:00
firestar5683 040e367fb2 Reduce Sonata Hybrid CAN decoding work 2026-11-28 23:52:28 -06:00
firestar5683 7eae03d00e Repair CI fixtures after Card and UI changes 2026-11-28 23:37:24 -06:00
firestar5683 e05759f8f5 Preview End to End Slowdown Before Engagement 2026-11-28 23:35:38 -06:00
firestar5683 65bf82f608 Remove redundant CAN and model work in control loops 2026-11-28 23:21:38 -06:00
firestar5683 7fbe552da8 Repair CI fixtures after Card and UI changes 2026-11-28 23:20:14 -06:00
firestar5683 efaf16f95d Reuse static AOL configuration in the Card loop 2026-11-28 23:15:43 -06:00
rav4kumar c3e9f5de35 Allow Enhanced BSM with factory Prius sensors 2026-11-28 23:05:28 -06:00
91 changed files with 479 additions and 218 deletions
+2 -3
View File
@@ -90,7 +90,7 @@ class MessageState:
self.counter = cur_count self.counter = cur_count
return self.counter_fail < MAX_BAD_COUNTER return self.counter_fail < MAX_BAD_COUNTER
def valid(self, current_nanos: int, bus_timeout: bool) -> bool: def valid(self, current_nanos: int) -> bool:
if self.ignore_alive: if self.ignore_alive:
return True return True
if not self.timestamps: if not self.timestamps:
@@ -201,13 +201,12 @@ class CANParser:
def can_valid(self) -> bool: def can_valid(self) -> bool:
valid = True valid = True
counters_valid = True counters_valid = True
bus_timeout = self.bus_timeout
invalid_messages = set() invalid_messages = set()
for state in self.message_states.values(): for state in self.message_states.values():
if state.counter_fail >= MAX_BAD_COUNTER: if state.counter_fail >= MAX_BAD_COUNTER:
counters_valid = False counters_valid = False
state.rate_limited_log(self._last_update_nanos, f"counter invalid, {state.counter_fail=} {MAX_BAD_COUNTER=}") state.rate_limited_log(self._last_update_nanos, f"counter invalid, {state.counter_fail=} {MAX_BAD_COUNTER=}")
if not state.valid(self._last_update_nanos, bus_timeout): if not state.valid(self._last_update_nanos):
valid = False valid = False
invalid_messages.add(state.address) invalid_messages.add(state.address)
@@ -66,7 +66,7 @@ def camera_current(parser):
source = parser.message_states.get(0x2A4) source = parser.message_states.get(0x2A4)
now = parser._last_update_nanos now = parser._last_update_nanos
bus_timeout = parser.bus_timeout bus_timeout = parser.bus_timeout
healthy = all(state.valid(now, bus_timeout) and state.counter_fail < MAX_BAD_COUNTER for state in parser.message_states.values()) healthy = all(state.valid(now) and state.counter_fail < MAX_BAD_COUNTER for state in parser.message_states.values())
return bool(healthy and not bus_timeout and source is not None and source.timestamps return bool(healthy and not bus_timeout and source is not None and source.timestamps
and source.counter_fail < MAX_BAD_COUNTER and 0 < int(source.timestamps[-1]) <= now and source.counter_fail < MAX_BAD_COUNTER and 0 < int(source.timestamps[-1]) <= now
and now - int(source.timestamps[-1]) <= source.timeout_threshold) and now - int(source.timestamps[-1]) <= source.timeout_threshold)
+25 -3
View File
@@ -375,7 +375,7 @@ class CarState(CarStateBase):
bus_timeout = cp.bus_timeout bus_timeout = cp.bus_timeout
self.ev6_aol_source_healthy = bool( self.ev6_aol_source_healthy = bool(
not bus_timeout and source is not None and source.timestamps not bus_timeout and source is not None and source.timestamps
and source.valid(now, bus_timeout) and source.counter_fail < MAX_BAD_COUNTER and source.valid(now) and source.counter_fail < MAX_BAD_COUNTER
and 0 < self.ev6_aol_sample_stamp_ns <= now and 0 < self.ev6_aol_sample_stamp_ns <= now
and now - self.ev6_aol_sample_stamp_ns <= source.timeout_threshold) and now - self.ev6_aol_sample_stamp_ns <= source.timeout_threshold)
values = cp.vl_all['CLU11'] values = cp.vl_all['CLU11']
@@ -578,7 +578,7 @@ class CarState(CarStateBase):
bus_timeout = cp.bus_timeout bus_timeout = cp.bus_timeout
self.ev6_aol_source_healthy = bool( self.ev6_aol_source_healthy = bool(
not bus_timeout and source is not None and source.timestamps not bus_timeout and source is not None and source.timestamps
and source.valid(now, bus_timeout) and source.counter_fail < MAX_BAD_COUNTER and source.valid(now) and source.counter_fail < MAX_BAD_COUNTER
and 0 < self.ev6_aol_sample_stamp_ns <= now and 0 < self.ev6_aol_sample_stamp_ns <= now
and now - self.ev6_aol_sample_stamp_ns <= source.timeout_threshold) and now - self.ev6_aol_sample_stamp_ns <= source.timeout_threshold)
values = cp.vl_all[self.cruise_btns_msg_canfd] values = cp.vl_all[self.cruise_btns_msg_canfd]
@@ -777,8 +777,30 @@ class CarState(CarStateBase):
msgs.extend((name, 0) for name in {available_msg, enabled_msg, speed_msg}) msgs.extend((name, 0) for name in {available_msg, enabled_msg, speed_msg})
if not CP.flags & HyundaiFlags.NON_SCC_NO_FCA: if not CP.flags & HyundaiFlags.NON_SCC_NO_FCA:
(msgs if CP.flags & HyundaiFlags.NON_SCC_RADAR_FCA else cam_msgs).append(("FCA11", math.nan)) (msgs if CP.flags & HyundaiFlags.NON_SCC_RADAR_FCA else cam_msgs).append(("FCA11", math.nan))
pt_signals = None
if (CP.carFingerprint == CAR.HYUNDAI_SONATA_HYBRID and CP.pcmCruise and not CP.openpilotLongitudinalControl and
not CP.flags & (HyundaiFlags.CAMERA_SCC | HyundaiFlags.NON_SCC)):
pt_signals = {
"BCM_PO_11": ("LDA_BTN",),
"CGW1": ("CF_Gway_DrvDrSw", "CF_Gway_AstDrSw", "CF_Gway_DrvSeatBeltSw", "CF_Gway_TurnSigLh", "CF_Gway_TurnSigRh"),
"CGW2": ("CF_Gway_RLDrSw", "CF_Gway_RRDrSw"),
"CLU15": ("CF_Clu_VehicleSpeed",),
"ELECT_GEAR": ("Elect_Gear_Shifter",),
"E_EMS11": ("CR_Vcu_AccPedDep_Pos",),
"FCA11": ("CF_VSM_Warn", "CF_VSM_DecCmdAct", "FCA_CmdAct"),
"LCA11": ("CF_Lca_IndLeft", "CF_Lca_IndRight"),
"MDPS12": ("CR_Mdps_StrColTq", "CR_Mdps_OutTq", "CF_Mdps_ToiUnavail", "CF_Mdps_ToiFlt", "CF_Mdps_ToiActive"),
"SAS11": ("SAS_Angle", "SAS_Speed"),
"SCC11": ("MainMode_ACC", "SCCInfoDisplay", "VSetDis"),
"SCC12": ("ACCMode", "TakeOverReq", "CF_VSM_Warn", "CF_VSM_DecCmdAct", "AEB_CmdAct"),
"TCS11": ("TCS_PAS", "ABS_ACT"),
"TCS13": ("DriverOverride", "PBRAKE_ACT", "ACCEnable"),
"TCS15": ("AVH_LAMP",),
"WHL_SPD11": ("WHL_SPD_FL", "WHL_SPD_FR", "WHL_SPD_RL", "WHL_SPD_RR"),
}
parsers = { parsers = {
Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], msgs, 0), Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], msgs, 0, signals=pt_signals),
Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], cam_msgs, 2), Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], cam_msgs, 2),
} }
@@ -5,6 +5,18 @@ from opendbc.car.hyundai.classic_scc_aol import CLASSIC_SCC_IDS, stock_word
AOL_MARKER = 0x0400 AOL_MARKER = 0x0400
AOL_EXPERIENCE = 32 AOL_EXPERIENCE = 32
_EXCLUDED = int(HyundaiFlags.LEGACY | HyundaiFlags.UNSUPPORTED_LONGITUDINAL | HyundaiFlags.ALT_LIMITS_2 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.FCEV) _EXCLUDED = int(HyundaiFlags.LEGACY | HyundaiFlags.UNSUPPORTED_LONGITUDINAL | HyundaiFlags.ALT_LIMITS_2 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.FCEV)
_DYNAMIC_FLAGS = int(HyundaiFlags.HAS_LDA_BUTTON | HyundaiFlags.USE_FCA | HyundaiFlags.SEND_LFA)
_IDENTITY_MASK = int(
HyundaiFlags.CANFD
| HyundaiFlags.NON_SCC
| HyundaiFlags.FCEV
| HyundaiFlags.LEGACY
| HyundaiFlags.EV
| HyundaiFlags.HYBRID
| HyundaiFlags.ALT_LIMITS
| HyundaiFlags.ALT_LIMITS_2
| HyundaiFlags.CAMERA_SCC
)
CLASSIC_LONG_IDS = frozenset(identity for identity in CLASSIC_SCC_IDS if not int(identity.config.flags) & _EXCLUDED) CLASSIC_LONG_IDS = frozenset(identity for identity in CLASSIC_SCC_IDS if not int(identity.config.flags) & _EXCLUDED)
LONG_AOL_WORDS = frozenset(AOL_MARKER | 4 | gas | limits | lda for gas in (0, 1, 2) for limits in (0, 64) for lda in (0, 2048)) LONG_AOL_WORDS = frozenset(AOL_MARKER | 4 | gas | limits | lda for gas in (0, 1, 2) for limits in (0, 64) for lda in (0, 2048))
@@ -24,33 +36,22 @@ def aol_word(cp):
def qualified(cp, *, marked_only=False): def qualified(cp, *, marked_only=False):
if not cp.openpilotLongitudinalControl or cp.pcmCruise:
return False
from opendbc.car.hyundai.legacy_long_aol import CARS, qualified as legacy_qualified from opendbc.car.hyundai.legacy_long_aol import CARS, qualified as legacy_qualified
if cp.carFingerprint in CARS: if cp.carFingerprint in CARS:
return legacy_qualified(cp, marked_only=marked_only) return legacy_qualified(cp, marked_only=marked_only)
if cp.brand != 'hyundai' or cp.carFingerprint not in CLASSIC_LONG_IDS: if cp.brand != 'hyundai' or cp.carFingerprint not in CLASSIC_LONG_IDS:
return False return False
declared = int(CAR[cp.carFingerprint].config.flags) declared = int(CAR[cp.carFingerprint].config.flags)
allowed = declared | int(HyundaiFlags.HAS_LDA_BUTTON | HyundaiFlags.USE_FCA | HyundaiFlags.SEND_LFA) allowed = declared | _DYNAMIC_FLAGS
identity_mask = int(
HyundaiFlags.CANFD
| HyundaiFlags.NON_SCC
| HyundaiFlags.FCEV
| HyundaiFlags.LEGACY
| HyundaiFlags.EV
| HyundaiFlags.HYBRID
| HyundaiFlags.ALT_LIMITS
| HyundaiFlags.ALT_LIMITS_2
| HyundaiFlags.CAMERA_SCC
)
if ( if (
int(cp.flags) & identity_mask != declared & identity_mask int(cp.flags) & _IDENTITY_MASK != declared & _IDENTITY_MASK
or int(cp.flags) & ~allowed or int(cp.flags) & ~allowed
or is_blended(cp) or is_blended(cp)
or cp.passive or cp.passive
or cp.notCar or cp.notCar
or cp.dashcamOnly or cp.dashcamOnly
or not cp.openpilotLongitudinalControl
or cp.pcmCruise
or cp.steerControlType != structs.CarParams.SteerControlType.torque or cp.steerControlType != structs.CarParams.SteerControlType.torque
or not cp.alphaLongitudinalAvailable or not cp.alphaLongitudinalAvailable
or cp.alternativeExperience not in (0, AOL_EXPERIENCE) or cp.alternativeExperience not in (0, AOL_EXPERIENCE)
@@ -12,9 +12,21 @@ from opendbc.car.hyundai.values import CAR, HyundaiFlags, HyundaiSafetyFlags, is
AOL_MARKER = 0x0400 AOL_MARKER = 0x0400
AOL_EXPERIENCE = 32 AOL_EXPERIENCE = 32
_EXCLUDED = int(HyundaiFlags.CANFD | HyundaiFlags.NON_SCC | HyundaiFlags.FCEV) _EXCLUDED = int(HyundaiFlags.CANFD | HyundaiFlags.NON_SCC | HyundaiFlags.FCEV)
_DYNAMIC_FLAGS = int(HyundaiFlags.HAS_LDA_BUTTON | HyundaiFlags.USE_FCA | HyundaiFlags.SEND_LFA)
_IDENTITY_MASK = _EXCLUDED | int(
HyundaiFlags.EV | HyundaiFlags.HYBRID | HyundaiFlags.ALT_LIMITS | HyundaiFlags.ALT_LIMITS_2 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.LEGACY
)
CLASSIC_SCC_IDS = frozenset(identity for identity in CAR if not int(identity.config.flags) & _EXCLUDED and identity != CAR.HYUNDAI_PALISADE_2023) | frozenset( CLASSIC_SCC_IDS = frozenset(identity for identity in CAR if not int(identity.config.flags) & _EXCLUDED and identity != CAR.HYUNDAI_PALISADE_2023) | frozenset(
(CAR.HYUNDAI_NEXO_1ST_GEN,) (CAR.HYUNDAI_NEXO_1ST_GEN,)
) )
_STOCK_FLAGS = tuple((int(flag), int(safety)) for flag, safety in (
(HyundaiFlags.FCEV, HyundaiSafetyFlags.FCEV_GAS),
(HyundaiFlags.EV, HyundaiSafetyFlags.EV_GAS),
(HyundaiFlags.HYBRID, HyundaiSafetyFlags.HYBRID_GAS),
(HyundaiFlags.ALT_LIMITS, HyundaiSafetyFlags.ALT_LIMITS),
(HyundaiFlags.ALT_LIMITS_2, HyundaiSafetyFlags.ALT_LIMITS_2),
(HyundaiFlags.CAMERA_SCC, HyundaiSafetyFlags.CAMERA_SCC),
))
_MODELS = (structs.CarParams.SafetyModel.hyundai, structs.CarParams.SafetyModel.hyundaiLegacy) _MODELS = (structs.CarParams.SafetyModel.hyundai, structs.CarParams.SafetyModel.hyundaiLegacy)
FCEV_AOL_WORDS = frozenset((0x0500, 0x0D00)) FCEV_AOL_WORDS = frozenset((0x0500, 0x0D00))
NORMAL_AOL_WORDS = ( NORMAL_AOL_WORDS = (
@@ -31,16 +43,10 @@ def native_profile_supported(model, param):
def stock_word(cp): def stock_word(cp):
word = int(HyundaiSafetyFlags.CAN_REFRESH_MSGS) if cp.carFingerprint in (CAR.HYUNDAI_ELANTRA_2024, CAR.HYUNDAI_ELANTRA_HEV_2024) else 0 word = int(HyundaiSafetyFlags.CAN_REFRESH_MSGS) if cp.carFingerprint in (CAR.HYUNDAI_ELANTRA_2024, CAR.HYUNDAI_ELANTRA_HEV_2024) else 0
for flag, safety in ( flags = int(cp.flags)
(HyundaiFlags.FCEV, HyundaiSafetyFlags.FCEV_GAS), for flag, safety in _STOCK_FLAGS:
(HyundaiFlags.EV, HyundaiSafetyFlags.EV_GAS), if flags & flag:
(HyundaiFlags.HYBRID, HyundaiSafetyFlags.HYBRID_GAS), word |= safety
(HyundaiFlags.ALT_LIMITS, HyundaiSafetyFlags.ALT_LIMITS),
(HyundaiFlags.ALT_LIMITS_2, HyundaiSafetyFlags.ALT_LIMITS_2),
(HyundaiFlags.CAMERA_SCC, HyundaiSafetyFlags.CAMERA_SCC),
):
if int(cp.flags) & int(flag):
word |= int(safety)
return word return word
@@ -52,12 +58,9 @@ def qualified(cp, *, marked_only=False):
if cp.brand != "hyundai" or cp.carFingerprint not in CLASSIC_SCC_IDS: if cp.brand != "hyundai" or cp.carFingerprint not in CLASSIC_SCC_IDS:
return False return False
declared = int(CAR[cp.carFingerprint].config.flags) declared = int(CAR[cp.carFingerprint].config.flags)
allowed = declared | int(HyundaiFlags.HAS_LDA_BUTTON | HyundaiFlags.USE_FCA | HyundaiFlags.SEND_LFA) allowed = declared | _DYNAMIC_FLAGS
identity_mask = _EXCLUDED | int(
HyundaiFlags.EV | HyundaiFlags.HYBRID | HyundaiFlags.ALT_LIMITS | HyundaiFlags.ALT_LIMITS_2 | HyundaiFlags.CAMERA_SCC | HyundaiFlags.LEGACY
)
if ( if (
int(cp.flags) & identity_mask != declared & identity_mask int(cp.flags) & _IDENTITY_MASK != declared & _IDENTITY_MASK
or int(cp.flags) & ~allowed or int(cp.flags) & ~allowed
or is_blended(cp) or is_blended(cp)
or cp.passive or cp.passive
@@ -161,6 +161,8 @@ def get_radar_can_parser(CP):
# MRR35 publishes many unused/unknown fields in each object packet. Decode # MRR35 publishes many unused/unknown fields in each object packet. Decode
# the four consumed track fields, retaining parser integrity fields automatically. # the four consumed track fields, retaining parser integrity fields automatically.
selected = ({name: ('STATE', 'LONG_DIST', 'LAT_DIST', 'REL_SPEED') for name, _ in messages} if mrr35 else None) selected = ({name: ('STATE', 'LONG_DIST', 'LAT_DIST', 'REL_SPEED') for name, _ in messages} if mrr35 else None)
if radar_dbc(CP) == "hyundai_kia_mando_front_radar_generated":
selected = {name: ('STATE', 'AZIMUTH', 'LONG_DIST', 'REL_SPEED') for name, _ in messages}
return CANParser(radar_dbc(CP), messages, radar_bus(CP) if mrr35 or mrr30 or gv70 else 1, signals=selected) return CANParser(radar_dbc(CP), messages, radar_bus(CP) if mrr35 or mrr30 or gv70 else 1, signals=selected)
@@ -329,7 +329,7 @@ class TestBlendedLifecycle(unittest.TestCase):
car._deferred_radar_can = None car._deferred_radar_can = None
vars(car)['RI'] = SimpleNamespace(update=lambda can_list: None) vars(car)['RI'] = SimpleNamespace(update=lambda can_list: None)
vars(car)['state_publish'] = lambda *args: calls.append('state') vars(car)['state_publish'] = lambda *args: calls.append('state')
car.CP = SimpleNamespace(passive=False) car.CP = SimpleNamespace(brand='hyundai', passive=False)
car.ci_initialized = False car.ci_initialized = False
class SM(dict): class SM(dict):
@@ -216,7 +216,7 @@ def test_actual_classic_family_cancel_and_manual_withdrawal(identity, monkeypatc
config = card.CP.safetyConfigs[0] config = card.CP.safetyConfigs[0]
model, word = int(config.safetyModel.raw), int(config.safetyParam) model, word = int(config.safetyModel.raw), int(config.safetyParam)
configured = [False] configured = [False]
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body
assignments = [node for node in dispatch_tree if isinstance(node, ast.Assign) and assignments = [node for node in dispatch_tree if isinstance(node, ast.Assign) and
any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)] any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)]
decisions = [node for node in dispatch_tree if isinstance(node, ast.If) and ast.unparse(node.test) == 'not self.CP.passive and initialized'] decisions = [node for node in dispatch_tree if isinstance(node, ast.If) and ast.unparse(node.test) == 'not self.CP.passive and initialized']
@@ -243,7 +243,7 @@ def test_classic_family_actual_startup_cancel_and_manual_withdrawal(identity, mo
config = card.CP.safetyConfigs[0] config = card.CP.safetyConfigs[0]
model, word = int(config.safetyModel.raw), int(config.safetyParam) model, word = int(config.safetyModel.raw), int(config.safetyParam)
configured = [False] configured = [False]
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body
assignments = [ assignments = [
node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets) node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)
] ]
@@ -13,6 +13,7 @@ from opendbc.car.hyundai.radar_interface import RadarInterface
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.prefix import OpenpilotPrefix from openpilot.common.prefix import OpenpilotPrefix
from openpilot.selfdrive.car.card import Car from openpilot.selfdrive.car.card import Car
from openpilot.starpilot.aol.card_native import aol_configuration
from openpilot.starpilot.aol.intent import AOL_TOGGLE from openpilot.starpilot.aol.intent import AOL_TOGGLE
from openpilot.starpilot.car.hyundai.aol import policy_for, native_accepts_cp from openpilot.starpilot.car.hyundai.aol import policy_for, native_accepts_cp
@@ -102,7 +103,8 @@ class TestEV9CombinedPending(EV9StartupFixture):
self.assertEqual(self.sent, []) self.assertEqual(self.sent, [])
with structs.CarParams.from_bytes(saved.get('CarParams')) as published: with structs.CarParams.from_bytes(saved.get('CarParams')) as published:
self.assertEqual(published.to_dict(), card.CP.to_dict()) self.assertEqual(published.to_dict(), card.CP.to_dict())
self.assertEqual(card.aol_permission_owners()[0], aol) _, owners, _ = aol_configuration(card)
self.assertEqual(owners[0], aol)
owner.close() owner.close()
def test_marker_finalization_cannot_relabel_other_cp_fields_or_follow_publication(self): def test_marker_finalization_cannot_relabel_other_cp_fields_or_follow_publication(self):
@@ -116,16 +116,16 @@ class TestNonSccStartup(unittest.TestCase):
message = parser.message_states[parser.dbc.name_to_msg[name].address] message = parser.message_states[parser.dbc.name_to_msg[name].address]
self.assertFalse(message.ignore_alive, (identity, name)) self.assertFalse(message.ignore_alive, (identity, name))
self.assertFalse(message.timestamps, (identity, name)) self.assertFalse(message.timestamps, (identity, name))
self.assertFalse(message.valid(1_000_000_000, False), (identity, name, 'never received')) self.assertFalse(message.valid(1_000_000_000), (identity, name, 'never received'))
packer = CANPacker(DBC[identity][Bus.pt]) packer = CANPacker(DBC[identity][Bus.pt])
packet = packer.make_can_msg(name, 0, {}) packet = packer.make_can_msg(name, 0, {})
if name == 'EMS16': if name == 'EMS16':
packet = checksum(packet) packet = checksum(packet)
ci.update([(1_000_000_000, [packet])]) ci.update([(1_000_000_000, [packet])])
self.assertTrue(message.timestamps, (identity, name, 'packed arrival')) self.assertTrue(message.timestamps, (identity, name, 'packed arrival'))
self.assertTrue(message.valid(1_000_000_000, False), (identity, name, 'arrived')) self.assertTrue(message.valid(1_000_000_000), (identity, name, 'arrived'))
expired = 1_000_000_000 + int(message.timeout_threshold) + 1 expired = 1_000_000_000 + int(message.timeout_threshold) + 1
self.assertFalse(message.valid(expired, False), (identity, name, 'expired')) self.assertFalse(message.valid(expired), (identity, name, 'expired'))
self.assertFalse(ci.update([(expired, [])]).canValid, (identity, name, 'incomplete stream')) self.assertFalse(ci.update([(expired, [])]).canValid, (identity, name, 'incomplete stream'))
def test_required_sources_loss_wrong_bus_and_recovery(self): def test_required_sources_loss_wrong_bus_and_recovery(self):
@@ -227,7 +227,7 @@ def test_prepublication_classic_owner_preserves_real_boot_and_independent_axes(i
config = card.CP.safetyConfigs[0] config = card.CP.safetyConfigs[0]
model, word = int(config.safetyModel.raw), int(config.safetyParam) model, word = int(config.safetyModel.raw), int(config.safetyParam)
configured = [False] configured = [False]
dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car.step))).body[0].body dispatch_tree = ast.parse(textwrap.dedent(inspect.getsource(card_module.Car._step))).body[0].body
assignments = [ assignments = [
node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets) node for node in dispatch_tree if isinstance(node, ast.Assign) and any(isinstance(t, ast.Name) and t.id == 'initialized' for t in node.targets)
] ]
@@ -4,7 +4,7 @@ from opendbc.car.hyundai import radar_interface
from opendbc.car.hyundai.tests.test_dom_radar_complete_paths import CASES, bank, factory from opendbc.car.hyundai.tests.test_dom_radar_complete_paths import CASES, bank, factory
@pytest.mark.parametrize('name,dbc,bus,start,count,length,lka', [case for case in CASES if 'mrr35' in case[1]]) @pytest.mark.parametrize('name,dbc,bus,start,count,length,lka', [case for case in CASES if any(layout in case[1] for layout in ('mrr35', 'mando_front'))])
def test_projected_radar_matches_complete_decoder(monkeypatch, name, dbc, bus, start, count, length, lka): def test_projected_radar_matches_complete_decoder(monkeypatch, name, dbc, bus, start, count, length, lka):
cp = factory(name, bus, start, count, length, lka) cp = factory(name, bus, start, count, length, lka)
projected = radar_interface.RadarInterface(cp) projected = radar_interface.RadarInterface(cp)
@@ -532,7 +532,7 @@ class CarController(CarControllerBase):
can_sends.append(make_tester_present_msg(0x750, 0, 0xF)) can_sends.append(make_tester_present_msg(0x750, 0, 0xF))
if self.bsm_poller is not None: if self.bsm_poller is not None:
can_sends.extend(self.bsm_poller.update(CS.out, self.frame, factory_bsm=CS.factory_bsm)) can_sends.extend(self.bsm_poller.update(CS.out, self.frame))
door_command = self.door_locks.update(CS.out) door_command = self.door_locks.update(CS.out)
if door_command is not None: if door_command is not None:
+5 -7
View File
@@ -40,7 +40,6 @@ def has_optional_prius_gap_button(CP):
class CarState(CarStateBase): class CarState(CarStateBase):
def __init__(self, CP): def __init__(self, CP):
super().__init__(CP) super().__init__(CP)
self.factory_bsm = False
can_define = CANDefine(DBC[CP.carFingerprint][Bus.pt]) can_define = CANDefine(DBC[CP.carFingerprint][Bus.pt])
original_prius = prius_sdsu.configured(CP) or prius_advert_filter.configured(CP) original_prius = prius_sdsu.configured(CP) or prius_advert_filter.configured(CP)
self.eps_torque_scale = ((CP.safetyConfigs[0].safetyParam & 0xFF) / 100. if prius_advert_filter.configured(CP) else self.eps_torque_scale = ((CP.safetyConfigs[0].safetyParam & 0xFF) / 100. if prius_advert_filter.configured(CP) else
@@ -236,13 +235,12 @@ class CarState(CarStateBase):
ret.genericToggle = bool(cp.vl["LIGHT_STALK"]["AUTO_HIGH_BEAM"]) ret.genericToggle = bool(cp.vl["LIGHT_STALK"]["AUTO_HIGH_BEAM"])
ret.espDisabled = cp.vl["ESP_CONTROL"]["TC_DISABLED"] != 0 ret.espDisabled = cp.vl["ESP_CONTROL"]["TC_DISABLED"] != 0
self.factory_bsm = isinstance(cp, enhanced_bsm.BsmCANParser) and cp.factory_bsm if self.CP.flags & ToyotaFlags.HAS_BSM or isinstance(cp, enhanced_bsm.BsmCANParser) and cp.factory_bsm:
if self.CP.flags & ToyotaFlags.HAS_BSM or self.factory_bsm:
ret.leftBlindspot = (cp.vl["BSM"]["L_ADJACENT"] == 1) or (cp.vl["BSM"]["L_APPROACHING"] == 1) ret.leftBlindspot = (cp.vl["BSM"]["L_ADJACENT"] == 1) or (cp.vl["BSM"]["L_APPROACHING"] == 1)
ret.rightBlindspot = (cp.vl["BSM"]["R_ADJACENT"] == 1) or (cp.vl["BSM"]["R_APPROACHING"] == 1) ret.rightBlindspot = (cp.vl["BSM"]["R_ADJACENT"] == 1) or (cp.vl["BSM"]["R_APPROACHING"] == 1)
elif isinstance(cp, enhanced_bsm.BsmCANParser) and ret.vEgo > 6.0: if isinstance(cp, enhanced_bsm.BsmCANParser) and ret.vEgo > 6.0:
ret.leftBlindspot = cp.occupied(enhanced_bsm.SIDES[0]) ret.leftBlindspot |= cp.occupied(enhanced_bsm.SIDES[0])
ret.rightBlindspot = cp.occupied(enhanced_bsm.SIDES[1]) ret.rightBlindspot |= cp.occupied(enhanced_bsm.SIDES[1])
if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V: if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V:
self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD"]) self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD"])
@@ -417,7 +415,7 @@ class CarState(CarStateBase):
Rav4hCANParser if rav4h_filter_configured(CP) else CANParser) Rav4hCANParser if rav4h_filter_configured(CP) else CANParser)
if enhanced_bsm.configured(CP): if enhanced_bsm.configured(CP):
pt_parser = enhanced_bsm.BsmCANParser pt_parser = enhanced_bsm.BsmCANParser
pt_messages.append(("BSM", math.nan)) pt_messages.append(("BSM", 0 if CP.flags & ToyotaFlags.HAS_BSM else math.nan))
parsers = { parsers = {
Bus.pt: pt_parser(DBC[CP.carFingerprint][Bus.pt], pt_messages, 0, **({"stock_word": CP.safetyConfigs[0].safetyParam} if stock else Bus.pt: pt_parser(DBC[CP.carFingerprint][Bus.pt], pt_messages, 0, **({"stock_word": CP.safetyConfigs[0].safetyParam} if stock else
{"alternate_main": alternate_sdsu_main} if legacy_advert else {})), {"alternate_main": alternate_sdsu_main} if legacy_advert else {})),
@@ -16,7 +16,7 @@ REPLY_MAX_AGE_NS = 500_000_000
def supported(cp): def supported(cp):
required = ToyotaFlags.TSS2 | ToyotaFlags.NO_DSU | ToyotaFlags.RAISED_ACCEL_LIMIT | ToyotaFlags.HYBRID required = ToyotaFlags.TSS2 | ToyotaFlags.NO_DSU | ToyotaFlags.RAISED_ACCEL_LIMIT | ToyotaFlags.HYBRID
allowed = required | ToyotaFlags.AUTO_BRAKE_HOLD allowed = required | ToyotaFlags.AUTO_BRAKE_HOLD | ToyotaFlags.HAS_BSM
return (cp.carFingerprint == CAR.TOYOTA_PRIUS_TSS2 and cp.brand == 'toyota' and return (cp.carFingerprint == CAR.TOYOTA_PRIUS_TSS2 and cp.brand == 'toyota' and
cp.pcmCruise and cp.openpilotLongitudinalControl and not (cp.passive or cp.dashcamOnly or cp.notCar or cp.secOcRequired) and cp.pcmCruise and cp.openpilotLongitudinalControl and not (cp.passive or cp.dashcamOnly or cp.notCar or cp.secOcRequired) and
cp.steerControlType == structs.CarParams.SteerControlType.torque and cp.flags & required == required and cp.steerControlType == structs.CarParams.SteerControlType.torque and cp.flags & required == required and
@@ -55,8 +55,7 @@ class BsmCANParser(CANParser):
for address, data, bus in frames: for address, data, bus in frames:
if bus == self.bus and address == 0x3F6 and len(data) == 8: if bus == self.bus and address == 0x3F6 and len(data) == 8:
self.factory_bsm = True self.factory_bsm = True
self.blindspots.clear() if (bus == self.bus and address == 0x758 and len(data) == 8 and
if (not self.factory_bsm and bus == self.bus and address == 0x758 and len(data) == 8 and
data[0] in SIDES and data[1:4] == b'\x06\x61\x69'): data[0] in SIDES and data[1:4] == b'\x06\x61\x69'):
self.blindspots[data[0]] = (timestamp, max(data[5:7]) > 35) self.blindspots[data[0]] = (timestamp, max(data[5:7]) > 35)
return super().update(strings, sendcan) return super().update(strings, sendcan)
@@ -71,8 +70,8 @@ class BsmPoller:
self.active = False self.active = False
self.started = 0 self.started = 0
def update(self, state, frame, *, factory_bsm=False): def update(self, state, frame):
ready = (not factory_bsm and frame > 200 and state.canValid and not state.canTimeout and ready = (frame > 200 and state.canValid and not state.canTimeout and
state.gearShifter in (structs.CarState.GearShifter.drive, structs.CarState.GearShifter.sport) and state.gearShifter in (structs.CarState.GearShifter.drive, structs.CarState.GearShifter.sport) and
state.vEgo > (6.0 if self.active else 7.0)) state.vEgo > (6.0 if self.active else 7.0))
if ready != self.active: if ready != self.active:
@@ -21,11 +21,12 @@ def params(car=CAR.TOYOTA_PRIUS_TSS2, *, factory=False, requested=True):
@pytest.mark.parametrize('car,factory,requested,configured', ( @pytest.mark.parametrize('car,factory,requested,configured', (
(CAR.TOYOTA_PRIUS_TSS2, False, True, True), (CAR.TOYOTA_PRIUS_TSS2, False, True, True),
(CAR.TOYOTA_PRIUS_TSS2, True, True, False), (CAR.TOYOTA_PRIUS_TSS2, True, True, True),
(CAR.TOYOTA_PRIUS_TSS2, True, False, False),
(CAR.TOYOTA_PRIUS_TSS2, False, False, False), (CAR.TOYOTA_PRIUS_TSS2, False, False, False),
(CAR.TOYOTA_COROLLA_TSS2, False, True, False), (CAR.TOYOTA_COROLLA_TSS2, False, True, False),
)) ))
def test_fallback_admission(car, factory, requested, configured): def test_polling_admission(car, factory, requested, configured):
cp = params(car, factory=factory, requested=requested) cp = params(car, factory=factory, requested=requested)
ci = CarInterface(cp) ci = CarInterface(cp)
assert isinstance(ci.can_parsers[Bus.pt], enhanced_bsm.BsmCANParser) == configured assert isinstance(ci.can_parsers[Bus.pt], enhanced_bsm.BsmCANParser) == configured
@@ -53,15 +54,20 @@ def test_fresh_bsm_replies_are_independent_and_use_recorded_idle_format():
assert not parser.occupied(0x42) assert not parser.occupied(0x42)
def test_late_factory_broadcast_takes_priority(): @pytest.mark.parametrize('factory_at_startup', (False, True))
cp = params() def test_factory_and_diagnostic_detections_are_combined(factory_at_startup):
cp = params(factory=factory_at_startup)
ci = CarInterface(cp) ci = CarInterface(cp)
packer = CANPacker(DBC[CAR.TOYOTA_PRIUS_TSS2][Bus.pt]) packer = CANPacker(DBC[CAR.TOYOTA_PRIUS_TSS2][Bus.pt])
factory = packer.make_can_msg('BSM', 0, {'L_APPROACHING': 1}) wheel = packer.make_can_msg('WHEEL_SPEEDS', 0, {f'WHEEL_SPEED_{side}': 36 for side in ('FL', 'FR', 'RL', 'RR')})
right = (0x758, bytes.fromhex('4206616900390089'), 0) left_factory = packer.make_can_msg('BSM', 0, {'L_APPROACHING': 1})
state = ci.update([(1_000_000_000, [factory, right])]) left_idle = (0x758, bytes.fromhex('4106616900000089'), 0)
right_active = (0x758, bytes.fromhex('4206616900390089'), 0)
ci.update([(990_000_000, [])]) # The wheel message is registered on first access.
state = ci.update([(1_000_000_000, [wheel, left_factory, left_idle, right_active])])
assert state.leftBlindspot and state.rightBlindspot
state = ci.update([(1_500_000_001, [wheel, left_factory])])
assert state.leftBlindspot and not state.rightBlindspot assert state.leftBlindspot and not state.rightBlindspot
assert ci.CS.factory_bsm
def test_poll_cadence_and_cleanup(): def test_poll_cadence_and_cleanup():
@@ -132,8 +138,12 @@ def test_native_diagnostics_are_scoped_and_require_a_paced_moving_session(tmp_pa
assert tx(end) assert tx(end)
assert not tx(end) assert not tx(end)
wheel(8.) wheel(8.)
rx('BSM', {'L_ADJACENT': 1})
assert tx(enable) assert tx(enable)
rx('BSM', {}) safety.set_timer(1_141_000)
rx('BSM', {'L_ADJACENT': 1})
assert tx(poll)
wheel(0.)
assert not tx(poll) assert not tx(poll)
assert tx(end) assert tx(end)
assert not tx(enable) assert not tx(enable)
@@ -34,7 +34,7 @@ def test_prius_gap_button_requires_the_source_only_during_a_press(stock_aol):
gap_message = parsers[Bus.pt].message_states[0x343] gap_message = parsers[Bus.pt].message_states[0x343]
assert not gap_message.ignore_alive assert not gap_message.ignore_alive
assert edges(12_000_000_000) == [] assert edges(12_000_000_000) == []
assert not gap_message.valid(12_000_000_000, False) assert not gap_message.valid(12_000_000_000)
assert edges(12_030_000_000, 0) == [False] assert edges(12_030_000_000, 0) == [False]
assert gap_message.ignore_alive assert gap_message.ignore_alive
assert gap_message.valid(23_000_000_000, False) assert gap_message.valid(23_000_000_000)
+1 -6
View File
@@ -69,7 +69,6 @@ static bool toyota_stock_longitudinal = false;
static bool toyota_lta = false; static bool toyota_lta = false;
static bool toyota_radar_diagnostics_allowed = false; static bool toyota_radar_diagnostics_allowed = false;
static bool toyota_enhanced_bsm = false; static bool toyota_enhanced_bsm = false;
static bool toyota_factory_bsm_seen = false;
static uint32_t toyota_bsm_tx_ts[2] = {0U, 0U}; static uint32_t toyota_bsm_tx_ts[2] = {0U, 0U};
static bool toyota_bsm_session[2] = {false, false}; static bool toyota_bsm_session[2] = {false, false};
static int toyota_dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file static int toyota_dbc_eps_torque_factor = 100; // conversion factor for STEER_TORQUE_EPS in %: see dbc file
@@ -224,9 +223,6 @@ static void toyota_hold_observe(const CANPacket_t *msg) {
} }
static void toyota_optional_rx_hook(const CANPacket_t *msg) { static void toyota_optional_rx_hook(const CANPacket_t *msg) {
if (toyota_enhanced_bsm && msg_matches(msg, 0x3F6U, 0U) && (GET_LEN(msg) == 8U)) {
toyota_factory_bsm_seen = true;
}
// Only bus0 pedal RX belongs to the required catalog. A CRC-valid camera // Only bus0 pedal RX belongs to the required catalog. A CRC-valid camera
// copy must neither invalidate its parent nor refresh the primary lease. // copy must neither invalidate its parent nor refresh the primary lease.
const bool camera_copy = toyota_pedal && msg_matches(msg, 0x201U, 2U) && (GET_LEN(msg) == 6U) && const bool camera_copy = toyota_pedal && msg_matches(msg, 0x201U, 2U) && (GET_LEN(msg) == 6U) &&
@@ -627,7 +623,7 @@ static bool toyota_tx_hook(const CANPacket_t *msg) {
const bool paced = safety_get_ts_elapsed(now, toyota_bsm_tx_ts[side]) >= 40000U; const bool paced = safety_get_ts_elapsed(now, toyota_bsm_tx_ts[side]) >= 40000U;
const bool enable = start && !session && (vehicle_speed.values[0] > (7 * VEHICLE_SPEED_FACTOR)); const bool enable = start && !session && (vehicle_speed.values[0] > (7 * VEHICLE_SPEED_FACTOR));
const bool poll_allowed = poll && session && paced && (vehicle_speed.values[0] > (6 * VEHICLE_SPEED_FACTOR)); const bool poll_allowed = poll && session && paced && (vehicle_speed.values[0] > (6 * VEHICLE_SPEED_FACTOR));
tx &= (stop_polling && session) || (!toyota_factory_bsm_seen && ready && (enable || poll_allowed)); tx &= (stop_polling && session) || (ready && (enable || poll_allowed));
if (tx) { if (tx) {
toyota_bsm_session[side] = !stop_polling; toyota_bsm_session[side] = !stop_polling;
toyota_bsm_tx_ts[side] = now; toyota_bsm_tx_ts[side] = now;
@@ -646,7 +642,6 @@ static bool toyota_tx_hook(const CANPacket_t *msg) {
} }
static safety_config toyota_init(uint16_t param) { static safety_config toyota_init(uint16_t param) {
toyota_factory_bsm_seen = false;
toyota_enhanced_bsm = (param == 73U) && ((alternative_experience & ALT_EXP_TOYOTA_ENHANCED_BSM) != 0); toyota_enhanced_bsm = (param == 73U) && ((alternative_experience & ALT_EXP_TOYOTA_ENHANCED_BSM) != 0);
for (unsigned int i = 0U; i < 2U; i++) { for (unsigned int i = 0U; i < 2U; i++) {
toyota_bsm_tx_ts[i] = 0U; toyota_bsm_tx_ts[i] = 0U;
@@ -603,7 +603,12 @@ class TestToyotaHighlanderAol(unittest.TestCase):
self.assertTrue(send(right, start)) self.assertTrue(send(right, start))
self.rx(0x3F6, bytes(8)) self.rx(0x3F6, bytes(8))
self.safety.set_timer(1_080_000) self.safety.set_timer(1_080_000)
self.assertTrue(send(left, poll))
self.assertTrue(send(right, poll))
stopped = dict.fromkeys(speed, 0)
self.assertTrue(self.safety.safety_rx_hook(self.packer.make_can_msg_safety("WHEEL_SPEEDS", 0, stopped)))
self.assertFalse(send(left, poll)) self.assertFalse(send(left, poll))
self.assertFalse(send(right, poll))
self.assertTrue(send(left, stop)) self.assertTrue(send(left, stop))
self.assertTrue(send(right, stop)) self.assertTrue(send(right, stop))
self.assertFalse(send(left, start)) self.assertFalse(send(left, start))
Binary file not shown.
Binary file not shown.
+19 -32
View File
@@ -39,16 +39,10 @@ from openpilot.starpilot.aol.intent import AolProcessFaultContext, claim_remappe
from openpilot.starpilot.aol.transport_pause import TransportPauseFeedback, cp_identity from openpilot.starpilot.aol.transport_pause import TransportPauseFeedback, cp_identity
from opendbc.car.honda.stock_aol import qualified as qualified_honda_stock_aol, native_observation as honda_native_observation from opendbc.car.honda.stock_aol import qualified as qualified_honda_stock_aol, native_observation as honda_native_observation
from opendbc.car.volkswagen.stock_aol import safety_config as volkswagen_aol_safety_config from opendbc.car.volkswagen.stock_aol import safety_config as volkswagen_aol_safety_config
from openpilot.starpilot.car.volkswagen.aol import qualified as qualified_volkswagen_aol
from openpilot.starpilot.car.rivian.aol import retained_brake_lateral_intent as rivian_brake_intent_retained from openpilot.starpilot.car.rivian.aol import retained_brake_lateral_intent as rivian_brake_intent_retained
from opendbc.car.rivian.stock_aol import qualified as qualified_rivian_aol
from opendbc.car.mazda.stock_aol import qualified as qualified_mazda_aol
from opendbc.car.tesla.preap.aol import qualified as qualified_tesla_preap from opendbc.car.tesla.preap.aol import qualified as qualified_tesla_preap
from opendbc.car.hyundai.canfd_angle_aol import qualified as qualified_angle_aol
from opendbc.car.hyundai.canfd_owner import config_index as hyundai_canfd_config_index from opendbc.car.hyundai.canfd_owner import config_index as hyundai_canfd_config_index
from opendbc.car.hyundai.captured_adrv_startup import CapturedADRVStartup from opendbc.car.hyundai.captured_adrv_startup import CapturedADRVStartup
from openpilot.starpilot.car.nissan.aol import qualified as qualified_nissan_aol
from openpilot.starpilot.car.volvo.aol import qualified as qualified_volvo_aol
from openpilot.starpilot.car.hyundai.aol import aol_safety_config as hyundai_aol_safety_config, pending_stock_angle_arm from openpilot.starpilot.car.hyundai.aol import aol_safety_config as hyundai_aol_safety_config, pending_stock_angle_arm
from openpilot.starpilot.car.hyundai.aol import retained_shared_long_cancel_intent as hkg_cancel_intent_retained from openpilot.starpilot.car.hyundai.aol import retained_shared_long_cancel_intent as hkg_cancel_intent_retained
from openpilot.starpilot.car.ford.aol import (brake_pause_active as ford_brake_pause_active, from openpilot.starpilot.car.ford.aol import (brake_pause_active as ford_brake_pause_active,
@@ -56,7 +50,7 @@ from openpilot.starpilot.car.ford.aol import (brake_pause_active as ford_brake_p
qualification_cycle as ford_qualification_cycle, qualification_cycle as ford_qualification_cycle,
qualified as qualified_ford_aol) qualified as qualified_ford_aol)
from openpilot.starpilot.car.subaru import aol as subaru_aol from openpilot.starpilot.car.subaru import aol as subaru_aol
from openpilot.starpilot.aol.card_native import native_handlers from openpilot.starpilot.aol.card_native import aol_configuration
from openpilot.starpilot.aol.runtime import AXIS_MAX_AGE_NS, current_axis, current_native from openpilot.starpilot.aol.runtime import AXIS_MAX_AGE_NS, current_axis, current_native
from openpilot.starpilot.aol.vehicle import create_intent as create_aol_intent, native_latch_rejected, policy_for as aol_policy_for from openpilot.starpilot.aol.vehicle import create_intent as create_aol_intent, native_latch_rejected, policy_for as aol_policy_for
from openpilot.starpilot.aol.wire import IntentState, encode_intent from openpilot.starpilot.aol.wire import IntentState, encode_intent
@@ -388,6 +382,8 @@ class Car:
self._prepare_feedback_capture() self._prepare_feedback_capture()
except Exception: except Exception:
pass # Optional learning setup cannot stop native startup. pass # Optional learning setup cannot stop native startup.
if self.aol_card_intent is not None:
aol_configuration(self)
self.aol_transport_feedback = TransportPauseFeedback(self.CP) if self.aol_replay else None self.aol_transport_feedback = TransportPauseFeedback(self.CP) if self.aol_replay else None
if isinstance(self.CI, GMInterface) and self.CI.CC is not None and self.CI.CC.volt_sng_plan_input is not None: if isinstance(self.CI, GMInterface) and self.CI.CC is not None and self.CI.CC.volt_sng_plan_input is not None:
self.CI.CC.volt_sng_plan_input.boottime = self.volt_startup_keepalive() self.CI.CC.volt_sng_plan_input.boottime = self.volt_startup_keepalive()
@@ -488,6 +484,10 @@ class Car:
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True) can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
can_received_ns = time.monotonic_ns() can_received_ns = time.monotonic_ns()
if (self.CP.carFingerprint == HYUNDAI_CAR.HYUNDAI_SONATA_HYBRID and self.CP.pcmCruise and
not self.CP.openpilotLongitudinalControl):
can_list = can_capnp_to_list(can_strs, include_tx_receipts=False)
else:
can_list = can_capnp_to_list(can_strs) can_list = can_capnp_to_list(can_strs)
observe_controller_can(self.CI, can_list) observe_controller_can(self.CI, can_list)
@@ -644,11 +644,9 @@ class Car:
not any(e.immediateDisable or e.softDisable or e.userDisable for e in self.sm['onroadEvents'])) not any(e.immediateDisable or e.softDisable or e.userDisable for e in self.sm['onroadEvents']))
fault_active = transport_reset or self.aol_disarming_fault(CS, event_ns, now_ns, fault_active = transport_reset or self.aol_disarming_fault(CS, event_ns, now_ns,
transport_observed_healthy=reuse_transport or angle_arm_pending or ford_initial_wait or volkswagen_initial_wait) transport_observed_healthy=reuse_transport or angle_arm_pending or ford_initial_wait or volkswagen_initial_wait)
angle_aol, ford_aol, honda_aol, mazda_aol, preap_aol, volkswagen_aol = self.aol_permission_owners() _, owners, handlers = aol_configuration(self)
nissan_aol = qualified_nissan_aol(self.CP, marked_only=True) angle_aol, ford_aol, honda_aol, mazda_aol, preap_aol, volkswagen_aol, rivian_aol = owners
rivian_aol = qualified_rivian_aol(self.CP, marked_only=True) permission_owner = handlers is not None
volvo_aol = qualified_volvo_aol(self.CP, marked_only=True)
permission_owner = angle_aol or ford_aol or honda_aol or mazda_aol or preap_aol or nissan_aol or volkswagen_aol or rivian_aol or volvo_aol
angle_panda_ready = not permission_owner or self.startup_panda_configured() angle_panda_ready = not permission_owner or self.startup_panda_configured()
native = ( native = (
current_native(self.sm, self.CP, now_ns=now_ns, axis_session_id=self.aol_axis_session() if permission_owner else None) current_native(self.sm, self.CP, now_ns=now_ns, axis_session_id=self.aol_axis_session() if permission_owner else None)
@@ -658,11 +656,8 @@ class Car:
honda_eps_pending = bool(honda_aol and not transport_reset and native is not None and honda_eps_pending = bool(honda_aol and not transport_reset and native is not None and
getattr(self.aol_transport_feedback, 'honda_eps_retained_native_ns', 0) == int(native.observedMonoTime)) getattr(self.aol_transport_feedback, 'honda_eps_retained_native_ns', 0) == int(native.observedMonoTime))
native_reset = False native_reset = False
if permission_owner: if handlers is not None:
observe, restrict = native_handlers( observe, restrict = handlers
self, volvo_aol=volvo_aol, rivian_aol=rivian_aol, volkswagen_aol=volkswagen_aol, nissan_aol=nissan_aol,
preap_aol=preap_aol, mazda_aol=mazda_aol, honda_aol=honda_aol, ford_aol=ford_aol,
)
preap_observation = {} preap_observation = {}
if preap_aol: if preap_aol:
cancel_stamp = int(self.CI.CS.preap.cancel_echo_stamp_ns) cancel_stamp = int(self.CI.CS.preap.cancel_echo_stamp_ns)
@@ -938,18 +933,20 @@ class Car:
getattr(self, '_aol_can_observation', None), now_ns) getattr(self, '_aol_can_observation', None), now_ns)
def aol_disarming_fault(self, CS, event_ns: int, now_ns: int, *, transport_observed_healthy=False) -> bool: def aol_disarming_fault(self, CS, event_ns: int, now_ns: int, *, transport_observed_healthy=False) -> bool:
if not aol_policy_for(self.CP).intent_supported: if not aol_configuration(self)[0].intent_supported:
return True return True
from openpilot.starpilot.aol.vehicle import intent_disarming_fault from openpilot.starpilot.aol.vehicle import intent_disarming_fault
feedback = getattr(self, 'aol_transport_feedback', None) feedback = getattr(self, 'aol_transport_feedback', None)
if feedback is None: if feedback is None:
feedback = self.aol_transport_feedback = TransportPauseFeedback(self.CP) feedback = self.aol_transport_feedback = TransportPauseFeedback(self.CP)
if not transport_observed_healthy:
cancel_source_ns = self.aol_cancel_source(CS, now_ns)
hkg_cancel_retained = hkg_cancel_intent_retained(self.CP, CS, self.sm, feedback, hkg_cancel_retained = hkg_cancel_intent_retained(self.CP, CS, self.sm, feedback,
self.aol_card_intent, cancel_source_ns=self.aol_cancel_source(CS, now_ns), now_ns=now_ns, self.aol_card_intent, cancel_source_ns=cancel_source_ns, now_ns=now_ns,
producer=getattr(self, 'slc_producer_session', '')) producer=getattr(self, 'slc_producer_session', ''))
if not transport_observed_healthy and not hkg_cancel_retained and feedback.observe(self.sm, self.CP, CS, now_ns, if not hkg_cancel_retained and feedback.observe(self.sm, self.CP, CS, now_ns,
latched=getattr(getattr(self, 'aol_card_intent', None), 'allowed_latch', True), latched=getattr(getattr(self, 'aol_card_intent', None), 'allowed_latch', True),
cancel_source_ns=self.aol_cancel_source(CS, now_ns), brake_source_ns=self.aol_honda_brake_source(CS, now_ns), cancel_source_ns=cancel_source_ns, brake_source_ns=self.aol_honda_brake_source(CS, now_ns),
gm_withdrawal_source_ns=self.aol_gm_withdrawal_source(CS, now_ns), gm_withdrawal_source_ns=self.aol_gm_withdrawal_source(CS, now_ns),
intent_producer_session=getattr(self, 'slc_producer_session', ''), intent_producer_session=getattr(self, 'slc_producer_session', ''),
main_arm_ns=(getattr(self.aol_card_intent, 'main_arm_ns', 0) or main_arm_ns=(getattr(self.aol_card_intent, 'main_arm_ns', 0) or
@@ -976,19 +973,9 @@ class Car:
startup_calibration_pending=bool(intent is not None and getattr(intent, 'startup_calibration_pending', False) and startup_calibration_pending=bool(intent is not None and getattr(intent, 'startup_calibration_pending', False) and
intent.settings.enabled and intent.main_action != 9), intent.settings.enabled and intent.main_action != 9),
temporary_ui_process_failure=fault_context is not None and fault_context.temporary_ui_failure(event_ns, now_ns), temporary_ui_process_failure=fault_context is not None and fault_context.temporary_ui_failure(event_ns, now_ns),
temporary_selfdrive_lagging=(qualified_gm(self.CP) or aol_policy_for(self.CP).intent_supported), temporary_selfdrive_lagging=True,
temporary_source_pause=(feedback.qualified or feedback.awaiting)) temporary_source_pause=(feedback.qualified or feedback.awaiting))
def aol_permission_owners(self) -> tuple[bool, bool, bool, bool, bool, bool]:
# CP is fixed once the drive starts; these checks ran five times per 100 Hz frame.
cached = getattr(self, '_aol_owner_cache', None)
if cached is None or cached[0] is not self.CP:
owners = (bool(qualified_angle_aol(self.CP, marked_only=True)), bool(qualified_ford_aol(self.CP, marked_only=True)),
bool(qualified_honda_stock_aol(self.CP, marked_only=True)), bool(qualified_mazda_aol(self.CP, marked_only=True)),
bool(qualified_tesla_preap(self.CP, marked_only=True)), bool(qualified_volkswagen_aol(self.CP, marked_only=True)))
cached = self._aol_owner_cache = (self.CP, owners)
return cached[1]
def aol_honda_native_observation(self, native, *, latched, panda_ready, restricted, now_ns, pending_since_ns): def aol_honda_native_observation(self, native, *, latched, panda_ready, restricted, now_ns, pending_since_ns):
acknowledged = getattr(self, '_honda_aol_acknowledgment', None) acknowledged = getattr(self, '_honda_aol_acknowledgment', None)
key = None key = None
+2 -2
View File
@@ -22,7 +22,7 @@ from opendbc.car.toyota.values import CAR as TOYOTA_CAR, ToyotaFlags
from opendbc.car.subaru.values import CAR as SUBARU_CAR, FROGGER_ANGLE_SIBLINGS from opendbc.car.subaru.values import CAR as SUBARU_CAR, FROGGER_ANGLE_SIBLINGS
from opendbc.car.vehicle_model import VehicleModel from opendbc.car.vehicle_model import VehicleModel
from openpilot.selfdrive.controls.lib.drive_helpers import clip_curvature from openpilot.selfdrive.controls.lib.drive_helpers import clip_curvature
from openpilot.selfdrive.controls.lib.highway_correction_gain import HighwayCorrectionGain, predicted_lateral_accels, read_gain from openpilot.selfdrive.controls.lib.highway_correction_gain import HighwayCorrectionGain, read_gain
from openpilot.selfdrive.controls.lib.latcontrol import LatControl from openpilot.selfdrive.controls.lib.latcontrol import LatControl
from openpilot.selfdrive.controls.lib.latcontrol_torque import LatControlTorque from openpilot.selfdrive.controls.lib.latcontrol_torque import LatControlTorque
from openpilot.selfdrive.controls.lib.lateral_controller_factory import create_lateral_controller from openpilot.selfdrive.controls.lib.lateral_controller_factory import create_lateral_controller
@@ -661,7 +661,7 @@ class Controls:
self.highway_gain = read_gain(self.params) self.highway_gain = read_gain(self.params)
predicted = None predicted = None
if self.sm.all_checks(['modelV2']): if self.sm.all_checks(['modelV2']):
predicted = predicted_lateral_accels(model_v2.position.t, model_v2.velocity.x, model_v2.orientationRate.z) predicted = self.highway_correction_gain.predict(model_v2)
# before lane centering so its guard measures only its own correction against the smoothed base # before lane centering so its guard measures only its own correction against the smoothed base
new_desired_curvature = self.highway_correction_gain.update( new_desired_curvature = self.highway_correction_gain.update(
new_desired_curvature, new_desired_curvature,
@@ -75,8 +75,17 @@ class HighwayCorrectionGain:
def __init__(self): def __init__(self):
self.alpha = DT_CTRL / (BASELINE_TAU + DT_CTRL) self.alpha = DT_CTRL / (BASELINE_TAU + DT_CTRL)
self.alpha_curve = DT_CTRL / (CURVE_LEVEL_TAU + DT_CTRL) self.alpha_curve = DT_CTRL / (CURVE_LEVEL_TAU + DT_CTRL)
self._prediction_model = None
self._prediction = None
self.reset() self.reset()
def predict(self, model) -> tuple[float, ...] | None:
# SubMaster retains the same immutable reader until another packet arrives.
if model is not self._prediction_model:
self._prediction = predicted_lateral_accels(model.position.t, model.velocity.x, model.orientationRate.z)
self._prediction_model = model
return self._prediction
def reset(self, curvature: float = 0.0) -> None: def reset(self, curvature: float = 0.0) -> None:
self.baseline = curvature self.baseline = curvature
self.curve_level = curvature self.curve_level = curvature
@@ -2,6 +2,7 @@ import math
import numpy as np import numpy as np
from openpilot.cereal import messaging
from openpilot.common.realtime import DT_CTRL from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.controls.lib.highway_correction_gain import KEY, HighwayCorrectionGain, predicted_lateral_accels, read_gain from openpilot.selfdrive.controls.lib.highway_correction_gain import KEY, HighwayCorrectionGain, predicted_lateral_accels, read_gain
@@ -168,6 +169,26 @@ def test_gain_is_clamped():
np.testing.assert_allclose(low, floor, rtol=0, atol=1e-15) np.testing.assert_allclose(low, floor, rtol=0, atol=1e-15)
def test_prediction_reuses_only_the_same_model_packet():
hcg = HighwayCorrectionGain()
def packet(yaw_rate):
msg = messaging.new_message('modelV2')
msg.modelV2.position.t = [0., 2.]
msg.modelV2.velocity.x = [30., 30.]
msg.modelV2.orientationRate.z = [yaw_rate, yaw_rate]
return msg.as_reader().modelV2
first = packet(0.03125)
second = packet(0.0625)
predicted = hcg.predict(first)
assert predicted == (0.9375, 0.9375)
hcg.reset()
assert hcg.predict(first) is predicted
assert hcg.predict(second) == (1.875, 1.875)
assert hcg.predict(messaging.new_message('modelV2').as_reader().modelV2) is None
def test_predicted_lateral_accels(): def test_predicted_lateral_accels():
t = 10.0 * (np.arange(33) / 32) ** 2 t = 10.0 * (np.arange(33) / 32) ** 2
assert predicted_lateral_accels(t, np.full(33, 30.0), np.full(33, 0.02)) == (0.6, 0.6) assert predicted_lateral_accels(t, np.full(33, 30.0), np.full(33, 0.02)) == (0.6, 0.6)
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10 -1
View File
@@ -32,6 +32,7 @@ def can_list_to_can_capnp(can_msgs, msgtype='can', valid=True, *, source_observe
Args: Args:
can_msgs: List of tuples [(address, data_bytes, src), ...] can_msgs: List of tuples [(address, data_bytes, src), ...]
msgtype: 'can' or 'sendcan' msgtype: 'can' or 'sendcan'
include_tx_receipts: retain Panda TX receipts (sources 128 and above)
valid: Whether the event is valid valid: Whether the event is valid
Returns: Returns:
@@ -64,12 +65,13 @@ def can_list_to_can_capnp(can_msgs, msgtype='can', valid=True, *, source_observe
return dat.to_bytes() return dat.to_bytes()
def can_capnp_to_list(strings, msgtype='can'): def can_capnp_to_list(strings, msgtype='can', *, include_tx_receipts=True):
"""Convert Cap'n Proto serialized bytes to list of CAN messages. """Convert Cap'n Proto serialized bytes to list of CAN messages.
Args: Args:
strings: Tuple/list of serialized Cap'n Proto bytes strings: Tuple/list of serialized Cap'n Proto bytes
msgtype: 'can' or 'sendcan' msgtype: 'can' or 'sendcan'
include_tx_receipts: retain Panda TX receipts (sources 128 and above)
Returns: Returns:
List of tuples [(nanos, [(address, data, src), ...]), ...] List of tuples [(nanos, [(address, data, src), ...]), ...]
@@ -87,7 +89,14 @@ def can_capnp_to_list(strings, msgtype='can'):
if _cached_reader_fields is not None: if _cached_reader_fields is not None:
addr_f, dat_f, src_f = _cached_reader_fields addr_f, dat_f, src_f = _cached_reader_fields
if include_tx_receipts:
frame_list = [(f._get_by_field(addr_f), f._get_by_field(dat_f), f._get_by_field(src_f)) for f in frames] frame_list = [(f._get_by_field(addr_f), f._get_by_field(dat_f), f._get_by_field(src_f)) for f in frames]
else:
frame_list = []
for f in frames:
src = f._get_by_field(src_f)
if src < 128:
frame_list.append((f._get_by_field(addr_f), f._get_by_field(dat_f), src))
else: else:
frame_list = [] frame_list = []
@@ -0,0 +1,13 @@
from openpilot.cereal import messaging
from openpilot.selfdrive.pandad import can_capnp_to_list, can_list_to_can_capnp
def test_optional_receipt_filter_preserves_physical_frames_and_batch_stamps():
frames = [(0x340, b'physical', 0), (0x340, b'returned', 128),
(0x421, b'physical', 2), (0x421, b'rejected', 194)]
receipts = [frames[1], frames[3]]
packets = [can_list_to_can_capnp(batch) for batch in (frames, receipts, [])]
stamps = [int(messaging.log_from_bytes(packet).logMonoTime) for packet in packets]
assert can_capnp_to_list(packets) == list(zip(stamps, (frames, receipts, []), strict=True))
assert can_capnp_to_list(packets, include_tx_receipts=False) == list(zip(stamps, ([frames[0], frames[2]], [], []), strict=True))
+32
View File
@@ -17,6 +17,38 @@ from openpilot.starpilot.car.volkswagen.aol import temporary_restriction as volk
from openpilot.starpilot.car.volvo.aol import (native_observation as volvo_native_observation, from openpilot.starpilot.car.volvo.aol import (native_observation as volvo_native_observation,
temporary_restriction as volvo_temporary_restriction) temporary_restriction as volvo_temporary_restriction)
from openpilot.starpilot.car.volkswagen.aol import qualified as qualified_volkswagen_aol
from opendbc.car.rivian.stock_aol import qualified as qualified_rivian_aol
from opendbc.car.mazda.stock_aol import qualified as qualified_mazda_aol
from opendbc.car.hyundai.canfd_angle_aol import qualified as qualified_angle_aol
from openpilot.starpilot.car.nissan.aol import qualified as qualified_nissan_aol
from openpilot.starpilot.car.volvo.aol import qualified as qualified_volvo_aol
from opendbc.car.honda.stock_aol import qualified as qualified_honda_stock_aol
from opendbc.car.tesla.preap.aol import qualified as qualified_tesla_preap
from openpilot.starpilot.car.ford.aol import qualified as qualified_ford_aol
from openpilot.starpilot.aol.vehicle import policy_for
def aol_configuration(card):
cp = card.CP
cached = getattr(card, '_aol_configuration', None)
if cached is None or cached[0] is not cp:
angle = qualified_angle_aol(cp, marked_only=True)
ford = qualified_ford_aol(cp, marked_only=True)
honda = qualified_honda_stock_aol(cp, marked_only=True)
mazda = qualified_mazda_aol(cp, marked_only=True)
preap = qualified_tesla_preap(cp, marked_only=True)
volkswagen = qualified_volkswagen_aol(cp, marked_only=True)
nissan = qualified_nissan_aol(cp, marked_only=True)
rivian = qualified_rivian_aol(cp, marked_only=True)
volvo = qualified_volvo_aol(cp, marked_only=True)
owners = (angle, ford, honda, mazda, preap, volkswagen, rivian)
handlers = native_handlers(card, volvo_aol=volvo, rivian_aol=rivian, volkswagen_aol=volkswagen,
nissan_aol=nissan, preap_aol=preap, mazda_aol=mazda, honda_aol=honda,
ford_aol=ford) if any(owners) or nissan or volvo else None
cached = card._aol_configuration = (cp, (policy_for(cp), owners, handlers))
return cached[1]
def native_handlers(card, *, volvo_aol: bool, rivian_aol: bool, volkswagen_aol: bool, nissan_aol: bool, preap_aol: bool, def native_handlers(card, *, volvo_aol: bool, rivian_aol: bool, volkswagen_aol: bool, nissan_aol: bool, preap_aol: bool,
mazda_aol: bool, honda_aol: bool, ford_aol: bool): mazda_aol: bool, honda_aol: bool, ford_aol: bool):
@@ -1,7 +1,9 @@
from types import SimpleNamespace
from itertools import product from itertools import product
import pytest import pytest
from opendbc.car import structs
from opendbc.car.ford import aol as ford from opendbc.car.ford import aol as ford
from opendbc.car.honda import stock_aol as honda from opendbc.car.honda import stock_aol as honda
from opendbc.car.hyundai import canfd_angle_aol as hyundai from opendbc.car.hyundai import canfd_angle_aol as hyundai
@@ -12,7 +14,7 @@ from opendbc.car.volkswagen import stock_aol as volkswagen_observer
from openpilot.starpilot.car.nissan import aol as nissan from openpilot.starpilot.car.nissan import aol as nissan
from openpilot.starpilot.car.volkswagen import aol as volkswagen_restriction from openpilot.starpilot.car.volkswagen import aol as volkswagen_restriction
from openpilot.starpilot.car.volvo import aol as volvo from openpilot.starpilot.car.volvo import aol as volvo
from openpilot.starpilot.aol.card_native import native_handlers from openpilot.starpilot.aol.card_native import aol_configuration, native_handlers
class _Card: class _Card:
@@ -41,3 +43,18 @@ def test_native_handlers_keep_card_priority_and_lazy_honda_binding(admitted):
selected = native_handlers(card, **dict(zip(names, admitted, strict=True))) selected = native_handlers(card, **dict(zip(names, admitted, strict=True)))
assert selected == (observations[expected], restrictions[expected]) assert selected == (observations[expected], restrictions[expected])
assert card.honda_lookups == int(expected == 6) assert card.honda_lookups == int(expected == 6)
def test_aol_configuration_binds_only_finalized_car_params():
card = SimpleNamespace(CP=structs.CarParams(brand='ford', carFingerprint='FORD_MAVERICK_MK1', flags=2,
transmissionType='automatic', steerControlType='angle', pcmCruise=True,
safetyConfigs=[{'safetyModel': 'ford', 'safetyParam': 16384}], alternativeExperience=32))
first = aol_configuration(card)
assert first[2] == (ford.native_observation, ford.temporary_restriction)
assert aol_configuration(card) is first
card.CP = structs.CarParams(brand='mock', passive=True)
second = aol_configuration(card)
assert second is not first
assert second[2] is None
assert not second[0].intent_supported
@@ -27,6 +27,7 @@ def test_all_gm_initializing_steps_keep_servicing_handoff(cp):
state_update=Mock(return_value=(cs, None)), state_publish=Mock(), state_update=Mock(return_value=(cs, None)), state_publish=Mock(),
controls_update=Mock(), _deferred_radar_can=None, controls_update=Mock(), _deferred_radar_can=None,
radar_update=Mock(), radar_publish=Mock()) radar_update=Mock(), radar_publish=Mock())
card._step = Car._step.__get__(card)
events = [SimpleNamespace(name=1)] events = [SimpleNamespace(name=1)]
card.sm = type('SM', (), {'seen': {'onroadEvents': True}, '__getitem__': lambda _, key: events if key == 'onroadEvents' else None})() card.sm = type('SM', (), {'seen': {'onroadEvents': True}, '__getitem__': lambda _, key: events if key == 'onroadEvents' else None})()
for method in ('gm_startup_keepalive', 'volt_startup_keepalive', 'volt_sdgm_startup_keepalive'): for method in ('gm_startup_keepalive', 'volt_startup_keepalive', 'volt_sdgm_startup_keepalive'):
@@ -39,11 +39,11 @@ def native_template(tmp_path_factory, request):
timers = (ROOT / 'panda/board/drivers/timers.h').read_text() timers = (ROOT / 'panda/board/drivers/timers.h').read_text()
timer_check = timers[timers.index('bool timer_check('):timers.index('\nvoid interrupt_timer_init(')] timer_check = timers[timers.index('bool timer_check('):timers.index('\nvoid interrupt_timer_init(')]
interrupts = (ROOT / 'panda/board/drivers/interrupts.h').read_text() interrupts = (ROOT / 'panda/board/drivers/interrupts.h').read_text()
interrupts = interrupts[interrupts.index('static void unused_interrupt_handler'):] interrupts = interrupts[interrupts.index('static void unused_interrupt_handler'):interrupts.index('#endif // BOARD_DRIVERS_INTERRUPTS_H')]
sys = (ROOT / 'panda/board/sys/sys.h').read_text() sys = (ROOT / 'panda/board/sys/sys.h').read_text()
faults = sys[sys.index('#define FAULT_STATUS_NONE'):sys.index('// ******************** power_saving')] faults = sys[sys.index('#define FAULT_STATUS_NONE'):sys.index('// ******************** power_saving')]
fault_impl = (ROOT / 'panda/board/sys/faults.h').read_text() fault_impl = (ROOT / 'panda/board/sys/faults.h').read_text()
faults += fault_impl[fault_impl.index('uint8_t fault_status'):] faults += fault_impl[fault_impl.index('uint8_t fault_status'):fault_impl.index('#endif // BOARD_SYS_FAULTS_H')]
code = r''' code = r'''
#include "opendbc/safety/tests/libsafety/safety.c" #include "opendbc/safety/tests/libsafety/safety.c"
uint32_t heartbeat_counter, heartbeat_tick_counter, uptime_cnt, ignition_can_cnt, wake_on_can_cnt; uint32_t heartbeat_counter, heartbeat_tick_counter, uptime_cnt, ignition_can_cnt, wake_on_can_cnt;
+3 -2
View File
@@ -1181,7 +1181,8 @@ class TransportPauseFeedback:
self.retention_pending = False self.retention_pending = False
try: try:
axis = sm['aolAxisState'] axis = sm['aolAxisState']
if not latched or cp_identity(cp) != self.cp or self.session and str(axis.sessionId) != self.session: same_cp = cp_identity(cp) == self.cp
if not latched or not same_cp or self.session and str(axis.sessionId) != self.session:
self.fit_eps_intent = self.fit_eps_grant = None self.fit_eps_intent = self.fit_eps_grant = None
self.ordinary_warning_retained = False self.ordinary_warning_retained = False
self.ordinary_brake_proof = None self.ordinary_brake_proof = None
@@ -1207,7 +1208,7 @@ class TransportPauseFeedback:
axis.qualified and axis.sessionId and axis.sequence > 0 and stamp == axis.observedMonoTime and axis.qualified and axis.sessionId and axis.sequence > 0 and stamp == axis.observedMonoTime and
0 < stamp <= now_ns <= axis.validUntilMonoTime and now_ns - stamp <= AXIS_MAX_AGE_NS and 0 < stamp <= now_ns <= axis.validUntilMonoTime and now_ns - stamp <= AXIS_MAX_AGE_NS and
axis.validUntilMonoTime - stamp <= AXIS_MAX_AGE_NS and axis.faultSessionId == axis.sessionId and axis.validUntilMonoTime - stamp <= AXIS_MAX_AGE_NS and axis.faultSessionId == axis.sessionId and
cp_identity(cp) == self.cp) same_cp)
continuity = bool(not self.session or axis.sessionId == self.session and continuity = bool(not self.session or axis.sessionId == self.session and
(axis.sequence > self.sequence or axis.sequence == self.sequence and signature == self.signature)) (axis.sequence > self.sequence or axis.sequence == self.sequence and signature == self.signature))
pending_paddle = self.subaru_paddle_denial pending_paddle = self.subaru_paddle_denial
@@ -148,7 +148,9 @@ class LocalModelManagerHttpTest(unittest.TestCase):
self.assertEqual(status, 200) self.assertEqual(status, 200)
self.assertTrue(laboratory['runtimeSupported']) self.assertTrue(laboratory['runtimeSupported'])
self.assertFalse(laboratory['runtime']['active']) self.assertFalse(laboratory['runtime']['active'])
self.assertEqual(laboratory['summary']['published'], 92) published = {row['value'] for row in laboratory['models'] if row['modelLabArtifactAvailable']}
self.assertLessEqual({'gwm8223', 'sc23'}, published)
self.assertEqual(laboratory['summary']['published'], len(published))
pair = {'enabled': False, 'lateralModel': 'gwm8223', 'longitudinalModel': 'sc23'} pair = {'enabled': False, 'lateralModel': 'gwm8223', 'longitudinalModel': 'sc23'}
self.assertEqual(request('/api/models/laboratory', pair)[0], 200) self.assertEqual(request('/api/models/laboratory', pair)[0], 200)
self.assertEqual(request('/api/models/laboratory', {**pair, 'enabled': True})[0], 409) self.assertEqual(request('/api/models/laboratory', {**pair, 'enabled': True})[0], 409)
@@ -15,6 +15,19 @@ def settings(monkeypatch, topology):
monkeypatch.ford_topology = topology monkeypatch.ford_topology = topology
monkeypatch.ford_nonzero = True monkeypatch.ford_nonzero = True
monkeypatch.ford_native_10hz = True monkeypatch.ford_native_10hz = True
calls = []
observe = card_native.ford_native_observation
def traced_native(native, **kwargs):
result = observe(native, **kwargs)
calls.append({'now': kwargs['now_ns'], 'latched': kwargs['latched'], 'pending': kwargs['pending_since_ns'],
'restricted': kwargs['restricted'], 'result': result,
'native': None if native is None else [native.requestedLateral, native.lateralAllowed,
native.requestedLongitudinal, native.longitudinalAllowed]})
return result
monkeypatch.setattr(card_native, 'ford_native_observation', traced_native)
return calls
@pytest.mark.parametrize('identity,alpha,hands_free,topology', [ @pytest.mark.parametrize('identity,alpha,hands_free,topology', [
@@ -28,10 +41,10 @@ def settings(monkeypatch, topology):
('startup', 'paired'), ('startup', 'axis-delayed'), ('startup', 'state-delayed'), ('startup', 'paired'), ('startup', 'axis-delayed'), ('startup', 'state-delayed'),
('brake', 'health-first'), ('brake', 'wire-first'), ('startup', 'native-timeout'), ('brake', 'health-first'), ('brake', 'wire-first'), ('startup', 'native-timeout'),
]) ])
def test_initial_request_and_longitudinal_withdrawal(ford_joined, monkeypatch, scenario, delivery): def test_initial_request_and_longitudinal_withdrawal(settings, ford_joined, monkeypatch, scenario, delivery):
invalid = [False] invalid = [False]
injected = [False] injected = [False]
calls = [] calls = settings
delayed = {} delayed = {}
negative_checked = [False] negative_checked = [False]
if delivery == 'native-timeout': if delivery == 'native-timeout':
@@ -65,17 +78,6 @@ def test_initial_request_and_longitudinal_withdrawal(ford_joined, monkeypatch, s
return update(timestamp, adjusted) return update(timestamp, adjusted)
local.setattr(sd.sm, 'update_msgs', calibration) local.setattr(sd.sm, 'update_msgs', calibration)
observe = card_native.ford_native_observation
def traced_native(native, **kwargs):
result = observe(native, **kwargs)
calls.append({'now': kwargs['now_ns'], 'latched': kwargs['latched'], 'pending': kwargs['pending_since_ns'],
'restricted': kwargs['restricted'], 'result': result,
'native': None if native is None else [native.requestedLateral, native.lateralAllowed,
native.requestedLongitudinal, native.longitudinalAllowed]})
return result
local.setattr(card_native, 'ford_native_observation', traced_native)
pending = getattr(card_module, 'ford_awaiting_initial_request', None) pending = getattr(card_module, 'ford_awaiting_initial_request', None)
if pending is not None: if pending is not None:
def checked_pending(cp, cs, sm, native, feedback, intent, **kwargs): def checked_pending(cp, cs, sm, native, feedback, intent, **kwargs):
@@ -108,7 +108,7 @@ class TestVehicleStateContext(unittest.TestCase):
enable_edge = next(node for node in helper.body[0].body if isinstance(node, ast.If) and initialize in ast.walk(node)) enable_edge = next(node for node in helper.body[0].body if isinstance(node, ast.If) and initialize in ast.walk(node))
self.assertEqual(ast.unparse(enable_edge.test), "self.sm['carControl'].enabled and (not self.CC_prev.enabled)") self.assertEqual(ast.unparse(enable_edge.test), "self.sm['carControl'].enabled and (not self.CC_prev.enabled)")
self.assertIn(initialize, list(ast.walk(enable_edge))) self.assertIn(initialize, list(ast.walk(enable_edge)))
step = inspect.getsource(card.Car.step) step = inspect.getsource(card.Car._step)
step_tree = ast.parse(textwrap.dedent(step)) step_tree = ast.parse(textwrap.dedent(step))
state_update = next(node for node in ast.walk(step_tree) state_update = next(node for node in ast.walk(step_tree)
if isinstance(node, ast.Call) and ast.unparse(node.func) == 'self.state_update') if isinstance(node, ast.Call) and ast.unparse(node.func) == 'self.state_update')
@@ -7,8 +7,12 @@ Reset and migration actions additionally require a parked vehicle.
from __future__ import annotations from __future__ import annotations
from openpilot.starpilot.ui.feature_profile_edit import (edit_document, PRESETS as PRESETS, from openpilot.starpilot.ui.feature_profile_edit import (
PROFILE_NAMES as PROFILE_NAMES, DOCUMENT_PROFILE_NAMES as DOCUMENT_PROFILE_NAMES) edit_document,
PRESETS as PRESETS,
PROFILE_NAMES as PROFILE_NAMES,
DOCUMENT_PROFILE_NAMES as DOCUMENT_PROFILE_NAMES,
)
from collections.abc import Callable from collections.abc import Callable
from contextvars import ContextVar from contextvars import ContextVar
@@ -37,9 +41,12 @@ from openpilot.starpilot.longitudinal.profile_document import (
personality_reference_curves, serialize_personality_profiles, personality_reference_curves, serialize_personality_profiles,
synchronise_profile_document_enabled, synchronise_profile_document_enabled,
) )
from openpilot.starpilot.ui.feature_defaults import (AGGRESSIVE_COOLING_DESCRIPTION as AGGRESSIVE_COOLING_DESCRIPTION, from openpilot.starpilot.ui.feature_defaults import (
AGGRESSIVE_COOLING_DESCRIPTION as AGGRESSIVE_COOLING_DESCRIPTION,
AGGRESSIVE_COOLING_KEY as AGGRESSIVE_COOLING_KEY, AGGRESSIVE_COOLING_KEY as AGGRESSIVE_COOLING_KEY,
BOOL_DEFAULTS as BOOL_DEFAULTS, FLOAT_SPECS as FLOAT_SPECS) BOOL_DEFAULTS as BOOL_DEFAULTS,
FLOAT_SPECS as FLOAT_SPECS,
)
from openpilot.starpilot.ui.feature_settings_state import ( from openpilot.starpilot.ui.feature_settings_state import (
FeaturePage, FeatureRow, FeatureSettingsRequest, FeatureSettingsState, SettingLevel, SLC_CONFIRM_ACTIONS, SLC_OFFSET_KEYS, TORQUE_CONFIRM_ACTIONS, FeaturePage, FeatureRow, FeatureSettingsRequest, FeatureSettingsState, SettingLevel, SLC_CONFIRM_ACTIONS, SLC_OFFSET_KEYS, TORQUE_CONFIRM_ACTIONS,
) )
@@ -59,8 +66,14 @@ from openpilot.starpilot.ui.controller_feature import ControllerFeature, SETUP_A
from openpilot.starpilot.ui.slc_offset_feature import SlcOffsetOwner from openpilot.starpilot.ui.slc_offset_feature import SlcOffsetOwner
from openpilot.starpilot.ui.slc_policy_feature import SLC_ADVANCE_CHOICES, policy_rows from openpilot.starpilot.ui.slc_policy_feature import SLC_ADVANCE_CHOICES, policy_rows
from openpilot.starpilot.longitudinal.profile_preferences import read_document_value, read_profile_health from openpilot.starpilot.longitudinal.profile_preferences import read_document_value, read_profile_health
from openpilot.starpilot.ui.long_profile_feature import (LongProfileFeature, is_long_confirm_action, VALUE_HELP, CATEGORY_HELP, from openpilot.starpilot.ui.long_profile_feature import (
preset_label, preset_value) LongProfileFeature,
is_long_confirm_action,
VALUE_HELP,
CATEGORY_HELP,
preset_label,
preset_value,
)
from openpilot.starpilot.ui.traffic_feature import TrafficFeature, EDIT_KEYS as TRAFFIC_EDIT_KEYS from openpilot.starpilot.ui.traffic_feature import TrafficFeature, EDIT_KEYS as TRAFFIC_EDIT_KEYS
from openpilot.starpilot.ui.cruise_steps_feature import CRUISE_KEYS, apply_cruise, apply_reverse_cruise, cruise_rows from openpilot.starpilot.ui.cruise_steps_feature import CRUISE_KEYS, apply_cruise, apply_reverse_cruise, cruise_rows
from openpilot.starpilot.ui.lane_change_feature import LaneChangeFeature, KEYS as LANE_CHANGE_KEYS from openpilot.starpilot.ui.lane_change_feature import LaneChangeFeature, KEYS as LANE_CHANGE_KEYS
@@ -87,8 +100,6 @@ from openpilot.starpilot.curve_speed.preferences import (
DOCUMENT_LIMIT as CURVE_DOCUMENT_LIMIT, read_learning, DOCUMENT_LIMIT as CURVE_DOCUMENT_LIMIT, read_learning,
) )
from openpilot.starpilot.curve_speed.actions import ACTION_KEYS as CURVE_ACTION_KEYS, apply_learning, learning_snapshot from openpilot.starpilot.curve_speed.actions import ACTION_KEYS as CURVE_ACTION_KEYS, apply_learning, learning_snapshot
from openpilot.starpilot.controllers.toyota_cruise import capability as toyota_cruise_capability from openpilot.starpilot.controllers.toyota_cruise import capability as toyota_cruise_capability
@@ -164,8 +175,8 @@ class FeatureSettingsOwner:
self.volt_radar = VoltRadarFeature(self, galaxy=galaxy) self.volt_radar = VoltRadarFeature(self, galaxy=galaxy)
self.panda_wake = PandaWakeFeature(self, galaxy=galaxy) self.panda_wake = PandaWakeFeature(self, galaxy=galaxy)
self.traffic_profiles = TrafficFeature(self) self.traffic_profiles = TrafficFeature(self)
self.lane_changes = LaneChangeFeature(params, authority, vehicle_fingerprint, self.vehicle_params, self.lane_changes = LaneChangeFeature(
configuration_longitudinal=self.configuration_longitudinal) params, authority, vehicle_fingerprint, self.vehicle_params, configuration_longitudinal=self.configuration_longitudinal)
self.conditional = ConditionalFeature(self) self.conditional = ConditionalFeature(self)
self.wheel = TeslaWheelRows(self) self.wheel = TeslaWheelRows(self)
@@ -316,6 +316,16 @@ class MiciSidebarWidgets:
self._stop_icon(center) self._stop_icon(center)
elif (preview is not None and preview.curve_curvature is not None and state.alert.size != AlertSize.FULL) or curve_controlling(state): elif (preview is not None and preview.curve_curvature is not None and state.alert.size != AlertSize.FULL) or curve_controlling(state):
self._curve_icon(center) self._curve_icon(center)
elif state.e2e_preview_slowdown is not None and state.alert.size != AlertSize.FULL:
match state.e2e_preview_slowdown:
case 'Stopping':
self._stop_icon(center)
case 'Lead vehicle':
self._lead_icon(center)
case 'Curve':
self._curve_icon(center)
case _:
self._slowdown_icon(center)
elif conditional is not None and self.fonts is not None: elif conditional is not None and self.fonts is not None:
family, _, color = conditional family, _, color = conditional
reason = conditional_reason(state) reason = conditional_reason(state)
@@ -323,13 +333,15 @@ class MiciSidebarWidgets:
'cem_curve': 'curve', 'cem_signal': 'turn', 'cem_curve': 'curve', 'cem_signal': 'turn',
'cem_speed': 'speed', 'cem_open_road': 'speed', 'cem_speed_limit': 'speed', 'ccm_speed': 'speed'}.get(reason) 'cem_speed': 'speed', 'cem_open_road': 'speed', 'cem_speed_limit': 'speed', 'ccm_speed': 'speed'}.get(reason)
if family == 'E2E': if family == 'E2E':
icon = {'Lead vehicle': 'lead', 'Curve': 'curve'}.get(state.e2e_slowdown) icon = {'Lead vehicle': 'lead', 'Curve': 'curve', 'Slowing': 'slowdown'}.get(state.e2e_slowdown)
if icon == 'stop': if icon == 'stop':
self._stop_icon(center) self._stop_icon(center)
elif icon == 'lead': elif icon == 'lead':
self._lead_icon(center) self._lead_icon(center)
elif icon == 'curve': elif icon == 'curve':
self._curve_icon(center) self._curve_icon(center)
elif icon == 'slowdown':
self._active_slowdown_icon(center)
elif icon == 'turn': elif icon == 'turn':
self._turn_icon(center, state) self._turn_icon(center, state)
elif icon == 'speed': elif icon == 'speed':
@@ -379,6 +391,19 @@ class MiciSidebarWidgets:
def _lead_icon(self, rect: rl.Rectangle) -> None: def _lead_icon(self, rect: rl.Rectangle) -> None:
draw_lead_icon(rect) draw_lead_icon(rect)
def _slowdown_icon(self, rect: rl.Rectangle) -> None:
cx, cy = rect.x + rect.width / 2, rect.y + rect.height / 2
blue = rl.Color(112, 192, 216, 255)
_line(cx - 12, cy - 5, cx, cy + 7, blue, 4)
_line(cx, cy + 7, cx + 12, cy - 5, blue, 4)
def _active_slowdown_icon(self, rect: rl.Rectangle) -> None:
cx, cy = rect.x + rect.width / 2, rect.y + rect.height / 2
amber = rl.Color(255, 155, 63, 255)
_line(cx, cy - 13, cx, cy + 13, amber, 4)
_line(cx - 11, cy + 2, cx, cy + 13, amber, 4)
_line(cx, cy + 13, cx + 11, cy + 2, amber, 4)
def _stop_icon(self, rect: rl.Rectangle) -> None: def _stop_icon(self, rect: rl.Rectangle) -> None:
draw_stop_light_icon(rect) draw_stop_light_icon(rect)
+3 -4
View File
@@ -56,16 +56,15 @@ class PersonalityWidget:
driver_feedback = profile == Profile.LARGE or state.appearance.wheel_pedal_feedback driver_feedback = profile == Profile.LARGE or state.appearance.wheel_pedal_feedback
self.draw(rect, personality=state.personality, has_lead=state.lead_detected, self.draw(rect, personality=state.personality, has_lead=state.lead_detected,
longitudinal_active=state.cruise_active, traffic_mode=state.traffic_selected or state.traffic_mode, longitudinal_active=state.cruise_active, traffic_mode=state.traffic_selected or state.traffic_mode,
gas_override=state.gas_pressed_override and driver_feedback, visible=routine, gas_override=state.gas_pressed_override and driver_feedback, visible=routine)
white_disengaged=profile == Profile.COMPACT)
def draw(self, rect: rl.Rectangle, *, personality: int, has_lead: bool, longitudinal_active: bool, def draw(self, rect: rl.Rectangle, *, personality: int, has_lead: bool, longitudinal_active: bool,
traffic_mode: bool = False, gas_override: bool = False, visible: bool = True, fit: bool = True, white_disengaged: bool = False) -> None: traffic_mode: bool = False, gas_override: bool = False, visible: bool = True, fit: bool = True) -> None:
self._prepare() self._prepare()
assert self._lead_car is not None assert self._lead_car is not None
alpha = self._alpha_filter.update(visible) alpha = self._alpha_filter.update(visible)
engaged_lead = has_lead and longitudinal_active engaged_lead = has_lead and longitudinal_active
white_target = 0.0 if engaged_lead else (1.0 if has_lead or white_disengaged and not longitudinal_active else 0.35) white_target = 0.0 if engaged_lead else (1.0 if has_lead else 0.35)
white_f, green_f = self._lead_car_filters white_f, green_f = self._lead_car_filters
if not longitudinal_active: if not longitudinal_active:
white_f.x, green_f.x = white_target, 0.0 white_f.x, green_f.x = white_target, 0.0
+1
View File
@@ -185,6 +185,7 @@ class OnroadState:
experimental_available: bool = False experimental_available: bool = False
experimental_enabled: bool = False experimental_enabled: bool = False
e2e_slowdown: str | None = None e2e_slowdown: str | None = None
e2e_preview_slowdown: str | None = None
torque_utilization: float = 0.0 torque_utilization: float = 0.0
personality: int = 1 personality: int = 1
lead_detected: bool = False lead_detected: bool = False
+21 -2
View File
@@ -801,8 +801,27 @@ class RuntimeSnapshotAdapter:
drive_mode_source, display_car, cp=cp, drive_frame=after, drive_mode_source, display_car, cp=cp, drive_frame=after,
event_ns=int(sm.logMonoTime['starpilotCarState']) if drive_mode_source is not None else 0, now_ns=now_ns, event_ns=int(sm.logMonoTime['starpilotCarState']) if drive_mode_source is not None else 0, now_ns=now_ns,
native_alert=alert, traffic_active=bool(traffic is not None and traffic.state == 'active')) native_alert=alert, traffic_active=bool(traffic is not None and traffic.state == 'active'))
e2e_mode = observed_experimental and self._conditional_choice in (None, ModeChoice.STOCK)
e2e_preview_slowdown = None
if e2e_mode and not display_long_active and ui.has_longitudinal_control and display_car_valid:
model_action = getattr(display_model, 'action', None)
if getattr(model_action, 'shouldStop', False):
e2e_preview_slowdown = "Stopping"
else:
paired_plan = (display_plan is not None and display_model is not None and
getattr(display_plan, 'modelMonoTime', None) == sm.logMonoTime['modelV2'])
plan_target = getattr(display_plan, 'aTarget', 0.0) if paired_plan else 0.0
source = getattr(display_plan, 'longitudinalPlanSource', None) if paired_plan else None
model_target = getattr(model_action, 'desiredAcceleration', 0.0)
if math.isfinite(plan_target) and plan_target < -0.15 and source in ('lead0', 'lead1') and getattr(display_plan, 'hasLead', False):
e2e_preview_slowdown = "Lead vehicle"
elif (math.isfinite(plan_target) and plan_target < -0.15 and source == 'cruise' and
curve is not None and curve.applied and curve.controlling):
e2e_preview_slowdown = "Curve"
elif math.isfinite(model_target) and model_target < -0.15:
e2e_preview_slowdown = "Slowing"
e2e_slowdown = None e2e_slowdown = None
if (observed_experimental and self._conditional_choice in (None, ModeChoice.STOCK) and if (e2e_mode and
display_long_active and not longitudinal_overridden and display_plan is not None): display_long_active and not longitudinal_overridden and display_plan is not None):
target = getattr(display_plan, 'aTarget', None) target = getattr(display_plan, 'aTarget', None)
if bool(getattr(display_plan, 'shouldStop', False)): if bool(getattr(display_plan, 'shouldStop', False)):
@@ -833,7 +852,7 @@ class RuntimeSnapshotAdapter:
appearance=self._appearance_value, customization=self._customization_value, appearance=self._appearance_value, customization=self._customization_value,
alert=alert, metric=bool(ui.is_metric), slc_offset_schedule=self._slc_offset_schedule, alert=alert, metric=bool(ui.is_metric), slc_offset_schedule=self._slc_offset_schedule,
experimental_available=bool(ui.has_longitudinal_control), experimental_available=bool(ui.has_longitudinal_control),
experimental_enabled=observed_experimental, e2e_slowdown=e2e_slowdown, experimental_enabled=observed_experimental, e2e_slowdown=e2e_slowdown, e2e_preview_slowdown=e2e_preview_slowdown,
personality=list(Personality).index(persona), personality=list(Personality).index(persona),
lead_detected=bool(display_plan is not None and display_plan.hasLead), lead_detected=bool(display_plan is not None and display_plan.hasLead),
gas_pressed_override=bool(display_events is not None and any( gas_pressed_override=bool(display_events is not None and any(
@@ -16,7 +16,7 @@ def test_native_chestnut_status_accepts_typed_params(raw, expected, tmp_path):
params.get_param_path.side_effect = lambda key: str(tmp_path / key) params.get_param_path.side_effect = lambda key: str(tmp_path / key)
params.get.return_value = raw params.get.return_value = raw
params.get_bool.return_value = False params.get_bool.return_value = False
state = Mock(spec=UIState, params=params, started=True, chestnut_compiled=True, usb_connected=False) state = Mock(spec=UIState, params=params, started=True, chestnut_compiled=True, usb_connected=False, _gpu_artifacts=None)
with patch('openpilot.selfdrive.ui.ui_state.get_cache', return_value=None), \ with patch('openpilot.selfdrive.ui.ui_state.get_cache', return_value=None), \
patch('openpilot.selfdrive.ui.ui_state.cable_connected', return_value=False): patch('openpilot.selfdrive.ui.ui_state.cable_connected', return_value=False):
UIState.update_params(state) UIState.update_params(state)
@@ -44,8 +44,21 @@ def test_same_selected_bars_and_lead_on_both_profiles(display, profile, personal
draws = settle(display, road(personality=personality)) draws = settle(display, road(personality=personality))
assert draws[1].args[3] > .999 assert draws[1].args[3] > .999
assert all(draws[2 + 2*i].args[3] == pytest.approx(.9 if i <= personality else .35, abs=.001) for i in range(3)) assert all(draws[2 + 2*i].args[3] == pytest.approx(.9 if i <= personality else .35, abs=.001) for i in range(3))
for has_lead, active, white, green in ((False, True, .35, 0), (True, False, 1, 0), (True, True, 0, 1)):
draws = settle(display, road(lead_detected=has_lead, longitudinal_active=active))
@pytest.mark.parametrize('profile', list(Profile))
@pytest.mark.parametrize(('lateral', 'longitudinal', 'has_lead', 'white', 'green'), (
pytest.param(False, False, False, .35, 0., id='disengaged-no-lead'),
pytest.param(False, False, True, 1., 0., id='disengaged-lead'),
pytest.param(True, False, False, .35, 0., id='aol-no-lead'),
pytest.param(True, False, True, 1., 0., id='aol-lead'),
pytest.param(True, True, False, .35, 0., id='longitudinal-no-lead'),
pytest.param(True, True, True, 0., 1., id='longitudinal-lead'),
))
def test_lead_feedback_tracks_detection_and_longitudinal_engagement(display, profile, lateral, longitudinal, has_lead, white, green):
display.fonts.profile = profile
draws = settle(display, road(engaged=lateral or longitudinal, lateral_active=lateral,
longitudinal_active=longitudinal, lead_detected=has_lead))
assert draws[0].args[3] == pytest.approx(white, abs=.001) assert draws[0].args[3] == pytest.approx(white, abs=.001)
assert draws[1].args[3] == pytest.approx(green, abs=.001) assert draws[1].args[3] == pytest.approx(green, abs=.001)
@@ -235,7 +248,7 @@ def test_default_compact_lead_and_distance_feedback(display, monkeypatch):
settle(display, state) settle(display, state)
assert display._draw_centered.call_args_list[-8].args[3] == pytest.approx(.35) assert display._draw_centered.call_args_list[-8].args[3] == pytest.approx(.35)
settle(display, replace(state, longitudinal_active=False)) settle(display, replace(state, longitudinal_active=False))
assert display._draw_centered.call_args_list[-8].args[3] == pytest.approx(1.) assert display._draw_centered.call_args_list[-8].args[3] == pytest.approx(.35)
settle(display, replace(state, lead_detected=True)) settle(display, replace(state, lead_detected=True))
assert display._draw_centered.call_args_list[-7].args[3] == pytest.approx(1., abs=.001) assert display._draw_centered.call_args_list[-7].args[3] == pytest.approx(1., abs=.001)
@@ -505,14 +505,14 @@ class NativeSettingsPageTests(unittest.TestCase):
# Run the real controller methods with only device services isolated. # Run the real controller methods with only device services isolated.
source = Path('openpilot/selfdrive/ui/layouts/settings/toggles.py') source = Path('openpilot/selfdrive/ui/layouts/settings/toggles.py')
layout = next(node for node in ast.parse(source.read_text()).body if isinstance(node, ast.ClassDef) and node.name == 'TogglesLayout') layout = next(node for node in ast.parse(source.read_text()).body if isinstance(node, ast.ClassDef) and node.name == 'TogglesLayout')
methods = {'_update_toggles', '_update_state', '_toggle_callback', methods = {'_update_toggles', '_update_state', '_toggle_callback', '_toggle_action',
'request_toggle', 'request_personality', '_set_longitudinal_personality'} 'request_toggle', 'request_personality', '_set_longitudinal_personality'}
layout.bases = [] layout.bases = []
layout.body = [node for node in layout.body if isinstance(node, ast.FunctionDef) and node.name in methods] layout.body = [node for node in layout.body if isinstance(node, ast.FunctionDef) and node.name in methods]
ui = NS(CP=None, engaged=False, parked=True, update_params=Mock(), sm=NS(updated={'selfdriveState': False})) ui = NS(CP=None, engaged=False, parked=True, update_params=Mock(), sm=NS(updated={'selfdriveState': False}))
app = NS(push_widget=Mock()) app = NS(push_widget=Mock())
namespace = ModuleType('toggles_controller_test') namespace = ModuleType('toggles_controller_test')
namespace.__dict__.update(tr=lambda text: text, ui_state=ui) namespace.__dict__.update(tr=lambda text: text, ui_state=ui, ToggleAction=ToggleAction)
exec(compile(ast.Module(body=[layout], type_ignores=[]), str(source), 'exec'), namespace.__dict__) exec(compile(ast.Module(body=[layout], type_ignores=[]), str(source), 'exec'), namespace.__dict__)
owner = namespace.TogglesLayout() owner = namespace.TogglesLayout()
class SavedParams(Params): class SavedParams(Params):
@@ -383,27 +383,73 @@ class TestOnroadAxes(unittest.TestCase):
companion.sourcePlanMonoTime -= 1 companion.sourcePlanMonoTime -= 1
self.assertEqual(self.state(True, True).e2e_slowdown, 'Slowing') self.assertEqual(self.state(True, True).e2e_slowdown, 'Slowing')
def test_end_to_end_sidebar_uses_a_moon_until_the_planner_reports_a_specific_reason(self): def test_end_to_end_sidebar_previews_slowdown_without_longitudinal_engagement(self):
self.ui.params.put('ConditionalModeConfig', json.loads(encode_preferences(SavedPreferences(mode=ModeChoice.STOCK))), block=True)
sm = self.ui.sm
sm['selfdriveState'].experimentalMode = True
sm['selfdriveState'].enabled = False
sidebar = MiciSidebarWidgets(Mock())
center = rl.Rectangle(476, 80, 60, 80)
for stop, target, source, plan_stamp, expected in (
(True, -0.12, 'cruise', NOW, '_stop_icon'),
(False, -0.25, 'e2e', NOW, '_slowdown_icon'),
(False, -0.12, 'lead0', NOW, '_lead_icon'),
(False, -0.12, 'lead0', NOW - 1, '_chill_icon'),
(False, -0.12, 'cruise', NOW, '_chill_icon'),
):
with self.subTest(stop=stop, target=target, source=source, plan_stamp=plan_stamp):
sm.put('modelV2', NS(action=NS(shouldStop=stop, desiredAcceleration=target)))
sm.put('longitudinalPlan', NS(aTarget=-0.8, hasLead=source == 'lead0', shouldStop=False,
longitudinalPlanSource=source, modelMonoTime=plan_stamp))
for lateral in (True, False):
state = self.state(lateral, False)
self.assertFalse(state.longitudinal_active)
self.assertIsNone(state.e2e_slowdown)
self.assertEqual(rgba(axis_status_color(state)), (10, 186, 181, 255) if lateral else (18, 40, 57, 255))
with patch.multiple(sidebar, **{name: Mock() for name in ('_stop_icon', '_slowdown_icon', '_lead_icon',
'_curve_icon', '_chill_icon', '_speed_icon')}):
sidebar._conditional(center, state)
getattr(sidebar, expected).assert_called_once()
sidebar._speed_icon.assert_not_called()
sm.put('modelV2', NS(action=NS(shouldStop=True, desiredAcceleration=-0.5)))
sm.valid['modelV2'] = False
self.assertIsNone(self.state(True, False).e2e_preview_slowdown)
sm.valid['modelV2'] = True
sm['selfdriveState'].experimentalMode = False
self.assertIsNone(self.state(True, False).e2e_preview_slowdown)
def test_end_to_end_sidebar_uses_the_active_slowdown_reason(self):
self.ui.params.put('ConditionalModeConfig', json.loads(encode_preferences(SavedPreferences(mode=ModeChoice.STOCK))), block=True) self.ui.params.put('ConditionalModeConfig', json.loads(encode_preferences(SavedPreferences(mode=ModeChoice.STOCK))), block=True)
self.ui.sm['selfdriveState'].experimentalMode = True self.ui.sm['selfdriveState'].experimentalMode = True
self.ui.sm['carState'].vEgo, self.ui.sm['carState'].vCruise = 31.0, 97.0
self.ui.sm['slcState'].hasCeiling = False
sidebar = MiciSidebarWidgets(Mock()) sidebar = MiciSidebarWidgets(Mock())
center = rl.Rectangle(476, 80, 60, 80) center = rl.Rectangle(476, 80, 60, 80)
for source, accel, stop, expected in ( for source, accel, stop, expected in (
('cruise', 0.0, False, '_chill_icon'), ('cruise', 0.0, False, '_chill_icon'),
('cruise', -1.0, False, '_chill_icon'), ('cruise', -1.0, False, '_chill_icon'),
('e2e', -0.24, False, '_chill_icon'), ('e2e', -0.24, False, '_active_slowdown_icon'),
('e2e', -0.9, True, '_stop_icon'), ('e2e', -0.9, True, '_stop_icon'),
('lead0', -0.5, False, '_lead_icon'), ('lead0', -0.5, False, '_lead_icon'),
): ):
with self.subTest(source=source, accel=accel, stop=stop): with self.subTest(source=source, accel=accel, stop=stop):
self.ui.sm.put('longitudinalPlan', NS(aTarget=accel, hasLead=source == 'lead0', shouldStop=stop, self.ui.sm.put('longitudinalPlan', NS(aTarget=accel, hasLead=source == 'lead0', shouldStop=stop,
longitudinalPlanSource=source)) longitudinalPlanSource=source))
with patch.object(sidebar, expected) as icon, patch.object(sidebar, '_speed_icon') as speed, \ icons = {name: Mock() for name in ('_chill_icon', '_active_slowdown_icon', '_slowdown_icon', '_stop_icon',
patch.object(sidebar, '_active_icon') as letter: '_lead_icon', '_curve_icon', '_speed_icon', '_active_icon')}
sidebar._conditional(center, self.state(True, True)) with patch.multiple(sidebar, **icons):
icon.assert_called_once() state = self.state(True, True)
speed.assert_not_called() sidebar._conditional(center, state)
letter.assert_not_called() icons[expected].assert_called_once_with(center)
for name, icon in icons.items():
if name != expected:
icon.assert_not_called()
if expected == '_active_slowdown_icon':
self.assertEqual(state.e2e_slowdown, 'Slowing')
self.assertEqual(rgba(axis_status_color(state)), (218, 111, 37, 255))
sidebar._conditional(center, replace(state, alert=OnroadAlert(size=AlertSize.FULL)))
icons['_chill_icon'].assert_called_once_with(center)
icons[expected].assert_called_once()
def test_both_profile_compositions_use_axis_border_and_fixtures_remain_combined(self): def test_both_profile_compositions_use_axis_border_and_fixtures_remain_combined(self):
engaged_fixture = reference_onroad("onroad_engaged_no_camera") engaged_fixture = reference_onroad("onroad_engaged_no_camera")
@@ -158,6 +158,7 @@ def test_actual_c4_startup_redirect_only_yields_to_fresh_open_parked_game(monkey
owner._prev_onroad, owner._prev_standstill = True, True owner._prev_onroad, owner._prev_standstill = True, True
owner._onroad_time_delay = 5. owner._onroad_time_delay = 5.
owner._onboarding_window = Mock() owner._onboarding_window = Mock()
owner._home_layout = Mock()
page = object.__new__(native.SpacePilotPage) page = object.__new__(native.SpacePilotPage)
page.closed = condition == 'closed' page.closed = condition == 'closed'
page.session = Mock(stage=native.Stage.CLOSED if page.closed else native.Stage.VERIFYING) page.session = Mock(stage=native.Stage.CLOSED if page.closed else native.Stage.VERIFYING)
@@ -1,6 +1,8 @@
from dataclasses import replace from dataclasses import replace
from types import SimpleNamespace from types import SimpleNamespace
import pytest
from opendbc.car import gen_empty_fingerprint, structs from opendbc.car import gen_empty_fingerprint, structs
from opendbc.car.toyota.enhanced_bsm import configured from opendbc.car.toyota.enhanced_bsm import configured
from opendbc.car.toyota.interface import CarInterface from opendbc.car.toyota.interface import CarInterface
@@ -12,10 +14,14 @@ from openpilot.starpilot.ui.vehicle_bool import VEHICLE_BOOL_KEYS, confirmation_
from openpilot.starpilot.vehicle_preferences import VehicleStartupPreferences from openpilot.starpilot.vehicle_preferences import VehicleStartupPreferences
def test_vehicle_setting_and_startup_permission(tmp_path): @pytest.mark.parametrize('factory_bsm', (False, True))
def test_vehicle_setting_and_startup_permission(tmp_path, factory_bsm):
params = Params(str(tmp_path)) params = Params(str(tmp_path))
fw = [structs.CarParams.CarFw(ecu=structs.CarParams.Ecu.hybrid)] fw = [structs.CarParams.CarFw(ecu=structs.CarParams.Ecu.hybrid)]
current = SimpleNamespace(cp=CarInterface.get_params(CAR.TOYOTA_PRIUS_TSS2, gen_empty_fingerprint(), fw, False, False, False), parked=True) fp = gen_empty_fingerprint()
if factory_bsm:
fp[0][0x3F6] = 8
current = SimpleNamespace(cp=CarInterface.get_params(CAR.TOYOTA_PRIUS_TSS2, fp, fw, False, False, False), parked=True)
owner = FeatureSettingsOwner(params, lambda group: current.parked and group in ('vehicle', 'parked_preferences'), owner = FeatureSettingsOwner(params, lambda group: current.parked and group in ('vehicle', 'parked_preferences'),
vehicle_fingerprint=lambda: current.cp.carFingerprint, vehicle_params=lambda: current.cp) vehicle_fingerprint=lambda: current.cp.carFingerprint, vehicle_params=lambda: current.cp)
@@ -46,8 +52,6 @@ def test_vehicle_setting_and_startup_permission(tmp_path):
params.put_bool('SafeMode', True, block=True) params.put_bool('SafeMode', True, block=True)
VehicleStartupPreferences.read(params, enabled=True).finalize(cp) VehicleStartupPreferences.read(params, enabled=True).finalize(cp)
assert not configured(cp) assert not configured(cp)
fp = gen_empty_fingerprint() current.cp = CarInterface.get_params(CAR.TOYOTA_COROLLA_TSS2, fp, fw, False, False, False)
fp[0][0x3F6] = 8
current.cp = CarInterface.get_params(CAR.TOYOTA_PRIUS_TSS2, fp, fw, False, False, False)
assert not rows() assert not rows()
assert not configured(prefs.prepare(current.cp)) assert not configured(prefs.prepare(current.cp))
@@ -112,7 +112,7 @@ def test_renderer_dispatches_each_widget_in_saved_order(profile, viewport):
method = next(node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef) and node.name == '_ordered_widgets') method = next(node for node in ast.walk(tree) if isinstance(node, ast.FunctionDef) and node.name == '_ordered_widgets')
namespace: dict[str, Any] = {'CLOCK_WIDGET': CLOCK_WIDGET, 'MODE_WIDGET': MODE_WIDGET, 'placement': placement, 'widget_order': widget_order, namespace: dict[str, Any] = {'CLOCK_WIDGET': CLOCK_WIDGET, 'MODE_WIDGET': MODE_WIDGET, 'placement': placement, 'widget_order': widget_order,
'RAIL_WIDGETS': RAIL_WIDGETS, 'STOPPED_TIMER_WIDGET': STOPPED_TIMER_WIDGET, 'RAIL_WIDGETS': RAIL_WIDGETS, 'STOPPED_TIMER_WIDGET': STOPPED_TIMER_WIDGET,
'render_rear_fog': lambda *args: seen.append('rear_fog'), 'render_rear_fog': lambda *args: seen.append('rear_fog'), 'compact_wheel_warning': lambda state: False,
'manual_slc_confirmation': lambda profile, state: False, 'AlertSize': NS(NONE='none', FULL='full'), 'CameraViewChoice': NS(NONE='none'), 'manual_slc_confirmation': lambda profile, state: False, 'AlertSize': NS(NONE='none', FULL='full'), 'CameraViewChoice': NS(NONE='none'),
'rl': NS(Rectangle=lambda x, y, width, height: NS(x=x, y=y, width=width, height=height))} 'rl': NS(Rectangle=lambda x, y, width, height: NS(x=x, y=y, width=width, height=height))}
exec(compile(ast.Module(body=[method], type_ignores=[]), str(source), 'exec'), namespace) exec(compile(ast.Module(body=[method], type_ignores=[]), str(source), 'exec'), namespace)
+15 -3
View File
@@ -462,12 +462,24 @@ class TestAthenadMethods(OpenpilotTestCase):
fn = self._create_file('qlog.zst') fn = self._create_file('qlog.zst')
item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) # noqa: TID251 item = athenad.UploadItem(path=fn, url=f"{host}/qlog.zst", headers={}, created_at=int(time.time()*1000), id='', allow_cellular=True) # noqa: TID251
athenad.upload_queue.put_nowait(item) started, release = threading.Event(), threading.Event()
self._wait_for_upload() upload = athenad._do_upload
def hold_upload(*args, **kwargs):
started.set()
if not release.wait(5):
raise TimeoutError("Upload queue assertion did not release the transfer")
return upload(*args, **kwargs)
with mock.patch.object(athenad, "_do_upload", side_effect=hold_upload):
athenad.upload_queue.put_nowait(item)
try:
assert started.wait(5)
items = dispatcher["listUploadQueue"]() items = dispatcher["listUploadQueue"]()
assert len(items) == 1 assert len(items) == 1
assert items[0]['current'] assert items[0]['current'] and items[0]['path'] == fn
finally:
release.set()
def test_list_upload_queue_priority(self): def test_list_upload_queue_priority(self):
priorities = (25, 50, 99, 75, 0) priorities = (25, 50, 99, 75, 0)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,4 +1,4 @@
#pragma once #pragma once
extern const uint8_t gitversion[29]; extern const uint8_t gitversion[29];
const uint8_t gitversion[29] = "DEV-6bd89852-Pf38f504f-DEBUG"; const uint8_t gitversion[29] = "DEV-57f15547-Pf38f504f-DEBUG";
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
DEV-6bd89852-Pf38f504f-DEBUG DEV-57f15547-Pf38f504f-DEBUG
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "a99017021edd749982e3b3ec07191fe296b48b997b65b0d64294a720023d7ca8", "schema_version": 1} {"protected_inventory_sha256": "9ecf7ff0e3a1d1292bc4e4ec99225755b1bdfd0a678329094f974832b97829f2", "schema_version": 1}
+23 -23
View File
@@ -10,123 +10,123 @@
"basis": "Existing exact capability guard, preserved from8b9338a0; skipped remains unavailable, never passed", "basis": "Existing exact capability guard, preserved from8b9338a0; skipped remains unavailable, never passed",
"guard": "real_xapk", "guard": "real_xapk",
"reason": "Skipped: the user's own Android Auto XAPK is not in .cache/", "reason": "Skipped: the user's own Android Auto XAPK is not in .cache/",
"source_blob": "b642d677dcabd4d51f8379dd05d9c72cdcf35f37" "source_blob": "d09d62b9e7a947df49bcf46c39eb3b396719d306"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-32-18-0-0]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-32-18-0-0]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-32-18-4-2]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-32-18-4-2]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-32-20-3-5]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-32-20-3-5]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-40-18-0-6]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[False-40-18-0-6]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-32-18-0-0]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-32-18-0-0]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-32-18-4-2]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-32-18-4-2]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-32-20-3-5]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-32-20-3-5]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-40-18-0-6]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_composed_car_frame_converts_to_the_same_picture[True-40-18-0-6]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[False-32-18-0-0]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[False-32-18-0-0]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[False-32-18-4-2]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[False-32-18-4-2]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[False-32-20-3-5]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[False-32-20-3-5]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[True-32-18-0-0]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[True-32-18-0-0]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[True-32-18-4-2]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[True-32-18-4-2]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[True-32-20-3-5]": { "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py::test_fused_projection_conversion_matches_rgba_composition[True-32-20-3-5]": {
"basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited software EGL setup through ff5342ca; exact GPU environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3" "source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e"
}, },
"openpilot/starpilot/ui/tests/test_onroad_map.py::test_overlay_draws_heading_up_roads_route_and_soft_edges": { "openpilot/starpilot/ui/tests/test_onroad_map.py::test_overlay_draws_heading_up_roads_route_and_soft_edges": {
"basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"guard_source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3", "guard_source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e",
"guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py", "guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "df1f777daf295f4997e0659ad0dec4e4efcf38ee" "source_blob": "92db495f2fdadcd961a92da8bbdb2118a0085a81"
}, },
"openpilot/starpilot/ui/tests/test_onroad_map.py::test_overlay_opacity_fades_map_background": { "openpilot/starpilot/ui/tests/test_onroad_map.py::test_overlay_opacity_fades_map_background": {
"basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"guard_source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3", "guard_source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e",
"guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py", "guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "df1f777daf295f4997e0659ad0dec4e4efcf38ee" "source_blob": "92db495f2fdadcd961a92da8bbdb2118a0085a81"
}, },
"openpilot/starpilot/ui/tests/test_onroad_map.py::test_overlay_without_gps_waits_without_drawing_roads": { "openpilot/starpilot/ui/tests/test_onroad_map.py::test_overlay_without_gps_waits_without_drawing_roads": {
"basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"guard_source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3", "guard_source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e",
"guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py", "guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "df1f777daf295f4997e0659ad0dec4e4efcf38ee" "source_blob": "92db495f2fdadcd961a92da8bbdb2118a0085a81"
}, },
"openpilot/starpilot/ui/tests/test_onroad_map.py::test_route_stays_bright_at_minimum_map_opacity": { "openpilot/starpilot/ui/tests/test_onroad_map.py::test_route_stays_bright_at_minimum_map_opacity": {
"basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed", "basis": "Re-audited unchanged map GPU test bodies and shared fixture alias; software EGL setup through ff5342ca; exact environment guard unchanged; skipped remains unavailable, never passed",
"guard": "gpu_env", "guard": "gpu_env",
"guard_source_blob": "6890e34c1e01be80495c1dc1089529c362de68f3", "guard_source_blob": "e9113b0c1e44d0975721a3ae165fdf056a7a106e",
"guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py", "guard_source_path": "openpilot/starpilot/system/starport/tests/test_gpu_nv12.py",
"reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context", "reason": "Skipped: STARPILOT_AUTO_GL_TEST=1 enables tests requiring a real graphics context",
"source_blob": "df1f777daf295f4997e0659ad0dec4e4efcf38ee" "source_blob": "92db495f2fdadcd961a92da8bbdb2118a0085a81"
} }
}, },
"independent_functions": { "independent_functions": {