From d429cc3c900ff79b4f16cb6c73f81a9cc8558a4e Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Thu, 22 Oct 2026 21:44:16 -0500 Subject: [PATCH] Verify Toyota angle factory and independent LTA health --- .../opendbc/safety/tests/test_toyota.py | 26 +++++++++++++++++++ openpilot/starpilot/aol/tests/test_toyota.py | 15 ++++++++++- prebuilt.json | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/opendbc_repo/opendbc/safety/tests/test_toyota.py b/opendbc_repo/opendbc/safety/tests/test_toyota.py index 2ce72e105a..fad4c68cf0 100755 --- a/opendbc_repo/opendbc/safety/tests/test_toyota.py +++ b/opendbc_repo/opendbc/safety/tests/test_toyota.py @@ -743,3 +743,29 @@ class TestToyotaHighlanderAol(unittest.TestCase): self.assertEqual(self.safety.aol_get_permission_mask(), 0) self.physical() self.assertEqual(self.safety.aol_get_permission_mask(), 1) + + +class TestToyotaLtaIndependentHealth(unittest.TestCase): + def test_lta_and_lka_must_both_be_healthy(self): + # Reuse the current library so instrumented CI observes these native branches. + from opendbc.safety.tests.test_toyota_eps8_sdsu import Physical + for word in (0x449, 0x649, 0x1449, 0x1649, 0x8449, 0x8649): + with self.subTest(word=word): + case = Physical(word) + try: + for _ in range(25): + case.tick(cruise=False) + for _ in range(25): + case.tick() + expected = 1 if word & 0x200 else 3 + self.assertEqual(case.native.aol_get_permission_mask(), expected) + for lka, lta in [(1, fault) for fault in (0, 3, 9, 11, 17, 21, 25)] + [(9, 1)]: + frame = case.packer.make_can_msg('EPS_STATUS', 0, {'LKA_STATE': lka, 'LTA_STATE': lta}) + address, data, bus = frame + case.native.safety_rx_hook(libsafety_py.make_CANPacket(address, bus, data)) + self.assertEqual(case.native.aol_get_permission_mask(), 0) + case.tick(cruise=False) + case.tick() + self.assertEqual(case.native.aol_get_permission_mask(), expected) + finally: + case.close() diff --git a/openpilot/starpilot/aol/tests/test_toyota.py b/openpilot/starpilot/aol/tests/test_toyota.py index 2ecbeac7b6..eec7ef1392 100644 --- a/openpilot/starpilot/aol/tests/test_toyota.py +++ b/openpilot/starpilot/aol/tests/test_toyota.py @@ -201,10 +201,23 @@ class TestHighlanderAol(unittest.TestCase): bad.safetyConfigs[0].safetyParam ^= 0x4000 self.assertFalse(qualified(bad)) for car in (CAR.LEXUS_RC, - CAR.TOYOTA_RAV4_TSS2_2023, CAR.TOYOTA_RAV4_PRIME, CAR.TOYOTA_SIENNA_4TH_GEN): + CAR.TOYOTA_RAV4_PRIME, CAR.TOYOTA_SIENNA_4TH_GEN): cp = CarInterface.get_params(car, gen_empty_fingerprint(), [], True, False, False) self.assertFalse(qualified(cp)) + def test_rav4_2023_angle_factory_and_exact_experience(self): + for alpha, word in ((False, 0x649), (True, 0x449)): + with self.subTest(alpha=alpha): + cp = CarInterface.get_params(CAR.TOYOTA_RAV4_TSS2_2023, gen_empty_fingerprint(), [], alpha, False, False) + self.assertEqual(cp.safetyConfigs[0].safetyParam, word) + self.assertEqual(cp.steerControlType, structs.CarParams.SteerControlType.angle) + self.assertTrue(qualified(cp)) + cp.alternativeExperience |= policy_for(cp).alternative_experience_addition + self.assertEqual(cp.alternativeExperience, 32) + self.assertTrue(qualified(cp, marked_only=True)) + cp.safetyConfigs[0].safetyParam ^= 1 + self.assertFalse(qualified(cp, marked_only=True)) + def test_camera_torque_group_consumes_same_physical_sources(self): for car in CAMERA_TORQUE_CASES: for hybrid in (False, True): diff --git a/prebuilt.json b/prebuilt.json index 4ee991d357..e07cb46e97 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "45fadb06ddb24275e842844570cc79915ee3ce86aff19eb9a4f10edc48bcd8ec", "schema_version": 1} +{"protected_inventory_sha256": "9cedb8d6ba48ec4842fef2bba28a7982aa8418de8764490567b97f483b1fce56", "schema_version": 1}