Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/scheduler/scheduler.h
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 79 | typedef enum { | |||
---|---|---|---|---|---|
87 | PARKWAIT_ERROR | 87 | PARKWAIT_ERROR | ||
88 | } ParkWaitStatus; | 88 | } ParkWaitStatus; | ||
89 | 89 | | |||
90 | /** @brief Columns, in the same order as UI. */ | 90 | /** @brief Columns, in the same order as UI. */ | ||
91 | typedef enum { | 91 | typedef enum { | ||
92 | SCHEDCOL_NAME = 0, | 92 | SCHEDCOL_NAME = 0, | ||
93 | SCHEDCOL_STATUS, | 93 | SCHEDCOL_STATUS, | ||
94 | SCHEDCOL_CAPTURES, | 94 | SCHEDCOL_CAPTURES, | ||
95 | SCHEDCOL_ALTITUDE, | ||||
95 | SCHEDCOL_SCORE, | 96 | SCHEDCOL_SCORE, | ||
96 | SCHEDCOL_STARTTIME, | 97 | SCHEDCOL_STARTTIME, | ||
97 | SCHEDCOL_ENDTIME, | 98 | SCHEDCOL_ENDTIME, | ||
98 | SCHEDCOL_DURATION, | 99 | SCHEDCOL_DURATION, | ||
100 | SCHEDCOL_LEADTIME, | ||||
99 | SCHEDCOL_COUNT | 101 | SCHEDCOL_COUNT | ||
100 | } SchedulerColumns; | 102 | } SchedulerColumns; | ||
101 | 103 | | |||
102 | Scheduler(); | 104 | Scheduler(); | ||
103 | ~Scheduler() = default; | 105 | ~Scheduler() = default; | ||
104 | 106 | | |||
105 | QString getCurrentJobName(); | 107 | QString getCurrentJobName(); | ||
106 | void appendLogText(const QString &); | 108 | void appendLogText(const QString &); | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 164 | /** | |||
164 | * @param mode 0 For Sync, 1 for SlewToTarget, 2 for Nothing | 166 | * @param mode 0 For Sync, 1 for SlewToTarget, 2 for Nothing | ||
165 | */ | 167 | */ | ||
166 | void setSolverAction(Align::GotoMode mode); | 168 | void setSolverAction(Align::GotoMode mode); | ||
167 | 169 | | |||
168 | /** | 170 | /** | ||
169 | * @brief findAltitude Find altitude given a specific time | 171 | * @brief findAltitude Find altitude given a specific time | ||
170 | * @param target Target | 172 | * @param target Target | ||
171 | * @param when date time to find altitude | 173 | * @param when date time to find altitude | ||
174 | * @param is_setting whether target is setting at the argument time (optional). | ||||
175 | * @param debug outputs calculation to log file (optional). | ||||
172 | * @return Altitude of the target at the specific date and time given. | 176 | * @return Altitude of the target at the specific date and time given. | ||
177 | * @warning This function uses the current KStars geolocation. | ||||
173 | */ | 178 | */ | ||
174 | static double findAltitude(const SkyPoint &target, const QDateTime &when); | 179 | static double findAltitude(const SkyPoint &target, const QDateTime &when, bool *is_setting = nullptr, bool debug = false); | ||
175 | 180 | | |||
176 | /** @defgroup SchedulerDBusInterface Ekos DBus Interface - Scheduler Module | 181 | /** @defgroup SchedulerDBusInterface Ekos DBus Interface - Scheduler Module | ||
177 | * Ekos::Align interface provides primary functions to run and stop the scheduler. | 182 | * Ekos::Align interface provides primary functions to run and stop the scheduler. | ||
178 | */ | 183 | */ | ||
179 | 184 | | |||
180 | /*@{*/ | 185 | /*@{*/ | ||
181 | 186 | | |||
182 | /** DBUS interface function. | 187 | /** DBUS interface function. | ||
Show All 13 Lines | 197 | /** DBUS interface function. | |||
196 | */ | 201 | */ | ||
197 | Q_SCRIPTABLE bool loadScheduler(const QString &fileURL); | 202 | Q_SCRIPTABLE bool loadScheduler(const QString &fileURL); | ||
198 | 203 | | |||
199 | /** DBUS interface function. | 204 | /** DBUS interface function. | ||
200 | * @brief Resets all jobs to IDLE | 205 | * @brief Resets all jobs to IDLE | ||
201 | */ | 206 | */ | ||
202 | Q_SCRIPTABLE void resetAllJobs(); | 207 | Q_SCRIPTABLE void resetAllJobs(); | ||
203 | 208 | | |||
209 | /** DBUS interface function. | ||||
210 | * @brief Resets all jobs to IDLE | ||||
211 | */ | ||||
212 | Q_SCRIPTABLE void sortJobsPerAltitude(); | ||||
213 | | ||||
204 | Ekos::SchedulerState status() { return state; } | 214 | Ekos::SchedulerState status() { return state; } | ||
205 | 215 | | |||
206 | void setProfile(const QString &profile) {schedulerProfileCombo->setCurrentText(profile);} | 216 | void setProfile(const QString &profile) {schedulerProfileCombo->setCurrentText(profile);} | ||
207 | QString profile() {return schedulerProfileCombo->currentText();} | 217 | QString profile() {return schedulerProfileCombo->currentText();} | ||
208 | 218 | | |||
209 | /** @}*/ | 219 | /** @}*/ | ||
210 | 220 | | |||
211 | /** @{ */ | 221 | /** @{ */ | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 247 | protected slots: | |||
314 | void setJobManipulation(bool can_reorder, bool can_delete); | 324 | void setJobManipulation(bool can_reorder, bool can_delete); | ||
315 | 325 | | |||
316 | /** | 326 | /** | ||
317 | * @brief clickQueueTable Update UI state when the job list is clicked once. | 327 | * @brief clickQueueTable Update UI state when the job list is clicked once. | ||
318 | */ | 328 | */ | ||
319 | void clickQueueTable(QModelIndex index); | 329 | void clickQueueTable(QModelIndex index); | ||
320 | 330 | | |||
321 | /** | 331 | /** | ||
332 | * @brief reorderJobs Change the order of jobs in the UI based on a subset of its jobs. | ||||
333 | */ | ||||
334 | void reorderJobs(QList<SchedulerJob*> reordered_sublist); | ||||
335 | | ||||
336 | /** | ||||
322 | * @brief moveJobUp Move the selected job up in the job list. | 337 | * @brief moveJobUp Move the selected job up in the job list. | ||
323 | */ | 338 | */ | ||
324 | void moveJobUp(); | 339 | void moveJobUp(); | ||
325 | 340 | | |||
326 | /** | 341 | /** | ||
327 | * @brief moveJobDown Move the selected job down in the list. | 342 | * @brief moveJobDown Move the selected job down in the list. | ||
328 | */ | 343 | */ | ||
329 | void moveJobDown(); | 344 | void moveJobDown(); | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 444 | /** | |||
430 | * @brief executeJob After the best job is selected, we call this in order to start the process that will execute the job. | 445 | * @brief executeJob After the best job is selected, we call this in order to start the process that will execute the job. | ||
431 | * checkJobStatus slot will be connected in order to figure the exact state of the current job each second | 446 | * checkJobStatus slot will be connected in order to figure the exact state of the current job each second | ||
432 | * @param value | 447 | * @param value | ||
433 | */ | 448 | */ | ||
434 | void executeJob(SchedulerJob *job); | 449 | void executeJob(SchedulerJob *job); | ||
435 | 450 | | |||
436 | void executeScript(const QString &filename); | 451 | void executeScript(const QString &filename); | ||
437 | 452 | | |||
438 | int16_t getDarkSkyScore(const QDateTime &observationDateTime); | 453 | /** | ||
454 | * @brief getDarkSkyScore Get the dark sky score of a date and time. The further from dawn the better. | ||||
455 | * @param when date and time to check the dark sky score, now if omitted | ||||
yurchor: Actually, this should be
```
* param observationDateTime when ...
```
to not confusing doxygen. | |||||
TallFurryMan: Thanks, I'll sync declaration and definition. | |||||
456 | * @return Dark sky score. Daylight get bad score, as well as pre-dawn to dawn. | ||||
457 | */ | ||||
458 | int16_t getDarkSkyScore(QDateTime const &when = QDateTime()) const; | ||||
439 | 459 | | |||
440 | /** | 460 | /** | ||
441 | * @brief getAltitudeScore Get the altitude score of an object. The higher the better | 461 | * @brief getAltitudeScore Get the altitude score of an object. The higher the better | ||
442 | * @param job Active job | 462 | * @param job Target job | ||
443 | * @param when At what time to check the target altitude | 463 | * @param when date and time to check the target altitude, now if omitted. | ||
444 | * @return Altitude score. Altitude below minimum default of 15 degrees but above horizon get -20 score. Bad altitude below minimum required altitude or below horizon get -1000 score. | 464 | * @return Altitude score. Target altitude below minimum altitude required by job or setting target under 3 degrees below minimum altitude get bad score. | ||
445 | */ | 465 | */ | ||
446 | int16_t getAltitudeScore(SchedulerJob *job, QDateTime when); | 466 | int16_t getAltitudeScore(SchedulerJob const *job, QDateTime const &when = QDateTime()) const; | ||
447 | 467 | | |||
448 | /** | 468 | /** | ||
449 | * @brief getMoonSeparationScore Get moon separation score. The further apart, the better, up a maximum score of 20. | 469 | * @brief getMoonSeparationScore Get moon separation score. The further apart, the better, up a maximum score of 20. | ||
450 | * @param job Target job | 470 | * @param job Target job | ||
451 | * @param when What time to check the moon separation? | 471 | * @param when date and time to check the moon separation, now if omitted. | ||
452 | * @return Moon separation score | 472 | * @return Moon separation score | ||
453 | */ | 473 | */ | ||
454 | int16_t getMoonSeparationScore(SchedulerJob *job, QDateTime when); | 474 | int16_t getMoonSeparationScore(SchedulerJob const *job, QDateTime const &when = QDateTime()) const; | ||
455 | 475 | | |||
456 | /** | 476 | /** | ||
457 | * @brief calculateJobScore Calculate job dark sky score, altitude score, and moon separation scores and returns the sum. | 477 | * @brief calculateJobScore Calculate job dark sky score, altitude score, and moon separation scores and returns the sum. | ||
458 | * @param job job to evaluate | 478 | * @param job Target | ||
459 | * @param when time to evaluate constraints | 479 | * @param when date and time to evaluate constraints, now if omitted. | ||
460 | * @return Total score | 480 | * @return Total score | ||
461 | */ | 481 | */ | ||
462 | int16_t calculateJobScore(SchedulerJob *job, QDateTime when); | 482 | int16_t calculateJobScore(SchedulerJob const *job, QDateTime const &when = QDateTime()) const; | ||
463 | 483 | | |||
464 | /** | 484 | /** | ||
465 | * @brief getWeatherScore Get weather condition score. | 485 | * @brief getWeatherScore Get current weather condition score. | ||
466 | * @return If weather condition OK, return 0, if warning return -500, if alert return -1000 | 486 | * @return If weather condition OK, return score 0, else bad score. | ||
467 | */ | 487 | */ | ||
468 | int16_t getWeatherScore(); | 488 | int16_t getWeatherScore() const; | ||
469 | 489 | | |||
470 | /** | 490 | /** | ||
471 | * @brief calculateAltitudeTime calculate the altitude time given the minimum altitude given. | 491 | * @brief calculateAltitudeTime calculate the altitude time given the minimum altitude given. | ||
472 | * @param job active target | 492 | * @param job active target | ||
473 | * @param minAltitude minimum altitude required | 493 | * @param minAltitude minimum altitude required | ||
474 | * @param minMoonAngle minimum separation from the moon. -1 to ignore. | 494 | * @param minMoonAngle minimum separation from the moon. -1 to ignore. | ||
475 | * @return True if found a time in the night where the object is at or above the minimum altitude, false otherise. | 495 | * @param when date and time to start searching from, now if omitted. | ||
496 | * @return The date and time the target is at or above the argument altitude, valid if found, invalid if not achievable (always under altitude). | ||||
476 | */ | 497 | */ | ||
477 | bool calculateAltitudeTime(SchedulerJob *job, double minAltitude, double minMoonAngle = -1); | 498 | QDateTime calculateAltitudeTime(SchedulerJob const *job, double minAltitude, double minMoonAngle = -1, QDateTime const &when = QDateTime()) const; | ||
478 | 499 | | |||
479 | /** | 500 | /** | ||
480 | * @brief calculateCulmination find culmination time adjust for the job offset | 501 | * @brief calculateCulmination find culmination time adjust for the job offset | ||
481 | * @param job Active job | 502 | * @param job active target | ||
482 | * @return True if culmination time adjust for offset is a valid time in the night | 503 | * @param offset_minutes offset in minutes before culmination to search for. | ||
504 | * @param when date and time to start searching from, now if omitted | ||||
505 | * @return The date and time the target is in entering the culmination interval, valid if found, invalid if not achievable (currently always valid). | ||||
483 | */ | 506 | */ | ||
484 | bool calculateCulmination(SchedulerJob *job); | 507 | QDateTime calculateCulmination(SchedulerJob const *job, int offset_minutes, QDateTime const &when = QDateTime()) const; | ||
485 | 508 | | |||
486 | /** | 509 | /** | ||
487 | * @brief calculateDawnDusk Get dawn and dusk times for today | 510 | * @brief calculateDawnDusk Get dawn and dusk times for today | ||
488 | */ | 511 | */ | ||
489 | void calculateDawnDusk(); | 512 | void calculateDawnDusk(); | ||
490 | 513 | | |||
491 | /** | 514 | /** | ||
492 | * @brief checkEkosState Check ekos startup stages and take whatever action necessary to get Ekos up and running | 515 | * @brief checkEkosState Check ekos startup stages and take whatever action necessary to get Ekos up and running | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 612 | /** | |||
593 | */ | 616 | */ | ||
594 | bool processJobInfo(XMLEle *root); | 617 | bool processJobInfo(XMLEle *root); | ||
595 | 618 | | |||
596 | /** | 619 | /** | ||
597 | * @brief getCurrentMoonSeparation Get current moon separation in degrees at current time for the given job | 620 | * @brief getCurrentMoonSeparation Get current moon separation in degrees at current time for the given job | ||
598 | * @param job scheduler job | 621 | * @param job scheduler job | ||
599 | * @return Separation in degrees | 622 | * @return Separation in degrees | ||
600 | */ | 623 | */ | ||
601 | double getCurrentMoonSeparation(SchedulerJob *job); | 624 | double getCurrentMoonSeparation(SchedulerJob const *job) const; | ||
602 | 625 | | |||
603 | /** | 626 | /** | ||
604 | * @brief updatePreDawn Update predawn time depending on current time and user offset | 627 | * @brief updatePreDawn Update predawn time depending on current time and user offset | ||
605 | */ | 628 | */ | ||
606 | void updatePreDawn(); | 629 | void updatePreDawn(); | ||
607 | 630 | | |||
608 | /** | 631 | /** | ||
609 | * @brief estimateJobTime Estimates the time the job takes to complete based on the sequence file and what modules to utilize during the observation run. | 632 | * @brief estimateJobTime Estimates the time the job takes to complete based on the sequence file and what modules to utilize during the observation run. | ||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |
Actually, this should be
to not confusing doxygen.