9 #include "internalguider.h"
11 #include "ekos_guide_debug.h"
14 #include "auxiliary/kspaths.h"
15 #include "fitsviewer/fitsdata.h"
16 #include "fitsviewer/fitsview.h"
17 #include "guidealgorithms.h"
18 #include "ksnotification.h"
19 #include "ekos/auxiliary/stellarsolverprofileeditor.h"
21 #include <KMessageBox>
28 #define MAX_GUIDE_STARS 10
32 InternalGuider::InternalGuider()
35 pmath.reset(
new cgmath());
36 connect(pmath.get(), &cgmath::newStarPosition,
this, &InternalGuider::newStarPosition);
37 connect(pmath.get(), &cgmath::guideStats,
this, &InternalGuider::guideStats);
41 pmath->getMutableCalibration()->restore(
42 pierSide, Options::reverseDecOnPierSideChange(), subBinX, subBinY,
nullptr);
48 bool InternalGuider::guide()
50 if (state >= GUIDE_GUIDING)
52 return processGuiding();
55 if (state == GUIDE_SUSPENDED)
59 m_GuideFrame->disconnect(
this);
63 m_starLostCounter = 0;
67 m_isFirstFrame =
true;
69 if (state == GUIDE_IDLE)
71 if (Options::saveGuideLog())
73 GuideLog::GuideInfo info;
75 guideLog.startGuiding(info);
78 state = GUIDE_GUIDING;
79 emit newStatus(state);
81 emit frameCaptureRequested();
93 bool InternalGuider::abort()
98 guideLog.endGuiding();
100 if (state == GUIDE_CALIBRATING ||
101 state == GUIDE_GUIDING ||
102 state == GUIDE_DITHERING ||
103 state == GUIDE_MANUAL_DITHERING ||
104 state == GUIDE_REACQUIRE)
106 if (state == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING)
107 emit newStatus(GUIDE_DITHERING_ERROR);
108 emit newStatus(GUIDE_ABORTED);
110 qCDebug(KSTARS_EKOS_GUIDE) <<
"Aborting" << getGuideStatusString(state);
114 emit newStatus(GUIDE_IDLE);
115 qCDebug(KSTARS_EKOS_GUIDE) <<
"Stopping internal guider.";
120 m_ProgressiveDither.clear();
121 m_starLostCounter = 0;
122 m_highRMSCounter = 0;
126 pmath->suspend(
false);
132 bool InternalGuider::suspend()
134 guideLog.pauseInfo();
135 state = GUIDE_SUSPENDED;
136 emit newStatus(state);
138 pmath->suspend(
true);
143 bool InternalGuider::resume()
145 guideLog.resumeInfo();
146 state = GUIDE_GUIDING;
147 emit newStatus(state);
149 pmath->suspend(
false);
151 emit frameCaptureRequested();
156 bool InternalGuider::ditherXY(
double x,
double y)
158 m_ProgressiveDither.clear();
161 pmath->getTargetPosition(&cur_x, &cur_y);
166 double oneJump = (guideBoxSize / 4.0);
167 double targetX = cur_x, targetY = cur_y;
168 int xSign = (x >= cur_x) ? 1 : -1;
169 int ySign = (y >= cur_y) ? 1 : -1;
173 if (fabs(targetX - x) > oneJump)
174 targetX += oneJump * xSign;
175 else if (fabs(targetX - x) < oneJump)
178 if (fabs(targetY - y) > oneJump)
179 targetY += oneJump * ySign;
180 else if (fabs(targetY - y) < oneJump)
183 m_ProgressiveDither.enqueue(GuiderUtils::Vector(targetX, targetY, -1));
186 while (targetX != x || targetY != y);
188 m_DitherTargetPosition = m_ProgressiveDither.dequeue();
189 pmath->setTargetPosition(m_DitherTargetPosition.x, m_DitherTargetPosition.y);
190 guideLog.ditherInfo(x, y, m_DitherTargetPosition.x, m_DitherTargetPosition.y);
192 state = GUIDE_MANUAL_DITHERING;
193 emit newStatus(state);
200 bool InternalGuider::dither(
double pixels)
203 pmath->getTargetPosition(&ret_x, &ret_y);
210 GuiderUtils::Vector star_position = pmath->findLocalStarPosition(m_ImageData, m_GuideFrame,
false);
211 if (pmath->isStarLost() || (star_position.x == -1) || (star_position.y == -1))
215 constexpr
int abortStarLostThreshold = MAX_LOST_STAR_THRESHOLD * 3;
216 if (++m_starLostCounter > abortStarLostThreshold)
218 qCDebug(KSTARS_EKOS_GUIDE) <<
"Too many consecutive lost stars." << m_starLostCounter <<
"Aborting dither.";
219 return abortDither();
221 qCDebug(KSTARS_EKOS_GUIDE) <<
"Dither lost star. Trying again.";
222 emit frameCaptureRequested();
226 m_starLostCounter = 0;
228 if (state != GUIDE_DITHERING)
232 auto seed = std::chrono::system_clock::now().time_since_epoch().count();
233 std::default_random_engine generator(seed);
234 std::uniform_real_distribution<double> angleMagnitude(0, 360);
237 double diff_x = pixels * cos(angle);
238 double diff_y = pixels * sin(angle);
240 if (pmath->getCalibration().declinationSwapEnabled())
243 if (m_DitherOrigin.x() == 0 && m_DitherOrigin.y() == 0)
245 m_DitherOrigin =
QVector3D(ret_x, ret_y, 0);
247 double totalXOffset = ret_x - m_DitherOrigin.x();
248 double totalYOffset = ret_y - m_DitherOrigin.y();
250 if (fabs(diff_x + totalXOffset) > MAX_DITHER_TRAVEL)
252 if (fabs(diff_y + totalYOffset) > MAX_DITHER_TRAVEL)
255 m_DitherTargetPosition = GuiderUtils::Vector(ret_x, ret_y, 0) + GuiderUtils::Vector(diff_x, diff_y, 0);
257 qCDebug(KSTARS_EKOS_GUIDE)
258 <<
QString(
"Dithering by %1 pixels. Target: %2,%3 Current: %4,%5 Move: %6,%7 Wander: %8,%9")
259 .
arg(pixels, 3,
'f', 1)
260 .
arg(m_DitherTargetPosition.x, 5,
'f', 1).
arg(m_DitherTargetPosition.y, 5,
'f', 1)
261 .
arg(ret_x, 5,
'f', 1).
arg(ret_y, 5,
'f', 1)
262 .
arg(diff_x, 4,
'f', 1).
arg(diff_y, 4,
'f', 1)
263 .
arg(totalXOffset + diff_x, 5,
'f', 1).
arg(totalYOffset + diff_y, 5,
'f', 1);
264 guideLog.ditherInfo(diff_x, diff_y, m_DitherTargetPosition.x, m_DitherTargetPosition.y);
266 pmath->setTargetPosition(m_DitherTargetPosition.x, m_DitherTargetPosition.y);
268 if (Options::gPGEnabled())
270 pmath->getGPG().startDithering(diff_x, diff_y, pmath->getCalibration());
272 state = GUIDE_DITHERING;
273 emit newStatus(state);
281 double driftRA, driftDEC;
282 pmath->getCalibration().computeDrift(
284 GuiderUtils::Vector(m_DitherTargetPosition.x, m_DitherTargetPosition.y, 0),
285 &driftRA, &driftDEC);
287 double pixelOffsetX = m_DitherTargetPosition.x - star_position.x;
288 double pixelOffsetY = m_DitherTargetPosition.y - star_position.y;
290 qCDebug(KSTARS_EKOS_GUIDE)
291 <<
QString(
"Dithering in progress. Current: %1,%2 Target: %3,%4 Diff: %5,%6 Wander: %8,%9")
292 .
arg(star_position.x, 5,
'f', 1).
arg(star_position.y, 5,
'f', 1)
293 .
arg(m_DitherTargetPosition.x, 5,
'f', 1).
arg(m_DitherTargetPosition.y, 5,
'f', 1)
294 .
arg(pixelOffsetX, 4,
'f', 1).
arg(pixelOffsetY, 4,
'f', 1)
295 .
arg(star_position.x - m_DitherOrigin.x(), 5,
'f', 1)
296 .
arg(star_position.y - m_DitherOrigin.y(), 5,
'f', 1);
298 if (Options::ditherWithOnePulse() || (fabs(driftRA) < 1 && fabs(driftDEC) < 1))
300 pmath->setTargetPosition(star_position.x, star_position.y);
305 if (Options::ditherWithOnePulse())
306 m_isFirstFrame =
true;
308 qCDebug(KSTARS_EKOS_GUIDE) <<
"Dither complete.";
310 if (Options::ditherSettle() > 0)
312 state = GUIDE_DITHERING_SETTLE;
313 guideLog.settleStartedInfo();
314 emit newStatus(state);
317 if (Options::gPGEnabled())
318 pmath->getGPG().ditheringSettled(
true);
324 if (++m_DitherRetries > Options::ditherMaxIterations())
325 return abortDither();
333 bool InternalGuider::abortDither()
335 if (Options::ditherFailAbortsAutoGuide())
337 emit newStatus(Ekos::GUIDE_DITHERING_ERROR);
343 emit newLog(
i18n(
"Warning: Dithering failed. Autoguiding shall continue as set in the options in case "
344 "of dither failure."));
346 if (Options::ditherSettle() > 0)
348 state = GUIDE_DITHERING_SETTLE;
349 guideLog.settleStartedInfo();
350 emit newStatus(state);
353 if (Options::gPGEnabled())
354 pmath->getGPG().ditheringSettled(
false);
361 bool InternalGuider::processManualDithering()
364 pmath->getTargetPosition(&cur_x, &cur_y);
365 pmath->getStarScreenPosition(&cur_x, &cur_y);
368 double driftRA, driftDEC;
369 pmath->getCalibration().computeDrift(
370 GuiderUtils::Vector(cur_x, cur_y, 0),
371 GuiderUtils::Vector(m_DitherTargetPosition.x, m_DitherTargetPosition.y, 0),
372 &driftRA, &driftDEC);
374 qCDebug(KSTARS_EKOS_GUIDE) <<
"Manual Dithering in progress. Diff star X:" << driftRA <<
"Y:" << driftDEC;
376 if (fabs(driftRA) < guideBoxSize / 5.0 && fabs(driftDEC) < guideBoxSize / 5.0)
378 if (m_ProgressiveDither.empty() ==
false)
380 m_DitherTargetPosition = m_ProgressiveDither.dequeue();
381 pmath->setTargetPosition(m_DitherTargetPosition.x, m_DitherTargetPosition.y);
382 qCDebug(KSTARS_EKOS_GUIDE) <<
"Next Dither Jump X:" << m_DitherTargetPosition.x <<
"Jump Y:" << m_DitherTargetPosition.y;
390 if (fabs(driftRA) < 1 && fabs(driftDEC) < 1)
392 pmath->setTargetPosition(cur_x, cur_y);
393 qCDebug(KSTARS_EKOS_GUIDE) <<
"Manual Dither complete.";
395 if (Options::ditherSettle() > 0)
397 state = GUIDE_DITHERING_SETTLE;
398 guideLog.settleStartedInfo();
399 emit newStatus(state);
411 if (++m_DitherRetries > Options::ditherMaxIterations())
413 emit newLog(
i18n(
"Warning: Manual Dithering failed."));
415 if (Options::ditherSettle() > 0)
417 state = GUIDE_DITHERING_SETTLE;
418 guideLog.settleStartedInfo();
419 emit newStatus(state);
432 void InternalGuider::setDitherSettled()
434 guideLog.settleCompletedInfo();
435 emit newStatus(Ekos::GUIDE_DITHERING_SUCCESS);
438 state = GUIDE_GUIDING;
441 bool InternalGuider::calibrate()
443 bool ccdInfo =
true, scopeInfo =
true;
446 if (subW == 0 || subH == 0)
452 if (mountAperture == 0.0 || mountFocalLength == 0.0)
455 if (ccdInfo ==
false)
456 errMsg +=
" & Telescope";
458 errMsg +=
"Telescope";
461 if (ccdInfo ==
false || scopeInfo ==
false)
463 KSNotification::error(
i18n(
"%1 info are missing. Please set the values in INDI Control Panel.", errMsg),
464 i18n(
"Missing Information"));
468 if (state != GUIDE_CALIBRATING)
470 pmath->getTargetPosition(&calibrationStartX, &calibrationStartY);
471 calibrationProcess.reset(
472 new CalibrationProcess(calibrationStartX, calibrationStartY,
473 !Options::twoAxisEnabled()));
474 state = GUIDE_CALIBRATING;
475 emit newStatus(GUIDE_CALIBRATING);
478 if (calibrationProcess->inProgress())
480 iterateCalibration();
484 if (restoreCalibration())
486 calibrationProcess.reset();
487 emit newStatus(Ekos::GUIDE_CALIBRATION_SUCCESS);
489 i18n(
"Guiding calibration restored"));
496 pmath->getMutableCalibration()->setParameters(
497 ccdPixelSizeX / 1000.0, ccdPixelSizeY / 1000.0, mountFocalLength,
498 subBinX, subBinY, pierSide, mountRA, mountDEC);
500 calibrationProcess->useCalibration(pmath->getMutableCalibration());
502 m_GuideFrame->disconnect(
this);
505 emit DESwapChanged(
false);
506 pmath->setLostStar(
false);
508 if (Options::saveGuideLog())
510 GuideLog::GuideInfo info;
511 fillGuideInfo(&info);
512 guideLog.startCalibration(info);
514 calibrationProcess->startup();
515 calibrationProcess->setGuideLog(&guideLog);
516 iterateCalibration();
521 void InternalGuider::iterateCalibration()
523 if (calibrationProcess->inProgress())
525 pmath->performProcessing(GUIDE_CALIBRATING, m_ImageData, m_GuideFrame);
526 if (pmath->isStarLost())
528 emit newLog(
i18n(
"Lost track of the guide star. Try increasing the square size or reducing pulse duration."));
529 emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
530 emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY,
531 i18n(
"Guide Star lost."));
537 pmath->getStarScreenPosition(&starX, &starY);
538 calibrationProcess->iterate(starX, starY);
540 auto status = calibrationProcess->getStatus();
541 if (status != GUIDE_CALIBRATING)
542 emit newStatus(status);
544 QString logStatus = calibrationProcess->getLogStatus();
546 emit newLog(logStatus);
550 GuideInterface::CalibrationUpdateType
type;
551 calibrationProcess->getCalibrationUpdate(&type, &updateMessage, &x, &y);
552 if (updateMessage.
length())
553 emit calibrationUpdate(type, updateMessage, x, y);
555 GuideDirection pulseDirection;
557 calibrationProcess->getPulse(&pulseDirection, &pulseMsecs);
558 if (pulseDirection != NO_DIR)
559 emit newSinglePulse(pulseDirection, pulseMsecs);
561 if (status == GUIDE_CALIBRATION_ERROR)
563 KSNotification::event(
QLatin1String(
"CalibrationFailed"),
i18n(
"Guiding calibration failed"),
564 KSNotification::EVENT_ALERT);
567 else if (status == GUIDE_CALIBRATION_SUCCESS)
569 KSNotification::event(
QLatin1String(
"CalibrationSuccessful"),
570 i18n(
"Guiding calibration completed successfully"));
571 emit DESwapChanged(pmath->getCalibration().declinationSwapEnabled());
572 pmath->setTargetPosition(calibrationStartX, calibrationStartY);
579 m_GuideFrame = guideView;
585 if (Options::saveGuideImages())
589 now.toString(
"yyyy-MM-dd"));
594 QString name =
"guide_frame_" + now.toString(
"HH-mm-ss") +
".fits";
595 QString filename = path + QStringLiteral(
"/") +
name;
596 m_ImageData->saveImage(filename);
600 void InternalGuider::reset()
604 connect(m_GuideFrame.get(), &FITSView::trackingStarSelected,
this, &InternalGuider::trackingStarSelected,
Qt::UniqueConnection);
605 calibrationProcess.reset();
608 bool InternalGuider::clearCalibration()
610 Options::setSerializedCalibration(
"");
611 pmath->getMutableCalibration()->reset();
615 bool InternalGuider::restoreCalibration()
617 bool success = Options::reuseGuideCalibration() &&
618 pmath->getMutableCalibration()->restore(
619 pierSide, Options::reverseDecOnPierSideChange(),
620 subBinX, subBinY, &mountDEC);
622 emit DESwapChanged(pmath->getCalibration().declinationSwapEnabled());
626 void InternalGuider::setStarPosition(
QVector3D &starCenter)
628 pmath->setTargetPosition(starCenter.
x(), starCenter.
y());
631 void InternalGuider::trackingStarSelected(
int x,
int y)
649 void InternalGuider::setDECSwap(
bool enable)
651 pmath->getMutableCalibration()->setDeclinationSwapEnabled(enable);
654 void InternalGuider::setSquareAlgorithm(
int index)
656 if (index == SEP_MULTISTAR && !pmath->usingSEPMultiStar())
657 m_isFirstFrame =
true;
658 pmath->setAlgorithmIndex(index);
661 bool InternalGuider::getReticleParameters(
double *x,
double *y)
663 return pmath->getTargetPosition(x, y);
666 bool InternalGuider::setGuiderParams(
double ccdPixelSizeX,
double ccdPixelSizeY,
double mountAperture,
667 double mountFocalLength)
669 this->ccdPixelSizeX = ccdPixelSizeX;
670 this->ccdPixelSizeY = ccdPixelSizeY;
671 this->mountAperture = mountAperture;
672 this->mountFocalLength = mountFocalLength;
673 return pmath->setGuiderParameters(ccdPixelSizeX, ccdPixelSizeY, mountAperture, mountFocalLength);
676 bool InternalGuider::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t binX, uint16_t binY)
678 if (w <= 0 || h <= 0)
689 pmath->setVideoParameters(w, h, subBinX, subBinY);
694 bool InternalGuider::processGuiding()
696 const cproc_out_params *out;
703 m_isFirstFrame =
false;
704 if (state == GUIDE_GUIDING)
706 GuiderUtils::Vector star_pos = pmath->findLocalStarPosition(m_ImageData, m_GuideFrame,
true);
707 if (star_pos.x != -1 && star_pos.y != -1)
708 pmath->setTargetPosition(star_pos.x, star_pos.y);
713 m_isFirstFrame =
true;
719 pmath->performProcessing(state, m_ImageData, m_GuideFrame, &guideLog);
721 if (state == GUIDE_SUSPENDED)
723 if (Options::gPGEnabled())
724 emit frameCaptureRequested();
728 if (pmath->isStarLost())
731 m_starLostCounter = 0;
734 out = pmath->getOutputParameters();
736 bool sendPulses = !pmath->isStarLost();
738 double delta_rms = std::hypot(out->delta[GUIDE_RA], out->delta[GUIDE_DEC]);
739 if (delta_rms > Options::guideMaxDeltaRMS())
742 m_highRMSCounter = 0;
744 uint8_t abortStarLostThreshold = (state == GUIDE_DITHERING
745 || state == GUIDE_MANUAL_DITHERING) ? MAX_LOST_STAR_THRESHOLD * 3 : MAX_LOST_STAR_THRESHOLD;
746 uint8_t abortRMSThreshold = (state == GUIDE_DITHERING
747 || state == GUIDE_MANUAL_DITHERING) ? MAX_RMS_THRESHOLD * 3 : MAX_RMS_THRESHOLD;
748 if (m_starLostCounter > abortStarLostThreshold || m_highRMSCounter > abortRMSThreshold)
750 qCDebug(KSTARS_EKOS_GUIDE) <<
"m_starLostCounter" << m_starLostCounter
751 <<
"m_highRMSCounter" << m_highRMSCounter
752 <<
"delta_rms" << delta_rms;
754 if (m_starLostCounter > abortStarLostThreshold)
755 emit newLog(
i18n(
"Lost track of the guide star. Searching for guide stars..."));
757 emit newLog(
i18n(
"Delta RMS threshold value exceeded. Searching for guide stars..."));
759 reacquireTimer.start();
760 rememberState = state;
761 state = GUIDE_REACQUIRE;
762 emit newStatus(state);
767 if (sendPulses && (out->pulse_dir[GUIDE_RA] != NO_DIR || out->pulse_dir[GUIDE_DEC] != NO_DIR))
769 emit newMultiPulse(out->pulse_dir[GUIDE_RA], out->pulse_length[GUIDE_RA],
770 out->pulse_dir[GUIDE_DEC], out->pulse_length[GUIDE_DEC]);
773 emit frameCaptureRequested();
775 if (state == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING)
783 if (state < GUIDE_DITHERING)
784 emit newAxisDelta(out->delta[GUIDE_RA], out->delta[GUIDE_DEC]);
786 double raPulse = out->pulse_length[GUIDE_RA];
787 double dePulse = out->pulse_length[GUIDE_DEC];
790 if(out->pulse_dir[GUIDE_RA] == NO_DIR)
793 if(out->pulse_dir[GUIDE_DEC] == NO_DIR)
796 if(out->pulse_dir[GUIDE_RA] == RA_INC_DIR)
799 if(out->pulse_dir[GUIDE_DEC] == DEC_INC_DIR)
802 emit newAxisPulse(raPulse, dePulse);
804 emit newAxisSigma(out->sigma[GUIDE_RA], out->sigma[GUIDE_DEC]);
805 if (SEPMultiStarEnabled())
806 emit newSNR(pmath->getGuideStarSNR());
811 bool InternalGuider::selectAutoStarSEPMultistar()
813 m_GuideFrame->updateFrame();
815 QVector3D newStarCenter = pmath->selectGuideStar(m_ImageData);
816 if (newStarCenter.
x() >= 0)
818 emit newStarPosition(newStarCenter,
true);
824 bool InternalGuider::SEPMultiStarEnabled()
826 return Options::guideAlgorithm() == SEP_MULTISTAR;
829 bool InternalGuider::selectAutoStar()
832 if (Options::guideAlgorithm() == SEP_MULTISTAR)
833 return selectAutoStarSEPMultistar();
835 bool useNativeDetection =
false;
839 if (Options::guideAlgorithm() != SEP_THRESHOLD)
840 starCenters = GuideAlgorithms::detectStars(m_ImageData, m_GuideFrame->getTrackingBox());
842 if (starCenters.
empty())
844 QVariantMap settings;
845 settings[
"maxStarsCount"] = 50;
846 settings[
"optionsProfileIndex"] = Options::guideOptionsProfile();
847 settings[
"optionsProfileGroup"] =
static_cast<int>(Ekos::GuideProfiles);
848 m_ImageData->setSourceExtractorSettings(settings);
850 if (Options::guideAlgorithm() == SEP_THRESHOLD)
851 m_ImageData->findStars(ALGORITHM_SEP).waitForFinished();
853 m_ImageData->findStars().waitForFinished();
855 starCenters = m_ImageData->getStarCenters();
856 if (starCenters.
empty())
859 useNativeDetection =
true;
861 if (Options::guideAlgorithm() == SEP_THRESHOLD)
862 std::sort(starCenters.
begin(), starCenters.
end(), [](
const Edge * a,
const Edge * b)
864 return a->val > b->val;
867 std::sort(starCenters.
begin(), starCenters.
end(), [](
const Edge * a,
const Edge * b)
869 return a->width > b->width;
872 m_GuideFrame->setStarsEnabled(
true);
873 m_GuideFrame->updateFrame();
876 int maxX = m_ImageData->width();
877 int maxY = m_ImageData->height();
879 int scores[MAX_GUIDE_STARS];
881 int maxIndex = MAX_GUIDE_STARS < starCenters.
count() ? MAX_GUIDE_STARS : starCenters.
count();
883 for (
int i = 0; i < maxIndex; i++)
889 if (useNativeDetection)
897 if (
center->width >
float(guideBoxSize) / subBinX)
901 if (Options::guideAlgorithm() == SEP_THRESHOLD)
902 score += sqrt(
center->val);
909 foreach (Edge *edge, starCenters)
930 int maxScoreIndex = -1;
931 for (
int i = 0; i < maxIndex; i++)
933 if (scores[i] > maxScore)
935 maxScore = scores[i];
940 if (maxScoreIndex < 0)
942 qCDebug(KSTARS_EKOS_GUIDE) <<
"No suitable star detected.";
946 QVector3D newStarCenter(starCenters[maxScoreIndex]->x, starCenters[maxScoreIndex]->y, 0);
948 if (useNativeDetection ==
false)
949 qDeleteAll(starCenters);
951 emit newStarPosition(newStarCenter,
true);
956 bool InternalGuider::reacquire()
958 bool rc = selectAutoStar();
961 m_highRMSCounter = m_starLostCounter = 0;
962 m_isFirstFrame =
true;
965 if (rememberState == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING)
967 if (Options::ditherSettle() > 0)
969 state = GUIDE_DITHERING_SETTLE;
970 guideLog.settleStartedInfo();
971 emit newStatus(state);
978 state = GUIDE_GUIDING;
979 emit newStatus(state);
983 else if (reacquireTimer.elapsed() >
static_cast<int>(Options::guideLostStarTimeout() * 1000))
985 emit newLog(
i18n(
"Failed to find any suitable guide stars. Aborting..."));
990 emit frameCaptureRequested();
994 void InternalGuider::fillGuideInfo(GuideLog::GuideInfo *info)
999 info->pixelScale = (206.26481 * this->ccdPixelSizeX * this->subBinX) / this->mountFocalLength;
1000 info->binning = this->subBinX;
1001 info->focalLength = this->mountFocalLength;
1002 info->ra = this->mountRA.Degrees();
1003 info->dec = this->mountDEC.Degrees();
1004 info->azimuth = this->mountAzimuth.Degrees();
1005 info->altitude = this->mountAltitude.Degrees();
1006 info->pierSide = this->pierSide;
1007 info->xangle = pmath->getCalibration().getRAAngle();
1008 info->yangle = pmath->getCalibration().getDECAngle();
1010 info->xrate = 1000.0 / pmath->getCalibration().raPulseMillisecondsPerArcsecond();
1011 info->yrate = 1000.0 / pmath->getCalibration().decPulseMillisecondsPerArcsecond();
1014 void InternalGuider::updateGPGParameters()
1016 pmath->getGPG().updateParameters();
1019 void InternalGuider::resetGPG()
1021 pmath->getGPG().reset();
1024 const Calibration &InternalGuider::getCalibration()
const
1026 return pmath->getCalibration();