Repository navigation
Seeded vision faults for stress tests; three edge-bug fixes - #34
Open
featurescript wants to merge 4 commits into
Open
featurescript wants to merge 4 commits into
featurescript wants to merge 4 commits into
Conversation
…ound VisionFaults configures injectable, seeded, deterministic camera faults: heavier pixel and angle noise, extra latency and jitter, dropped, repeated and out-of-order frames, missed detections, blackouts, an occluding patch, false detections and wrong IDs or kinds. Each fault draws from its own seeded stream, so turning one on does not change another's draws. VisionFaultInjector applies the content faults to sightings, tag sightings and rendered frames; FaultedFrameStream applies the timing faults to frames of any type. FakeLimelight3A takes them via Builder.faults(VisionFaults); with none set, every output is unchanged. Bugs the faults exposed, each with a regression test: - FakeLimelight3A: heavy tx/ty noise could report a tag far outside the image (tx of -188 degrees). A noisy tag whose centre leaves the image is now dropped (heavyNoiseNeverReportsATagOutsideTheImage). - SimCamera.groundPointInRobotFrame: on a lens whose distortion folds over, a pixel past the fold returned a mirrored floor point. It now returns null when the undistorted ray does not project back to the pixel (aPixelNoRayReachesHasNoGroundPoint). - SimFrameRenderer: corner pixels past such a fold were drawn along the mirrored ray. They are now black and unlabelled (cornersPastAFoldingLensesReachAreBlackAndUnlabelled).
…and empty Limelight results reorderFrames(1.0) never delivers a frame: documented in VisionFaults.Builder#reorderFrames and FaultedFrameStream, pinned by a test.
With no faults set, a frame whose tags the noise pushed out of the image returned before its five pose draws, so every later frame's noise moved, tags well inside the image included. The frame now makes those draws and discards them. A test runs one seed through a narrow and a wide lens and checks the tag angles and MegaTag1 agree frame by frame; without the fix it fails at frame 9. Two doc sentences said more than the code does: turning on misses or drops changes which sightings get wrong ids and which frames are held back, and a repeated frame can hide an out-of-order one released on the same tick.
This branch has not been deployed
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.
What
Seeded, deterministic camera faults for stress-testing vision code, and fixes for three edge bugs they found.
VisionFaults: an immutable config with a builder. It covers heavier pixel and angle noise, extra latency and jitter, dropped, repeated (same capture stamp) and out-of-order frames, missed detections, blackouts, an occluding patch, false detections, and wrong IDs or kinds. Each fault draws from its own seeded stream, so turning one fault on does not change the draws of another.VisionFaultInjector: applies the content faults toCameraSightings,TagSightings andSimFrames.FaultedFrameStream<T>: applies the timing faults to frames of any type, usingofferandpollDueon the sim clock.FakeLimelight3A.Builder.faults(VisionFaults): with no faults set, every output is unchanged. With faults on, a correctly identified tag still solves the true pose. Wrong IDs and false tags pull both botposes.docs/packages/vision.md("Faults for stress tests") anddocs/packages/fakehardware.md.Bugs found and fixed
FakeLimelight3AFakeLimelight3AFaultsTest.heavyNoiseNeverReportsATagOutsideTheImageSimCamera.groundPointInRobotFrameCameraLensDistortionTest.aPixelNoRayReachesHasNoGroundPointSimFrameRendererSimFrameRendererTest.cornersPastAFoldingLensesReachAreBlackAndUnlabelledKnown limit (documented)
FakeLimelight3Aserves the newest frame delivered in a loop. A repeated frame is therefore invisible to it. An out-of-order frame shows only when the camera's frame rate is below the loop rate.Verified
./gradlew test, counted from the JUnit XML::SimLoop:testDebugUnitTest: 1277 tests, 0 failures. That is 26 new tests; the base count, derived, is 1251.:SimLoop:desktop:test: 6 tests, 0 failures.examples: 2 tests, 0 failures../gradlew :SimLoop:docsSitepasses.tools/leak-gate/leak-gate.shpasses: 10 rules, 413 files, no violations.From Horizon (FTC 36596).