Kstars

align.h
1/*
2 SPDX-FileCopyrightText: 2013 Jasem Mutlaq <mutlaqja@ikarustech.com>
3 SPDX-FileCopyrightText: 2013-2021 Jasem Mutlaq <mutlaqja@ikarustech.com>
4 SPDX-FileCopyrightText: 2018-2020 Robert Lancaster <rlancaste@gmail.com>
5 SPDX-FileCopyrightText: 2019-2021 Hy Murveit <hy@murveit.com>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "ui_align.h"
13#include "ekos/ekos.h"
14#include "indi/indicamera.h"
15#include "indi/indistd.h"
16#include "indi/indimount.h"
17#include "skypoint.h"
18
19#include <QTime>
20#include <QTimer>
21#include <QElapsedTimer>
22#include <KConfigDialog>
23
24#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
25#include <qtdbusglobal.h>
26#else
27#include <qdbusmacros.h>
28#endif
29
30#include <stellarsolver.h>
31#include <memory>
32
34
35class AlignView;
36class FITSViewer;
37class FOV;
38class StarObject;
39class ProfileInfo;
40class RotatorSettings;
41
42namespace Ekos
43{
44class AstrometryParser;
45class DarkProcessor;
46class FilterManager;
47class RemoteAstrometryParser;
48class OpsAstrometry;
49class OpsAlign;
50class StellarSolverProfileEditor;
51class OpsPrograms;
52class OpsASTAP;
53class OpsAstrometryIndexFiles;
54class MountModel;
55class PolarAlignmentAssistant;
56class ManualRotator;
57
58/**
59 *@class Align
60 *@short Align class handles plate-solving and polar alignment measurement and correction using astrometry.net
61 * The align class employs StellarSolver library for local solvers and supports remote INDI-based solver.
62 * StellarSolver supports internal and external solvers (Astrometry.net, ASTAP, Online Astrometry).
63 * If an image is solved successfully, the image central J2000 RA & DE coordinates along with pixel scale, rotation, and partiy are
64 * reported back.
65 * Index files management is supported with ability to download astrometry.net files. The user may select and edit different solver
66 * profiles that provide settings to control both extraction and solving profiles in detail. Manual and automatic field rotation
67 * is supported in order to align the solved images to a particular orientation in the sky. The manual rotation assistant is an interactive
68 * tool that helps the user to arrive at the desired framing.
69 * Align module provide Polar Align Helper tool which enables easy-to-follow polar alignment procedure given wide FOVs (> 1.5 degrees)
70 * Legacy polar aligment is deprecated.
71 *@author Jasem Mutlaq
72 *@version 2.0
73 */
74class Align : public QWidget, public Ui::Align
75{
77 Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Align")
78 Q_PROPERTY(Ekos::AlignState status READ status NOTIFY newStatus)
79 Q_PROPERTY(QStringList logText READ logText NOTIFY newLog)
80 Q_PROPERTY(QString opticalTrain READ opticalTrain WRITE setOpticalTrain)
81 Q_PROPERTY(QString camera READ camera)
82 Q_PROPERTY(QString filterWheel READ filterWheel)
84 Q_PROPERTY(double exposure READ exposure WRITE setExposure)
86 Q_PROPERTY(QList<double> cameraInfo READ cameraInfo)
87 Q_PROPERTY(QList<double> telescopeInfo READ telescopeInfo)
88 //Q_PROPERTY(QString solverArguments READ solverArguments WRITE setSolverArguments)
89
90 public:
92 virtual ~Align() override;
93
94 typedef enum { GOTO_SYNC, GOTO_SLEW, GOTO_NOTHING } GotoMode;
95 typedef enum { SOLVER_LOCAL, SOLVER_REMOTE } SolverMode;
96 typedef enum
97 {
98 ALIGN_RESULT_SUCCESS,
99 ALIGN_RESULT_WARNING,
100 ALIGN_RESULT_FAILED
101 } AlignResult;
102
103 typedef enum
104 {
105 BLIND_IDLE,
106 BLIND_ENGAGNED,
107 BLIND_USED
108 } BlindState;
109
110 /** @defgroup AlignDBusInterface Ekos DBus Interface - Align Module
111 * Ekos::Align interface provides advanced scripting capabilities to solve images using online or offline astrometry.net
112 */
113
114 /*@{*/
115
116 /** DBUS interface function.
117 * Select CCD
118 * @param device CCD device name
119 * @return Returns true if device if found and selected, false otherwise.
120 */
122
123 /** DBUS interface function.
124 * select the filter device from the available filter drivers. The filter device can be the same as the CCD driver if the filter functionality was embedded within the driver.
125 * @param device The filter device name
126 * @return Returns true if filter device is found and set, false otherwise.
127 */
129
130 /** DBUS interface function.
131 * select the filter from the available filters.
132 * @param filter The filter name
133 * @return Returns true if filter is found and set, false otherwise.
134 */
135 Q_SCRIPTABLE bool setFilter(const QString &filter);
136 Q_SCRIPTABLE QString filter();
137
138 /** DBUS interface function.
139 * Start the plate-solving process given the passed image file.
140 * @param filename Name of image file to solve. FITS and JPG/JPG/TIFF formats are accepted.
141 * @param isGenerated Set to true if filename is generated from a CCD capture operation. If the file is loaded from any storage or network media, pass false.
142 * @return Returns true if device if found and selected, false otherwise.
143 */
144 Q_SCRIPTABLE Q_NOREPLY void startSolving();
145
146 /** DBUS interface function.
147 * Select Solver Action after successfully solving an image.
148 * @param mode 0 for Sync, 1 for Slew To Target, 2 for Nothing (just display solution results)
149 */
150 Q_SCRIPTABLE Q_NOREPLY void setSolverAction(int mode);
151
152 /** DBUS interface function.
153 * Returns the solver's solution results
154 * @return Returns array of doubles. First item is RA in degrees. Second item is DEC in degrees.
155 */
157
158 /** DBUS interface function.
159 * Returns the solver's current status
160 * @return Returns solver status (Ekos::AlignState)
161 */
163 {
164 return state;
165 }
166
167 /** DBUS interface function.
168 * @return Returns State of load slew procedure. Idle if not started. Busy if in progress. Ok if complete. Alert if procedure failed.
169 */
171 {
172 return m_SolveFromFile;
173 }
174
175 /** DBUS interface function.
176 * Sets the exposure of the selected CCD device.
177 * @param value Exposure value in seconds
178 */
179 Q_SCRIPTABLE Q_NOREPLY void setExposure(double value);
180 Q_SCRIPTABLE double exposure()
181 {
182 return alignExposure->value();
183 }
184
185 /** DBUS interface function.
186 * Get currently active camera info in this order:
187 * width, height, pixel_size_x, pixel_size_y
188 */
190
191 /** DBUS interface function.
192 * Get current active telescope info in this order:
193 * focal length, aperture
194 */
196
197 /** @}*/
198
199 /**
200 * @brief Add Camera to the list of available Cameras.
201 * @param device pointer to camera device.
202 * @return True if added successfully, false if duplicate or failed to add.
203 */
204 bool setCamera(ISD::Camera *device);
205
206 /**
207 * @brief addFilterWheel Add new filter wheel filter device.
208 * @param device pointer to filter device.
209 * @return True if added successfully, false if duplicate or failed to add.
210 */
211 bool setFilterWheel(ISD::FilterWheel *device);
212
213 /**
214 * @brief Add new mount
215 * @param device pointer to mount device.
216 * @return True if added successfully, false if duplicate or failed to add.
217 */
218 bool setMount(ISD::Mount *device);
219
220 /**
221 * @brief Add new Dome
222 * @param device pointer to dome device.
223 * @return True if added successfully, false if duplicate or failed to add.
224 */
225 bool setDome(ISD::Dome *device);
226
227 /**
228 * @brief Add new Rotator
229 * @param device pointer to rotator device.
230 */
231 void setRotator(ISD::Rotator *device);
232
233 void removeDevice(const QSharedPointer<ISD::GenericDevice> &device);
234
235 /**
236 * @brief setAstrometryDevice
237 * @param newAstrometry
238 */
240
241 /**
242 * @brief CCD information is updated, sync them.
243 */
244 void syncCameraInfo();
245
246 /**
247 * @brief syncCCDControls Update camera controls like gain, offset, ISO..etc.
248 */
249 void syncCameraControls();
250
251 /**
252 * @brief Generate arguments we pass to the remote solver.
253 */
255
256 /**
257 * @brief Does our parser exist in the system?
258 */
259 bool isParserOK();
260
261 // Log
262 QStringList logText()
263 {
264 return m_LogText;
265 }
266 QString getLogText()
267 {
268 return m_LogText.join("\n");
269 }
270 Q_SCRIPTABLE void clearLog();
271
272 /**
273 * @brief getFOVScale Returns calculated FOV values
274 * @param fov_w FOV width in arcmins
275 * @param fov_h FOV height in arcmins
276 * @param fov_scale FOV scale in arcsec per pixel
277 */
278 void getFOVScale(double &fov_w, double &fov_h, double &fov_scale);
279 QList<double> fov();
280
281 /**
282 * @brief getCalculatedFOVScale Get calculated FOV scales from the current CCD+Telescope combination.
283 * @param fov_w return calculated fov width in arcminutes
284 * @param fov_h return calculated fov height in arcminutes
285 * @param fov_scale return calculated fov pixcale in arcsecs per pixel.
286 * @note This is NOT the same as effective FOV which is the measured FOV from astrometry. It is the
287 * theoretical FOV from calculated values.
288 */
289 void getCalculatedFOVScale(double &fov_w, double &fov_h, double &fov_scale);
290
291 void setupFilterManager();
292 void setupPlot();
293 void setupSolutionTable();
294 void setupOptions();
295
296 /**
297 * @brief Sync the telescope to the solved alignment coordinate.
298 */
299 void Sync();
300
301 /**
302 * @brief Slew the telescope to the solved alignment coordinate.
303 */
304 void Slew();
305
306 /**
307 * @brief Sync the telescope to the solved alignment coordinate, and then slew to the target coordinate.
308 */
309 void SlewToTarget();
310
311 /**
312 * @brief getStellarSolverProfiles
313 * @return list of StellarSolver profile names
314 */
316
317 GotoMode currentGOTOMode() const
318 {
319 return m_CurrentGotoMode;
320 }
321
322 /**
323 * @brief generateOptions Generate astrometry.net option given the supplied map
324 * @param optionsMap List of key=value pairs for all astrometry.net options
325 * @return String List of valid astrometry.net options
326 */
327 static QStringList generateRemoteOptions(const QVariantMap &optionsMap);
328 static void generateFOVBounds(double fov_h, QString &fov_low, QString &fov_high, double tolerance = 0.05);
329
330 // access to the mount model UI, required for testing
331 MountModel * mountModel() const
332 {
333 return m_MountModel;
334 }
335
336 PolarAlignmentAssistant *polarAlignmentAssistant() const
337 {
338 return m_PolarAlignmentAssistant;
339 }
340
341 bool wcsSynced() const
342 {
343 return m_wcsSynced;
344 }
345
346 /**
347 * @brief Process updated device properties
348 * @param prop INDI Property
349 */
350 void updateProperty(INDI::Property prop);
351
352
353 /**
354 * @brief Check CCD and make sure information is updated and FOV is re-calculated.
355 * @param CCDNum By default, we check the already selected CCD in the dropdown menu. If CCDNum is specified, the check is made against this specific CCD in the dropdown menu. CCDNum is the index of the CCD in the dropdown menu.
356 */
357 void checkCamera();
358
359 /**
360 * @brief Check Filter and make sure information is updated accordingly.
361 * @param filterNum By default, we check the already selected filter in the dropdown menu. If filterNum is specified, the check is made against this specific filter in the dropdown menu.
362 * filterNum is the index of the filter in the dropdown menu.
363 */
364 void checkFilter();
365
366 /**
367 * @brief checkCameraExposureProgress Track the progress of CCD exposure
368 * @param targetChip Target chip under exposure
369 * @param remaining how many seconds remaining
370 * @param state status of exposure
371 */
372 void checkCameraExposureProgress(ISD::CameraChip *targetChip, double remaining, IPState state);
373 /**
374 * @brief Process new FITS received from CCD.
375 * @param bp pointer to blob property
376 */
377 void processData(const QSharedPointer<FITSData> &data);
378
379 /** DBUS interface function.
380 * Loads an image (FITS, RAW, or JPG/PNG) and solve its coordinates, then it slews to the solved coordinates and an image is captured and solved to ensure
381 * the telescope is pointing to the same coordinates of the image.
382 * @param image buffer to image data.
383 * @param extension image extension (e.g. cr2, jpg, fits,..etc).
384 */
385 bool loadAndSlew(const QByteArray &image, const QString &extension);
386
387 /** \addtogroup AlignDBusInterface
388 * @{
389 */
390
391 /**
392 * @brief Stop aligning
393 * @param mode stop mode (abort or suspend)
394 */
395 void stop(Ekos::AlignState mode);
396
397 /** DBUS interface function.
398 * Aborts the solving operation, handle outside of the align module.
399 */
400 Q_SCRIPTABLE Q_NOREPLY void abort()
401 {
403 }
404
405 /**
406 * @brief Suspend aligning, recovery handled by the align module itself.
407 */
408 void suspend()
409 {
411 }
412
413 /** DBUS interface function.
414 * Select the solver mode
415 * @param type Set solver type. 0 LOCAL, 1 REMOTE (requires remote astrometry driver to be activated)
416 */
417 Q_SCRIPTABLE Q_NOREPLY void setSolverMode(int mode);
418
419 /** DBUS interface function.
420 * Capture and solve an image using the astrometry.net engine
421 * @return Returns true if the procedure started successful, false otherwise (return true, not false, when retrying!)
422 */
423 Q_SCRIPTABLE bool captureAndSolve(bool initialCall = true);
424
425 /** DBUS interface function.
426 * Loads an image (FITS, RAW, or JPG/PNG) and solve its coordinates, then it slews to the solved coordinates and an image is captured and solved to ensure
427 * the telescope is pointing to the same coordinates of the image.
428 * @param fileURL URL to the image to solve
429 */
431
432 /** DBUS interface function.
433 * Sets the target coordinates that the solver compares the solution coordinates to.
434 * By default, the target coordinates are those of the current mount when the capture and
435 * solve operation is started. In case of SYNC, only the error between the solution and target
436 * coordinates is calculated. When Slew to Target is selected, the mount would be slewed afterwards to
437 * this target coordinate.
438 * @param ra0 J2000 Right Ascension in hours.
439 * @param de0 J2000 Declination in degrees.
440 */
441 Q_SCRIPTABLE Q_NOREPLY void setTargetCoords(double ra0, double de0);
442
443 /**
444 * @brief getTargetCoords QList of target coordinates.
445 * @return First value is J2000 RA in hours. Second value is J2000 DE in degrees.
446 */
448
449
450 /**
451 * @brief Set the alignment target where the mount is expected to point at.
452 * @param targetCoord exact coordinates of the target position.
453 */
454 void setTarget(const SkyPoint &targetCoord);
455
456 /**
457 * @brief Set the coordinates that the mount reports as its position
458 * @param position current mount position
459 */
460 void setTelescopeCoordinates(const SkyPoint &position)
461 {
462 m_TelescopeCoord = position;
463 }
464
465 Q_SCRIPTABLE Q_NOREPLY void setTargetPositionAngle(double value);
466
467 /** DBUS interface function.
468 * Sets the binning of the selected CCD device.
469 * @param binIndex Index of binning value. Default values range from 0 (binning 1x1) to 3 (binning 4x4)
470 */
471 Q_SCRIPTABLE Q_NOREPLY void setBinningIndex(int binIndex);
472
473 /** @}*/
474
475 /**
476 * @brief Solver finished successfully, process the data and execute the required actions depending on the mode.
477 * @param orientation Orientation of image in degrees (East of North)
478 * @param ra Center RA in solved image, degrees.
479 * @param dec Center DEC in solved image, degrees.
480 * @param pixscale Image scale is arcsec/pixel
481 * @param eastToTheRight When the image is rotated, so that North is up, East would be to the right.
482 */
483 void solverFinished(double orientation, double ra, double dec, double pixscale, bool eastToTheRight);
484
485 void solverComplete();
486
487 /**
488 * @brief Process solver failure.
489 */
490 void solverFailed();
491
492 /**
493 * @brief We received new telescope info, process them and update FOV.
494 */
495 bool syncTelescopeInfo();
496
497 void setFocusStatus(Ekos::FocusState state);
498
499 // Log
500 void appendLogText(const QString &);
501
502 // Capture
503 void setCaptureComplete();
504
505 // Update Capture Module status
506 void setCaptureStatus(Ekos::CaptureState newState);
507 // Update Mount module status
508 void setMountStatus(ISD::Mount::Status newState);
509
510 void zoomAlignView();
511 void setAlignZoom(double scale);
512
513 // Manual Rotator Dialog
514 void toggleManualRotator(bool toggled);
515
516 /**
517 * @brief checkIfRotationRequired Check whether we need to perform an ALIGN_ROTATING action, whether manual or automatic.
518 * @return True if rotation is required as per the settings, false is not required.
519 */
521
522 // Settings
523 QVariantMap getAllSettings() const;
524 void setAllSettings(const QVariantMap &settings);
525
526 /**
527 * @brief settleSettings Run this function after timeout from debounce timer to update database
528 * and emit settingsChanged signal. This is required so we don't overload output.
529 */
530 void settleSettings();
531
532 // Trains
533 QString opticalTrain() const
534 {
535 return opticalTrainCombo->currentText();
536 }
537 void setOpticalTrain(const QString &value)
538 {
539 opticalTrainCombo->setCurrentText(value);
540 }
541
542 Ekos::OpsAlign *getAlignOptionsModule()
543 {
544 return opsAlign;
545 }
546
547 private slots:
548 // Solver timeout
549 void checkAlignmentTimeout();
550 void setAlignTableResult(AlignResult result);
551
552 // External View
553 void showFITSViewer();
554 void toggleAlignWidgetFullScreen();
555
556 /**
557 * @brief prepareCapture Set common settings for capture for align module
558 * @param targetChip target Chip
559 */
560 void prepareCapture(ISD::CameraChip *targetChip);
561
562 //Solutions Display slots
563 void buildTarget();
564 void handlePointTooltip(QMouseEvent *event);
565 void handleVerticalPlotSizeChange();
566 void handleHorizontalPlotSizeChange();
567 void selectSolutionTableRow(int row, int column);
568 void slotClearAllSolutionPoints();
569 void slotRemoveSolutionPoint();
570 void slotAutoScaleGraph();
571
572 // Model
573 void slotMountModel();
574
575 // Capture Timeout
576 void processCaptureTimeout();
577
578 protected slots:
579 /**
580 * @brief After a solver process is completed successfully, sync, slew to target, or do nothing as set by the user.
581 */
582 void executeGOTO();
583
584 /**
585 * @brief refreshAlignOptions is called when settings are updated in OpsAlign.
586 */
587 void refreshAlignOptions();
588
589 void processPAHStage(int stage);
590
591 signals:
592 void newLog(const QString &text);
593 void newStatus(Ekos::AlignState state);
594 void newPAAStage(int stage);
595 void newSolution(const QVariantMap &solution);
596
597 // This is sent when we load an image in the view
598 void newImage(const QSharedPointer<FITSView> &view);
599 // This is sent when the pixmap is updated within the view
600 void newFrame(const QSharedPointer<FITSView> &view);
601 // Send new solver results
602 void newSolverResults(double orientation, double ra, double dec, double pixscale);
603
604 // Train changed
605 void trainChanged();
606
607 // Settings
608 void settingsUpdated(const QVariantMap &settings);
609
610 // Manual Rotator
611 void manualRotatorChanged(double currentPA, double targetPA, double pixscale);
612
613 private:
614
615 void setupOpticalTrainManager();
616 void refreshOpticalTrain();
617
618 ////////////////////////////////////////////////////////////////////
619 /// Settings
620 ////////////////////////////////////////////////////////////////////
621
622 /**
623 * @brief Connect GUI elements to sync settings once updated.
624 */
625 void connectSettings();
626 /**
627 * @brief Stop updating settings when GUI elements are updated.
628 */
629 void disconnectSettings();
630 /**
631 * @brief loadSettings Load setting from Options and set them accordingly.
632 */
633 void loadGlobalSettings();
634
635 /**
636 * @brief syncSettings When checkboxes, comboboxes, or spin boxes are updated, save their values in the
637 * global and per-train settings.
638 */
639 void syncSettings();
640
641 /**
642 * @brief syncControl Sync setting to widget. The value depends on the widget type.
643 * @param settings Map of all settings
644 * @param key name of widget to sync
645 * @param widget pointer of widget to set
646 * @return True if sync successful, false otherwise
647 */
648 bool syncControl(const QVariantMap &settings, const QString &key, QWidget * widget);
649
650 void setState (AlignState value);
651 /**
652 * @brief Retrieve the align status indicator
653 */
654 QProgressIndicator *getProgressStatus();
655
656 /**
657 * @brief Stop the progress animation in the solution table
658 */
659 void stopProgressAnimation();
660
661 void exportSolutionPoints();
662
663 /**
664 * @brief Calculate Field of View of CCD+Telescope combination that we need to pass to astrometry.net solver.
665 */
666 void calculateFOV();
667
668 /**
669 * @brief calculateEffectiveFocalLength Calculate Focal Length purely form astrometric data.
670 */
671 void calculateEffectiveFocalLength(double newFOVW);
672
673 /**
674 * @brief calculateAlignTargetDiff Find the difference between aligned vs. target coordinates and update
675 * the GUI accordingly.
676 */
677 void calculateAlignTargetDiff();
678
679 /**
680 * @brief Get formatted RA & DEC coordinates compatible with astrometry.net format.
681 * @param ra Right ascension
682 * @param dec Declination
683 * @param ra_str will contain the formatted RA string
684 * @param dec_str will contain the formatted DEC string
685 */
686 void getFormattedCoords(double ra, double dec, QString &ra_str, QString &dec_str);
687
688 uint8_t getSolverDownsample(uint16_t binnedW);
689
690 /**
691 * @brief setWCSEnabled enables/disables World Coordinate System settings in the CCD driver.
692 * @param enable true to enable WCS, false to disable.
693 */
694 void setWCSEnabled(bool enable);
695
696 void resizeEvent(QResizeEvent *event) override;
697
698 KPageWidgetItem *m_IndexFilesPage;
699 QString savedOptionsProfiles;
700
701 /**
702 * @brief React when a mount motion has been detected
703 */
704 void handleMountMotion();
705
706 /**
707 * @brief Continue aligning according to the current mount status
708 */
709 void handleMountStatus();
710
711 /**
712 * @brief initPolarAlignmentAssistant Initialize Polar Alignment Asssistant Tool
713 */
714 void setupPolarAlignmentAssistant();
715
716 void setupRotatorControl();
717
718 /**
719 * @brief initManualRotator Initialize Manual Rotator Tool
720 */
721 void setupManualRotator();
722
723 /**
724 * @brief initDarkProcessor Initialize Dark Processor
725 */
726 void setuptDarkProcessor();
727
728 bool matchPAHStage(uint32_t stage);
729
730
731 // Effective FOV
732
733 /**
734 * @brief getEffectiveFOV Search database for effective FOV that matches the current profile and settings
735 * @return Variant Map containing effect FOV data or empty variant map if none found
736 */
737 QVariantMap getEffectiveFOV();
738 void saveNewEffectiveFOV(double newFOVW, double newFOVH);
739 QList<QVariantMap> effectiveFOVs;
740 void syncFOV();
741
742 // We are using calculated FOV now until a more accurate effective FOV is found.
743 bool m_EffectiveFOVPending { false };
744 /// Which chip should we invoke in the current CCD?
745 bool useGuideHead { false };
746 /// Can the mount sync its coordinates to those set by Ekos?
747 bool canSync { false };
748 // m_SolveFromFile is true we load an image and solve it, no capture is done.
749 bool m_SolveFromFile { false };
750 // Target Position Angle of solver Load&Slew image to be used for rotator if necessary
751 double m_TargetPositionAngle { std::numeric_limits<double>::quiet_NaN() };
752 // Target Pierside of solver Load&Slew image to be used
753 ISD::Mount::PierSide m_TargetPierside = ISD::Mount::PIER_UNKNOWN;
754 double currentRotatorPA { -1 };
755 /// Solver iterations count
756 uint8_t solverIterations { 0 };
757 /// Was solving with scale off used?
758 BlindState useBlindScale {BLIND_IDLE};
759 /// Was solving with position off used?
760 BlindState useBlindPosition {BLIND_IDLE};
761
762 // FOV
763 double m_CameraPixelWidth { -1 };
764 double m_CameraPixelHeight { -1 };
765 uint16_t m_CameraWidth { 0 };
766 uint16_t m_CameraHeight { 0 };
767
768 double m_FocalLength {-1};
769 double m_Aperture {-1};
770 double m_FocalRatio {-1};
771 double m_Reducer = {-1};
772
773 double m_FOVWidth { 0 };
774 double m_FOVHeight { 0 };
775 double m_FOVPixelScale { 0 };
776
777 // Keep raw rotator angle
778 double sRawAngle { INVALID_VALUE };
779 // Keep track of solver results
780 double sOrientation { INVALID_VALUE };
781 double sRA { INVALID_VALUE };
782 double sDEC { INVALID_VALUE };
783
784 /// Solver alignment coordinates
785 SkyPoint m_AlignCoord;
786 /// Target coordinates the mount will slew to
787 SkyPoint m_TargetCoord;
788 /// Final coordinates we want to reach in case of differential align
789 SkyPoint m_DestinationCoord;
790 /// Current telescope coordinates
791 SkyPoint m_TelescopeCoord;
792 /// Difference between solution and target coordinate
793 double m_TargetDiffTotal { 1e6 };
794 double m_TargetDiffRA { 1e6 };
795 double m_TargetDiffDE { 1e6 };
796
797 /// Progress icon if the solver is running
798 std::unique_ptr<QProgressIndicator> pi;
799
800 /// Keep track of how long the solver is running
801 QElapsedTimer solverTimer;
802
803 // The StellarSolver
804 std::unique_ptr<StellarSolver> m_StellarSolver;
805 // StellarSolver Profiles
806 QList<SSolver::Parameters> m_StellarSolverProfiles;
807
808 /// Have we slewed?
809 bool m_wasSlewStarted { false };
810 // Above flag only stays false for 10s after slew start.
811 QElapsedTimer slewStartTimer;
812 bool didSlewStart();
813 // Only wait this many milliseconds for slew to start.
814 // Otherwise assume it has begun.
815 static constexpr int MAX_WAIT_FOR_SLEW_START_MSEC = 10000;
816
817 // Online and Offline parsers
818 AstrometryParser* parser { nullptr };
819 std::unique_ptr<RemoteAstrometryParser> remoteParser;
820 QSharedPointer<ISD::GenericDevice> m_RemoteParserDevice;
821
822 // Pointers to our devices
823 ISD::Mount *m_Mount { nullptr };
824 ISD::Dome *m_Dome { nullptr };
825 ISD::Camera *m_Camera { nullptr };
826 ISD::Rotator *m_Rotator { nullptr };
827 ISD::FilterWheel *m_FilterWheel { nullptr };
828
829 int currentFilterPosition { -1 };
830 /// True if we need to change filter position and wait for result before continuing capture
831 bool filterPositionPending { false };
832
833 /// Keep track of solver FOV to be plotted in the skymap after each successful solve operation
834 std::shared_ptr<FOV> solverFOV;
835 std::shared_ptr<FOV> sensorFOV;
836
837 /// WCS
838 bool m_wcsSynced { false };
839
840 /// Log
841 QStringList m_LogText;
842
843 /// Issue counters
844 uint8_t m_CaptureTimeoutCounter { 0 };
845 uint8_t m_CaptureErrorCounter { 0 };
846 uint8_t m_SlewErrorCounter { 0 };
847 bool m_resetCaptureTimeoutCounter = false;
848
849 QTimer m_CaptureTimer;
850
851 // State
852 AlignState state { ALIGN_IDLE };
853 FocusState m_FocusState { FOCUS_IDLE };
854 CaptureState m_CaptureState { CAPTURE_IDLE };
855
856 // Track which upload mode the CCD is set to. If set to UPLOAD_LOCAL, then we need to switch it to UPLOAD_CLIENT in order to do focusing, and then switch it back to UPLOAD_LOCAL
857 ISD::Camera::UploadMode rememberUploadMode { ISD::Camera::UPLOAD_CLIENT };
858
859 GotoMode m_CurrentGotoMode;
860
861 QString dirPath;
862
863 // Timer
864 QTimer m_AlignTimer;
865 QTimer m_DebounceTimer;
866
867 // Align Frame
868 QSharedPointer<AlignView> m_AlignView;
869
870 // FITS Viewer in case user want to display in it instead of internal view
872
873 QUrl alignURL;
874 QUrl alignURLPath;
875
876 // keep track of autoWSC
877 bool rememberAutoWCS { false };
878 bool rememberSolverWCS { false };
879
880 // move rotator
881 bool RotatorGOTO { false };
882
883 // Align slew
884 bool targetAccuracyNotMet { false };
885
886 // Astrometry Options
887 OpsAstrometry *opsAstrometry { nullptr };
888 OpsAlign *opsAlign { nullptr };
889 OpsPrograms *opsPrograms { nullptr };
890 OpsAstrometryIndexFiles *opsAstrometryIndexFiles { nullptr };
891 OpsASTAP *opsASTAP { nullptr };
892 StellarSolverProfileEditor *optionsProfileEditor { nullptr };
893
894 // Drawing
895 QCPCurve *centralTarget { nullptr };
896 QCPCurve *yellowTarget { nullptr };
897 QCPCurve *redTarget { nullptr };
898 QCPCurve *concentricRings { nullptr };
899
900 // Telescope Settings
901 double m_EffectiveFocalLength = -1;
902 bool m_isRateSynced = false;
903 bool domeReady = true;
904
905 // CCD Exposure Looping
906 bool m_RememberCameraFastExposure = { false };
907
908 // Controls
909 double alignGainSpecialValue {INVALID_VALUE};
910 double TargetCustomGainValue {-1};
911
912 // Data
913 QSharedPointer<FITSData> m_ImageData;
914
915 // Active Profile
916 QSharedPointer<ProfileInfo> m_ActiveProfile;
917
918 // Threshold to notify settle time is 3 seconds
919 static constexpr uint16_t DELAY_THRESHOLD_NOTIFY { 3000 };
920
921 // Mount Model
922 // N.B. We do not need to use "smart pointer" here as the object memroy
923 // is taken care of by the Qt framework.
924 MountModel *m_MountModel {nullptr};
925 PolarAlignmentAssistant *m_PolarAlignmentAssistant {nullptr};
926 ManualRotator *m_ManualRotator {nullptr};
927
928 // Dark Processor
929 QPointer<DarkProcessor> m_DarkProcessor;
930
931 // Filter Manager
932 QSharedPointer<FilterManager> m_FilterManager;
933
934 // Rotator Control
935 QSharedPointer<RotatorSettings> m_RotatorControlPanel;
936 int m_RotatorTimeFrame = 0;
937 bool m_estimateRotatorTimeFrame = false;
938
939 // Settings
940 QVariantMap m_Settings;
941 QVariantMap m_GlobalSettings;
942
943 bool m_UsedScale = false;
944 bool m_UsedPosition = false;
945 double m_ScaleUsed = 0;
946 double m_RAUsed = 0;
947 double m_DECUsed = 0;
948};
949}
Align class handles plate-solving and polar alignment measurement and correction using astrometry....
Definition align.h:75
void Slew()
Slew the telescope to the solved alignment coordinate.
Definition align.cpp:2941
static QStringList generateRemoteOptions(const QVariantMap &optionsMap)
generateOptions Generate astrometry.net option given the supplied map
Definition align.cpp:1189
void checkCameraExposureProgress(ISD::CameraChip *targetChip, double remaining, IPState state)
checkCameraExposureProgress Track the progress of CCD exposure
Definition align.cpp:3274
QStringList generateRemoteArgs(const QSharedPointer< FITSData > &imageData)
Generate arguments we pass to the remote solver.
Definition align.cpp:1279
Q_SCRIPTABLE bool setFilter(const QString &filter)
DBUS interface function.
Definition align.cpp:3159
void syncCameraInfo()
CCD information is updated, sync them.
Definition align.cpp:857
bool setCamera(ISD::Camera *device)
Add Camera to the list of available Cameras.
Definition align.cpp:638
Q_SCRIPTABLE QList< double > cameraInfo()
DBUS interface function.
bool setDome(ISD::Dome *device)
Add new Dome.
Definition align.cpp:745
bool setMount(ISD::Mount *device)
Add new mount.
Definition align.cpp:688
Q_SCRIPTABLE int getLoadAndSlewStatus()
DBUS interface function.
Definition align.h:170
void syncCameraControls()
syncCCDControls Update camera controls like gain, offset, ISO..etc.
Definition align.cpp:908
void checkCamera()
Check CCD and make sure information is updated and FOV is re-calculated.
Definition align.cpp:600
Q_SCRIPTABLE Ekos::AlignState status()
DBUS interface function.
Definition align.h:162
bool isParserOK()
Does our parser exist in the system?
Definition align.cpp:526
Q_SCRIPTABLE QList< double > getSolutionResult()
DBUS interface function.
Definition align.cpp:2589
Q_SCRIPTABLE QList< double > telescopeInfo()
DBUS interface function.
QStringList getStellarSolverProfiles()
getStellarSolverProfiles
Definition align.cpp:3911
Q_SCRIPTABLE Q_NOREPLY void startSolving()
DBUS interface function.
Definition align.cpp:1811
void refreshAlignOptions()
refreshAlignOptions is called when settings are updated in OpsAlign.
Definition align.cpp:3471
void getFOVScale(double &fov_w, double &fov_h, double &fov_scale)
getFOVScale Returns calculated FOV values
Definition align.cpp:967
void executeGOTO()
After a solver process is completed successfully, sync, slew to target, or do nothing as set by the u...
Definition align.cpp:2901
bool loadAndSlew(const QByteArray &image, const QString &extension)
DBUS interface function.
Definition align.cpp:3072
void setAstrometryDevice(const QSharedPointer< ISD::GenericDevice > &device)
setAstrometryDevice
Definition align.cpp:3458
void solverFinished(double orientation, double ra, double dec, double pixscale, bool eastToTheRight)
Solver finished successfully, process the data and execute the required actions depending on the mode...
Definition align.cpp:2063
bool checkIfRotationRequired()
checkIfRotationRequired Check whether we need to perform an ALIGN_ROTATING action,...
Definition align.cpp:2424
Q_SCRIPTABLE QString camera()
DBUS interface function.
bool setFilterWheel(ISD::FilterWheel *device)
addFilterWheel Add new filter wheel filter device.
Definition align.cpp:3116
void Sync()
Sync the telescope to the solved alignment coordinate.
Definition align.cpp:2923
void checkFilter()
Check Filter and make sure information is updated accordingly.
Definition align.cpp:3176
void setRotator(ISD::Rotator *device)
Add new Rotator.
Definition align.cpp:3210
Q_SCRIPTABLE QString filterWheel()
DBUS interface function.
void processData(const QSharedPointer< FITSData > &data)
Process new FITS received from CCD.
Definition align.cpp:1690
void getCalculatedFOVScale(double &fov_w, double &fov_h, double &fov_scale)
getCalculatedFOVScale Get calculated FOV scales from the current CCD+Telescope combination.
Definition align.cpp:1001
Q_SCRIPTABLE Q_NOREPLY void setExposure(double value)
DBUS interface function.
Definition align.cpp:3096
void settleSettings()
settleSettings Run this function after timeout from debounce timer to update database and emit settin...
Definition align.cpp:4257
Q_SCRIPTABLE Q_NOREPLY void setSolverAction(int mode)
DBUS interface function.
Definition align.cpp:1805
bool syncTelescopeInfo()
We received new telescope info, process them and update FOV.
Definition align.cpp:814
void updateProperty(INDI::Property prop)
Process updated device properties.
Definition align.cpp:2614
void solverFailed()
Process solver failure.
Definition align.cpp:2343
void SlewToTarget()
Sync the telescope to the solved alignment coordinate, and then slew to the target coordinate.
Definition align.cpp:2970
Primary window to view monochrome and color FITS images.
Definition fitsviewer.h:50
A simple class encapsulating a Field-of-View symbol.
Definition fov.h:28
CameraChip class controls a particular chip in camera.
Camera class controls an INDI Camera device.
Definition indicamera.h:44
Class handles control of INDI dome devices.
Definition indidome.h:23
device handle controlling Mounts.
Definition indimount.h:27
Rotator class handles control of INDI Rotator devices.
Definition indirotator.h:20
A plottable representing a parametric curve in a plot.
The QProgressIndicator class lets an application display a progress indicator to show that a long tas...
The sky coordinates of a point in the sky.
Definition skypoint.h:45
This is a subclass of SkyObject.
Definition starobject.h:33
void setTarget(const SkyPoint &targetCoord)
Set the alignment target where the mount is expected to point at.
Definition align.cpp:3804
Q_SCRIPTABLE Q_NOREPLY void setSolverMode(int mode)
DBUS interface function.
Definition align.cpp:557
void stop(Ekos::AlignState mode)
Stop aligning.
Definition align.cpp:2503
void setTelescopeCoordinates(const SkyPoint &position)
Set the coordinates that the mount reports as its position.
Definition align.h:460
Q_SCRIPTABLE Q_NOREPLY void setTargetCoords(double ra0, double de0)
DBUS interface function.
Definition align.cpp:3795
Q_SCRIPTABLE Q_NOREPLY void setBinningIndex(int binIndex)
DBUS interface function.
Definition align.cpp:3101
Q_SCRIPTABLE bool captureAndSolve(bool initialCall=true)
DBUS interface function.
Definition align.cpp:1412
void suspend()
Suspend aligning, recovery handled by the align module itself.
Definition align.h:408
Q_SCRIPTABLE QList< double > getTargetCoords()
getTargetCoords QList of target coordinates.
Definition align.cpp:3811
Q_SCRIPTABLE Q_NOREPLY void abort()
DBUS interface function.
Definition align.h:400
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
AlignState
Definition ekos.h:145
@ ALIGN_ABORTED
Alignment aborted by user or agent.
Definition ekos.h:149
@ ALIGN_IDLE
No ongoing operations.
Definition ekos.h:146
@ ALIGN_SUSPENDED
Alignment operations suspended.
Definition ekos.h:155
CaptureState
Capture states.
Definition ekos.h:92
@ CAPTURE_IDLE
Definition ekos.h:93
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QString join(QChar separator) const const
virtual bool event(QEvent *event) override
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:48:25 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.