Align Toyota safety boundary tests with Faster Takeoffs limits

This commit is contained in:
firestar5683
2026-11-16 20:44:54 -06:00
parent 355929ba09
commit b96152aa1c
6 changed files with 14 additions and 6 deletions
@@ -126,7 +126,9 @@ def test_ordinary_cruise_and_stock_cancel_only(word):
assert case.native.get_controls_allowed()
assert bool(case.accel()) == (not word & 0x200)
assert case.accel(0, 1)
for value in (-3.501, 2.001):
for value in (-3.5, 3.5):
assert bool(case.accel(value)) == (not word & 0x200)
for value in (-3.501, 3.501):
assert not case.accel(value)
for _ in range(25):
case.tick(status=None)
@@ -68,7 +68,9 @@ def test_original_prius_advert_six_independent_rx_and_limits(stock, experience):
for _ in range(50):
case.tick(ad=False)
active(case, stock, experience)
for accel in (-3.501, 2.001):
for accel in (-3.5, 3.5):
assert bool(case.tx('ACC_CONTROL', {'ACCEL_CMD': accel})) == (not stock)
for accel in (-3.501, 3.501):
assert not case.tx('ACC_CONTROL', {'ACCEL_CMD': accel})
assert not case.tx('STEERING_LTA', {'STEER_REQUEST': 1})
assert not case.native.safety_tx_hook(libsafety_py.make_CANPacket(0x750, 0, bytes.fromhex('0f02280100000000')))
@@ -68,7 +68,9 @@ def test_eps73_prius_advert_six_independent_rx_and_limits(stock, experience):
for _ in range(50):
case.tick(ad=False)
active(case, stock, experience)
for accel in (-3.501, 2.001):
for accel in (-3.5, 3.5):
assert bool(case.tx('ACC_CONTROL', {'ACCEL_CMD': accel})) == (not stock)
for accel in (-3.501, 3.501):
assert not case.tx('ACC_CONTROL', {'ACCEL_CMD': accel})
assert not case.tx('STEERING_LTA', {'STEER_REQUEST': 1})
assert not case.native.safety_tx_hook(libsafety_py.make_CANPacket(0x750, 0, bytes.fromhex('0f02280100000000')))
@@ -82,7 +82,9 @@ def test_original_prius_required_status_lease_aeb_and_malformed_source(stock, ex
assert not case.tx('ACC_CONTROL', {'ACCEL_CMD': .1})
assert case.tx('ACC_CONTROL', {'ACCEL_CMD': 0, 'CANCEL_REQ': 1})
case.earn()
for value in (-3.501, 2.001):
for value in (-3.5, 3.5):
assert bool(case.tx('ACC_CONTROL', {'ACCEL_CMD': value})) == (not stock)
for value in (-3.501, 3.501):
assert not case.tx('ACC_CONTROL', {'ACCEL_CMD': value})
assert not case.tx('STEERING_LTA', {'STEER_REQUEST': 1})
assert not case.native.safety_tx_hook(libsafety_py.make_CANPacket(0x750, 0, bytes.fromhex('0f02280100000000')))
@@ -151,7 +151,7 @@ class TestRav4hFilterNative(unittest.TestCase):
for ae in (0, 32, 128, 160):
self.init(0x9049, ae)
self.physical(cruise=True)
for accel, allowed in ((-3.501, False), (-3.5, True), (2., True), (2.001, False)):
for accel, allowed in ((-3.501, False), (-3.5, True), (2., True), (3.5, True), (3.501, False)):
self.assertEqual(bool(self.safety.safety_tx_hook(self.packer.make_can_msg_safety("ACC_CONTROL", 0, {
"ACCEL_CMD": accel}))), allowed, (ae, accel))
self.safety.set_controls_allowed(False)
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "8b128e2ae4a94a83a4a2f209d9e09f1740969f56053652b04334be957c1adfeb", "schema_version": 1}
{"protected_inventory_sha256": "20f6b8a98b3999009ef8c9e39253d3988d9a51b939dec3ac36c5a950b88160c5", "schema_version": 1}