Kstars

calibrationprocess.h
1 /* Ekos Internal Guider Class
2  Copyright (C) 2016 Jasem Mutlaq <[email protected]>.
3 
4  Based on lin_guider
5 
6  SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 
9 #pragma once
10 
11 #include "fitsviewer/fitsdata.h"
12 #include "indi/indicommon.h"
13 #include "../guideinterface.h"
14 #include "guidelog.h"
15 #include "calibration.h"
16 
17 #include <QFile>
18 #include <QPointer>
19 #include <QQueue>
20 #include <QTime>
21 
22 #include <memory>
23 
24 class QVector3D;
25 class GuideView;
26 class Edge;
27 
28 namespace Ekos
29 {
30 class CalibrationProcess
31 {
32  public:
33  enum CalibrationStage
34  {
35  CAL_IDLE,
36  CAL_ERROR,
37  CAL_CAPTURE_IMAGE,
38  CAL_SELECT_STAR,
39  CAL_START,
40  CAL_RA_INC,
41  CAL_RA_DEC,
42  CAL_DEC_INC,
43  CAL_DEC_DEC,
44  CAL_BACKLASH
45  };
46  enum CalibrationType
47  {
48  CAL_NONE,
49  CAL_RA_AUTO,
50  CAL_RA_DEC_AUTO
51  };
52 
53  CalibrationProcess(double startX, double startY, bool raOnly);
54  ~CalibrationProcess() {}
55 
56  void useCalibration(Calibration *calibrationPtr);
57  bool inProgress() const;
58 
59  void startup();
60  void setGuideLog(GuideLog *guideLogPtr);
61 
62  void iterate(double x, double y);
63 
64  // Return values from each iteration.
65  void getCalibrationUpdate(
66  GuideInterface::CalibrationUpdateType *type,
67  QString *message, double *x, double *y) const;
68  void getPulse(GuideDirection *dir, int *msecs) const;
69  QString getLogStatus() const;
70  Ekos::GuideState getStatus() const;
71 
72  private:
73  void initializeIteration();
74 
75  // Methods corresponding to each calibration state.
76  void startState();
77  void raOutState(double cur_x, double cur_y);
78  void raInState(double cur_x, double cur_y);
79  void decBacklashState(double cur_x, double cur_y);
80  void decOutState(double cur_x, double cur_y);
81  void decInState(double cur_x, double cur_y);
82 
83  // Setup the return values from each iteration.
84  void addCalibrationUpdate(GuideInterface::CalibrationUpdateType type,
85  QString message, double x = 0, double y = 0);
86 
87  void addPulse(GuideDirection dir, int msecs);
88  void addLogStatus(const QString &status);
89  void addStatus(Ekos::GuideState s);
90 
91  // calibration parameters
92  int maximumSteps { 5 };
93  int turn_back_time { 0 };
94  int ra_iterations { 0 };
95  int dec_iterations { 0 };
96  int backlash_iterations { 0 };
97  int last_pulse { 0 };
98  int ra_total_pulse { 0 };
99  int de_total_pulse { 0 };
100  uint8_t backlash { 0 };
101 
102  // calibration coordinates
103  double start_x1 { 0 };
104  double start_y1 { 0 };
105  double end_x1 { 0 };
106  double end_y1 { 0 };
107  double start_x2 { 0 };
108  double start_y2 { 0 };
109  double end_x2 { 0 };
110  double end_y2 { 0 };
111  double last_x { 0 };
112  double last_y { 0 };
113  double ra_distance {0};
114  double de_distance {0};
115  double start_backlash_x { 0 };
116  double start_backlash_y { 0 };
117 
118  CalibrationStage calibrationStage { CAL_IDLE };
119  CalibrationType calibrationType;
120 
121  Calibration *calibration = nullptr;
122  Calibration tempCalibration;
123  bool raOnly = false;
124  GuideLog *guideLog = nullptr;
125 
126  // Return values from each iteration.
127  // Most of these result in emits in internalguider.cpp
128  bool axisCalibrationComplete = false;
129  QString logString;
130  GuideInterface::CalibrationUpdateType updateType;
131  QString calibrationUpdate;
132  double updateX, updateY;
133  Ekos::GuideState status;
134  GuideDirection pulseDirection;
135  int pulseMsecs = 0;
136 };
137 }
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:69
The main change relative to fitsview is to add the capability of displaying the 'neighbor guide stars...
Definition: guideview.h:21
QString message
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 04:02:48 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.