test_models: fuzz openpilot TX against panda on replayed routes#37726
Open
felmonon wants to merge 3 commits intocommaai:masterfrom
Open
test_models: fuzz openpilot TX against panda on replayed routes#37726felmonon wants to merge 3 commits intocommaai:masterfrom
felmonon wants to merge 3 commits intocommaai:masterfrom
Conversation
Replay real CAN windows into panda safety and the CarInterface before fuzzing plausible CarControl outputs, so TX checks run against warmed-up safety state instead of random payloads alone. Also add a Toyota LTA route-backed regression that alternates active and inactive angle commands to cover desired-angle history across state transitions.
Contributor
Process replay diff reportReplays driving segments through this PR and compares the behavior to master. ✅ 0 changed, 66 passed, 0 errors |
Bound the replayed TX fuzz test on valid frames so it reliably exercises controller output instead of failing on empty route slices. Also replace the Toyota LTA all-pass sequence with a deterministic accepted/blocked/inactive/recovered regression that forces the over-threshold panda torque path on openpilot-generated messages.
Replace the Toyota regression's direct panda torque setters with repeated STEER_TORQUE_SENSOR RX samples, and move recovery ahead of the inactive phase so the test exercises blocked-history behavior through the real safety RX path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #32425.
This adds TX-side fuzz coverage to
selfdrive/car/tests/test_models.py.The fuzz test replays route CAN through
CarInterfaceand panda safety, then checks the TX messages openpilot emits againstsafety_tx_hook. It waits for a bounded number of valid replayed frames so the test reliably exercises TX instead of failing on an empty route slice.It also adds a Toyota angle-control regression on a real route that exercises accepted, blocked, recovered, and inactive LTA TX paths. The blocked/recovered path is driven by repeated
STEER_TORQUE_SENSORRX samples into panda so the regression goes through the real safety RX history logic instead of direct test-only setters.Verification
python3 -m compileall selfdrive/car/tests/test_models.pyTX_FUZZ_MAX_EXAMPLES=5 /tmp/comma-openpilot-validate/.venv/bin/python -m pytest -n0 -q selfdrive/car/tests/test_models.py::TestCarModel_264_TOYOTA_RAV4_TSS2_2023::test_panda_safety_tx_fuzzyTX_FUZZ_MAX_EXAMPLES=5 /tmp/comma-openpilot-validate/.venv/bin/python -m pytest -n0 -q selfdrive/car/tests/test_models.py::TestCarModel_55_HONDA_ACCORD::test_panda_safety_tx_fuzzyTX_FUZZ_MAX_EXAMPLES=5 /tmp/comma-openpilot-validate/.venv/bin/python -m pytest -n0 -q selfdrive/car/tests/test_models.py::TestCarModel_264_TOYOTA_RAV4_TSS2_2023::test_toyota_lta_tx_regressionRoute
Route:
ad5a3fa719bc2f83/2023-10-17--19-48-42