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

KDE's Doxygen guidelines are available online.