Commit 1fa13a93 authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

Using Delta Max RMS as the threshold value to abort instead of just pulse...

Using Delta Max RMS as the threshold value to abort instead of just pulse length since it is a more reliable measure of guiding performance and also can be configured by the user.

Different messages for lost stars vs. max RMS are not included.
parent bb27336c
......@@ -56,7 +56,7 @@ bool InternalGuider::guide()
pmath->start();
m_starLostCounter = 0;
m_highPulseCounter= 0;
m_highRMSCounter= 0;
// TODO re-enable rapid check later on
#if 0
......@@ -109,7 +109,7 @@ bool InternalGuider::abort()
}
m_starLostCounter=0;
m_highPulseCounter=0;
m_highRMSCounter=0;
accumulator.first = accumulator.second = 0;
pmath->suspend(false);
......@@ -872,24 +872,42 @@ bool InternalGuider::processGuiding()
bool sendPulses = true;
// If within 95% of max pulse repeatedly, let's abort
if (out->pulse_length[GUIDE_RA] >= (0.95 * Options::rAMaximumPulse()) ||
out->pulse_length[GUIDE_DEC] >= (0.95 * Options::dECMaximumPulse()))
// if (out->pulse_length[GUIDE_RA] >= (0.95 * Options::rAMaximumPulse()) ||
// out->pulse_length[GUIDE_DEC] >= (0.95 * Options::dECMaximumPulse()))
// {
// // Stop sending pulses in case we are guiding and we already sent one high pulse before
// // since we do not want to stray too much off the target to purse the guiding star
// if (state == GUIDE_GUIDING && m_highPulseCounter > 0)
// sendPulses = false;
// m_highPulseCounter++;
// }
// else
// m_highPulseCounter=0;
double delta_rms = sqrt(out->delta[GUIDE_RA]*out->delta[GUIDE_RA] + out->delta[GUIDE_DEC]*out->delta[GUIDE_DEC]);
if (delta_rms > Options::guideMaxDeltaRMS())
{
// Stop sending pulses in case we are guiding and we already sent one high pulse before
// since we do not want to stray too much off the target to purse the guiding star
if (state == GUIDE_GUIDING && m_highPulseCounter > 0)
// Stop sending pulses on the 3rd time the delta RMS is high
// so that we don't stray too far off the main target.
if (state == GUIDE_GUIDING && m_highRMSCounter > 2)
sendPulses = false;
m_highPulseCounter++;
m_highRMSCounter++;
}
else
m_highPulseCounter=0;
m_highRMSCounter=0;
uint8_t abortThreshold = (state == GUIDE_DITHERING) ? MAX_COMBINTED_PULSE_LIMITS * 3 : MAX_COMBINTED_PULSE_LIMITS;
if (m_starLostCounter+m_highPulseCounter > abortThreshold)
uint8_t abortStarLostThreshold = (state == GUIDE_DITHERING) ? MAX_LOST_STAR_THRESHOLD * 3 : MAX_LOST_STAR_THRESHOLD;
uint8_t abortRMSThreshold = (state == GUIDE_DITHERING) ? MAX_RMS_THRESHOLD * 3 : MAX_RMS_THRESHOLD;
if (m_starLostCounter > abortStarLostThreshold || m_highRMSCounter > abortRMSThreshold)
{
qCDebug(KSTARS_EKOS_GUIDE) << "m_starLostCounter" << m_starLostCounter
<< "m_highPulseCounter" << m_highPulseCounter;
emit newLog(i18n("Lost track of the guide star. Searching for guide stars..."));
<< "m_highRMSCounter" << m_highRMSCounter
<< "delta_rms" << delta_rms;
if (m_starLostCounter > abortStarLostThreshold)
emit newLog(i18n("Lost track of the guide star. Searching for guide stars..."));
else
emit newLog(i18n("Delta RMS threshold value exceeded. Searching for guide stars..."));
reacquireTimer.start();
rememberState = state;
......@@ -1169,7 +1187,7 @@ bool InternalGuider::reacquire()
bool rc = selectAutoStar();
if (rc)
{
m_highPulseCounter=m_starLostCounter=0;
m_highRMSCounter=m_starLostCounter=0;
isFirstFrame = true;
// If we were in the process of dithering, wait until settle and resume
if (rememberState == GUIDE_DITHERING)
......
......@@ -178,15 +178,18 @@ class InternalGuider : public GuideInterface
uint8_t ditherRetries {0};
QTime reacquireTimer;
int m_highPulseCounter {0};
int m_highRMSCounter {0};
Ekos::Matrix ROT_Z;
CalibrationStage calibrationStage { CAL_IDLE };
CalibrationType calibrationType;
Ekos::GuideState rememberState { GUIDE_IDLE };
// How many high pulses and lost stars before we stop
static const uint8_t MAX_COMBINTED_PULSE_LIMITS = 3;
// How many high RMS pulses before we stop
static const uint8_t MAX_RMS_THRESHOLD = 5;
// How many lost stars before we stop
static const uint8_t MAX_LOST_STAR_THRESHOLD = 5;
// Maximum pulse time limit for immediate capture. Any pulses longer that this
// will be delayed until pulse is over
static const uint16_t MAX_IMMEDIATE_CAPTURE = 250;
......
......@@ -38,6 +38,14 @@ OpsGuide::OpsGuide() : QFrame(KStars::Instance())
KSNotification::info(i18n("You must restart KStars for this change to take effect."));
});
connect(kcfg_DitherNoGuiding, &QCheckBox::toggled, this, [&](bool checked) {
if (checked && kcfg_DitherEnabled->isChecked())
{
KSNotification::error("Guided dithering cannot be used along with non-guided dithering.");
kcfg_DitherEnabled->setChecked(false);
}
});
connect(m_ConfigDialog, SIGNAL(settingsChanged(QString)), this, SIGNAL(settingsUpdated()));
}
}
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>274</width>
<height>435</height>
<height>455</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
......@@ -31,10 +31,7 @@
<property name="title">
<string>Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>3</number>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>3</number>
</property>
......@@ -47,113 +44,112 @@
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="spacing">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="l_19">
<property name="text">
<string>Algorithm</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="kcfg_GuideAlgorithm">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<widget class="QLabel" name="l_19">
<property name="text">
<string>Algorithm</string>
</property>
</widget>
<property name="text">
<string>Smart</string>
</property>
</item>
<item>
<widget class="QComboBox" name="kcfg_GuideAlgorithm">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Smart</string>
</property>
</item>
<item>
<property name="text">
<string>SEP</string>
</property>
</item>
<item>
<property name="text">
<string>Fast</string>
</property>
</item>
<item>
<property name="text">
<string>Auto Threshold</string>
</property>
</item>
<item>
<property name="text">
<string>No Threshold</string>
</property>
</item>
</widget>
<property name="text">
<string>SEP</string>
</property>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<property name="text">
<string>Fast</string>
</property>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_11">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If star tracking is lost due to passing clouds or other reasons, wait this many seconds before giving up.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Lost Star timeout</string>
</property>
</widget>
<property name="text">
<string>Auto Threshold</string>
</property>
</item>
<item>
<widget class="QSpinBox" name="kcfg_GuideLostStarTimeout">
<property name="maximum">
<number>3600</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
<property name="text">
<string>No Threshold</string>
</property>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>seconds</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If star tracking is lost due to passing clouds or other reasons, wait this many seconds before giving up.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Lost Star timeout</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="kcfg_GuideLostStarTimeout">
<property name="maximum">
<number>3600</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label_12">
<property name="text">
<string>seconds</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_13">
<property name="toolTip">
<string>Maximum delta RMS permitted before stopping guide process and searching for new guide stars.</string>
</property>
<property name="text">
<string>Max Delta RMS</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="kcfg_GuideMaxDeltaRMS">
<property name="minimum">
<double>0.500000000000000</double>
</property>
<property name="maximum">
<double>30.000000000000000</double>
</property>
<property name="value">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="label_14">
<property name="text">
<string>arcsecs</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QCheckBox" name="kcfg_GuideRemoteImagesEnabled">
<property name="enabled">
<bool>true</bool>
......@@ -166,7 +162,7 @@
</property>
</widget>
</item>
<item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="kcfg_RapidGuideEnabled">
<property name="enabled">
<bool>false</bool>
......
......@@ -1971,6 +1971,10 @@
<label>When star tracking is lost, wait this many seconds before aborting.</label>
<default>60</default>
</entry>
<entry name="GuideMaxDeltaRMS" type="Double">
<label>Maximum delta RMS permitted while guiding before aborting.</label>
<default>10</default>
</entry>
<entry name="TwoAxisEnabled" type="Bool">
<label>Use both axes to perform calibration.</label>
<default>true</default>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment