Skip to content

Commit 742db84

Browse files
committed
alignment/SPK: complete pointing model with altaz convention and polar axis mapping
Implement the full 6-term Pmfit least-squares fitting loop with hot-path incremental normal-equation accumulation. Apply the altaz roll convention (pi - Az, matching vtel Note 7). Add call to MathPlugin::Initialise() so the base class sanitizes sync points before Pmfit runs. Activate EQUATORIAL_PE output in the CCD/guide simulators only when tracking state is Ok, so plate solves see a stable star field. Map ME (polar elevation error, pmv[2]) to pan/AN (along-meridian tilt) and MA (polar azimuth error, pmv[3]) to paw/AW (across-meridian tilt) in ParsePmfitCoefficients, following Wallace PM struct conventions. Use RA-based (ANTI_CLOCKWISE) TDV encoding throughout: telescope_simulator Sync/Goto, MathPlugin polar sanitizer, and SPKMathPlugin boundary functions. Store LST in UpdateAstrometry so DirectionVectorToRollPitch and RollPitchToDirectionVector can convert between RA-based TDVs and the HA-based roll/pitch that the Wallace kernel expects internally. Add altaz/EQ polar degeneracy and regression tests. Update ARCHITECTURE.md to document the Wallace error injection pipeline.
1 parent a682dd6 commit 742db84

11 files changed

Lines changed: 1064 additions & 140 deletions

File tree

drivers/ccd/ccd_simulator.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,12 @@ int CCDSim::DrawCcdFrame(INDI::CCDChip * targetChip)
658658
}
659659
else
660660
{
661+
static bool s_warnedNoSnoop = false;
662+
if (!s_warnedNoSnoop)
663+
{
664+
LOG_WARN("EQUATORIAL_PE not yet snooped — rendering at raw EQUATORIAL_EOD_COORD (mount errors not active)");
665+
s_warnedNoSnoop = true;
666+
}
661667
#endif
662668
currentRA = RA;
663669
currentDE = Dec;
@@ -1382,7 +1388,15 @@ bool CCDSim::ISSnoopDevice(XMLEle * root)
13821388
INDI::ObservedToJ2000(&epochPos, ln_get_julian_from_sys(), &J2000Pos);
13831389
raPE = J2000Pos.rightascension;
13841390
decPE = J2000Pos.declination;
1385-
usePE = true;
1391+
1392+
// Only activate PE rendering once the telescope reports a valid (Ok) state.
1393+
// The initial defNumberVector arrives with state Idle and values 0/0.
1394+
const char * state = findXMLAttValu(root, "state");
1395+
if (!usePE && strcmp(state, "Ok") == 0)
1396+
{
1397+
LOGF_INFO("EQUATORIAL_PE snoop active: JNow RA %.4f Dec %.4f -> J2000 RA %.4f Dec %.4f", newra, newdec, raPE, decPE);
1398+
usePE = true;
1399+
}
13861400

13871401
EqPENP[AXIS_RA].setValue(newra);
13881402
EqPENP[AXIS_DE].setValue(newdec);

drivers/ccd/guide_simulator.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,12 @@ int GuideSim::DrawCcdFrame(INDI::CCDChip * targetChip)
519519
}
520520
else
521521
{
522+
static bool s_warnedNoSnoop = false;
523+
if (!s_warnedNoSnoop)
524+
{
525+
LOG_WARN("EQUATORIAL_PE not yet snooped — rendering at raw EQUATORIAL_EOD_COORD (mount errors not active)");
526+
s_warnedNoSnoop = true;
527+
}
522528
#endif
523529
m_CurrentRA = RA;
524530
m_CurrentDEC = Dec;
@@ -1168,7 +1174,15 @@ bool GuideSim::ISSnoopDevice(XMLEle * root)
11681174
INDI::ObservedToJ2000(&epochPos, ln_get_julian_from_sys(), &J2000Pos);
11691175
raPE = J2000Pos.rightascension;
11701176
decPE = J2000Pos.declination;
1171-
m_UsePE = true;
1177+
1178+
// Only activate PE rendering once the telescope reports a valid (Ok) state.
1179+
// The initial defNumberVector arrives with state Idle and values 0/0.
1180+
const char * state = findXMLAttValu(root, "state");
1181+
if (!m_UsePE && strcmp(state, "Ok") == 0)
1182+
{
1183+
LOGF_INFO("EQUATORIAL_PE snoop active: JNow RA %.4f Dec %.4f -> J2000 RA %.4f Dec %.4f", newra, newdec, raPE, decPE);
1184+
m_UsePE = true;
1185+
}
11721186

11731187
EqPENP[AXIS_RA].setValue(newra);
11741188
EqPENP[AXIS_DE].setValue(newdec);

drivers/telescope/telescope_simulator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,12 @@ bool ScopeSim::Goto(double r, double d)
579579
EquatorialCoordinatesFromTelescopeDirectionVector(tdv, raCoords);
580580
targetRA = raCoords.rightascension;
581581
targetDec = raCoords.declination;
582+
LOGF_INFO("EQ Goto: alignment corrected RA %.4fh Dec %.4f -> RA %.4fh Dec %.4f",
583+
r, d, targetRA, targetDec);
584+
}
585+
else
586+
{
587+
LOG_WARN("EQ Goto: TransformCelestialToTelescope FAILED, using raw coordinates");
582588
}
583589
}
584590

libs/alignment/ARCHITECTURE.md

Lines changed: 149 additions & 40 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)