Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/guide/internalguide/gmath.h
Context not available. | |||||
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. | ||
---|---|---|---|---|---|
10 | */ | 10 | */ | ||
11 | 11 | | |||
12 | #ifndef GMATH_H_ | 12 | #pragma once | ||
13 | #define GMATH_H_ | | |||
14 | 13 | | |||
15 | #include <stdint.h> | 14 | #include <stdint.h> | ||
16 | #include <sys/types.h> | 15 | #include <sys/types.h> | ||
17 | 16 | | |||
17 | #include "matr.h" | ||||
18 | #include "vect.h" | ||||
19 | #include "indi/indicommon.h" | ||||
20 | | ||||
18 | #include <QObject> | 21 | #include <QObject> | ||
19 | #include <QTime> | | |||
20 | #include <QPointer> | 22 | #include <QPointer> | ||
23 | #include <QTime> | ||||
24 | #include <QVector> | ||||
21 | 25 | | |||
22 | #include "fitsviewer/fitsview.h" | 26 | class QFile; | ||
23 | #include "indi/indicommon.h" | | |||
24 | 27 | | |||
25 | #include "vect.h" | 28 | class FITSView; | ||
26 | #include "matr.h" | | |||
27 | 29 | | |||
28 | typedef struct | 30 | typedef struct | ||
29 | { | 31 | { | ||
Context not available. | |||||
51 | #define GUIDE_RA 0 | 53 | #define GUIDE_RA 0 | ||
52 | #define GUIDE_DEC 1 | 54 | #define GUIDE_DEC 1 | ||
53 | #define CHANNEL_CNT 2 | 55 | #define CHANNEL_CNT 2 | ||
54 | #define DEFAULT_SQR 1 | | |||
55 | 56 | | |||
56 | #define MAX_ACCUM_CNT 50 | 57 | #define MAX_ACCUM_CNT 50 | ||
57 | extern const guide_square_t guide_squares[]; | 58 | extern const guide_square_t guide_squares[]; | ||
Context not available. | |||||
65 | void reset(void); | 66 | void reset(void); | ||
66 | 67 | | |||
67 | int threshold_alg_idx; | 68 | int threshold_alg_idx; | ||
68 | double guiding_rate; | | |||
69 | bool enabled[CHANNEL_CNT]; | 69 | bool enabled[CHANNEL_CNT]; | ||
70 | bool enabled_axis1[CHANNEL_CNT]; | 70 | bool enabled_axis1[CHANNEL_CNT]; | ||
71 | bool enabled_axis2[CHANNEL_CNT]; | 71 | bool enabled_axis2[CHANNEL_CNT]; | ||
Context not available. | |||||
179 | // Templated functions | 179 | // Templated functions | ||
180 | template <typename T> | 180 | template <typename T> | ||
181 | Vector findLocalStarPosition(void) const; | 181 | Vector findLocalStarPosition(void) const; | ||
182 | // sys... | 182 | | ||
183 | uint32_t ticks; // global channel ticker | 183 | // Creates a new float image from the guideView image data. The returned image MUST be deleted later or memory will leak. | ||
184 | QPointer<FITSView> guideView; // pointer to image | 184 | float *createFloatImage() const; | ||
185 | int video_width, video_height; // video frame dimensions | 185 | | ||
186 | double ccd_pixel_width, ccd_pixel_height, aperture, focal; | 186 | void do_ticks(void); | ||
187 | Vector point2arcsec(const Vector &p) const; | ||||
188 | void process_axes(void); | ||||
189 | void calc_square_err(void); | ||||
190 | const char *get_direction_string(GuideDirection dir); | ||||
191 | | ||||
192 | /// Global channel ticker | ||||
193 | uint32_t ticks { 0 }; | ||||
194 | /// Pointer to image | ||||
195 | QPointer<FITSView> guideView; | ||||
196 | /// Video frame width | ||||
197 | int video_width { -1 }; | ||||
198 | /// Video frame height | ||||
199 | int video_height { -1 }; | ||||
200 | double ccd_pixel_width { 0 }; | ||||
201 | double ccd_pixel_height { 0 }; | ||||
202 | double aperture { 0 }; | ||||
203 | double focal { 0 }; | ||||
187 | Matrix ROT_Z; | 204 | Matrix ROT_Z; | ||
188 | bool preview_mode, suspended, lost_star, dec_swap; | 205 | bool preview_mode { true }; | ||
206 | bool suspended { false }; | ||||
207 | bool lost_star { false }; | ||||
208 | bool dec_swap { false }; | ||||
189 | 209 | | |||
190 | // square variables | 210 | // square variables | ||
191 | int squareSize; // size of analysing square | 211 | /// Analyzing square size | ||
192 | int square_alg_idx; // index of threshold algorithm | 212 | int squareSize { 0 }; | ||
193 | int subBinX, subBinY; | 213 | /// Index of threshold algorithm | ||
214 | int square_alg_idx { SMART_THRESHOLD }; | ||||
215 | int subBinX { 1 }; | ||||
216 | int subBinY { 1 }; | ||||
194 | 217 | | |||
195 | // sky coord. system vars. | 218 | // sky coord. system vars. | ||
196 | Vector star_pos; // position of star in reticle coord. system | 219 | /// Star position in reticle coord. system | ||
197 | Vector scr_star_pos; // sctreen star position | 220 | Vector star_pos; | ||
221 | /// Star position on the screen | ||||
222 | Vector scr_star_pos; | ||||
198 | Vector reticle_pos; | 223 | Vector reticle_pos; | ||
199 | Vector reticle_orts[2]; | 224 | Vector reticle_orts[2]; | ||
200 | double reticle_angle; | 225 | double reticle_angle { 0 }; | ||
201 | 226 | | |||
202 | // processing | 227 | // processing | ||
203 | uint32_t channel_ticks[2]; | 228 | uint32_t channel_ticks[2]; | ||
Context not available. | |||||
210 | cproc_out_params out_params; | 235 | cproc_out_params out_params; | ||
211 | 236 | | |||
212 | // stat math... | 237 | // stat math... | ||
213 | bool do_statistics; | 238 | bool do_statistics { true }; | ||
214 | double sum, sqr_sum; | 239 | double sum { 0 }; | ||
215 | double delta_prev, sigma_prev, sigma; | | |||
216 | | ||||
217 | // proc | | |||
218 | void do_ticks(void); | | |||
219 | Vector point2arcsec(const Vector &p) const; | | |||
220 | void process_axes(void); | | |||
221 | void calc_square_err(void); | | |||
222 | const char *get_direction_string(GuideDirection dir); | | |||
223 | 240 | | |||
224 | // rapid guide | 241 | // rapid guide | ||
225 | bool useRapidGuide = false; | 242 | bool useRapidGuide { false }; | ||
226 | double rapidDX, rapidDY; | 243 | double rapidDX { 0 }; | ||
244 | double rapidDY { 0 }; | ||||
227 | 245 | | |||
228 | // Image Guide | 246 | // Image Guide | ||
229 | bool imageGuideEnabled = false; | 247 | bool imageGuideEnabled { false }; | ||
230 | // Creates a new float image from the guideView image data. The returned image MUST be deleted later or memory will leak. | | |||
231 | float *createFloatImage() const; | | |||
232 | // Partition guideView image into NxN square regions each of size axis*axis. The returned vector contains pointers to | 248 | // Partition guideView image into NxN square regions each of size axis*axis. The returned vector contains pointers to | ||
233 | // the newly allocated square images. It MUST be deleted later by delete[] or memory will leak. | 249 | // the newly allocated square images. It MUST be deleted later by delete[] or memory will leak. | ||
234 | QVector<float *> partitionImage() const; | 250 | QVector<float *> partitionImage() const; | ||
235 | uint32_t regionAxis = 64; | 251 | uint32_t regionAxis { 64 }; | ||
236 | QVector<float *> referenceRegions; | 252 | QVector<float *> referenceRegions; | ||
237 | 253 | | |||
238 | // dithering | 254 | // dithering | ||
239 | double ditherRate[2]; | 255 | double ditherRate[2]; | ||
240 | 256 | | |||
241 | QFile *logFile; | 257 | QFile *logFile { nullptr }; | ||
242 | QTime logTime; | 258 | QTime logTime; | ||
243 | }; | 259 | }; | ||
244 | | ||||
245 | #endif /*GMATH_H_*/ | | |||
Context not available. |