Kstars

linearguider.h
1/*
2 SPDX-FileCopyrightText: 2025 Hy Murveit <hy@murveit.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QObject>
10#include <QQueue>
11#include <QDateTime>
12
13class LinearGuider
14{
15
16 public:
17 LinearGuider(const QString &id);
18 ~LinearGuider() {}
19
20 struct Sample
21 {
22 double time;
23 double offset;
24 Sample(double t, double o) : time(t), offset(o) {}
25 };
26
27 void setLength(int length)
28 {
29 if (length > 0)
30 m_Length = length;
31 }
32 void setGain(double gain)
33 {
34 if (gain >= 0 && gain <= 1.0)
35 m_Gain = gain;
36 }
37 void setMinMove(double minMove)
38 {
39 if (minMove >= 0)
40 m_MinMove = minMove;
41 }
42
43 // Input is time in seconds and offset in arc-seconds.
44 // Returns an arc-second correction
45 // (i.e. guide pulse should correct that many arcseconds)
46 double guide(double offset);
47
48 void reset();
49
50 private:
51 double getSlope();
52 void removeLastSample();
53 void updateStats(const Sample &sample);
54 void addSample(const Sample &sample);
55
56 double m_Gain { 0.6 };
57 double m_MinMove { 0.0 };
58
59 QQueue<Sample> m_Samples;
60 int m_Length = 10;
61 double m_SumTime { 0 };
62 double m_SumOffset { 0 };
63 double m_SumTimeSq { 0 };
64 double m_OffsetSq { 0 };
65 double m_SumTimeOffset { 0 };
66 int m_NumRejects { 0 };
67 QString m_ID;
68 QDateTime m_LastGuideTime;
69 int m_GuiderIteration { 0 };
70};
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.