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

KDE's Doxygen guidelines are available online.