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 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 processCaptureError(ISD::Camera::ErrorType type);
474
475 void setCaptureComplete();
476
477 void showFITSViewer();
478
479 void toggleFocusingWidgetFullScreen();
480
481 void setVideoStreamEnabled(bool enabled);
482
483 void starDetectionFinished();
484 void setCurrentMeasure();
485 void startAbIns();
486 void manualStart();
487
488 signals:
489 void newLog(const QString &text);
490 void newStatus(Ekos::FocusState state);
491 void newHFR(double hfr, int position, bool inAutofocus);
492 void newFocusTemperatureDelta(double delta, double absTemperature);
493
494 void absolutePositionChanged(int value);
495 void focusPositionAdjusted();
496 void focusAdaptiveComplete(bool success);
497
498 void trainChanged();
499
500 void suspendGuiding();
501 void resumeGuiding();
502 void newImage(const QSharedPointer<FITSView> &view);
503 void newStarPixmap(QPixmap &);
504 void settingsUpdated(const QVariantMap &settings);
505
506 // Signals for Analyze.
507 void autofocusStarting(double temperature, const QString &filter, AutofocusReason reason, const QString &reasonInfo);
508 void autofocusComplete(double temperature, const QString &filter, const QString &points, const bool useWeights,
509 const QString &curve = "", const QString &title = "");
510 void autofocusAborted(const QString &filter, const QString &points, const bool useWeights,
511 const AutofocusFailReason failCode, const QString &failCodeInfo);
512
513 /**
514 * @brief Signal Analyze that an Adaptive Focus iteration is complete
515 * @param Active filter
516 * @param temperature
517 * @param tempTicks is the number of ticks movement due to temperature change
518 * @param altitude
519 * @param altTicks is the number of ticks movement due to altitude change
520 * @param prevPosError is the position error at the previous adaptive focus iteration
521 * @param thisPosError is the position error for the current adaptive focus iteration
522 * @param totalTicks is the total tick movement for this adaptive focus iteration
523 * @param position is the current focuser position
524 * @param focuserMoved indicates whether totalTicks > minimum focuser movement
525 */
526 void adaptiveFocusComplete(const QString &filter, double temperature, double tempTicks, double altitude, double altTicks,
527 int prevPosError, int thisPosError, int totalTicks, int position, bool focuserMoved);
528
529 // HFR V curve plot events
530 /**
531 * @brief initialize the HFR V plot
532 * @param showPosition show focuser position (true) or count focus iterations (false)
533 * @param yAxisLabel is the label to display
534 * @param starUnits the units multiplier to display the pixel data
535 * @param minimum whether the curve shape is a minimum or maximum
536 * @param useWeights whether or not to display weights on the graph
537 * @param showPosition show focuser position (true) or show focusing iteration number (false)
538 */
539 void initHFRPlot(QString str, double starUnits, bool minimum, bool useWeights, bool showPosition);
540
541 /**
542 * @brief new HFR plot position with sigma
543 * @param pos focuser position with associated error (sigma)
544 * @param hfr measured star HFR value
545 * @param sigma is the standard deviation of star HFRs
546 * @param pulseDuration Pulse duration in ms for relative focusers that only support timers,
547 * or the number of ticks in a relative or absolute focuser
548 * */
549 void newHFRPlotPosition(double pos, double hfr, double sigma, bool outlier, int pulseDuration, bool plot = true);
550
551 /**
552 * @brief draw the approximating polynomial into the HFR V-graph
553 * @param poly pointer to the polynomial approximation
554 * @param isVShape has the solution a V shape?
555 * @param activate make the graph visible?
556 */
557 void drawPolynomial(PolynomialFit *poly, bool isVShape, bool activate, bool plot = true);
558
559 /**
560 * @brief draw the curve into the HFR V-graph
561 * @param poly pointer to the polynomial approximation
562 * @param isVShape has the solution a V shape?
563 * @param activate make the graph visible?
564 */
565 void drawCurve(CurveFitting *curve, bool isVShape, bool activate, bool plot = true);
566
567 /**
568 * @brief Focus solution with minimal HFR found
569 * @param solutionPosition focuser position
570 * @param solutionValue HFR value
571 */
572 void minimumFound(double solutionPosition, double solutionValue, bool plot = true);
573
574 /**
575 * @brief Draw Critical Focus Zone on graph
576 * @param solutionPosition focuser position
577 * @param solutionValue HFR value
578 * @param m_cfzSteps the size of the CFZ
579 * @param plt - whether to plot the CFZ
580 */
581 void drawCFZ(double minPosition, double minValue, int m_cfzSteps, bool plt);
582
583 /**
584 * @brief redraw the entire HFR plot
585 * @param poly pointer to the polynomial approximation
586 * @param solutionPosition solution focuser position
587 * @param solutionValue solution HFR value
588 */
589 void redrawHFRPlot(PolynomialFit *poly, double solutionPosition, double solutionValue);
590
591 /**
592 * @brief draw a title on the focus plot
593 * @param title the title
594 */
595 void setTitle(const QString &title, bool plot = true);
596
597 /**
598 * @brief final updates after focus run comopletes on the focus plot
599 * @param title
600 * @param plot
601 */
602 void finalUpdates(const QString &title, bool plot = true);
603
604 /**
605 * @brief focuserTimedout responding to requests
606 * @param focuser
607 */
608 void focuserTimedout(const QString &focuser);
609
610 private:
611
612 QList<SSolver::Parameters> m_StellarSolverProfiles;
613 QString savedOptionsProfiles;
614 StellarSolverProfileEditor *optionsProfileEditor { nullptr };
615
616 // Connections
617 void initConnections();
618
619 // Settings
620
621 /**
622 * @brief Connect GUI elements to sync settings once updated.
623 */
624 void connectSyncSettings();
625 /**
626 * @brief Stop updating settings when GUI elements are updated.
627 */
628 void disconnectSyncSettings();
629 /**
630 * @brief loadSettings Load setting from Options and set them accordingly.
631 */
632 void loadGlobalSettings();
633
634 /**
635 * @brief checkMosaicMaskLimits Check if the maximum values configured
636 * for the aberration style mosaic tile sizes fit into the CCD frame size.
637 */
638 void checkMosaicMaskLimits();
639
640 /**
641 * @brief syncSettings When checkboxes, comboboxes, or spin boxes are updated, save their values in the
642 * global and per-train settings.
643 */
644 void syncSettings();
645
646 /**
647 * @brief syncControl Sync setting to widget. The value depends on the widget type.
648 * @param settings Map of all settings
649 * @param key name of widget to sync
650 * @param widget pointer of widget to set
651 * @return True if sync successful, false otherwise
652 */
653 bool syncControl(const QVariantMap &settings, const QString &key, QWidget * widget);
654
655 /**
656 * @brief settleSettings Run this function after timeout from debounce timer to update database
657 * and emit settingsChanged signal. This is required so we don't overload output.
658 */
659 void settleSettings();
660
661 /**
662 * @brief prepareGUI Perform once only GUI prep processing
663 */
664 void prepareGUI();
665
666 /**
667 * @brief setUseWeights sets the useWeights checkbox
668 */
669 void setUseWeights();
670
671 /**
672 * @brief setDonutBuster sets the donutBuster checkbox
673 */
674 void setDonutBuster();
675
676 /**
677 * @brief addMissingStellarSolverProfiles
678 * @param profile to add
679 * @param profilePath file pathname
680 */
681 void addMissingStellarSolverProfile(const QString profilesPath, const QString profile);
682
683 // HFR Plot
684 void initPlots();
685
686 // Positions
687 void getAbsFocusPosition();
688 bool autoFocusChecks();
689 void autoFocusAbs();
690 void autoFocusLinear();
691 void autoFocusRel();
692
693 // Linear does plotting differently from the rest.
694 void plotLinearFocus();
695
696 // Linear final updates to the curve
697 void plotLinearFinalUpdates();
698
699 // Launch the Aberation Inspector popup
700 void startAberrationInspector();
701
702 // Get the curve fitting goal based on how the algorithm is progressing
703 CurveFitting::FittingGoal getGoal(int numSteps);
704
705 /** @brief Helper function determining whether the focuser behaves like a position
706 * based one (vs. a timer based)
707 */
708 bool isPositionBased()
709 {
710 return (canAbsMove || canRelMove || (m_FocusAlgorithm == FOCUS_LINEAR) || (m_FocusAlgorithm == FOCUS_LINEAR1PASS));
711 }
712 void resetButtons();
713
714 /**
715 * @brief returns whether the Aberration Inspector can be used or not
716 * @return can / cant be started
717 */
718 bool canAbInsStart();
719 void stop(FocusState completionState = FOCUS_ABORTED);
720
721 void initView();
722
723 /** @brief Sets the plot vectors for Analyze after Autofocus. Used by Linear and Linear1Pass
724 */
725 void updatePlotPosition();
726
727 /** @brief Build the data string to send to Analyze
728 */
729 QString getAnalyzeData();
730
731 /**
732 * @brief prepareCapture Set common settings for capture for focus module
733 * @param targetChip target Chip
734 */
735 void prepareCapture(ISD::CameraChip *targetChip);
736
737 // HFR / FWHM
738 void setHFRComplete();
739
740 // Sets the star algorithm and enables/disables various UI inputs.
741 void setFocusDetection(StarAlgorithm starAlgorithm);
742
743 // Sets the algorithm and enables/disables various UI inputs.
744 void setFocusAlgorithm(Algorithm algorithm);
745
746 void setCurveFit(CurveFitting::CurveFit curvefit);
747
748 void setStarMeasure(StarMeasure starMeasure);
749 void setStarPSF(StarPSF starPSF);
750 void setStarUnits(StarUnits starUnits);
751 void setWalk(FocusWalk focusWalk);
752 double calculateStarWeight(const bool useWeights, const std::vector<double> values);
753 bool boxOverlap(const QPair<int, int> b1Start, const QPair<int, int> b1End, const QPair<int, int> b2Start,
754 const QPair<int, int> b2End);
755 double getStarUnits(const StarMeasure starMeasure, const StarUnits starUnits);
756 // Calculate the CFZ of the current focus camera
757 double calcCameraCFZ();
758
759 // Calculate the CFZ from the screen parameters
760 void calcCFZ();
761
762 // Static data for filter's midpoint wavelength changed so update CFZ
763 void wavelengthChanged();
764
765 // Reset the CFZ parameters from the current Optical Train
766 void resetCFZToOT();
767
768 // Setup the Focus Advisor recommendations
769 void focusAdvisorSetup(const QString OTName);
770
771 // Look at similar Optical Trains to get parameters
772 QVariantMap focusAdvisorOTDefaults(const QString OTName);
773
774 // Update parameters based on Focus Advisor recommendations
775 void focusAdvisorAction(bool forceAll);
776
777 // Update parameters based on Focus Advisor recommendations
778 void focusAdvisorHelp();
779
780 // Move the focuser in (negative) or out (positive amount).
781 bool changeFocus(int amount, bool updateDir = true);
782
783 // Start up capture, or occasionally move focuser again, after current focus-move accomplished.
784 void autoFocusProcessPositionChange(IPState state);
785
786 // For the Linear algorithm, which always scans in (from higher position to lower position)
787 // if we notice the new position is higher than the current position (that is, it is the start
788 // of a new scan), we adjust the new position to be several steps further out than requested
789 // and set focuserAdditionalMovement to the extra motion, so that after this motion completes
790 // we will then scan back in (back to the originally requested position). This "overscan dance" is done
791 // to reduce backlash on such movement changes and so that we've always focused in before capture.
792 int adjustLinearPosition(int position, int newPosition, int overscan, bool updateDir);
793
794 // Process the image to get star FWHMs
795 void getFWHM(const QList<Edge *> &stars, double *FWHM, double *weight);
796
797 // Process the image to get the Fourier Transform Power
798 // If tile = -1 use the whole image; if mosaicTile is specified use just that
799 void getFourierPower(double *fourierPower, double *weight, const int mosaicTile = -1);
800
801 /**
802 * @brief syncTrackingBoxPosition Sync the tracking box to the current selected star center
803 */
804 void syncTrackingBoxPosition();
805
806 /** @internal Search for stars using the method currently configured, and return the consolidated HFR.
807 * @param image_data is the FITS frame to work with.
808 * @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.
809 */
810 void analyzeSources();
811
812 /** @internal Add a new star measure (HFR, FWHM, etc) for the current focuser position.
813 * @param newMeasure is the new measure (e.g. HFR, FWHM, etc) to consider for the current focuser position.
814 * @return true if a new sample is required, else false.
815 */
816 bool appendMeasure(double newMeasure);
817
818 /**
819 * @brief completeAutofocusProcedure finishes off autofocus and emits a message for other modules.
820 */
821 void completeFocusProcedure(FocusState completionState, AutofocusFailReason failCode, QString failCodeInfo = "", bool plot = true);
822
823 /**
824 * @brief activities to be executed after the configured settling time
825 * @param completionState state the focuser completed with
826 * @param autoFocusUsed is autofocus running?
827 * @param buildOffsetsUsed is autofocus running as a result of build offsets
828 * @param failCode is the reason for the Autofocus failure
829 * @param failCodeInfo contains extra info about failCode
830 */
831 void settle(const FocusState completionState, const bool autoFocusUsed,
832 const bool buildOffsetsUsed, const AutofocusFailReason failCode, const QString failCodeInfo);
833
834 void setLastFocusTemperature();
835 void setLastFocusAlt();
836 bool findTemperatureElement(const QSharedPointer<ISD::GenericDevice> &device);
837
838 /**
839 * @brief reset Adaptive Focus parameters
840 * @param Adaptive Focus enabled
841 */
842 void resetAdaptiveFocus(bool enabled);
843
844 void setupOpticalTrainManager();
845 void refreshOpticalTrain();
846
847 /**
848 * @brief set member valiables for the scope attached to the current Optical Train
849 * @param Optical Train scope parameters
850 * @param Optical Train reducer
851 */
852 void setScopeDetails(const QJsonObject &scope, const double reducer);
853
854 /**
855 * @brief handleFocusMotionTimeout When focuser is command to go to a target position, we expect to receive a notification
856 * that it arrived at the desired destination. If not, we command it again.
857 */
858 void handleFocusMotionTimeout();
859
860 /**
861 * @brief returns axis label based on measure selected
862 * @param starMeasure the star measure beuing used
863 */
864 QString getyAxisLabel(StarMeasure starMeasure);
865
866 /**
867 * @brief disable input widgets at the start of an AF run
868 * @param the widget to disable
869 * @param whether to disable at the widget level or disable all the children
870 */
871 void AFDisable(QWidget * widget, const bool children);
872
873 /**
874 * @brief returns whether the Gain input field is enabled outside of autofocus and
875 * whether logically is should be enabled during AF even though all input widgets are disabled
876 */
877 bool isFocusGainEnabled();
878
879 /**
880 * @brief returns whether the ISO input field is enabled outside of autofocus and
881 * whether logically is should be enabled during AF even though all input widgets are disabled
882 */
883 bool isFocusISOEnabled();
884
885 /**
886 * @brief returns whether the SubFrame input field is enabled outside of autofocus and
887 * whether logically is should be enabled during AF even though all input widgets are disabled
888 */
889 bool isFocusSubFrameEnabled();
890
891 /**
892 * @brief returns whether the optical train telescope has a central obstruction
893 * @param scopeType is the type of telescope
894 * @return whether scope has an obstruction
895 */
896 bool scopeHasObstruction(QString scopeType);
897
898 /**
899 * @brief Save the focus frame for later dubugging
900 */
901 void saveFocusFrame();
902
903 /**
904 * @brief Initialise donut processing
905 * @return whether scanStartPos has been kicked off
906 */
907 bool initDonutProcessing();
908
909 /**
910 * @brief Setup Linear Focuser
911 * @param initialPosition of the focuser
912 */
913 void setupLinearFocuser(int initialPosition);
914
915 /**
916 * @brief Process the scan for the Autofocus starting position
917 */
918 void scanStartPos();
919
920 /**
921 * @brief Reset donut processing
922 */
923 void resetDonutProcessing();
924
925 /**
926 * @brief Adjust Autofocus capture exposure based on user settings when using Donut Buster
927 */
928 void donutTimeDilation();
929
930 /// Focuser device needed for focus operation
931 ISD::Focuser *m_Focuser { nullptr };
932 /// CCD device needed for focus operation
933 ISD::Camera *m_Camera { nullptr };
934 /// Optional device filter
935 ISD::FilterWheel *m_FilterWheel { nullptr };
936 /// Optional temperature source element
937 INumber *currentTemperatureSourceElement {nullptr};
938
939 /// Current filter position
940 int currentFilterPosition { -1 };
941 int fallbackFilterPosition { -1 };
942 /// True if we need to change filter position and wait for result before continuing capture
943 bool filterPositionPending { false };
944 bool fallbackFilterPending { false };
945
946 /// They're generic GDInterface because they could be either ISD::Camera or ISD::FilterWheel or ISD::Weather
947 QList<QSharedPointer<ISD::GenericDevice>> m_TemperatureSources;
948
949 /// Last Focus direction. Used by Iterative and Polynomial. NOTE: this does not take account of overscan
950 /// so, e.g. an outward move will always by FOCUS_OUT even though overscan will move back in
951 Direction m_LastFocusDirection { FOCUS_NONE };
952 /// Keep track of the last requested steps
953 uint32_t m_LastFocusSteps {0};
954 /// What type of focusing are we doing right now?
955 Type m_FocusType { FOCUS_MANUAL };
956 /// Focus HFR & Centeroid algorithms
957 StarAlgorithm m_FocusDetection { ALGORITHM_SEP };
958 /// Focus Process Algorithm
959 Algorithm m_FocusAlgorithm { FOCUS_LINEAR1PASS };
960 /// Curve fit
961 CurveFitting::CurveFit m_CurveFit { CurveFitting::FOCUS_HYPERBOLA };
962 /// Star measure to use
963 StarMeasure m_StarMeasure { FOCUS_STAR_HFR };
964 /// PSF to use
965 StarPSF m_StarPSF { FOCUS_STAR_GAUSSIAN };
966 /// Units to use when displaying HFR or FWHM
967 StarUnits m_StarUnits { FOCUS_UNITS_PIXEL };
968 /// Units to use when displaying HFR or FWHM
969 FocusWalk m_FocusWalk { FOCUS_WALK_FIXED_STEPS };
970 /// Are we minimising or maximising?
971 CurveFitting::OptimisationDirection m_OptDir { CurveFitting::OPTIMISATION_MINIMISE };
972 /// The type of statistics to use
973 Mathematics::RobustStatistics::ScaleCalculation m_ScaleCalc { Mathematics::RobustStatistics::SCALE_VARIANCE };
974
975 /******************************************
976 * "Measure" variables, HFR, FWHM, numStars
977 ******************************************/
978
979 /// Current HFR value just fetched from FITS file
980 double currentHFR { INVALID_STAR_MEASURE };
981 double currentFWHM { INVALID_STAR_MEASURE };
982 double currentNumStars { INVALID_STAR_MEASURE };
983 double currentFourierPower { INVALID_STAR_MEASURE };
984 double currentMeasure { INVALID_STAR_MEASURE };
985 double currentWeight { 0 };
986 /// Last HFR value recorded
987 double lastHFR { 0 };
988 /// If (currentHFR > deltaHFR) we start the autofocus process.
989 double minimumRequiredHFR { INVALID_STAR_MEASURE };
990 /// Maximum HFR recorded
991 double maxHFR { 1 };
992 /// 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
993 int HFRInc { 0 };
994 /// If HFR decreasing? Well, good job. Once HFR start decreasing, we can start calculating HFR slope and estimating our next move.
995 int HFRDec { 0 };
996
997 /****************************
998 * Absolute position focusers
999 ****************************/
1000 /// Absolute focus position
1001 int currentPosition { 0 };
1002 /// Motion state of the absolute focuser
1003 IPState currentPositionState {IPS_IDLE};
1004 /// What was our position before we started the focus process?
1005 int initialFocuserAbsPosition { -1 };
1006 /// Pulse duration in ms for relative focusers that only support timers, or the number of ticks in a relative or absolute focuser
1007 int pulseDuration { 1000 };
1008 /// Does the focuser support absolute motion?
1009 bool canAbsMove { false };
1010 /// Does the focuser support relative motion?
1011 bool canRelMove { false };
1012 /// Does the focuser support timer-based motion?
1013 bool canTimerMove { false };
1014 /// Maximum range of motion for our lovely absolute focuser
1015 double absMotionMax { 0 };
1016 /// Minimum range of motion for our lovely absolute focuser
1017 double absMotionMin { 0 };
1018 /// How many iterations have we completed now in our absolute autofocus algorithm? We can't go forever
1019 int absIterations { 0 };
1020 /// Current image mask
1021 ImageMaskType m_currentImageMask = FOCUS_MASK_NONE;
1022
1023 /****************************
1024 * Misc. variables
1025 ****************************/
1026
1027 /// Are we in the process of capturing an image?
1028 bool captureInProgress { false };
1029 /// Are we in the process of calculating HFR?
1030 bool hfrInProgress { false };
1031 // 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.
1032 //bool frameModified;
1033 /// Was the modified frame subFramed?
1034 bool subFramed { false };
1035 /// 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
1036 /// and then we truly give up.
1037 int resetFocusIteration { 0 };
1038 /// Which filter must we use once the autofocus process kicks in?
1039 int lockedFilterIndex { -1 };
1040 /// Keep track of what we're doing right now
1041 bool inAutoFocus { false };
1042 bool inFocusLoop { false };
1043 bool inScanStartPos { false };
1044 //bool inSequenceFocus { false };
1045 /// Keep track of request to retry or abort an AutoFocus run after focus position has been reset
1046 /// RESTART_NONE = normal operation, no restart
1047 /// RESTART_NOW = restart the autofocus routine
1048 /// RESTART_ABORT = when autofocus has been tried MAXIMUM_RESET_ITERATIONS times, abort the routine
1049 typedef enum { RESTART_NONE = 0, RESTART_NOW, RESTART_ABORT } FocusRestartState;
1050 FocusRestartState m_RestartState { RESTART_NONE };
1051 /// Did we reverse direction?
1052 bool reverseDir { false };
1053 /// Did the user or the auto selection process finish selecting our focus star?
1054 bool starSelected { false };
1055 /// Adjust the focus position to a target value
1056 bool inAdjustFocus { false };
1057 /// Build offsets is a special case of the Autofocus run
1058 bool inBuildOffsets { false };
1059 // Target frame dimensions
1060 //int fx,fy,fw,fh;
1061 /// 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.
1062 int noStarCount { 0 };
1063 /// 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
1064 ISD::Camera::UploadMode rememberUploadMode { ISD::Camera::UPLOAD_CLIENT };
1065 /// Star measure (e.g. HFR, FWHM, etc) values for captured frames before averages
1066 QVector<double> starMeasureFrames;
1067 // Camera Fast Exposure
1068 bool m_RememberCameraFastExposure = { false };
1069 // Future Watch
1070 QFutureWatcher<bool> m_StarFinderWatcher;
1071 // R2 as a measure of how well the curve fits the datapoints. Passed to the V-curve graph for display
1072 double R2 = 0;
1073 // Counter to retry the auto focus run if the R2Limit has not been reached
1074 int R2Retries = 0;
1075 // Counter to retry starting auto focus if the focuser is still active
1076 int AFStartRetries = 0;
1077 // Reason code for the Autofocus run - passed to Analyze
1078 AutofocusReason m_AutofocusReason = AutofocusReason::FOCUS_NONE;
1079 // Extra information about m_AutofocusReason
1080 QString m_AutofocusReasonInfo;
1081 // Autofocus run number - to help with debugging logs
1082 int m_AFRun = 0;
1083
1084 /// Autofocus log file info.
1085 QStringList m_LogText;
1086 QFile m_FocusLogFile;
1087 QString m_FocusLogFileName;
1088 bool m_FocusLogEnabled { false };
1089
1090 ITextVectorProperty *filterName { nullptr };
1091 INumberVectorProperty *filterSlot { nullptr };
1092
1093 // Holds the superset of text values in combo-boxes that can have restricted options
1094 QStringList m_StarMeasureText;
1095 QStringList m_CurveFitText;
1096 QStringList m_FocusWalkText;
1097
1098 // Holds the enabled state of widgets that is used to active functionality in focus
1099 // during Autofocus when the input interface is disabled
1100 bool m_FocusGainAFEnabled { false };
1101 bool m_FocusISOAFEnabled { false };
1102 bool m_FocusSubFrameAFEnabled { false };
1103
1104 /****************************
1105 * Plot variables
1106 ****************************/
1107
1108 /// Plot minimum positions
1109 double minPos { 1e6 };
1110 /// Plot maximum positions
1111 double maxPos { 0 };
1112 /// V curve plot points
1113 QVector<double> plot_position, plot_value, plot_weight;
1114 QVector<bool> plot_outlier;
1115 bool isVShapeSolution = false;
1116
1117 /// State
1118 FocusState m_state { Ekos::FOCUS_IDLE };
1119 FocusState state() const
1120 {
1121 return m_state;
1122 }
1123 void setState(FocusState newState);
1124
1125 /// CCD Chip frame settings
1127
1128 /// Selected star coordinates
1129 QVector3D starCenter;
1130
1131 // Remember last star center coordinates in case of timeout in manual select mode
1132 QVector3D rememberStarCenter;
1133
1134 /// Focus Frame
1135 QSharedPointer<FITSView> m_FocusView;
1136
1137 /// Star Select Timer
1138 QTimer waitStarSelectTimer;
1139
1140 /// FITS Viewer in case user want to display in it instead of internal view
1142
1143 /// Track star position and HFR to know if we're detecting bogus stars due to detection algorithm false positive results
1144 QVector<QVector3D> starsHFR;
1145
1146 /// Relative Profile
1147 FocusProfilePlot *profilePlot { nullptr };
1148 QDialog *profileDialog { nullptr };
1149
1150 /// Polynomial fitting.
1151 std::unique_ptr<PolynomialFit> polynomialFit;
1152
1153 // Curve fitting for focuser movement.
1154 std::unique_ptr<CurveFitting> curveFitting;
1155
1156 // Curve fitting for stars.
1157 std::unique_ptr<CurveFitting> starFitting;
1158
1159 // FWHM processing.
1160 std::unique_ptr<FocusFWHM> focusFWHM;
1161
1162 // Fourier Transform power processing.
1163 std::unique_ptr<FocusFourierPower> focusFourierPower;
1164
1165 // Adaptive Focus processing.
1166 std::unique_ptr<AdaptiveFocus> adaptFocus;
1167
1168 // Capture timers
1169 QTimer captureTimer;
1170 QTimer captureTimeout;
1171 uint8_t captureTimeoutCounter { 0 };
1172 uint8_t captureFailureCounter { 0 };
1173
1174 // Gain Control
1175 double GainSpinSpecialValue { INVALID_VALUE };
1176
1177 // Focus motion timer.
1178 QTimer m_FocusMotionTimer;
1179 uint8_t m_FocusMotionTimerCounter { 0 };
1180
1181 // Focuser reconnect counter
1182 uint8_t m_FocuserReconnectCounter { 0 };
1183
1184 // Set m_DebugFocuser = true to simulate a focuser failure
1185 bool m_DebugFocuser { false };
1186 uint16_t m_DebugFocuserCounter { 0 };
1187
1188 // Guide Suspend
1189 bool m_GuidingSuspended { false };
1190
1191 // Data
1192 QSharedPointer<FITSData> m_ImageData;
1193
1194 // Linear focuser.
1195 std::unique_ptr<FocusAlgorithmInterface> linearFocuser;
1196 int focuserAdditionalMovement { 0 };
1197 bool focuserAdditionalMovementUpdateDir { true };
1198 int linearRequestedPosition { 0 };
1199
1200 bool hasDeviation { false };
1201
1202 //double observatoryTemperature { INVALID_VALUE };
1203 double m_LastSourceAutofocusTemperature { INVALID_VALUE };
1204 QSharedPointer<ISD::GenericDevice> m_LastSourceDeviceAutofocusTemperature;
1205 //TemperatureSource lastFocusTemperatureSource { NO_TEMPERATURE };
1206 double m_LastSourceAutofocusAlt { INVALID_VALUE };
1207
1208 // Mount altitude value for logging
1209 double mountAlt { INVALID_VALUE };
1210
1211 static constexpr uint8_t MAXIMUM_FLUCTUATIONS {10};
1212
1213 QVariantMap m_Settings;
1214 QVariantMap m_GlobalSettings;
1215
1216 // Dark Processor
1217 QPointer<DarkProcessor> m_DarkProcessor;
1218
1219 QSharedPointer<FilterManager> m_FilterManager;
1220
1221 // Maintain a list of disabled widgets when Autofocus is running that can be restored at the end of the run
1222 QVector <QWidget *> disabledWidgets;
1223
1224 // Scope parameters of the active optical train
1225 double m_Aperture = 0.0f;
1226 double m_FocalLength = 0.0f;
1227 double m_FocalRatio = 0.0f;
1228 double m_Reducer = 0.0f;
1229 double m_CcdPixelSizeX = 0.0f;
1230 int m_CcdWidth = 0;
1231 int m_CcdHeight = 0;
1232 QString m_ScopeType;
1233
1234 // Settings popup
1235 //std::unique_ptr<Ui::Settings> m_SettingsUI;
1236 //QPointer<QDialog> m_SettingsDialog;
1237 OpsFocusSettings *m_OpsFocusSettings { nullptr };
1238
1239 // Process popup
1240 //std::unique_ptr<Ui::Process> m_ProcessUI;
1241 //QPointer<QDialog> m_ProcessDialog;
1242 OpsFocusProcess *m_OpsFocusProcess { nullptr };
1243
1244 // Mechanics popup
1245 //std::unique_ptr<Ui::Mechanics> m_MechanicsUI;
1246 //QPointer<QDialog> m_MechanicsDialog;
1247 OpsFocusMechanics *m_OpsFocusMechanics { nullptr };
1248
1249 // CFZ popup
1250 std::unique_ptr<Ui::focusCFZDialog> m_CFZUI;
1251 QPointer<QDialog> m_CFZDialog;
1252
1253 // Focus Advisor popup
1254 std::unique_ptr<Ui::focusAdvisorDialog> m_AdvisorUI;
1255 QPointer<QDialog> m_AdvisorDialog;
1256 QVariantMap m_AdvisorMap;
1257
1258 // CFZ
1259 double m_cfzSteps = 0.0f;
1260
1261 // Aberration Inspector
1262 void calculateAbInsData();
1263 bool m_abInsOn = false;
1264 int m_abInsRun = 0;
1265 QVector<int> m_abInsPosition;
1266 QVector<QVector<double>> m_abInsMeasure;
1267 QVector<QVector<double>> m_abInsWeight;
1268 QVector<QVector<int>> m_abInsNumStars;
1269 QVector<QPoint> m_abInsTileCenterOffset;
1270
1271 QTimer m_DebounceTimer;
1272
1273 // Donut Buster
1274 double m_donutOrigExposure = 0.0;
1275 QVector<int> m_scanPosition;
1276 QVector<double> m_scanMeasure;
1277 QString m_AFfilter = NULL_FILTER;
1278};
1279}
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:5189
void checkTemperatureSource(const QString &name=QString())
Check temperature source and make sure information is updated accordingly.
Definition focus.cpp:565
Q_SCRIPTABLE bool setFilter(const QString &filter)
DBUS interface function.
Definition focus.cpp:652
void startFraming()
startFraming Begins continuous capture of the CCD and calculates HFR every frame.
Definition focus.cpp:4344
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:243
Q_SCRIPTABLE Q_NOREPLY void setBinning(int binX, int binY)
DBUS interface function.
Definition focus.cpp:4768
void clearDataPoints()
clearDataPoints Remove all data points from HFR plots
Definition focus.cpp:2942
Q_SCRIPTABLE Q_NOREPLY void setAutoStarEnabled(bool enable)
DBUS interface function.
Definition focus.cpp:4774
void runAutoFocus(const AutofocusReason autofocusReason, const QString &reasonInfo)
Run the autofocus process for the currently selected filter.
Definition focus.cpp:1012
void appendLogText(const QString &)
setFocusStatus Upon completion of the focusing process, set its status (fail or pass) and reset focus...
Definition focus.cpp:4298
void updateProperty(INDI::Property prop)
updateProperty Read focus number properties of interest as they arrive from the focuser driver and pr...
Definition focus.cpp:3951
void focusStarSelected(int x, int y)
focusStarSelected The user selected a focus star, save its coordinates and subframe it if subframing ...
Definition focus.cpp:4547
void reconnectFocuser(const QString &focuser)
reconnectFocuser Add focuser to the list of available focusers.
Definition focus.cpp:1868
bool setFocuser(ISD::Focuser *device)
addFocuser Add focuser to the list of available focusers.
Definition focus.cpp:702
void resetFocuser()
Move the focuser to the initial focus position.
Definition focus.cpp:2405
void processData(const QSharedPointer< FITSData > &data)
newFITS A new FITS blob is received by the CCD driver.
Definition focus.cpp:1894
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:4534
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:311
void meridianFlipStarted()
React when a meridian flip has been started.
Definition focus.cpp:1410
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:4964
void syncCameraInfo()
syncCameraInfo Read current CCD information and update settings accordingly.
Definition focus.cpp:466
void checkFilter()
Check Filter and make sure information is updated accordingly.
Definition focus.cpp:668
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:1369
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:4763
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:4784
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:504
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:4779
bool addTemperatureSource(const QSharedPointer< ISD::GenericDevice > &device)
addTemperatureSource Add temperature source to the list of available sources.
Definition focus.cpp:545
bool setCamera(ISD::Camera *device)
Add CCD to the list of available CCD.
Definition focus.cpp:847
void syncCCDControls()
Update camera controls like Gain, ISO, Offset...etc.
Definition focus.cpp:414
void checkCamera()
Check CCD and make sure information is updated accordingly.
Definition focus.cpp:355
void selectImageMask()
setImageMask Select the currently active image mask filtering the stars relevant for focusing
Definition focus.cpp:1831
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.
CameraChip class controls a particular chip in camera.
Camera class controls an INDI Camera device.
Definition indicamera.h:47
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:4671
Q_SCRIPTABLE Q_NOREPLY void capture(double settleTime=0.0)
DBUS interface function.
Definition focus.cpp:1505
Q_SCRIPTABLE bool focusOut(int ms=-1)
DBUS interface function.
Definition focus.cpp:1691
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:1424
Q_SCRIPTABLE bool focusIn(int ms=-1)
DBUS interface function.
Definition focus.cpp:1671
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:78
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 Tue Mar 26 2024 11:19:02 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.