Plate solving and star detection
Star detection (SEP extraction, HFR) and astrometry solving both run in a dedicated child process (ostsolverhost, one per module instance), spawned lazily on first use and killed by releaseSolver() — never shared or pooled across modules. IndiModule owns the whole connect/spawn/IPC/disconnect dance; a module only ever sees findStars()/solveField(), the four completion signals, and the _solver result cache they fill in.
findStars(): star extraction, used by Focus, Guider, Inspector, Sequencer
bool findStars(const std::function<Parameters()> &buildParams, int zones = 1);Sequencer connects once to starsFound() right before calling it, with Qt::UniqueConnection so a repeated call never double-connects, and disconnects again as soon as the result lands or the call failed to even start:
// src/modules/sequencer/sequencer.cpp, SMFindStars()
connect(this, &IndiModule::starsFound, this, &Sequencer::OnSucessSEP, Qt::UniqueConnection);
bool started = findStars([this]()
{
return StellarSolver::getBuiltInProfiles()[0];
});
if (!started)
{
disconnect(this, &IndiModule::starsFound, this, &Sequencer::OnSucessSEP);
pMachine->submitEvent("FindStarsDone");
}starsFound() fires once the child’s reply arrives — always, whether or not a star was actually found, and also on a lower-level failure (the child crashing). Sequencer::OnSucessSEP() checks _solver.stars.isEmpty() rather than connecting a separate failure handler, deliberately: a frame with no stars by design (a dark/bias, filtered out earlier in SMFindStars() itself) and a real solver failure both mean “nothing to measure,” and the sequence must move on (FindStarsDone) either way.
solveField(): astrometry, used by Navigator and Polar
bool solveField(const std::function<SolveFieldRequest()> &buildRequest);Same shape, but buildRequest returns a richer SolveFieldRequest (index folders, a position hint to narrow the search, a field-of-view-derived search window) instead of a plain Parameters — there is no live StellarSolver instance to configure directly anymore, everything travels to the child as part of the request. Polar builds one from the mount’s current coordinates, converted to J2000:
// src/modules/polar/polar.cpp
connect(this, &IndiModule::fieldSolved, this, &Polar::OnSucessSolve, Qt::UniqueConnection);
connect(this, &IndiModule::fieldSolveFailed, this, &Polar::OnFailSolve, Qt::UniqueConnection);
bool started = solveField([this]()
{
INDI::IEquatorialCoordinates mountEod, mountJ2000;
mountEod.rightascension = _mountRA;
mountEod.declination = _mountDEC;
double jdHint = 2440587.5 + QDateTime::currentMSecsSinceEpoch() / (86400.0 * 1000.0);
INDI::ObservedToJ2000(&mountEod, jdHint, &mountJ2000);
SolveFieldRequest req;
req.indexFolders << "/usr/share/astrometry";
req.usePosition = true;
req.searchRaDeg = mountJ2000.rightascension * 360.0 / 24.0;
req.searchDecDeg = mountJ2000.declination;
int profile = qBound(0, getInt("parameters", "sepprofile"), 7);
SSolver::Parameters params = StellarSolver::getBuiltInProfiles()[profile];
double fovWidthDeg = _ccdX * _ccdSampling / 3600.0; // actual horizontal FOV, not diagonal
params.minwidth = 0.5 * fovWidthDeg;
params.maxwidth = 1.1 * fovWidthDeg;
params.search_radius = 3;
req.params = params;
return req;
});
if (!started)
{
disconnect(this, &IndiModule::fieldSolved, this, &Polar::OnSucessSolve);
disconnect(this, &IndiModule::fieldSolveFailed, this, &Polar::OnFailSolve);
emit Abort();
}solveField(), unlike findStars(), has a real distinct failure signal every caller connects: fieldSolved() (read _solver.solution) and fieldSolveFailed() are always wired as a pair — a genuine solve failure is not the same as “a frame with no stars,” there is no equally cheap fallback reading to fall back on.
_solver/mAnalysisImage: read these, not currentImage(), from a completion handler
Both calls snapshot the frame they’re about to analyze into mAnalysisImage before kicking off the child — by the time starsFound()/fieldSolved() actually fires, _image/currentImage() may already have moved on to a newer frame (Serving a live preview image). _solver (a plain results cache, same field names the old in-process Solver class used, so existing handlers read it unchanged) and mAnalysisImage are what a starsFound/fieldSolved handler should read instead.
releaseSolver(): call once done, not between loop iterations
Kills the module’s own child process and forgets about it — the next findStars()/solveField() call lazily spawns a fresh one. The cost of a fresh spawn means this is for “done analyzing for a while,” not for right after every single shot in an active loop:
// src/modules/inspector/inspector.cpp, stopping
// Going idle for a while, not between loop iterations - kill
// the solver child process now rather than leave it resident
// (see IndiModule::releaseSolver()).
releaseSolver();// src/modules/inspector/inspector.cpp, a single (non-looping) shot finishing
// Single shot, not a loop - kill the solver child process now rather
// than leave it resident until the next shot (see
// IndiModule::releaseSolver()).
releaseSolver();Navigator calls it the same way, right alongside abortnavigator.