|
Instrument Neutral Distributed Interface INDI 2.2.5
|
This document defines the mathematical and conceptual architecture of INDI's telescope pointing model subsystem. Because telescope tracking depends on translating idealized sky coordinates to physical mechanical hardware, INDI provides different math plugins to model these discrepancies depending on user needs and hardware setups.
This guide details the shared conventions across the subsystem and outlines the two primary approaches used by the plugins: Matrix-Based local mapping and Physics-Based unified modeling.
Regardless of the solver algorithm, all alignment plugins must negotiate standard coordinate systems and sidereal time.
| System | Origin | Direction | Notes |
|---|---|---|---|
| INDI/SOFA | North (0°) | East positive (CCW from above) | Used by INDI's IHorizontalCoordinates, iauHd2ae, iauAe2hd. |
| SPK internal (altaz) | — | roll = π − Az | Left-handed encoding; see roll convention below. |
| SPK internal (equatorial) | — | roll = −HA | Right-hand rule; HA increases westward. |
INDI and SOFA use the same azimuth convention (North=0°, East=90°), so no conversion is required between them. The only non-trivial mapping is between INDI/SOFA azimuth and SPK's internal roll coordinate.
SPK's internal solver (spkVtel) encodes mount axes as a (roll, pitch) pair whose semantics depend on mount type (see spk/vtel.c Note 7):
This encoding is internal to the SPK library. SPKMathPlugin translates between it and INDI's TelescopeDirectionVector (TDV) representation at every boundary:
| Function | Direction | Operation |
|---|---|---|
| RollPitchToDirectionVector | SPK → TDV | Az = π − roll |
| DirectionVectorToRollPitch | TDV → SPK | roll = π − Az |
| ExtractObsRow / BuildObservationData | TDV → Pmfit | rdem = π − roll = Az |
All plugins rely on libnova to determine Local Sidereal Time (LST) to maintain tight integration and backward compatibility with the INDI driver ecosystem.
Some plugins (like SPK) additionally use ERFA internally. To ensure there is no clock drift between libnova and the ERFA engine, synchronization occurs via the Earth Rotation Angle (ERA):
$$ \text{LST}_{rad} = (\text{GAST}_{hrs} + \lambda_{hrs}) \times \frac{\pi}{12} $$ $$ \text{eral} = \text{LST}_{rad} + \text{EO} $$ (Where EO is the Equation of the Origins)
The telescope simulator (drivers/telescope/telescope_simulator.cpp) implements a six-term Wallace pointing model via scopesim_helper.cpp. This lets you inject known errors into the simulator and verify that alignment plugins recover them.
Six error terms are exposed as the MOUNT_MODEL property (UI label "Mount Model", Simulator tab). Values are stored and displayed in arcminutes; the driver divides by 60 before passing degrees to setCorrections().
| Property element | Wallace term | Physical meaning |
|---|---|---|
| MM_IH | IH | HA zero / roll index error |
| MM_ID | ID | Dec zero / pitch index error |
| MM_CH | CH | Collimation (non-perpendicularity of optical and mechanical axes) |
| MM_NP | NP | HA/Dec non-perpendicularity |
| MM_MA | MA | Polar axis azimuth error |
| MM_ME | ME | Polar axis elevation error |
Settings are saved across sessions and applied immediately on connection via ISGetProperties.
scopesim_helper.cpp provides two directions of the Wallace transform:
Every ReadScopeStatus tick the telescope simulator computes the true pointing position (with all Wallace errors applied) and publishes it as the EQUATORIAL_PE property (IP_RO, state Ok):
EQUATORIAL_EOD_COORD is published separately as the raw encoder position (no Wallace correction), which is what the INDI alignment subsystem and goto logic use.
Both indi_simulator_ccd and indi_simulator_guide are built with -DUSE_EQUATORIAL_PE. They register a snoop for EQUATORIAL_PE from the active telescope device during initProperties.
ISSnoopDevice handles the snoop:
DrawCcdFrame then renders the star field centred on raPE/decPE instead of the raw EQUATORIAL_EOD_COORD position, making the Wallace errors visible to the plate solver.
The Math Subsystem operates two distinct classes of plugin solvers, each excelling in different deployment scenarios.
These matrix plugins treat pointing as a geometric mapping problem, without requiring explicit parameterization of telescope hardware constraints (like bent tubes or drooping vertical axes). They solve a transformation matrix $T$ that takes a true Celestial Vector ($A$) and maps it to a mechanical Mount Vector ($B$).
Because a single transformation matrix cannot account for physical flexure across the full sky, these plugins rely on a highly effective piecewise local mesh:
The Convex Hull Consideration: This local mesh strategy works best when the target is inside the "boundary" or Convex Hull of all alignment points. Slewing significantly outside the boundary requires the subsystem to extrapolate, which can reduce relative accuracy.
Given 3 local alignment points, it does raw inversion: $T = B \cdot A^{-1}$
Given the same 3 local alignment points, SVD applies rigid-body constraints. It uses Singular Value Decomposition to calculate the "best-fit" matrix $T$ while demanding that $T$ remains a pure rigid 3D rotation (an orthogonal matrix with determinant = $+1$). This protects the geometry of the coordinate sphere while solving both Index Errors and Polar Misalignment simultaneously.
The SPK plugin is built on Patrick Wallace's SPK pointing kernel library. Instead of mapping localized sky patches, it models the entire sky using a unified physical parameterization, estimating the mechanical traits of the mount directly.
It fits 6 terms whose names differ by mount type:
| # | Equatorial term | Altazimuth term | Physical meaning |
|---|---|---|---|
| 0 | IH | IA | Roll (Az/HA) index error |
| 1 | ID | IE | Pitch (Dec/El) index error |
| 2 | ME | AN | Polar/azimuth-axis north tilt |
| 3 | MA | AW | Polar/azimuth-axis east tilt |
| 4 | CH | CA | Collimation / non-perpendicularity |
| 5 | TF | TF | Tube flexure (vertical droop) |
Because it uses a unified physics model, SPK requires sufficient data points to differentiate between similar mechanical errors. The plugin enforces the following progression to maintain mathematical stability:
| Sync points | Terms fitted | Terms |
|---|---|---|
| 1–2 | 2 | IH/IA, ID/IE |
| 3–4 | 4 | + ME/AN, MA/AW |
| 5 | 5 | + CH/CA |
| 6+ | 6 | + TF (full model) |
The SPK model involves a few specific implementation abstractions to interface with the rest of INDI:
Transformations occur via a "Virtual Telescope" model.
Initialise uses a two-path design to keep per-sync-point cost low once a full model is established.
Cold path — used on the first fit, after a mount-type change, or as a fallback: calls Pmfit directly over all sync points. This is O(n) in the number of points and rebuilds the model from scratch.
Hot path — active once a 6-term model exists: each new sync point calls AccumulateObsRow to update a set of pre-built normal equation accumulators (m_NE_A, m_NE_v), then SolveNormalEquations to extract updated coefficients. The point history is not re-traversed, keeping Initialise O(1) per added point regardless of how many sync points have accumulated.
If the hot-path accumulation or solve fails for any reason (degenerate geometry, numerical issue), the plugin falls through to the cold path automatically.
The SPK C sources (vtel.c, pmfit.c, astr.c, etc.) were natively designed for the SOFA (iauXxx) API. Since SOFA has a non-standard restrictive license, INDI uses the open-source ERFA fork (which is mathematically identical).
A C-header shim (libs/alignment/spk/sofa.h) maps the API at compile time without modifying Wallace's core source:
The internal matrix generator (spkVtel) uses iauRx, iauRy, and iauRz. It is important to note that ERFA does not follow the standard "active" rotation matrix format.
Substituting standard $M^T_{active}$ math engines here will result in polar offset (AN, AW) coefficients being applied inversely, which would cause systematic pointing errors.