Kstars
scheduler.h
45 * @brief The Ekos scheduler is a simple scheduler class to orchestrate automated multi object observation jobs.
59 typedef enum { INDI_IDLE, INDI_CONNECTING, INDI_DISCONNECTING, INDI_PROPERTY_CHECK, INDI_READY } INDIState;
172 * @brief startFocusing DBus call for feeding ekos the specified settings and initiating focus operation
189 * @brief startCapture The current job file name is solved to an url which is fed to ekos. We then start the capture process
190 * @param restart Set to true if the goal to restart an existing sequence. The only difference is that when a sequence is restarted, sequence file
191 * is not loaded from disk again since that results in erasing all the history of the capture process.
196 * @brief getNextAction Checking for the next appropriate action regarding the current state of the scheduler and execute it
285 * @brief select the error handling strategy (no restart, restart after all terminated, restart immediately)
303 SchedulerJob::CompletionCondition completion, const QDateTime &completionTime, int completionRepeats,
304 double minimumAltitude, double minimumMoonSeparation, bool enforceWeather, bool enforceTwilight,
308 * @brief evaluateJobs Computes estimated start and end times for the SchedulerJobs passed in. Returns a proposed schedule.
316 static QList<SchedulerJob *> evaluateJobs(QList<SchedulerJob *> &jobs, const QMap<QString, uint16_t> &capturedFramesCount,
326 * @param possiblyDelay a return value indicating whether the timer should try scheduling again after a delay.
331 QList<SchedulerJob *> &jobs, SchedulerState state, const QMap<QString, uint16_t> &capturedFramesCount,
335 * @brief calculateJobScore Calculate job dark sky score, altitude score, and moon separation scores and returns the sum.
344 static int16_t calculateJobScore(SchedulerJob const *job, QDateTime const &dawn, QDateTime const &dusk,
348 * @brief estimateJobTime Estimates the time the job takes to complete based on the sequence file and what modules to utilize during the observation run.
354 static bool estimateJobTime(SchedulerJob *schedJob, const QMap<QString, uint16_t> &capturedFramesCount,
357 * @brief loadSequenceQueue Loads what's necessary to estimate job completion time from a capture sequence queue file
361 * @param hasAutoFocus a return value indicating whether autofocus can be triggered by the sequence.
366 static bool loadSequenceQueue(const QString &fileURL, SchedulerJob *schedJob, QList<SequenceJob *> &jobs,
370 * @brief getDarkSkyScore Get the dark sky score of a date and time. The further from dawn the better.
374 static int16_t getDarkSkyScore(QDateTime const &dawn, QDateTime const &dusk, QDateTime const &when = QDateTime());
376 /** @brief Setter used in testing to fix the local time. Otherwise getter gets from KStars instance. */
440 * @brief addToQueue Construct a SchedulerJob and add it to the queue or save job settings from current form values.
456 * @brief createJobSequence Creates a job sequence for the mosaic tool given the prefix and output dir. The currently selected sequence file is modified
476 * @brief processJobInfo a utility used by loadSequenceQueue() to help it read a capture sequence file
484 * @brief timeHeuristics Estimates the number of seconds of overhead above and beyond imaging time, used by estimateJobTime.
509 /** @internal Enables signal watch on SchedulerJob form values in order to apply changes to current job.
524 * @param row is an integer indexing the row to associate cells from, and also the index of the job in the job list..
538 * @brief syncProperties Sync startup properties from the various device to enable/disable features in the scheduler
544 * @brief checkInterfaceReady Sometimes syncProperties() is not sufficient since the ready signal could have fired already
545 * and cannot be relied on to know once a module interface is ready. Therefore, we explicitly check if the module interface
634 * @return True if we set the scheduler to sleep mode. False, if not required and we need to execute now
662 * @param job SchedulerJob for which to display the next dawn and dusk, or the job currently selected if null, or today's next dawn and dusk if no job is selected.
667 * @brief checkJobStatus Check the overall state of the scheduler, Ekos, and INDI. When all is OK, it calls evaluateJobs() when no job is current or executeJob() if a job is selected.
668 * @return False if this function needs to be called again later, true if situation is stable and operations may continue.
673 * @brief checkJobStage Check the progress of the job states and make DBUS call to start the next stage until the job is complete.
680 * @brief findNextJob Check if the job met the completion criteria, and if it did, then it search for next job candidate. If no jobs are found, it starts the shutdown stage.
685 * @brief stopCurrentJobAction Stop whatever action taking place in the current job (eg. capture, guiding...etc).
691 * @return true if connection to Ekos/INDI should be attempted again, false if not mitigation is available or needed.
701 * @brief checkProcessExit Check script process exist status. This is called when the process exists either normally or abnormally.
702 * @param exitCode exit code from the script process. Depending on the exist code, the status of startup/shutdown procedure is set accordingly.
707 * @brief resumeCheckStatus If the scheduler primary loop was suspended due to weather or sleep event, resume it again.
712 * @brief checkWeather Check weather status and act accordingly depending on the current status of the scheduler and running jobs.
722 * @brief startJobEvaluation Start job evaluation only without starting the scheduler process itself. Display the result to the user.
755 void solverDone(bool timedOut, bool success, const FITSImage::Solution &solution, double elapsedSeconds);
760 * @brief setCaptureComplete Handle one sequence image completion. This is used now only to run alignment check
781 * @brief evaluateJobs evaluates the current state of each objects and gives each one a score based on the constraints.
788 * @brief executeJob After the best job is selected, we call this in order to start the process that will execute the job.
789 * checkJobStatus slot will be connected in order to figure the exact state of the current job each second
809 * @brief checkEkosState Check ekos startup stages and take whatever action necessary to get Ekos up and running
821 * @brief checkINDIState Check INDI startup stages and take whatever action necessary to get INDI devices connected.
827 * @brief checkStartupState Check startup procedure stages and make sure all stages are complete.
833 * @brief checkShutdownState Check shutdown procedure stages and make sure all stages are complete.
840 * @return If parking/unparking in progress, return false. If parking/unparking complete, return true.
885 * @brief checkMountParkingStatus check mount parking status and updating corresponding states accordingly.
890 * @brief checkDomeParkingStatus check dome parking status and updating corresponding states accordingly.
895 * @brief checkDomeParkingStatus check dome parking status and updating corresponding states accordingly.
900 * @brief processJobInfo Process the job information from a scheduler file and populate jobs accordingly
922 * @brief updateCompletedJobsCount For each scheduler job, examine sequence job storage and count captures.
923 * @param forced forces recounting captures unconditionally if true, else only IDLE, EVALUATION or new jobs are examined.
938 * @brief Calculate the map signature -> expected number of captures from the given list of capture sequence jobs,
944 static uint16_t calculateExpectedCapturesMap(const QList<SequenceJob *> &seqJobs, QMap<QString, uint16_t> &expected);
947 * @brief Fill the map signature -> frame count so that a single iteration of the scheduled job creates as many frames as possible
952 * @param capture_map map signature -> frame count that will be handed over to the capture module to control that a single iteration
953 * of the scheduler job creates as many frames as possible, but does not exceed the expected ones.
954 * @return total number of captured frames, truncated to the maximal number of frames the scheduler job could produce
991 // Interface strings for the dbus. Changeable for mocks when testing. Private so only tests can change.
1146 /// Check if initial autofocus is completed and do not run autofocus until there is a change is telescope position/alignment.
1162 /// Call checkWeather when weatherTimer time expires. It is equal to the UpdatePeriod time in INDI::Weather device.
1186 // before check its state again. If State is still IDLE, then it either didn't received the command
Q_OBJECTQ_OBJECT
void startAstrometry()
startAstrometry initiation of the capture and solve operation.
Definition: scheduler.cpp:5395
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
Definition: kstarsdatetime.h:35
ErrorHandlingStrategy
options what should happen if an error or abort occurs
Definition: scheduler.h:100
Q_PROPERTY(...)
void setJobManipulation(bool can_reorder, bool can_delete)
setJobManipulation Enable or disable job manipulation buttons.
Definition: scheduler.cpp:1635
void checkTwilightWarning(bool enabled)
displayTwilightWarning Display twilight warning to user if it is unchecked.
Definition: scheduler.cpp:7153
void resumeCheckStatus()
resumeCheckStatus If the scheduler primary loop was suspended due to weather or sleep event,...
Definition: scheduler.cpp:6878
void startJobEvaluation()
startJobEvaluation Start job evaluation only without starting the scheduler process itself.
Definition: scheduler.cpp:6832
void disconnectINDI()
disconnectINDI disconnect all INDI devices from server.
Definition: scheduler.cpp:5638
void startFocusing()
startFocusing DBus call for feeding ekos the specified settings and initiating focus operation
Definition: scheduler.cpp:4991
static QList< SchedulerJob * > evaluateJobs(QList< SchedulerJob * > &jobs, const QMap< QString, uint16_t > &capturedFramesCount, QDateTime const &dawn, QDateTime const &dusk, Scheduler *scheduler)
evaluateJobs Computes estimated start and end times for the SchedulerJobs passed in.
Definition: scheduler.cpp:2362
void readProcessOutput()
readProcessOutput read running script process output and display it in Ekos
Definition: scheduler.cpp:3704
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:70
Q_CLASSINFO(Name, Value)
ErrorHandlingStrategy getErrorHandlingStrategy()
retrieve the error handling strategy from the UI
Definition: scheduler.cpp:6885
void setCaptureComplete(const QVariantMap &metadata)
setCaptureComplete Handle one sequence image completion.
Definition: scheduler.cpp:8305
bool checkStatus()
checkJobStatus Check the overall state of the scheduler, Ekos, and INDI.
Definition: scheduler.cpp:3770
void registerNewModule(const QString &name)
registerNewModule Register an Ekos module as it arrives via DBus and create the appropriate DBus inte...
Definition: scheduler.cpp:7491
void checkProcessExit(int exitCode)
checkProcessExit Check script process exist status.
Definition: scheduler.cpp:3709
bool createJobSequence(XMLEle *root, const QString &prefix, const QString &outputDir)
createJobSequence Creates a job sequence for the mosaic tool given the prefix and output dir.
Definition: scheduler.cpp:7093
Q_SCRIPTABLE void setSequence(const QString &sequenceFileURL)
DBUS interface function.
Definition: scheduler.cpp:1047
void wakeUpScheduler()
checkWeather Check weather status and act accordingly depending on the current status of the schedule...
Definition: scheduler.cpp:2920
The QProgressIndicator class lets an application display a progress indicator to show that a long tas...
Definition: QProgressIndicator.h:23
bool saveScheduler(const QUrl &fileURL)
saveScheduler Save scheduler jobs to a file
Definition: scheduler.cpp:4775
Sequence Job is a container for the details required to capture a series of images.
Definition: sequencejob.h:18
static int16_t getDarkSkyScore(QDateTime const &dawn, QDateTime const &dusk, QDateTime const &when=QDateTime())
getDarkSkyScore Get the dark sky score of a date and time.
Definition: scheduler.cpp:2955
void load(bool clearQueue, const QString &filename="")
load Open a file dialog to select an ESL file, and load its contents.
Definition: scheduler.cpp:4383
void stopGuiding()
stopGuiding After guiding is done we need to stop the process
Definition: scheduler.cpp:5612
void updateNightTime(SchedulerJob const *job=nullptr)
updateNightTime update the Twilight restriction with the argument job properties.
Definition: scheduler.cpp:1536
void checkJobStage()
checkJobStage Check the progress of the job states and make DBUS call to start the next stage until t...
Definition: scheduler.cpp:3875
static void setupJob(SchedulerJob &job, const QString &name, int priority, const dms &ra, const dms &dec, double djd, double rotation, const QUrl &sequenceUrl, const QUrl &fitsUrl, SchedulerJob::StartupCondition startup, const QDateTime &startupTime, int16_t startupOffset, SchedulerJob::CompletionCondition completion, const QDateTime &completionTime, int completionRepeats, double minimumAltitude, double minimumMoonSeparation, bool enforceWeather, bool enforceTwilight, bool enforceArtificialHorizon, bool track, bool focus, bool align, bool guide)
setupJob Massive initialization of a SchedulerJob for testing and exectution
Definition: scheduler.cpp:1124
bool reorderJobs(QList< SchedulerJob * > reordered_sublist)
reorderJobs Change the order of jobs in the UI based on a subset of its jobs.
Definition: scheduler.cpp:1654
static QList< SchedulerJob * > prepareJobsForEvaluation(QList< SchedulerJob * > &jobs, SchedulerState state, const QMap< QString, uint16_t > &capturedFramesCount, bool rescheduleErrors, bool restartJobs, bool *possiblyDelay, Scheduler *scheduler)
prepareJobsForEvaluation Start of job evaluation
Definition: scheduler.cpp:2188
void stopCurrentJobAction()
stopCurrentJobAction Stop whatever action taking place in the current job (eg.
Definition: scheduler.cpp:4284
void getNextAction()
getNextAction Checking for the next appropriate action regarding the current state of the scheduler a...
Definition: scheduler.cpp:4186
QString join(const QString &separator) const const
void startCapture(bool restart=false)
startCapture The current job file name is solved to an url which is fed to ekos.
Definition: scheduler.cpp:5520
enabled
bool manageConnectionLoss()
manageConnectionLoss Mitigate loss of connection with the INDI server.
Definition: scheduler.cpp:4330
bool appendEkosScheduleList(const QString &fileURL)
appendEkosScheduleList Append the contents of an ESL file to the queue.
Definition: scheduler.cpp:4431
Q_SCRIPTABLE bool loadScheduler(const QString &fileURL)
DBUS interface function.
Definition: scheduler.cpp:4425
static int16_t calculateJobScore(SchedulerJob const *job, QDateTime const &dawn, QDateTime const &dusk, QDateTime const &when=QDateTime())
calculateJobScore Calculate job dark sky score, altitude score, and moon separation scores and return...
Definition: scheduler.cpp:3001
focus
void solverDone(bool timedOut, bool success, const FITSImage::Solution &solution, double elapsedSeconds)
solverDone Process solver solution after it is done.
Definition: scheduler.cpp:8338
void saveJob()
addToQueue Construct a SchedulerJob and add it to the queue or save job settings from current form va...
Definition: scheduler.cpp:1200
static bool estimateJobTime(SchedulerJob *schedJob, const QMap< QString, uint16_t > &capturedFramesCount, Scheduler *scheduler)
estimateJobTime Estimates the time the job takes to complete based on the sequence file and what modu...
Definition: scheduler.cpp:5861
void syncProperties()
syncProperties Sync startup properties from the various device to enable/disable features in the sche...
Definition: scheduler.cpp:7574
SchedulerTimerState
IterationTypes, the different types of scheduler iterations that are run.
Definition: scheduler.h:130
static KStarsDateTime getLocalTime()
Setter used in testing to fix the local time.
Definition: scheduler.cpp:274
void syncGUIToJob(SchedulerJob *job)
set all GUI fields to the values of the given scheduler job
Definition: scheduler.cpp:1437
void setJobAddApply(bool add_mode)
setJobAddApply Set first button state to add new job or apply changes.
Definition: scheduler.cpp:1617
The Ekos scheduler is a simple scheduler class to orchestrate automated multi object observation jobs...
Definition: scheduler.h:49
void checkInterfaceReady(QDBusInterface *iface)
checkInterfaceReady Sometimes syncProperties() is not sufficient since the ready signal could have fi...
Definition: scheduler.cpp:7654
void queueTableSelectionChanged(QModelIndex current, QModelIndex previous)
Update scheduler parameters to the currently selected scheduler job.
Definition: scheduler.cpp:1591
void setSolverAction(Align::GotoMode mode)
setSolverAction set the GOTO mode for the solver
Definition: scheduler.cpp:5631
static bool loadSequenceQueue(const QString &fileURL, SchedulerJob *schedJob, QList< SequenceJob * > &jobs, bool &hasAutoFocus, Scheduler *scheduler)
loadSequenceQueue Loads what's necessary to estimate job completion time from a capture sequence queu...
Definition: scheduler.cpp:7358
void startGuiding(bool resetCalibration=false)
startGuiding After ekos is fed the calibration options, we start the guiding process
Definition: scheduler.cpp:5480
void startMosaicTool()
startMosaicTool Start Mosaic tool and create jobs if necessary.
Definition: scheduler.cpp:6951
void setErrorHandlingStrategy(ErrorHandlingStrategy strategy)
select the error handling strategy (no restart, restart after all terminated, restart immediately)
Definition: scheduler.cpp:6897
void findNextJob()
findNextJob Check if the job met the completion criteria, and if it did, then it search for next job ...
Definition: scheduler.cpp:5125
bool shouldSchedulerSleep(SchedulerJob *currentJob)
shouldSchedulerSleep Check if the scheduler needs to sleep until the job is ready
Definition: scheduler.cpp:8160
void clickQueueTable(QModelIndex index)
jobSelectionChanged Update UI state when the job list is clicked once.
Definition: scheduler.cpp:1612
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.