Kstars

focus.h
1/*
2 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ui_focus.h"
10#include "focusfourierpower.h"
11#include "ekos/ekos.h"
12#include "parameters.h"
13#include "ekos/auxiliary/filtermanager.h"
14
15#include "indi/indicamera.h"
16#include "indi/indifocuser.h"
17#include "indi/indistd.h"
18#include "indi/indiweather.h"
19#include "indi/indimount.h"
20
21#include "opsfocussettings.h"
22#include "opsfocusprocess.h"
23#include "opsfocusmechanics.h"
24#include "ui_cfz.h"
25#include "focusutils.h"
26
27class FocusProfilePlot;
28class FITSData;
29class FITSView;
30class FITSViewer;
31
32namespace Ekos
33{
34
35class DarkProcessor;
36class FocusAlgorithmInterface;
37class FocusFWHM;
38class PolynomialFit;
39class AdaptiveFocus;
40class FocusAdvisor;
41class StellarSolverProfileEditor;
42
43/**
44 * @class Focus
45 * @short Supports manual focusing and auto focusing using relative and absolute INDI focusers.
46 *
47 * @author Jasem Mutlaq
48 * @version 1.5
49 */
50class Focus : public QWidget, public Ui::Focus
51{
53 Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Focus")
54 Q_PROPERTY(Ekos::FocusState status READ status NOTIFY newStatus)
55 Q_PROPERTY(QStringList logText READ logText NOTIFY newLog)
56 Q_PROPERTY(QString opticalTrain READ opticalTrain WRITE setOpticalTrain)
57 Q_PROPERTY(QString camera READ camera)
58 Q_PROPERTY(QString focuser READ focuser)
59 Q_PROPERTY(QString filterWheel READ filterWheel)
60 Q_PROPERTY(QString filter READ filter WRITE setFilter)
61 Q_PROPERTY(double HFR READ getHFR NOTIFY newHFR)
62 Q_PROPERTY(double exposure READ exposure WRITE setExposure)
63
64 // AdaptiveFocus and FocusAdvisor are friend classes so they can access methods in Focus
65 friend class AdaptiveFocus;
66 friend class FocusAdvisor;
67
68 public:
69 Focus();
70 ~Focus();
71
72 typedef enum { FOCUS_NONE, FOCUS_IN, FOCUS_OUT } Direction;
73 typedef enum { FOCUS_MANUAL, FOCUS_AUTO } Type;
74 typedef enum { FOCUS_ITERATIVE, FOCUS_POLYNOMIAL, FOCUS_LINEAR, FOCUS_LINEAR1PASS } Algorithm;
75 typedef enum { FOCUS_CFZ_CLASSIC, FOCUS_CFZ_WAVEFRONT, FOCUS_CFZ_GOLD } CFZAlgorithm;
76 typedef enum { FOCUS_STAR_HFR, FOCUS_STAR_HFR_ADJ, FOCUS_STAR_FWHM, FOCUS_STAR_NUM_STARS, FOCUS_STAR_FOURIER_POWER } StarMeasure;
77 typedef enum { FOCUS_STAR_GAUSSIAN, FOCUS_STAR_MOFFAT } StarPSF;
78 typedef enum { FOCUS_UNITS_PIXEL, FOCUS_UNITS_ARCSEC } StarUnits;
79 typedef enum { FOCUS_WALK_CLASSIC, FOCUS_WALK_FIXED_STEPS, FOCUS_WALK_CFZ_SHUFFLE } FocusWalk;
80 typedef enum { FOCUS_MASK_NONE, FOCUS_MASK_RING, FOCUS_MASK_MOSAIC } ImageMaskType;
81
82 /** @defgroup FocusDBusInterface Ekos DBus Interface - Focus Module
83 * Ekos::Focus interface provides advanced scripting capabilities to perform manual and automatic focusing operations.
84 */
85
86 /*@{*/
87
88 /** DBUS interface function.
89 * select the CCD device from the available CCD drivers.
90 * @param device The CCD device name
91 * @return Returns true if CCD device is found and set, false otherwise.
92 */
93 Q_SCRIPTABLE QString camera();
94
95 /** DBUS interface function.
96 * select the focuser device from the available focuser drivers. The focuser device can be the same as the CCD driver if the focuser functionality was embedded within the driver.
97 * @param device The focuser device name
98 * @return Returns true if focuser device is found and set, false otherwise.
99 */
100 Q_SCRIPTABLE QString focuser();
101
102 /** DBUS interface function.
103 * 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.
104 * @param device The filter device name
105 * @return Returns true if filter device is found and set, false otherwise.
106 */
107 Q_SCRIPTABLE QString filterWheel();
108
109 /** DBUS interface function.
110 * select the filter from the available filters.
111 * @param filter The filter name
112 * @return Returns true if filter is found and set, false otherwise.
113 */
114 Q_SCRIPTABLE bool setFilter(const QString &filter);
115 Q_SCRIPTABLE QString filter();
116
117 /** DBUS interface function.
118 * @return Returns True if current focuser supports auto-focusing
119 */
120 Q_SCRIPTABLE bool canAutoFocus()
121 {
122 return (m_FocusType == FOCUS_AUTO);
123 }
124
125 /** DBUS interface function.
126 * @return Returns Half-Flux-Radius in pixels.
127 */
128 Q_SCRIPTABLE double getHFR()
129 {
130 return currentHFR;
131 }
132
133 /** DBUS interface function.
134 * Set CCD exposure value
135 * @param value exposure value in seconds.
136 */
137 Q_SCRIPTABLE Q_NOREPLY void setExposure(double value);
138 Q_SCRIPTABLE double exposure()
139 {
140 return focusExposure->value();
141 }
142
143 /** DBUS interface function.
144 * Set CCD binning
145 * @param binX horizontal binning
146 * @param binY vertical binning
147 */
148 Q_SCRIPTABLE Q_NOREPLY void setBinning(int binX, int binY);
149
150 /** DBUS interface function.
151 * Set Auto Focus options. The options must be set before starting the autofocus operation. If no options are set, the options loaded from the user configuration are used.
152 * @param enable If true, Ekos will attempt to automatically select the best focus star in the frame. If it fails to select a star, the user will be asked to select a star manually.
153 */
154 Q_SCRIPTABLE Q_NOREPLY void setAutoStarEnabled(bool enable);
155
156 /** DBUS interface function.
157 * Set Auto Focus options. The options must be set before starting the autofocus operation. If no options are set, the options loaded from the user configuration are used.
158 * @param enable if true, Ekos will capture a subframe around the selected focus star. The subframe size is determined by the boxSize parameter.
159 */
160 Q_SCRIPTABLE Q_NOREPLY void setAutoSubFrameEnabled(bool enable);
161
162 /** DBUS interface function.
163 * Set Autofocus parameters
164 * @param boxSize the box size around the focus star in pixels. The boxsize is used to subframe around the focus star.
165 * @param stepSize the initial step size to be commanded to the focuser. If the focuser is absolute, the step size is in ticks. For relative focusers, the focuser will be commanded to focus inward for stepSize milliseconds initially.
166 * @param maxTravel the maximum steps permitted before the autofocus operation aborts.
167 * @param tolerance Measure of how accurate the autofocus algorithm is. If the difference between the current HFR and minimum measured HFR is less than %tolerance after the focuser traversed both ends of the V-curve, then the focusing operation
168 * is deemed successful. Otherwise, the focusing operation will continue.
169 */
170 Q_SCRIPTABLE Q_NOREPLY void setAutoFocusParameters(int boxSize, int stepSize, int maxTravel, double tolerance);
171
172 /** DBUS interface function.
173 * resetFrame Resets the CCD frame to its full native resolution.
174 */
175 Q_SCRIPTABLE Q_NOREPLY void resetFrame();
176
177 /** DBUS interface function.
178 * Return state of Focuser module (Ekos::FocusState)
179 */
180
181 Q_SCRIPTABLE Ekos::FocusState status()
182 {
183 return m_state;
184 }
185
186 /** @}*/
187
188 /**
189 * @brief Add CCD to the list of available CCD.
190 * @param newCCD pointer to CCD device.
191 * @return True if added successfully, false if duplicate or failed to add.
192 */
193 bool setCamera(ISD::Camera *device);
194
195 /**
196 * @brief addFocuser Add focuser to the list of available focusers.
197 * @param newFocuser pointer to focuser device.
198 * @return True if added successfully, false if duplicate or failed to add.
199 */
200 bool setFocuser(ISD::Focuser *device);
201
202 /**
203 * @brief reconnectFocuser Add focuser to the list of available focusers.
204 * @param focuser name of the focuser.
205 */
206 void reconnectFocuser(const QString &focuser);
207
208 /**
209 * @brief addFilter Add filter to the list of available filters.
210 * @param newFilter pointer to filter device.
211 * @return True if added successfully, false if duplicate or failed to add.
212 */
213 bool setFilterWheel(ISD::FilterWheel *device);
214
215 /**
216 * @brief setImageMask Select the currently active image mask filtering
217 * the stars relevant for focusing
218 */
219 void selectImageMask();
220
221 /**
222 * @brief addTemperatureSource Add temperature source to the list of available sources.
223 * @param newSource Device with temperature reporting capability
224 * @return True if added successfully, false if duplicate or failed to add.
225 */
227
228 /**
229 * @brief removeDevice Remove device from Focus module
230 * @param deviceRemoved pointer to device
231 */
232 void removeDevice(const QSharedPointer<ISD::GenericDevice> &deviceRemoved);
233
234 const QSharedPointer<FilterManager> &filterManager() const
235 {
236 return m_FilterManager;
237 }
238 void setupFilterManager();
239 void connectFilterManager();
240
241 Q_SCRIPTABLE void clearLog();
242 QStringList logText()
243 {
244 return m_LogText;
245 }
246 QString getLogText()
247 {
248 return m_LogText.join("\n");
249 }
250
251 // Settings
252 QVariantMap getAllSettings() const;
253 void setAllSettings(const QVariantMap &settings);
254
255 public slots:
256
257 /** \addtogroup FocusDBusInterface
258 * @{
259 */
260
261 /* Focus */
262 /** DBUS interface function.
263 * Start the autofocus operation.
264 */
265 Q_SCRIPTABLE Q_NOREPLY void start();
266
267 /** DBUS interface function.
268 * Abort the autofocus operation.
269 */
270 Q_SCRIPTABLE Q_NOREPLY void abort();
271
272 /** DBUS interface function.
273 * Capture a focus frame.
274 * @param settleTime if > 0 wait for the given time in seconds before starting to capture
275 */
276 Q_SCRIPTABLE Q_NOREPLY void capture(double settleTime = 0.0);
277
278 /** DBUS interface function.
279 * Focus inward
280 * @param ms If set, focus inward for ms ticks (Absolute Focuser), or ms milliseconds (Relative Focuser). If not set, it will use the value specified in the options.
281 */
282 Q_SCRIPTABLE bool focusIn(int ms = -1);
283
284 /** DBUS interface function.
285 * Focus outward
286 * @param ms If set, focus outward for ms ticks (Absolute Focuser), or ms milliseconds (Relative Focuser). If not set, it will use the value specified in the options.
287 */
288 Q_SCRIPTABLE bool focusOut(int ms = -1);
289
290 /**
291 * @brief checkFocus Given the minimum required HFR, check focus and calculate HFR. If current HFR exceeds required HFR, start autofocus process, otherwise do nothing.
292 * @param requiredHFR Minimum HFR to trigger autofocus process.
293 */
294 Q_SCRIPTABLE Q_NOREPLY void checkFocus(double requiredHFR);
295
296 /** @}*/
297
298 /**
299 * @brief Run the autofocus process for the currently selected filter
300 * @param The reason Autofocus has been called.
301 */
302 void runAutoFocus(const AutofocusReason autofocusReason, const QString &reasonInfo);
303
304 /**
305 * @brief startFraming Begins continuous capture of the CCD and calculates HFR every frame.
306 */
307 void startFraming();
308
309 /**
310 * @brief Move the focuser to the initial focus position.
311 */
312 void resetFocuser();
313
314 /**
315 * @brief checkStopFocus Perform checks before stopping the autofocus operation. Some checks are necessary for in-sequence focusing.
316 * @param abort true iff focusing should be aborted, false if it should only be stopped and marked as failed
317 */
318 void checkStopFocus(bool abort);
319
320 /**
321 * @brief React when a meridian flip has been started
322 */
323 void meridianFlipStarted();
324
325 /**
326 * @brief Check CCD and make sure information is updated accordingly. This simply calls syncCameraInfo for the current CCD.
327 * @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.
328 * CCDNum is the index of the CCD in the dropdown menu.
329 */
330 void checkCamera();
331
332 /**
333 * @brief syncCameraInfo Read current CCD information and update settings accordingly.
334 */
335 void syncCameraInfo();
336
337 /**
338 * @brief Update camera controls like Gain, ISO, Offset...etc
339 */
340 void syncCCDControls();
341
342 /**
343 * @brief Check Focuser and make sure information is updated accordingly.
344 * @param FocuserNum By default, we check the already selected focuser in the dropdown menu. If FocuserNum is specified, the check is made against this specific focuser in the dropdown menu.
345 * FocuserNum is the index of the focuser in the dropdown menu.
346 */
347 void checkFocuser();
348
349 /**
350 * @brief Check Filter and make sure information is updated accordingly.
351 * @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.
352 * filterNum is the index of the filter in the dropdown menu.
353 */
354 void checkFilter();
355
356 /**
357 * @brief Check temperature source and make sure information is updated accordingly.
358 * @param name Name of temperature source, if empty then use current source.
359 */
360 void checkTemperatureSource(const QString &name = QString());
361
362 /**
363 * @brief clearDataPoints Remove all data points from HFR plots
364 */
365 void clearDataPoints();
366
367 /**
368 * @brief focusStarSelected The user selected a focus star, save its coordinates and subframe it if subframing is enabled.
369 * @param x X coordinate
370 * @param y Y coordinate
371 */
372 void focusStarSelected(int x, int y);
373
374 /**
375 * @brief selectFocusStarFraction Select the focus star based by fraction of the overall size.
376 * It calls focusStarSelected after multiplying the fractions (0.0 to 1.0) with the focus view width and height.
377 * @param x final x = x * focusview_width
378 * @param y final y = y * focusview_height
379 */
380 void selectFocusStarFraction(double x, double y);
381
382 /**
383 * @brief newFITS A new FITS blob is received by the CCD driver.
384 * @param bp pointer to blob data
385 */
386 void processData(const QSharedPointer<FITSData> &data);
387
388 /**
389 * @brief updateProperty Read focus number properties of interest as they arrive from the focuser driver and process them accordingly.
390 * @param prop INDI Property
391 */
392 void updateProperty(INDI::Property prop);
393
394 /**
395 * @brief processTemperatureSource Updates focus temperature source.
396 * @param nvp pointer to updated focuser number property.
397 */
398 void processTemperatureSource(INDI::Property prop);
399
400 /**
401 * @brief setFocusStatus Upon completion of the focusing process, set its status (fail or pass) and reset focus process to clean state.
402 * @param status If true, the focus process finished successfully. Otherwise, it failed.
403 */
404 //void setAutoFocusResult(bool status);
405
406 // Logging methods - one for INFO messages to the kstars log, and one for a CSV auto-focus log
407 void appendLogText(const QString &);
408 void appendFocusLogText(const QString &);
409
410 // Adjust focuser offset, relative or absolute
411 void adjustFocusOffset(int value, bool useAbsoluteOffset);
412
413 // Update Mount module status
414 void setMountStatus(ISD::Mount::Status newState);
415
416 // Update Altitude From Mount
417 void setMountCoords(const SkyPoint &position, ISD::Mount::PierSide pierSide, const dms &ha);
418
419 /**
420 * @brief toggleVideo Turn on and off video streaming if supported by the camera.
421 * @param enabled Set to true to start video streaming, false to stop it if active.
422 */
423 void toggleVideo(bool enabled);
424
425 /**
426 * @brief setWeatherData Updates weather data that could be used to extract focus temperature from observatory
427 * in case focus native temperature is not available.
428 */
429 //void setWeatherData(const std::vector<ISD::Weather::WeatherData> &data);
430
431 /**
432 * @brief loadOptionsProfiles Load StellarSolver Profile
433 */
435
436 /**
437 * @brief getStellarSolverProfiles
438 * @return list of StellarSolver profile names
439 */
441
442 QString opticalTrain() const
443 {
444 return opticalTrainCombo->currentText();
445 }
446 void setOpticalTrain(const QString &value)
447 {
448 opticalTrainCombo->setCurrentText(value);
449 }
450
451 /**
452 * @brief adaptiveFocus moves the focuser between subframes to stay at focus
453 */
454 void adaptiveFocus();
455
456 protected:
457 void addPlotPosition(int pos, double hfr, bool plot = true);
458
459 private slots:
460 /**
461 * @brief toggleSubframe Process enabling and disabling subfrag.
462 * @param enable If true, subframing is enabled. If false, subframing is disabled. Even if subframing is enabled, it must be supported by the CCD driver.
463 */
464 void toggleSubframe(bool enable);
465
466 void checkAutoStarTimeout();
467
468 void setAbsoluteFocusTicks();
469
470 void updateBoxSize(int value);
471
472 void processCaptureTimeout();
473
474 void processCaptureErrorDefault();
475 void processCaptureError(ISD::Camera::ErrorType type);
476
477 void setCaptureComplete();
478
479 void showFITSViewer();
480
481 void toggleFocusingWidgetFullScreen();
482
483 void setVideoStreamEnabled(bool enabled);
484
485 void starDetectionFinished();
486 void setCurrentMeasure();
487 void startAbIns();
488 void manualStart();
489
490 signals:
491 void newLog(const QString &text);
492 void newStatus(Ekos::FocusState state);
493 void newHFR(double hfr, int position, bool inAutofocus);
494 void newFocusTemperatureDelta(double delta, double absTemperature);
495
496 void absolutePositionChanged(int value);
497 void focusPositionAdjusted();
498 void focusAdaptiveComplete(bool success);
499
500 void trainChanged();
501
502 void suspendGuiding();
503 void resumeGuiding();
504 void newImage(const QSharedPointer<FITSView> &view);
505 void newStarPixmap(QPixmap &);
506 void settingsUpdated(const QVariantMap &settings);
507
508 // Signals for Analyze.
509 void autofocusStarting(double temperature, const QString &filter, AutofocusReason reason, const QString &reasonInfo);
510 void autofocusComplete(double temperature, const QString &filter, const QString &points, const bool useWeights,
511 const QString &curve = "", const QString &title = "");
512 void autofocusAborted(const QString &filter, const QString &points, const bool useWeights,
513 const AutofocusFailReason failCode, const QString &failCodeInfo);
514
515 // Focus Advisor
516 void newFocusAdvisorStage(int stage);
517 void newFocusAdvisorMessage(QString name);
518
519 /**
520 * @brief Signal Analyze that an Adaptive Focus iteration is complete
521 * @param Active filter
522 * @param temperature
523 * @param tempTicks is the number of ticks movement due to temperature change
524 * @param altitude
525 * @param altTicks is the number of ticks movement due to altitude change
526 * @param prevPosError is the position error at the previous adaptive focus iteration
527 * @param thisPosError is the position error for the current adaptive focus iteration
528 * @param totalTicks is the total tick movement for this adaptive focus iteration
529 * @param position is the current focuser position
530 * @param focuserMoved indicates whether totalTicks > minimum focuser movement
531 */
532 void adaptiveFocusComplete(const QString &filter, double temperature, double tempTicks, double altitude, double altTicks,
533 int prevPosError, int thisPosError, int totalTicks, int position, bool focuserMoved);
534
535 // HFR V curve plot events
536 /**
537 * @brief initialize the HFR V plot
538 * @param showPosition show focuser position (true) or count focus iterations (false)
539 * @param yAxisLabel is the label to display
540 * @param starUnits the units multiplier to display the pixel data
541 * @param minimum whether the curve shape is a minimum or maximum
542 * @param useWeights whether or not to display weights on the graph
543 * @param showPosition show focuser position (true) or show focusing iteration number (false)
544 */
545 void initHFRPlot(QString str, double starUnits, bool minimum, bool useWeights, bool showPosition);
546
547 /**
548 * @brief new HFR plot position with sigma
549 * @param pos focuser position with associated error (sigma)
550 * @param hfr measured star HFR value
551 * @param sigma is the standard deviation of star HFRs
552 * @param pulseDuration Pulse duration in ms for relative focusers that only support timers,
553 * or the number of ticks in a relative or absolute focuser
554 * */
555 void newHFRPlotPosition(double pos, double hfr, double sigma, bool outlier, int pulseDuration, bool plot = true);
556
557 /**
558 * @brief draw the approximating polynomial into the HFR V-graph
559 * @param poly pointer to the polynomial approximation
560 * @param isVShape has the solution a V shape?
561 * @param activate make the graph visible?
562 */
563 void drawPolynomial(PolynomialFit *poly, bool isVShape, bool activate, bool plot = true);
564
565 /**
566 * @brief draw the curve into the HFR V-graph
567 * @param poly pointer to the polynomial approximation
568 * @param isVShape has the solution a V shape?
569 * @param activate make the graph visible?
570 */
571 void drawCurve(CurveFitting *curve, bool isVShape, bool activate, bool plot = true);
572
573 /**
574 * @brief Focus solution with minimal HFR found
575 * @param solutionPosition focuser position
576 * @param solutionValue HFR value
577 */
578 void minimumFound(double solutionPosition, double solutionValue, bool plot = true);
579
580 /**
581 * @brief Draw Critical Focus Zone on graph
582 * @param solutionPosition focuser position
583 * @param solutionValue HFR value
584 * @param m_cfzSteps the size of the CFZ
585 * @param plt - whether to plot the CFZ
586 */
587 void drawCFZ(double minPosition, double minValue, int m_cfzSteps, bool plt);
588
589 /**
590 * @brief redraw the entire HFR plot
591 * @param poly pointer to the polynomial approximation
592 * @param solutionPosition solution focuser position
593 * @param solutionValue solution HFR value
594 */
595 void redrawHFRPlot(PolynomialFit *poly, double solutionPosition, double solutionValue);
596
597 /**
598 * @brief draw a title on the focus plot
599 * @param title the title
600 */
601 void setTitle(const QString &title, bool plot = true);
602
603 /**
604 * @brief final updates after focus run comopletes on the focus plot
605 * @param title
606 * @param plot
607 */
608 void finalUpdates(const QString &title, bool plot = true);
609
610 /**
611 * @brief focuserTimedout responding to requests
612 * @param focuser
613 */
614 void focuserTimedout(const QString &focuser);
615
616 private:
617
618 QList<SSolver::Parameters> m_StellarSolverProfiles;
619 QString savedOptionsProfiles;
620 StellarSolverProfileEditor *optionsProfileEditor { nullptr };
621
622 // Connections
623 void initConnections();
624
625 // Settings
626
627 /**
628 * @brief Connect GUI elements to sync settings once updated.
629 */
630 void connectSyncSettings();
631 /**
632 * @brief Stop updating settings when GUI elements are updated.
633 */
634 void disconnectSyncSettings();
635 /**
636 * @brief loadSettings Load setting from Options and set them accordingly.
637 */
638 void loadGlobalSettings();
639
640 /**
641 * @brief checkMosaicMaskLimits Check if the maximum values configured
642 * for the aberration style mosaic tile sizes fit into the CCD frame size.
643 */
644 void checkMosaicMaskLimits();
645
646 /**
647 * @brief syncSettings When checkboxes, comboboxes, or spin boxes are updated, save their values in the
648 * global and per-train settings.
649 */
650 void syncSettings();
651
652 /**
653 * @brief syncControl Sync setting to widget. The value depends on the widget type.
654 * @param settings Map of all settings
655 * @param key name of widget to sync
656 * @param widget pointer of widget to set
657 * @return True if sync successful, false otherwise
658 */
659 bool syncControl(const QVariantMap &settings, const QString &key, QWidget * widget);
660
661 /**
662 * @brief settleSettings Run this function after timeout from debounce timer to update database
663 * and emit settingsChanged signal. This is required so we don't overload output.
664 */
665 void settleSettings();
666
667 /**
668 * @brief prepareGUI Perform once only GUI prep processing
669 */
670 void prepareGUI();
671
672 /**
673 * @brief setUseWeights sets the useWeights checkbox
674 */
675 void setUseWeights();
676
677 /**
678 * @brief setDonutBuster sets the donutBuster checkbox
679 */
680 void setDonutBuster();
681
682 /**
683 * @brief setScanForStartPos sets the scanForStartPos checkbox
684 */
685 void setScanForStartPos();
686
687 /**
688 * @brief addMissingStellarSolverProfiles
689 * @param profile to add
690 * @param profilePath file pathname
691 */
692 void addMissingStellarSolverProfile(const QString profilesPath, const QString profile);
693
694 /**
695 * @brief Perform the processing to abort an in-flight focus procedure
696 */
697 void processAbort();
698
699 // HFR Plot
700 void initPlots();
701
702 // Positions
703 void getAbsFocusPosition();
704 bool autoFocusChecks();
705 void autoFocusAbs();
706 void autoFocusLinear();
707 void autoFocusRel();
708
709 // Linear does plotting differently from the rest.
710 void plotLinearFocus();
711
712 // Linear final updates to the curve
713 void plotLinearFinalUpdates();
714
715 // Launch the Aberation Inspector popup
716 void startAberrationInspector();
717
718 // Get the curve fitting goal based on how the algorithm is progressing
719 CurveFitting::FittingGoal getGoal(int numSteps);
720
721 /** @brief Helper function determining whether the focuser behaves like a position
722 * based one (vs. a timer based)
723 */
724 bool isPositionBased()
725 {
726 return (canAbsMove || canRelMove || (m_FocusAlgorithm == FOCUS_LINEAR) || (m_FocusAlgorithm == FOCUS_LINEAR1PASS));
727 }
728 void resetButtons();
729
730 /**
731 * @brief returns whether the Aberration Inspector can be used or not
732 * @return can / cant be started
733 */
734 bool canAbInsStart();
735 void stop(FocusState completionState = FOCUS_ABORTED);
736
737 void initView();
738
739 /** @brief Sets the plot vectors for Analyze after Autofocus. Used by Linear and Linear1Pass
740 */
741 void updatePlotPosition();
742
743 /** @brief Build the data string to send to Analyze
744 */
745 QString getAnalyzeData();
746
747 /**
748 * @brief prepareCapture Set common settings for capture for focus module
749 * @param targetChip target Chip
750 */
751 void prepareCapture(ISD::CameraChip *targetChip);
752
753 // HFR / FWHM
754 void setHFRComplete();
755
756 // Sets the star algorithm and enables/disables various UI inputs.
757 void setFocusDetection(StarAlgorithm starAlgorithm);
758
759 // Sets the algorithm and enables/disables various UI inputs.
760 void setFocusAlgorithm(Algorithm algorithm);
761
762 void setCurveFit(CurveFitting::CurveFit curvefit);
763
764 void setStarMeasure(StarMeasure starMeasure);
765 void setStarPSF(StarPSF starPSF);
766 void setStarUnits(StarUnits starUnits);
767 void setWalk(FocusWalk focusWalk);
768 double calculateStarWeight(const bool useWeights, const std::vector<double> values);
769 bool boxOverlap(const QPair<int, int> b1Start, const QPair<int, int> b1End, const QPair<int, int> b2Start,
770 const QPair<int, int> b2End);
771 double getStarUnits(const StarMeasure starMeasure, const StarUnits starUnits);
772 // Calculate the CFZ of the current focus camera
773 double calcCameraCFZ();
774
775 // Calculate the CFZ from the screen parameters
776 void calcCFZ();
777
778 // Static data for filter's midpoint wavelength changed so update CFZ
779 void wavelengthChanged();
780
781 // Reset the CFZ parameters from the current Optical Train
782 void resetCFZToOT();
783
784 // Move the focuser in (negative) or out (positive amount).
785 bool changeFocus(int amount, bool updateDir = true);
786
787 // Start up capture, or occasionally move focuser again, after current focus-move accomplished.
788 void autoFocusProcessPositionChange(IPState state);
789
790 // For the Linear algorithm, which always scans in (from higher position to lower position)
791 // if we notice the new position is higher than the current position (that is, it is the start
792 // of a new scan), we adjust the new position to be several steps further out than requested
793 // and set focuserAdditionalMovement to the extra motion, so that after this motion completes
794 // we will then scan back in (back to the originally requested position). This "overscan dance" is done
795 // to reduce backlash on such movement changes and so that we've always focused in before capture.
796 int adjustLinearPosition(int position, int newPosition, int overscan, bool updateDir);
797
798 // Process the image to get star FWHMs
799 void getFWHM(const QList<Edge *> &stars, double *FWHM, double *weight);
800
801 // Process the image to get the Fourier Transform Power
802 // If tile = -1 use the whole image; if mosaicTile is specified use just that
803 void getFourierPower(double *fourierPower, double *weight, const int mosaicTile = -1);
804
805 /**
806 * @brief syncTrackingBoxPosition Sync the tracking box to the current selected star center
807 */
808 void syncTrackingBoxPosition();
809
810 /** @internal Search for stars using the method currently configured, and return the consolidated HFR.
811 * @param image_data is the FITS frame to work with.
812 * @return the HFR of the star or field of stars in the frame, depending on the consolidation method, or -1 if it cannot be estimated.
813 */
814 void analyzeSources();
815
816 /** @internal Add a new star measure (HFR, FWHM, etc) for the current focuser position.
817 * @param newMeasure is the new measure (e.g. HFR, FWHM, etc) to consider for the current focuser position.
818 * @return true if a new sample is required, else false.
819 */
820 bool appendMeasure(double newMeasure);
821
822 /**
823 * @brief completeAutofocusProcedure finishes off autofocus and emits a message for other modules.
824 */
825 void completeFocusProcedure(FocusState completionState, AutofocusFailReason failCode, QString failCodeInfo = "", bool plot = true);
826
827 /**
828 * @brief activities to be executed after the configured settling time
829 * @param completionState state the focuser completed with
830 * @param autoFocusUsed is autofocus running?
831 * @param buildOffsetsUsed is autofocus running as a result of build offsets
832 * @param failCode is the reason for the Autofocus failure
833 * @param failCodeInfo contains extra info about failCode
834 */
835 void settle(const FocusState completionState, const bool autoFocusUsed,
836 const bool buildOffsetsUsed, const AutofocusFailReason failCode, const QString failCodeInfo);
837
838 void setLastFocusTemperature();
839 void setLastFocusAlt();
840 bool findTemperatureElement(const QSharedPointer<ISD::GenericDevice> &device);
841
842 /**
843 * @brief reset Adaptive Focus parameters
844 * @param Adaptive Focus enabled
845 */
846 void resetAdaptiveFocus(bool enabled);
847
848 void setupOpticalTrainManager();
849 void refreshOpticalTrain();
850
851 /**
852 * @brief set member valiables for the scope attached to the current Optical Train
853 * @param Optical Train scope parameters
854 * @param Optical Train reducer
855 */
856 void setScopeDetails(const QJsonObject &scope, const double reducer);
857
858 /**
859 * @brief handleFocusMotionTimeout When focuser is command to go to a target position, we expect to receive a notification
860 * that it arrived at the desired destination. If not, we command it again.
861 */
862 void handleFocusMotionTimeout();
863
864 /**
865 * @brief returns axis label based on measure selected
866 * @param starMeasure the star measure beuing used
867 */
868 QString getyAxisLabel(StarMeasure starMeasure);
869
870 /**
871 * @brief disable input widgets at the start of an AF run
872 * @param the widget to disable
873 * @param whether to disable at the widget level or disable all the children
874 */
875 void AFDisable(QWidget * widget, const bool children);
876
877 /**
878 * @brief returns whether the Gain input field is enabled outside of autofocus and
879 * whether logically is should be enabled during AF even though all input widgets are disabled
880 */
881 bool isFocusGainEnabled();
882
883 /**
884 * @brief returns whether the ISO input field is enabled outside of autofocus and
885 * whether logically is should be enabled during AF even though all input widgets are disabled
886 */
887 bool isFocusISOEnabled();
888
889 /**
890 * @brief returns whether the SubFrame input field is enabled outside of autofocus and
891 * whether logically is should be enabled during AF even though all input widgets are disabled
892 */
893 bool isFocusSubFrameEnabled();
894
895 /**
896 * @brief Save the focus frame for later dubugging
897 */
898 void saveFocusFrame();
899
900 /**
901 * @brief Initialise donut processing
902 */
903 void initDonutProcessing();
904
905 /**
906 * @brief Setup Linear Focuser
907 * @param initialPosition of the focuser
908 */
909 void setupLinearFocuser(int initialPosition);
910
911 /**
912 * @brief Initialise the Scan Start Position algorithm
913 * @param force Scan Start Pos
914 * @param startPosition
915 * @return whether Scan for Start Position was initiated
916 */
917 bool initScanStartPos(const bool force, const int initialPosition);
918
919 /**
920 * @brief Process the scan for the Autofocus starting position
921 */
922 void scanStartPos();
923
924 /**
925 * @brief Reset donut processing
926 */
927 void resetDonutProcessing();
928
929 /**
930 * @brief Adjust Autofocus capture exposure based on user settings when using Donut Buster
931 */
932 void donutTimeDilation();
933
934 /// Focuser device needed for focus operation
935 ISD::Focuser *m_Focuser { nullptr };
936 /// CCD device needed for focus operation
937 ISD::Camera *m_Camera { nullptr };
938 /// Optional device filter
939 ISD::FilterWheel *m_FilterWheel { nullptr };
940 /// Optional temperature source element
941 INumber *currentTemperatureSourceElement {nullptr};
942
943 /// Current filter position
944 int currentFilterPosition { -1 };
945 int fallbackFilterPosition { -1 };
946 /// True if we need to change filter position and wait for result before continuing capture
947 bool filterPositionPending { false };
948 bool fallbackFilterPending { false };
949
950 /// They're generic GDInterface because they could be either ISD::Camera or ISD::FilterWheel or ISD::Weather
951 QList<QSharedPointer<ISD::GenericDevice>> m_TemperatureSources;
952
953 /// Last Focus direction. Used by Iterative and Polynomial. NOTE: this does not take account of overscan
954 /// so, e.g. an outward move will always by FOCUS_OUT even though overscan will move back in
955 Direction m_LastFocusDirection { FOCUS_NONE };
956 /// Keep track of the last requested steps
957 uint32_t m_LastFocusSteps {0};
958 /// What type of focusing are we doing right now?
959 Type m_FocusType { FOCUS_MANUAL };
960 /// Focus HFR & Centeroid algorithms
961 StarAlgorithm m_FocusDetection { ALGORITHM_SEP };
962 /// Focus Process Algorithm
963 Algorithm m_FocusAlgorithm { FOCUS_LINEAR1PASS };
964 /// Curve fit
965 CurveFitting::CurveFit m_CurveFit { CurveFitting::FOCUS_HYPERBOLA };
966 /// Star measure to use
967 StarMeasure m_StarMeasure { FOCUS_STAR_HFR };
968 /// PSF to use
969 StarPSF m_StarPSF { FOCUS_STAR_GAUSSIAN };
970 /// Units to use when displaying HFR or FWHM
971 StarUnits m_StarUnits { FOCUS_UNITS_PIXEL };
972 /// Units to use when displaying HFR or FWHM
973 FocusWalk m_FocusWalk { FOCUS_WALK_FIXED_STEPS };
974 /// Are we minimising or maximising?
975 CurveFitting::OptimisationDirection m_OptDir { CurveFitting::OPTIMISATION_MINIMISE };
976 /// The type of statistics to use
977 Mathematics::RobustStatistics::ScaleCalculation m_ScaleCalc { Mathematics::RobustStatistics::SCALE_VARIANCE };
978
979 /******************************************
980 * "Measure" variables, HFR, FWHM, numStars
981 ******************************************/
982
983 /// Current HFR value just fetched from FITS file
984 double currentHFR { INVALID_STAR_MEASURE };
985 double currentFWHM { INVALID_STAR_MEASURE };
986 double currentNumStars { INVALID_STAR_MEASURE };
987 double currentFourierPower { INVALID_STAR_MEASURE };
988 double currentMeasure { INVALID_STAR_MEASURE };
989 double currentWeight { 0 };
990 /// Last HFR value recorded
991 double lastHFR { 0 };
992 /// If (currentHFR > deltaHFR) we start the autofocus process.
993 double minimumRequiredHFR { INVALID_STAR_MEASURE };
994 /// Maximum HFR recorded
995 double maxHFR { 1 };
996 /// Is HFR increasing? We're going away from the sweet spot! If HFRInc=1, we re-capture just to make sure HFR calculations are correct, if HFRInc > 1, we switch directions
997 int HFRInc { 0 };
998 /// If HFR decreasing? Well, good job. Once HFR start decreasing, we can start calculating HFR slope and estimating our next move.
999 int HFRDec { 0 };
1000
1001 /****************************
1002 * Absolute position focusers
1003 ****************************/
1004 /// Absolute focus position
1005 int currentPosition { 0 };
1006 /// Motion state of the absolute focuser
1007 IPState currentPositionState {IPS_IDLE};
1008 /// What was our position before we started the focus process?
1009 int initialFocuserAbsPosition { -1 };
1010 /// Pulse duration in ms for relative focusers that only support timers, or the number of ticks in a relative or absolute focuser
1011 int pulseDuration { 1000 };
1012 /// Does the focuser support absolute motion?
1013 bool canAbsMove { false };
1014 /// Does the focuser support relative motion?
1015 bool canRelMove { false };
1016 /// Does the focuser support timer-based motion?
1017 bool canTimerMove { false };
1018 /// Maximum range of motion for our lovely absolute focuser
1019 double absMotionMax { 0 };
1020 /// Minimum range of motion for our lovely absolute focuser
1021 double absMotionMin { 0 };
1022 /// How many iterations have we completed now in our absolute autofocus algorithm? We can't go forever
1023 int absIterations { 0 };
1024 /// Current image mask
1025 ImageMaskType m_currentImageMask = FOCUS_MASK_NONE;
1026
1027 /****************************
1028 * Misc. variables
1029 ****************************/
1030
1031 /// Are we tring to abort Autofocus?
1032 bool m_abortInProgress { false };
1033 /// Are we in the process of capturing an image?
1034 bool m_captureInProgress { false };
1035 /// Are we in the process of star detection?
1036 bool m_starDetectInProgress { false };
1037 // Was the frame modified by us? Better keep track since we need to return it to its previous state once we are done with the focus operation.
1038 //bool frameModified;
1039 /// Was the modified frame subFramed?
1040 bool subFramed { false };
1041 /// If the autofocus process fails, let's not ruin the capture session probably taking place in the next tab. Instead, we should restart it and try again, but we keep count until we hit MAXIMUM_RESET_ITERATIONS
1042 /// and then we truly give up.
1043 int resetFocusIteration { 0 };
1044 /// Which filter must we use once the autofocus process kicks in?
1045 int lockedFilterIndex { -1 };
1046 /// Keep track of what we're doing right now
1047 bool inAutoFocus { false };
1048 bool inFocusLoop { false };
1049 bool inScanStartPos { false };
1050 //bool inSequenceFocus { false };
1051 /// Keep track of request to retry or abort an AutoFocus run after focus position has been reset
1052 /// RESTART_NONE = normal operation, no restart
1053 /// RESTART_NOW = restart the autofocus routine
1054 /// RESTART_ABORT = when autofocus has been tried MAXIMUM_RESET_ITERATIONS times, abort the routine
1055 typedef enum { RESTART_NONE = 0, RESTART_NOW, RESTART_ABORT } FocusRestartState;
1056 FocusRestartState m_RestartState { RESTART_NONE };
1057 /// Did we reverse direction?
1058 bool reverseDir { false };
1059 /// Did the user or the auto selection process finish selecting our focus star?
1060 bool starSelected { false };
1061 /// Adjust the focus position to a target value
1062 bool inAdjustFocus { false };
1063 /// Build offsets is a special case of the Autofocus run
1064 bool inBuildOffsets { false };
1065 // Target frame dimensions
1066 //int fx,fy,fw,fh;
1067 /// If HFR=-1 which means no stars detected, we need to decide how many times should the re-capture process take place before we give up or reverse direction.
1068 int noStarCount { 0 };
1069 /// 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
1070 ISD::Camera::UploadMode rememberUploadMode { ISD::Camera::UPLOAD_CLIENT };
1071 /// Star measure (e.g. HFR, FWHM, etc) values for captured frames before averages
1072 QVector<double> starMeasureFrames;
1073 // Camera Fast Exposure
1074 bool m_RememberCameraFastExposure = { false };
1075 // Future Watch
1076 QFutureWatcher<bool> m_StarFinderWatcher;
1077 // R2 as a measure of how well the curve fits the datapoints. Passed to the V-curve graph for display
1078 double R2 = 0;
1079 // Counter to retry the auto focus run if the R2Limit has not been reached
1080 int R2Retries = 0;
1081 // Counter to retry starting focus operation (autofocus, adjust focus, etc) if the focuser is still active
1082 int m_StartRetries = 0;
1083 // Reason code for the Autofocus run - passed to Analyze
1084 AutofocusReason m_AutofocusReason = AutofocusReason::FOCUS_NONE;
1085 // Extra information about m_AutofocusReason
1086 QString m_AutofocusReasonInfo;
1087 // Autofocus run number - to help with debugging logs
1088 int m_AFRun = 0;
1089 // Rerun flag indicating a rerun due to AF failing
1090 bool m_AFRerun = false;
1091
1092 /// Autofocus log file info.
1093 QStringList m_LogText;
1094 QFile m_FocusLogFile;
1095 QString m_FocusLogFileName;
1096 bool m_FocusLogEnabled { false };
1097
1098 ITextVectorProperty *filterName { nullptr };
1099 INumberVectorProperty *filterSlot { nullptr };
1100
1101 // Holds the superset of text values in combo-boxes that can have restricted options
1102 QStringList m_StarMeasureText;
1103 QStringList m_CurveFitText;
1104 QStringList m_FocusWalkText;
1105
1106 // Holds the enabled state of widgets that is used to active functionality in focus
1107 // during Autofocus when the input interface is disabled
1108 bool m_FocusGainAFEnabled { false };
1109 bool m_FocusISOAFEnabled { false };
1110 bool m_FocusSubFrameAFEnabled { false };
1111
1112 /****************************
1113 * Plot variables
1114 ****************************/
1115
1116 /// Plot minimum positions
1117 double minPos { 1e6 };
1118 /// Plot maximum positions
1119 double maxPos { 0 };
1120 /// V curve plot points
1121 QVector<double> plot_position, plot_value, plot_weight;
1122 QVector<bool> plot_outlier;
1123 bool isVShapeSolution = false;
1124
1125 /// State
1126 FocusState m_state { Ekos::FOCUS_IDLE };
1127 FocusState state() const
1128 {
1129 return m_state;
1130 }
1131 void setState(FocusState newState);
1132
1133 /// CCD Chip frame settings
1135
1136 /// Selected star coordinates
1137 QVector3D starCenter;
1138
1139 // Remember last star center coordinates in case of timeout in manual select mode
1140 QVector3D rememberStarCenter;
1141
1142 /// Focus Frame
1143 QSharedPointer<FITSView> m_FocusView;
1144
1145 /// Star Select Timer
1146 QTimer waitStarSelectTimer;
1147
1148 /// FITS Viewer in case user want to display in it instead of internal view
1150
1151 /// Track star position and HFR to know if we're detecting bogus stars due to detection algorithm false positive results
1152 QVector<QVector3D> starsHFR;
1153
1154 /// Relative Profile
1155 FocusProfilePlot *profilePlot { nullptr };
1156 QDialog *profileDialog { nullptr };
1157
1158 /// Polynomial fitting.
1159 std::unique_ptr<PolynomialFit> polynomialFit;
1160
1161 // Curve fitting for focuser movement.
1162 std::unique_ptr<CurveFitting> curveFitting;
1163
1164 // Curve fitting for stars.
1165 std::unique_ptr<CurveFitting> starFitting;
1166
1167 // FWHM processing.
1168 std::unique_ptr<FocusFWHM> focusFWHM;
1169
1170 // Fourier Transform power processing.
1171 std::unique_ptr<FocusFourierPower> focusFourierPower;
1172
1173 // Adaptive Focus processing.
1174 std::unique_ptr<AdaptiveFocus> adaptFocus;
1175
1176 // Focus Advisor processing.
1177 std::unique_ptr<FocusAdvisor> focusAdvisor;
1178
1179 // Capture timers
1180 QTimer captureTimer;
1181 QTimer captureTimeout;
1182 uint8_t captureTimeoutCounter { 0 };
1183 uint8_t m_MissingCameraCounter { 0 };
1184 uint8_t captureFailureCounter { 0 };
1185
1186 // Gain Control
1187 double GainSpinSpecialValue { INVALID_VALUE };
1188
1189 // Focus motion timer.
1190 QTimer m_FocusMotionTimer;
1191 uint8_t m_FocusMotionTimerCounter { 0 };
1192
1193 // Focuser reconnect counter
1194 uint8_t m_FocuserReconnectCounter { 0 };
1195
1196 // Set m_DebugFocuser = true to simulate a focuser failure
1197 bool m_DebugFocuser { false };
1198 uint16_t m_DebugFocuserCounter { 0 };
1199
1200 // Guide Suspend
1201 bool m_GuidingSuspended { false };
1202
1203 // Data
1204 QSharedPointer<FITSData> m_ImageData;
1205
1206 // Linear focuser.
1207 std::unique_ptr<FocusAlgorithmInterface> linearFocuser;
1208 int focuserAdditionalMovement { 0 };
1209 bool focuserAdditionalMovementUpdateDir { true };
1210 int linearRequestedPosition { 0 };
1211
1212 bool hasDeviation { false };
1213
1214 //double observatoryTemperature { INVALID_VALUE };
1215 double m_LastSourceAutofocusTemperature { INVALID_VALUE };
1216 QSharedPointer<ISD::GenericDevice> m_LastSourceDeviceAutofocusTemperature;
1217 //TemperatureSource lastFocusTemperatureSource { NO_TEMPERATURE };
1218 double m_LastSourceAutofocusAlt { INVALID_VALUE };
1219
1220 // Mount altitude value for logging
1221 double mountAlt { INVALID_VALUE };
1222
1223 static constexpr uint8_t MAXIMUM_FLUCTUATIONS {10};
1224
1225 QVariantMap m_Settings;
1226 QVariantMap m_GlobalSettings;
1227
1228 // Dark Processor
1229 QPointer<DarkProcessor> m_DarkProcessor;
1230
1231 QSharedPointer<FilterManager> m_FilterManager;
1232
1233 // Maintain a list of disabled widgets when Autofocus is running that can be restored at the end of the run
1234 QVector <QWidget *> disabledWidgets;
1235
1236 // Scope parameters of the active optical train
1237 double m_Aperture = 0.0f;
1238 double m_FocalLength = 0.0f;
1239 double m_FocalRatio = 0.0f;
1240 double m_Reducer = 0.0f;
1241 double m_CcdPixelSizeX = 0.0f;
1242 int m_CcdWidth = 0;
1243 int m_CcdHeight = 0;
1244 QString m_ScopeType;
1245
1246 // Settings popup
1247 //std::unique_ptr<Ui::Settings> m_SettingsUI;
1248 //QPointer<QDialog> m_SettingsDialog;
1249 OpsFocusSettings *m_OpsFocusSettings { nullptr };
1250
1251 // Process popup
1252 //std::unique_ptr<Ui::Process> m_ProcessUI;
1253 //QPointer<QDialog> m_ProcessDialog;
1254 OpsFocusProcess *m_OpsFocusProcess { nullptr };
1255
1256 // Mechanics popup
1257 //std::unique_ptr<Ui::Mechanics> m_MechanicsUI;
1258 //QPointer<QDialog> m_MechanicsDialog;
1259 OpsFocusMechanics *m_OpsFocusMechanics { nullptr };
1260
1261 // CFZ popup
1262 std::unique_ptr<Ui::focusCFZDialog> m_CFZUI;
1263 QPointer<QDialog> m_CFZDialog;
1264
1265 // CFZ
1266 double m_cfzSteps = 0.0f;
1267
1268 // Aberration Inspector
1269 void calculateAbInsData();
1270 bool m_abInsOn = false;
1271 int m_abInsRun = 0;
1272 QVector<int> m_abInsPosition;
1273 QVector<QVector<double>> m_abInsMeasure;
1274 QVector<QVector<double>> m_abInsWeight;
1275 QVector<QVector<int>> m_abInsNumStars;
1276 QVector<QPoint> m_abInsTileCenterOffset;
1277
1278 QTimer m_DebounceTimer;
1279
1280 // Donut Buster
1281 double m_donutOrigExposure = 0.0;
1282 QVector<int> m_scanPosition;
1283 QVector<double> m_scanMeasure;
1284 QString m_AFfilter = NULL_FILTER;
1285};
1286
1287}
Supports manual focusing and auto focusing using relative and absolute INDI focusers.
Definition focus.h:51
void drawPolynomial(PolynomialFit *poly, bool isVShape, bool activate, bool plot=true)
draw the approximating polynomial into the HFR V-graph
void toggleVideo(bool enabled)
toggleVideo Turn on and off video streaming if supported by the camera.
Definition focus.cpp:5334
void checkTemperatureSource(const QString &name=QString())
Check temperature source and make sure information is updated accordingly.
Definition focus.cpp:567
Q_SCRIPTABLE bool setFilter(const QString &filter)
DBUS interface function.
Definition focus.cpp:654
void startFraming()
startFraming Begins continuous capture of the CCD and calculates HFR every frame.
Definition focus.cpp:4454
void newHFRPlotPosition(double pos, double hfr, double sigma, bool outlier, int pulseDuration, bool plot=true)
new HFR plot position with sigma
void redrawHFRPlot(PolynomialFit *poly, double solutionPosition, double solutionValue)
redraw the entire HFR plot
Q_SCRIPTABLE double getHFR()
DBUS interface function.
Definition focus.h:128
void loadStellarSolverProfiles()
setWeatherData Updates weather data that could be used to extract focus temperature from observatory ...
Definition focus.cpp:245
Q_SCRIPTABLE Q_NOREPLY void setBinning(int binX, int binY)
DBUS interface function.
Definition focus.cpp:4906
void clearDataPoints()
clearDataPoints Remove all data points from HFR plots
Definition focus.cpp:2993
Q_SCRIPTABLE Q_NOREPLY void setAutoStarEnabled(bool enable)
DBUS interface function.
Definition focus.cpp:4912
void runAutoFocus(const AutofocusReason autofocusReason, const QString &reasonInfo)
Run the autofocus process for the currently selected filter.
Definition focus.cpp:1016
void appendLogText(const QString &)
setFocusStatus Upon completion of the focusing process, set its status (fail or pass) and reset focus...
Definition focus.cpp:4408
void updateProperty(INDI::Property prop)
updateProperty Read focus number properties of interest as they arrive from the focuser driver and pr...
Definition focus.cpp:4040
void focusStarSelected(int x, int y)
focusStarSelected The user selected a focus star, save its coordinates and subframe it if subframing ...
Definition focus.cpp:4657
void reconnectFocuser(const QString &focuser)
reconnectFocuser Add focuser to the list of available focusers.
Definition focus.cpp:1889
bool setFocuser(ISD::Focuser *device)
addFocuser Add focuser to the list of available focusers.
Definition focus.cpp:704
void resetFocuser()
Move the focuser to the initial focus position.
Definition focus.cpp:2437
void processData(const QSharedPointer< FITSData > &data)
newFITS A new FITS blob is received by the CCD driver.
Definition focus.cpp:1915
void focuserTimedout(const QString &focuser)
focuserTimedout responding to requests
void initHFRPlot(QString str, double starUnits, bool minimum, bool useWeights, bool showPosition)
initialize the HFR V plot
void selectFocusStarFraction(double x, double y)
selectFocusStarFraction Select the focus star based by fraction of the overall size.
Definition focus.cpp:4644
void adaptiveFocus()
adaptiveFocus moves the focuser between subframes to stay at focus
Definition focus.cpp:990
Q_SCRIPTABLE Q_NOREPLY void resetFrame()
DBUS interface function.
Definition focus.cpp:313
void meridianFlipStarted()
React when a meridian flip has been started.
Definition focus.cpp:1400
Q_SCRIPTABLE QString filterWheel()
DBUS interface function.
void processTemperatureSource(INDI::Property prop)
processTemperatureSource Updates focus temperature source.
Definition focus.cpp:923
void removeDevice(const QSharedPointer< ISD::GenericDevice > &deviceRemoved)
removeDevice Remove device from Focus module
Definition focus.cpp:5109
void syncCameraInfo()
syncCameraInfo Read current CCD information and update settings accordingly.
Definition focus.cpp:468
void checkFilter()
Check Filter and make sure information is updated accordingly.
Definition focus.cpp:670
void drawCFZ(double minPosition, double minValue, int m_cfzSteps, bool plt)
Draw Critical Focus Zone on graph.
Q_SCRIPTABLE QString focuser()
DBUS interface function.
void finalUpdates(const QString &title, bool plot=true)
final updates after focus run comopletes on the focus plot
void minimumFound(double solutionPosition, double solutionValue, bool plot=true)
Focus solution with minimal HFR found.
void checkStopFocus(bool abort)
checkStopFocus Perform checks before stopping the autofocus operation.
Definition focus.cpp:1354
void checkFocuser()
Check Focuser and make sure information is updated accordingly.
Definition focus.cpp:741
Q_SCRIPTABLE Q_NOREPLY void setExposure(double value)
DBUS interface function.
Definition focus.cpp:4901
void setTitle(const QString &title, bool plot=true)
draw a title on the focus plot
void drawCurve(CurveFitting *curve, bool isVShape, bool activate, bool plot=true)
draw the curve into the HFR V-graph
QStringList getStellarSolverProfiles()
getStellarSolverProfiles
Definition focus.cpp:296
Q_SCRIPTABLE Q_NOREPLY void setAutoFocusParameters(int boxSize, int stepSize, int maxTravel, double tolerance)
DBUS interface function.
Definition focus.cpp:4922
Q_SCRIPTABLE Ekos::FocusState status()
DBUS interface function.
Definition focus.h:181
bool setFilterWheel(ISD::FilterWheel *device)
addFilter Add filter to the list of available filters.
Definition focus.cpp:506
Q_SCRIPTABLE bool canAutoFocus()
DBUS interface function.
Definition focus.h:120
Q_SCRIPTABLE QString camera()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void setAutoSubFrameEnabled(bool enable)
DBUS interface function.
Definition focus.cpp:4917
bool addTemperatureSource(const QSharedPointer< ISD::GenericDevice > &device)
addTemperatureSource Add temperature source to the list of available sources.
Definition focus.cpp:547
bool setCamera(ISD::Camera *device)
Add CCD to the list of available CCD.
Definition focus.cpp:849
void syncCCDControls()
Update camera controls like Gain, ISO, Offset...etc.
Definition focus.cpp:416
void checkCamera()
Check CCD and make sure information is updated accordingly.
Definition focus.cpp:357
void selectImageMask()
setImageMask Select the currently active image mask filtering the stars relevant for focusing
Definition focus.cpp:1852
void adaptiveFocusComplete(const QString &filter, double temperature, double tempTicks, double altitude, double altTicks, int prevPosError, int thisPosError, int totalTicks, int position, bool focuserMoved)
Signal Analyze that an Adaptive Focus iteration is complete.
Primary window to view monochrome and color FITS images.
Definition fitsviewer.h:50
CameraChip class controls a particular chip in camera.
Camera class controls an INDI Camera device.
Definition indicamera.h:44
Focuser class handles control of INDI focuser devices.
Definition indifocuser.h:21
The sky coordinates of a point in the sky.
Definition skypoint.h:45
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
Q_SCRIPTABLE Q_NOREPLY void checkFocus(double requiredHFR)
checkFocus Given the minimum required HFR, check focus and calculate HFR.
Definition focus.cpp:4781
Q_SCRIPTABLE Q_NOREPLY void capture(double settleTime=0.0)
DBUS interface function.
Definition focus.cpp:1510
Q_SCRIPTABLE bool focusOut(int ms=-1)
DBUS interface function.
Definition focus.cpp:1704
Q_SCRIPTABLE Q_NOREPLY void start()
DBUS interface function.
Definition focus.cpp:1010
Q_SCRIPTABLE Q_NOREPLY void abort()
DBUS interface function.
Definition focus.cpp:1414
Q_SCRIPTABLE bool focusIn(int ms=-1)
DBUS interface function.
Definition focus.cpp:1684
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
const QObjectList & children() const const
QString join(QChar separator) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:59:51 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.