alignment: fix plugin selection persistence, sanitize polar sync entries#2372
Merged
Merged
Conversation
…ur-angle encoding Fix math plugin selection not persisting across restarts. Add polar/zenith entry sanitization in MathPlugin base class to prevent degenerate sync points near the celestial pole (EQ) or zenith (altaz) from producing garbage pointing models. Switch CCD and guide simulator to hour-angle-based telescope direction vector encoding to match the alignment subsystem convention.
6faba9e to
ea87e9a
Compare
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.
Problem
Three independent bugs that each corrupt pointing after a restart or a single near-pole sync:
Plugin selection not persisting.
saveConfig(true, name)only patches the named property in the existing XML; it skipsCURRENT_MATH_PLUGIN. After a restart the text property is replayed before the switch property, so the selected external plugin (Nearest, SVD, …) is overwritten by the stale built-in default.Mount alignment lost on plugin switch. When loading a new plugin,
SetApproximateMountAlignmentwas never called on it. Every external plugin defaults toZENITH, silently switching EQ drivers to the AltAz code path and producing garbage Goto coordinates whenever the user changes plugins at runtime.Degenerate sync points near the celestial pole. When all sync points are close to the celestial pole (Dec near +/-90), the HA component of the telescope direction vector is unconstrained — any HA value maps to nearly the same point on the sky. All plugins that solve a least-squares system over the sync database (BuiltIn, SVD, Nearest) are affected: the solver assigns an arbitrary HA-axis correction that produces wildly wrong Gotos away from the pole. The same singularity occurs for altaz mounts when all sync points are near the zenith.
Fix
telescope_simulator.cpp: usesaveConfig()(full save) instead ofsaveConfig(true, name)soCURRENT_MATH_PLUGINis included.MathPluginManagement.cpp: captureApproximateMountAlignmentbefore unloading the old plugin, then callSetApproximateMountAlignment+Initialiseon the newly loaded one. Also skip a redundant reload when the switch property arrives after the text property on startup.MathPlugin.cpp/MathPlugin.h: addSanitizePolarEntries(), called fromInitialise(). Entries with |Dec| > 88 (EQ) or encoder El > 88 (altaz) are shifted to 80 while applying the same delta to the paired celestial coordinate, preserving the pointing correction while breaking the degeneracy. The TDV is rebuilt using RA-based encoding, consistent with the BuiltIn/SVD/Nearest convention.ccd_simulator.cpp,guide_simulator.cpp: fix a unit mismatch —IEquatorialCoordinates.rightascensionis in degrees, not hours; remove the erroneous x15 / /15 factor in the EQUATORIAL_PE snooping path.Tests
Six new
PolarDegeneracytests intest_alignment_pluginscover EQ and altaz single-point-near-pole scenarios for BuiltIn, SVD, and Nearest plugins.