Kstars
7#include "hysteresisguider.h"
10#include "ekos_guide_debug.h"
12HysteresisGuider::HysteresisGuider(
const QString &
id) : m_ID(id)
17void HysteresisGuider::reset()
20 m_LastGuideTime = QDateTime();
21 m_GuiderIteration = 0;
23double HysteresisGuider::guide(
double offset)
27 const double hysteresis = m_Hysteresis;
31 if (m_LastGuideTime.isValid())
33 constexpr int MAX_GUIDE_LAG = 30;
34 const int interval = m_LastGuideTime.secsTo(now);
35 if (interval < 0 || interval > MAX_GUIDE_LAG)
38 comment = QString(
"Reset: guide lag %1s").
arg(interval);
43 m_LastGuideTime = now;
45 const double time = ++m_GuiderIteration;
46 double guideVal = m_Gain * ((1.0 - hysteresis) * offset + hysteresis * m_LastOutput);
48 if (fabs(guideVal) > 0 && fabs(guideVal) < m_MinMove)
51 comment.
append(QString(
"%1%2 < minMove %3").arg(!comment.
isEmpty() ?
", " :
"")
52 .arg(guideVal, 0,
'f', 2).arg(m_MinMove, 0,
'f', 2));
56 qCDebug(KSTARS_EKOS_GUIDE) << QString(
"HysteresisGuide(%1,%2) %3 * ((%4 * %5) + (%6 * %7)) --> %8: %9")
57 .arg(m_ID, 3).arg(time, 3,
'f', 0).arg(m_Gain, 4,
'f', 2)
58 .arg((1.0 - hysteresis), 4,
'f', 2).arg(offset, 4,
'f', 2)
59 .arg(hysteresis, 4,
'f', 2).arg(m_LastOutput, 4,
'f', 2)
60 .arg(guideVal, 5,
'f', 2).arg(comment);
61 m_LastOutput = guideVal;
QDateTime currentDateTime()
QString & append(QChar ch)
QString arg(Args &&... args) const const
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:58:35 by
doxygen 1.13.2 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.