ldw: fix blinker cooldown using wrong time step#37767
Open
Lidang-Jiang wants to merge 4 commits intocommaai:masterfrom
Open
ldw: fix blinker cooldown using wrong time step#37767Lidang-Jiang wants to merge 4 commits intocommaai:masterfrom
Lidang-Jiang wants to merge 4 commits intocommaai:masterfrom
Conversation
recent_blinker multiplied frame deltas by DT_CTRL (100 Hz) but sm.frame advances at DT_MDL (20 Hz), making the 5-second cooldown effectively 25 seconds. Replace DT_CTRL with DT_MDL. Fixes commaai#36126 Signed-off-by: Lidang-Jiang <[email protected]>
Contributor
Process replay diff reportReplays driving segments through this PR and compares the behavior to master. ✅ 0 changed, 66 passed, 0 errors |
- Replace unittest.mock.MagicMock with types.SimpleNamespace (TID251: unittest banned) - Remove unused imports: pytest, importlib (F401) - Use openpilot.selfdrive prefix instead of bare selfdrive (TID251) - Use explicit string concatenation instead of implicit (ISC002) - Remove unused noqa directives (RUF100) Signed-off-by: Lidang-Jiang <[email protected]>
The previous approach stubbed cereal and openpilot namespace modules at import time, which polluted sys.modules for the entire pytest session and caused ImportError in unrelated tests (test_leads, test_longcontrol, etc.). Since CI builds cereal properly, use direct imports instead. Signed-off-by: Lidang-Jiang <[email protected]>
laneChangeLeft=3, laneChangeRight=4, so the mock list needs 7 elements instead of 3. This fixes the IndexError in CI unit tests. Signed-off-by: Lidang-Jiang <[email protected]>
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.
Summary
Fix
recent_blinkertiming bug inLaneDepartureWarning.update(). The blinker cooldown multiplied frame deltas byDT_CTRL(0.01s, 100 Hz control loop rate), butsm.frameadvances atDT_MDL(0.05s, 20 Hz model rate). This made the intended 5-second cooldown effectively 25 seconds, causing LDW to remain suppressed far longer than intended after a lane change.DT_CTRLwithDT_MDLin import and usage (2 line changes)Fixes #36126
Before (3 tests fail — cooldown incorrectly uses DT_CTRL)
After (all 7 tests pass)
Test plan