Disable the oscillator correction: it makes the preview jump at every… - #11
Merged
Merged
Conversation
… turn c3b3479 shipped this unvalidated and it is worse than what it replaced. On a real run the preview leaps between the strongest and weakest shot, which makes the thing it exists to help -- knowing when to release -- harder, not easier. Measured on a recording of that run: 34 sign flips in cos between consecutive frames and 17 jumps of over 0.5, the worst going +0.946 to -0.955 across one frame boundary as the platform reversed. The reasoning in that commit was wrong in a specific way. It argued the failure was self-limiting -- "near the turning points the direction cannot be read, but that is also where cos is near zero, so falling back costs almost nothing". That holds only if y0 and amp are right. They are taken from observed min/max, which is outlier-sensitive and drifts as the detector picks different rows of the sliding platform, so at the observed reversal sin was 0.288 rather than ~1, |cos| was 0.957, and the sign flip cost the entire correction twice over. Recovering cos as sign(dy)*sqrt(1-sin^2) is the wrong shape of estimator for this: it is discontinuous exactly where the platform spends most of its visible time. The physics in c3b3479 is still right -- platform height and release velocity really are one oscillator in quadrature -- but the phase has to be estimated as a phase. The period is known exactly (G16[0] += 1.3 per 20ms and phi = 1.1*G16[0] deg, so 5.035 s), which makes platY = y0 + A*sin(wt) + B*cos(wt) a linear least squares fit over a window, with cos(phi) falling out of A and B continuously and with no sign to guess. shotA stays derived and the per-flight fit stays on the probe, so the data needed to validate the replacement is still being collected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
… turn
c3b3479 shipped this unvalidated and it is worse than what it replaced. On a real run the preview leaps between the strongest and weakest shot, which makes the thing it exists to help -- knowing when to release -- harder, not easier.
Measured on a recording of that run: 34 sign flips in cos between consecutive frames and 17 jumps of over 0.5, the worst going +0.946 to -0.955 across one frame boundary as the platform reversed.
The reasoning in that commit was wrong in a specific way. It argued the failure was self-limiting -- "near the turning points the direction cannot be read, but that is also where cos is near zero, so falling back costs almost nothing". That holds only if y0 and amp are right. They are taken from observed min/max, which is outlier-sensitive and drifts as the detector picks different rows of the sliding platform, so at the observed reversal sin was 0.288 rather than ~1, |cos| was 0.957, and the sign flip cost the entire correction twice over.
Recovering cos as sign(dy)sqrt(1-sin^2) is the wrong shape of estimator for this: it is discontinuous exactly where the platform spends most of its visible time. The physics in c3b3479 is still right -- platform height and release velocity really are one oscillator in quadrature -- but the phase has to be estimated as a phase. The period is known exactly (G16[0] += 1.3 per 20ms and phi = 1.1G16[0] deg, so 5.035 s), which makes platY = y0 + Asin(wt) + Bcos(wt) a linear least squares fit over a window, with cos(phi) falling out of A and B continuously and with no sign to guess.
shotA stays derived and the per-flight fit stays on the probe, so the data needed to validate the replacement is still being collected.