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

KDE's Doxygen guidelines are available online.