Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/guide/internalguide/internalguider.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 74 | if (ui.subFrameCheck->isEnabled() && ui.subFrameCheck->isChecked() && m_isSubFramed == false) | |||
---|---|---|---|---|---|
75 | first_subframe = true; | 75 | first_subframe = true; | ||
76 | 76 | | |||
77 | capture(); | 77 | capture(); | ||
78 | 78 | | |||
79 | #endif | 79 | #endif | ||
80 | 80 | | |||
81 | m_isFirstFrame = true; | 81 | m_isFirstFrame = true; | ||
82 | 82 | | |||
83 | if (state == GUIDE_IDLE) | ||||
84 | { | ||||
85 | if (Options::saveGuideLog()) | ||||
86 | guideLog.enable(); | ||||
87 | GuideLog::GuideInfo info; | ||||
88 | fillGuideInfo(&info); | ||||
89 | guideLog.startGuiding(info); | ||||
90 | } | ||||
91 | | ||||
83 | state = GUIDE_GUIDING; | 92 | state = GUIDE_GUIDING; | ||
84 | emit newStatus(state); | 93 | emit newStatus(state); | ||
85 | 94 | | |||
86 | emit frameCaptureRequested(); | 95 | emit frameCaptureRequested(); | ||
87 | 96 | | |||
88 | return true; | 97 | return true; | ||
89 | } | 98 | } | ||
90 | 99 | | |||
91 | bool InternalGuider::abort() | 100 | bool InternalGuider::abort() | ||
92 | { | 101 | { | ||
93 | calibrationStage = CAL_IDLE; | 102 | calibrationStage = CAL_IDLE; | ||
94 | 103 | | |||
95 | logFile.close(); | 104 | logFile.close(); | ||
105 | guideLog.endGuiding(); | ||||
96 | 106 | | |||
97 | if (state == GUIDE_CALIBRATING || state == GUIDE_GUIDING || state == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING) | 107 | if (state == GUIDE_CALIBRATING || state == GUIDE_GUIDING || state == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING) | ||
98 | { | 108 | { | ||
99 | if (state == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING) | 109 | if (state == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING) | ||
100 | emit newStatus(GUIDE_DITHERING_ERROR); | 110 | emit newStatus(GUIDE_DITHERING_ERROR); | ||
101 | emit newStatus(GUIDE_ABORTED); | 111 | emit newStatus(GUIDE_ABORTED); | ||
102 | 112 | | |||
103 | qCDebug(KSTARS_EKOS_GUIDE) << "Aborting" << getGuideStatusString(state); | 113 | qCDebug(KSTARS_EKOS_GUIDE) << "Aborting" << getGuideStatusString(state); | ||
Show All 12 Lines | |||||
116 | pmath->suspend(false); | 126 | pmath->suspend(false); | ||
117 | state = GUIDE_IDLE; | 127 | state = GUIDE_IDLE; | ||
118 | 128 | | |||
119 | return true; | 129 | return true; | ||
120 | } | 130 | } | ||
121 | 131 | | |||
122 | bool InternalGuider::suspend() | 132 | bool InternalGuider::suspend() | ||
123 | { | 133 | { | ||
134 | guideLog.pauseInfo(); | ||||
124 | state = GUIDE_SUSPENDED; | 135 | state = GUIDE_SUSPENDED; | ||
125 | emit newStatus(state); | 136 | emit newStatus(state); | ||
126 | 137 | | |||
127 | pmath->suspend(true); | 138 | pmath->suspend(true); | ||
128 | 139 | | |||
129 | return true; | 140 | return true; | ||
130 | } | 141 | } | ||
131 | 142 | | |||
132 | bool InternalGuider::resume() | 143 | bool InternalGuider::resume() | ||
133 | { | 144 | { | ||
145 | guideLog.resumeInfo(); | ||||
134 | state = GUIDE_GUIDING; | 146 | state = GUIDE_GUIDING; | ||
135 | emit newStatus(state); | 147 | emit newStatus(state); | ||
136 | 148 | | |||
137 | pmath->suspend(false); | 149 | pmath->suspend(false); | ||
138 | 150 | | |||
139 | emit frameCaptureRequested(); | 151 | emit frameCaptureRequested(); | ||
140 | 152 | | |||
141 | return true; | 153 | return true; | ||
Show All 28 Lines | 172 | { | |||
170 | 182 | | |||
171 | m_ProgressiveDither.enqueue(Vector(targetX, targetY, ret_angle)); | 183 | m_ProgressiveDither.enqueue(Vector(targetX, targetY, ret_angle)); | ||
172 | 184 | | |||
173 | } | 185 | } | ||
174 | while (targetX != x || targetY != y); | 186 | while (targetX != x || targetY != y); | ||
175 | 187 | | |||
176 | m_DitherTargetPosition = m_ProgressiveDither.dequeue(); | 188 | m_DitherTargetPosition = m_ProgressiveDither.dequeue(); | ||
177 | pmath->setReticleParameters(m_DitherTargetPosition.x, m_DitherTargetPosition.y, m_DitherTargetPosition.z); | 189 | pmath->setReticleParameters(m_DitherTargetPosition.x, m_DitherTargetPosition.y, m_DitherTargetPosition.z); | ||
190 | guideLog.ditherInfo(x, y, m_DitherTargetPosition.x, m_DitherTargetPosition.y); | ||||
178 | 191 | | |||
179 | state = GUIDE_MANUAL_DITHERING; | 192 | state = GUIDE_MANUAL_DITHERING; | ||
180 | emit newStatus(state); | 193 | emit newStatus(state); | ||
181 | 194 | | |||
182 | processGuiding(); | 195 | processGuiding(); | ||
183 | 196 | | |||
184 | return true; | 197 | return true; | ||
185 | } | 198 | } | ||
Show All 26 Lines | 208 | { | |||
212 | if (fabs(diff_y + accumulator.second) > MAX_DITHER_TRAVEL) | 225 | if (fabs(diff_y + accumulator.second) > MAX_DITHER_TRAVEL) | ||
213 | diff_y *= -1.5; | 226 | diff_y *= -1.5; | ||
214 | accumulator.second += diff_y; | 227 | accumulator.second += diff_y; | ||
215 | 228 | | |||
216 | m_DitherTargetPosition = Vector(cur_x, cur_y, 0) + Vector(diff_x, diff_y, 0); | 229 | m_DitherTargetPosition = Vector(cur_x, cur_y, 0) + Vector(diff_x, diff_y, 0); | ||
217 | 230 | | |||
218 | qCDebug(KSTARS_EKOS_GUIDE) << "Dithering process started.. Reticle Target Pos X " << m_DitherTargetPosition.x << " Y " << | 231 | qCDebug(KSTARS_EKOS_GUIDE) << "Dithering process started.. Reticle Target Pos X " << m_DitherTargetPosition.x << " Y " << | ||
219 | m_DitherTargetPosition.y; | 232 | m_DitherTargetPosition.y; | ||
233 | guideLog.ditherInfo(diff_x, diff_y, m_DitherTargetPosition.x, m_DitherTargetPosition.y); | ||||
220 | 234 | | |||
221 | pmath->setReticleParameters(m_DitherTargetPosition.x, m_DitherTargetPosition.y, ret_angle); | 235 | pmath->setReticleParameters(m_DitherTargetPosition.x, m_DitherTargetPosition.y, ret_angle); | ||
222 | 236 | | |||
223 | state = GUIDE_DITHERING; | 237 | state = GUIDE_DITHERING; | ||
224 | emit newStatus(state); | 238 | emit newStatus(state); | ||
225 | 239 | | |||
226 | processGuiding(); | 240 | processGuiding(); | ||
227 | 241 | | |||
Show All 9 Lines | |||||
237 | if (fabs(star_pos.x) < 1 && fabs(star_pos.y) < 1) | 251 | if (fabs(star_pos.x) < 1 && fabs(star_pos.y) < 1) | ||
238 | { | 252 | { | ||
239 | pmath->setReticleParameters(cur_x, cur_y, ret_angle); | 253 | pmath->setReticleParameters(cur_x, cur_y, ret_angle); | ||
240 | qCDebug(KSTARS_EKOS_GUIDE) << "Dither complete."; | 254 | qCDebug(KSTARS_EKOS_GUIDE) << "Dither complete."; | ||
241 | 255 | | |||
242 | if (Options::ditherSettle() > 0) | 256 | if (Options::ditherSettle() > 0) | ||
243 | { | 257 | { | ||
244 | state = GUIDE_DITHERING_SETTLE; | 258 | state = GUIDE_DITHERING_SETTLE; | ||
259 | guideLog.settleStartedInfo(); | ||||
245 | emit newStatus(state); | 260 | emit newStatus(state); | ||
246 | } | 261 | } | ||
247 | 262 | | |||
248 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | 263 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | ||
249 | } | 264 | } | ||
250 | else | 265 | else | ||
251 | { | 266 | { | ||
252 | if (++m_DitherRetries > Options::ditherMaxIterations()) | 267 | if (++m_DitherRetries > Options::ditherMaxIterations()) | ||
253 | { | 268 | { | ||
254 | if (Options::ditherFailAbortsAutoGuide()) | 269 | if (Options::ditherFailAbortsAutoGuide()) | ||
255 | { | 270 | { | ||
256 | emit newStatus(Ekos::GUIDE_DITHERING_ERROR); | 271 | emit newStatus(Ekos::GUIDE_DITHERING_ERROR); | ||
257 | abort(); | 272 | abort(); | ||
258 | return false; | 273 | return false; | ||
259 | } | 274 | } | ||
260 | else | 275 | else | ||
261 | { | 276 | { | ||
262 | emit newLog(i18n("Warning: Dithering failed. Autoguiding shall continue as set in the options in case " | 277 | emit newLog(i18n("Warning: Dithering failed. Autoguiding shall continue as set in the options in case " | ||
263 | "of dither failure.")); | 278 | "of dither failure.")); | ||
264 | 279 | | |||
265 | if (Options::ditherSettle() > 0) | 280 | if (Options::ditherSettle() > 0) | ||
266 | { | 281 | { | ||
267 | state = GUIDE_DITHERING_SETTLE; | 282 | state = GUIDE_DITHERING_SETTLE; | ||
283 | guideLog.settleStartedInfo(); | ||||
268 | emit newStatus(state); | 284 | emit newStatus(state); | ||
269 | } | 285 | } | ||
270 | 286 | | |||
271 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | 287 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | ||
272 | return true; | 288 | return true; | ||
273 | } | 289 | } | ||
274 | } | 290 | } | ||
275 | 291 | | |||
Show All 33 Lines | 312 | { | |||
309 | if (fabs(star_pos.x) < 1 && fabs(star_pos.y) < 1) | 325 | if (fabs(star_pos.x) < 1 && fabs(star_pos.y) < 1) | ||
310 | { | 326 | { | ||
311 | pmath->setReticleParameters(cur_x, cur_y, ret_angle); | 327 | pmath->setReticleParameters(cur_x, cur_y, ret_angle); | ||
312 | qCDebug(KSTARS_EKOS_GUIDE) << "Manual Dither complete."; | 328 | qCDebug(KSTARS_EKOS_GUIDE) << "Manual Dither complete."; | ||
313 | 329 | | |||
314 | if (Options::ditherSettle() > 0) | 330 | if (Options::ditherSettle() > 0) | ||
315 | { | 331 | { | ||
316 | state = GUIDE_DITHERING_SETTLE; | 332 | state = GUIDE_DITHERING_SETTLE; | ||
333 | guideLog.settleStartedInfo(); | ||||
317 | emit newStatus(state); | 334 | emit newStatus(state); | ||
318 | } | 335 | } | ||
319 | 336 | | |||
320 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | 337 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | ||
321 | } | 338 | } | ||
322 | else | 339 | else | ||
323 | { | 340 | { | ||
324 | processGuiding(); | 341 | processGuiding(); | ||
325 | } | 342 | } | ||
326 | } | 343 | } | ||
327 | else | 344 | else | ||
328 | { | 345 | { | ||
329 | if (++m_DitherRetries > Options::ditherMaxIterations()) | 346 | if (++m_DitherRetries > Options::ditherMaxIterations()) | ||
330 | { | 347 | { | ||
331 | emit newLog(i18n("Warning: Manual Dithering failed.")); | 348 | emit newLog(i18n("Warning: Manual Dithering failed.")); | ||
332 | 349 | | |||
333 | if (Options::ditherSettle() > 0) | 350 | if (Options::ditherSettle() > 0) | ||
334 | { | 351 | { | ||
335 | state = GUIDE_DITHERING_SETTLE; | 352 | state = GUIDE_DITHERING_SETTLE; | ||
353 | guideLog.settleStartedInfo(); | ||||
336 | emit newStatus(state); | 354 | emit newStatus(state); | ||
337 | } | 355 | } | ||
338 | 356 | | |||
339 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | 357 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | ||
340 | return true; | 358 | return true; | ||
341 | } | 359 | } | ||
342 | 360 | | |||
343 | processGuiding(); | 361 | processGuiding(); | ||
344 | } | 362 | } | ||
345 | 363 | | |||
346 | return true; | 364 | return true; | ||
347 | } | 365 | } | ||
348 | 366 | | |||
349 | void InternalGuider::setDitherSettled() | 367 | void InternalGuider::setDitherSettled() | ||
350 | { | 368 | { | ||
369 | guideLog.settleCompletedInfo(); | ||||
351 | emit newStatus(Ekos::GUIDE_DITHERING_SUCCESS); | 370 | emit newStatus(Ekos::GUIDE_DITHERING_SUCCESS); | ||
352 | 371 | | |||
353 | // Back to guiding | 372 | // Back to guiding | ||
354 | state = GUIDE_GUIDING; | 373 | state = GUIDE_GUIDING; | ||
355 | } | 374 | } | ||
356 | 375 | | |||
357 | bool InternalGuider::calibrate() | 376 | bool InternalGuider::calibrate() | ||
358 | { | 377 | { | ||
Show All 38 Lines | |||||
397 | guideFrame->disconnect(this); | 416 | guideFrame->disconnect(this); | ||
398 | 417 | | |||
399 | // Must reset dec swap before we run any calibration procedure! | 418 | // Must reset dec swap before we run any calibration procedure! | ||
400 | emit DESwapChanged(false); | 419 | emit DESwapChanged(false); | ||
401 | pmath->setDeclinationSwapEnabled(false); | 420 | pmath->setDeclinationSwapEnabled(false); | ||
402 | pmath->setLostStar(false); | 421 | pmath->setLostStar(false); | ||
403 | 422 | | |||
404 | calibrationStage = CAL_START; | 423 | calibrationStage = CAL_START; | ||
424 | if (Options::saveGuideLog()) | ||||
425 | guideLog.enable(); | ||||
426 | GuideLog::GuideInfo info; | ||||
427 | fillGuideInfo(&info); | ||||
428 | guideLog.startCalibration(info); | ||||
405 | 429 | | |||
406 | // automatic | 430 | // automatic | ||
407 | // If two axies (RA/DEC) are required | 431 | // If two axies (RA/DEC) are required | ||
408 | if (Options::twoAxisEnabled()) | 432 | if (Options::twoAxisEnabled()) | ||
409 | calibrateRADECRecticle(false); | 433 | calibrateRADECRecticle(false); | ||
410 | else | 434 | else | ||
411 | // Just RA | 435 | // Just RA | ||
412 | calibrateRADECRecticle(true); | 436 | calibrateRADECRecticle(true); | ||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | 501 | case CAL_START: | |||
499 | m_CalibrationCoords.last_x = m_CalibrationCoords.start_x1; | 523 | m_CalibrationCoords.last_x = m_CalibrationCoords.start_x1; | ||
500 | m_CalibrationCoords.last_y = m_CalibrationCoords.start_x2; | 524 | m_CalibrationCoords.last_y = m_CalibrationCoords.start_x2; | ||
501 | 525 | | |||
502 | emit newPulse(RA_INC_DIR, m_CalibrationParams.last_pulse); | 526 | emit newPulse(RA_INC_DIR, m_CalibrationParams.last_pulse); | ||
503 | 527 | | |||
504 | m_CalibrationParams.ra_iterations++; | 528 | m_CalibrationParams.ra_iterations++; | ||
505 | 529 | | |||
506 | calibrationStage = CAL_RA_INC; | 530 | calibrationStage = CAL_RA_INC; | ||
531 | guideLog.addCalibrationData( | ||||
532 | RA_INC_DIR, | ||||
533 | m_CalibrationCoords.start_x1, m_CalibrationCoords.start_y1, | ||||
534 | m_CalibrationCoords.start_x1, m_CalibrationCoords.start_y1); | ||||
507 | 535 | | |||
508 | break; | 536 | break; | ||
509 | 537 | | |||
510 | case CAL_RA_INC: | 538 | case CAL_RA_INC: | ||
511 | { | 539 | { | ||
512 | // Star position resulting from LAST guiding pulse to mount | 540 | // Star position resulting from LAST guiding pulse to mount | ||
513 | double cur_x, cur_y; | 541 | double cur_x, cur_y; | ||
514 | pmath->getStarScreenPosition(&cur_x, &cur_y); | 542 | pmath->getStarScreenPosition(&cur_x, &cur_y); | ||
515 | 543 | | |||
516 | emit calibrationUpdate(GuideInterface::RA_IN, i18n("Calibrating RA Out"), | 544 | emit calibrationUpdate(GuideInterface::RA_IN, i18n("Calibrating RA Out"), | ||
517 | cur_x - m_CalibrationCoords.start_x1, cur_y - m_CalibrationCoords.start_y1); | 545 | cur_x - m_CalibrationCoords.start_x1, cur_y - m_CalibrationCoords.start_y1); | ||
518 | 546 | | |||
519 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration #" << m_CalibrationParams.ra_iterations << ": STAR " << cur_x << "," << cur_y; | 547 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration #" << m_CalibrationParams.ra_iterations << ": STAR " << cur_x << "," << cur_y; | ||
520 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration " << m_CalibrationParams.ra_iterations << " Direction: RA_INC_DIR" << " Duration: " | 548 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration " << m_CalibrationParams.ra_iterations << " Direction: RA_INC_DIR" << " Duration: " | ||
521 | << m_CalibrationParams.last_pulse << " ms."; | 549 | << m_CalibrationParams.last_pulse << " ms."; | ||
522 | 550 | | |||
551 | guideLog.addCalibrationData(RA_INC_DIR, cur_x, cur_y, | ||||
552 | m_CalibrationCoords.start_x1, m_CalibrationCoords.start_y1); | ||||
553 | | ||||
523 | // Must pass at least 1.5 pixels to move on to the next stage | 554 | // Must pass at least 1.5 pixels to move on to the next stage | ||
524 | if (m_CalibrationParams.ra_iterations >= m_CalibrationParams.auto_drift_time | 555 | if (m_CalibrationParams.ra_iterations >= m_CalibrationParams.auto_drift_time | ||
525 | && (fabs(cur_x - m_CalibrationCoords.start_x1) > 1.5 || fabs(cur_y - m_CalibrationCoords.start_y1) > 1.5)) | 556 | && (fabs(cur_x - m_CalibrationCoords.start_x1) > 1.5 || fabs(cur_y - m_CalibrationCoords.start_y1) > 1.5)) | ||
526 | { | 557 | { | ||
527 | m_CalibrationParams.ra_total_pulse += m_CalibrationParams.last_pulse; | 558 | m_CalibrationParams.ra_total_pulse += m_CalibrationParams.last_pulse; | ||
528 | 559 | | |||
529 | calibrationStage = CAL_RA_DEC; | 560 | calibrationStage = CAL_RA_DEC; | ||
530 | 561 | | |||
Show All 11 Lines | |||||
542 | 573 | | |||
543 | m_CalibrationCoords.ra_distance = 0; | 574 | m_CalibrationCoords.ra_distance = 0; | ||
544 | m_CalibrationParams.backlash = 0; | 575 | m_CalibrationParams.backlash = 0; | ||
545 | 576 | | |||
546 | emit newPulse(RA_DEC_DIR, m_CalibrationParams.last_pulse); | 577 | emit newPulse(RA_DEC_DIR, m_CalibrationParams.last_pulse); | ||
547 | m_CalibrationParams.ra_iterations++; | 578 | m_CalibrationParams.ra_iterations++; | ||
548 | 579 | | |||
549 | emit newLog(i18n("RA drifting reverse...")); | 580 | emit newLog(i18n("RA drifting reverse...")); | ||
581 | guideLog.endCalibrationSection(RA_INC_DIR, m_CalibrationParams.phi); | ||||
550 | } | 582 | } | ||
551 | else if (m_CalibrationParams.ra_iterations > m_CalibrationParams.turn_back_time) | 583 | else if (m_CalibrationParams.ra_iterations > m_CalibrationParams.turn_back_time) | ||
552 | { | 584 | { | ||
553 | emit newLog(i18n("Calibration rejected. Star drift is too short. Check for mount, cable, or backlash problems.")); | 585 | emit newLog(i18n("Calibration rejected. Star drift is too short. Check for mount, cable, or backlash problems.")); | ||
554 | 586 | | |||
555 | calibrationStage = CAL_ERROR; | 587 | calibrationStage = CAL_ERROR; | ||
556 | 588 | | |||
557 | emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR); | 589 | emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR); | ||
558 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Failed: Drift too short.")); | 590 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Failed: Drift too short.")); | ||
559 | KSNotification::event(QLatin1String("CalibrationFailed"), i18n("Guiding calibration failed with errors"), | 591 | KSNotification::event(QLatin1String("CalibrationFailed"), i18n("Guiding calibration failed with errors"), | ||
560 | KSNotification::EVENT_ALERT); | 592 | KSNotification::EVENT_ALERT); | ||
593 | guideLog.endCalibration(); | ||||
561 | 594 | | |||
562 | reset(); | 595 | reset(); | ||
563 | } | 596 | } | ||
564 | else | 597 | else | ||
565 | { | 598 | { | ||
566 | // Aggressive pulse in case we're going slow | 599 | // Aggressive pulse in case we're going slow | ||
567 | if (fabs(cur_x - m_CalibrationCoords.last_x) < 0.5 && fabs(cur_y - m_CalibrationCoords.last_y) < 0.5) | 600 | if (fabs(cur_x - m_CalibrationCoords.last_x) < 0.5 && fabs(cur_y - m_CalibrationCoords.last_y) < 0.5) | ||
568 | { | 601 | { | ||
Show All 32 Lines | 622 | { | |||
601 | star_pos.y = -star_pos.y; | 634 | star_pos.y = -star_pos.y; | ||
602 | star_pos = star_pos * ROT_Z; | 635 | star_pos = star_pos * ROT_Z; | ||
603 | 636 | | |||
604 | qCDebug(KSTARS_EKOS_GUIDE) << "Star x pos is " << star_pos.x << " from original point."; | 637 | qCDebug(KSTARS_EKOS_GUIDE) << "Star x pos is " << star_pos.x << " from original point."; | ||
605 | 638 | | |||
606 | if (m_CalibrationCoords.ra_distance == 0.0) | 639 | if (m_CalibrationCoords.ra_distance == 0.0) | ||
607 | m_CalibrationCoords.ra_distance = star_pos.x; | 640 | m_CalibrationCoords.ra_distance = star_pos.x; | ||
608 | 641 | | |||
642 | guideLog.addCalibrationData(RA_DEC_DIR, cur_x, cur_y, | ||||
643 | m_CalibrationCoords.start_x1, m_CalibrationCoords.start_y1); | ||||
644 | | ||||
609 | // start point reached... so exit | 645 | // start point reached... so exit | ||
610 | if (star_pos.x < 1.5) | 646 | if (star_pos.x < 1.5) | ||
611 | { | 647 | { | ||
612 | pmath->performProcessing(); | 648 | pmath->performProcessing(); | ||
613 | 649 | | |||
614 | m_CalibrationParams.ra_total_pulse += m_CalibrationParams.last_pulse; | 650 | m_CalibrationParams.ra_total_pulse += m_CalibrationParams.last_pulse; | ||
615 | m_CalibrationParams.last_pulse = Options::calibrationPulseDuration(); | 651 | m_CalibrationParams.last_pulse = Options::calibrationPulseDuration(); | ||
616 | axis_calibration_complete = true; | 652 | axis_calibration_complete = true; | ||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 749 | { | |||
717 | 753 | | |||
718 | emit calibrationUpdate(GuideInterface::DEC_IN, i18n("Calibrating DEC Out"), | 754 | emit calibrationUpdate(GuideInterface::DEC_IN, i18n("Calibrating DEC Out"), | ||
719 | cur_x - m_CalibrationCoords.start_x2, cur_y - m_CalibrationCoords.start_y2); | 755 | cur_x - m_CalibrationCoords.start_x2, cur_y - m_CalibrationCoords.start_y2); | ||
720 | 756 | | |||
721 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration #" << m_CalibrationParams.dec_iterations << ": STAR " << cur_x << "," << cur_y; | 757 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration #" << m_CalibrationParams.dec_iterations << ": STAR " << cur_x << "," << cur_y; | ||
722 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration " << m_CalibrationParams.dec_iterations << " Direction: DEC_INC_DIR" << | 758 | qCDebug(KSTARS_EKOS_GUIDE) << "Iteration " << m_CalibrationParams.dec_iterations << " Direction: DEC_INC_DIR" << | ||
723 | " Duration: " << m_CalibrationParams.last_pulse << " ms."; | 759 | " Duration: " << m_CalibrationParams.last_pulse << " ms."; | ||
724 | 760 | | |||
761 | // Don't yet know how to tell NORTH vs SOUTH | ||||
762 | guideLog.addCalibrationData(DEC_INC_DIR, cur_x, cur_y, | ||||
763 | m_CalibrationCoords.start_x2, m_CalibrationCoords.start_y2); | ||||
764 | | ||||
725 | if (m_CalibrationParams.dec_iterations >= m_CalibrationParams.auto_drift_time | 765 | if (m_CalibrationParams.dec_iterations >= m_CalibrationParams.auto_drift_time | ||
726 | && (fabs(cur_x - m_CalibrationCoords.start_x2) > 1.5 || fabs(cur_y - m_CalibrationCoords.start_y2) > 1.5)) | 766 | && (fabs(cur_x - m_CalibrationCoords.start_x2) > 1.5 || fabs(cur_y - m_CalibrationCoords.start_y2) > 1.5)) | ||
727 | { | 767 | { | ||
728 | calibrationStage = CAL_DEC_DEC; | 768 | calibrationStage = CAL_DEC_DEC; | ||
729 | 769 | | |||
730 | m_CalibrationParams.de_total_pulse += m_CalibrationParams.last_pulse; | 770 | m_CalibrationParams.de_total_pulse += m_CalibrationParams.last_pulse; | ||
731 | 771 | | |||
732 | m_CalibrationCoords.end_x2 = cur_x; | 772 | m_CalibrationCoords.end_x2 = cur_x; | ||
Show All 10 Lines | 782 | m_CalibrationParams.phi = pmath->calculatePhi(m_CalibrationCoords.start_x2, m_CalibrationCoords.start_y2, | |||
743 | m_CalibrationCoords.end_x2, m_CalibrationCoords.end_y2); | 783 | m_CalibrationCoords.end_x2, m_CalibrationCoords.end_y2); | ||
744 | ROT_Z = RotateZ(-M_PI * m_CalibrationParams.phi / 180.0); // derotates... | 784 | ROT_Z = RotateZ(-M_PI * m_CalibrationParams.phi / 180.0); // derotates... | ||
745 | 785 | | |||
746 | m_CalibrationCoords.de_distance = 0; | 786 | m_CalibrationCoords.de_distance = 0; | ||
747 | 787 | | |||
748 | emit newPulse(DEC_DEC_DIR, m_CalibrationParams.last_pulse); | 788 | emit newPulse(DEC_DEC_DIR, m_CalibrationParams.last_pulse); | ||
749 | emit newLog(i18n("DEC drifting reverse...")); | 789 | emit newLog(i18n("DEC drifting reverse...")); | ||
750 | m_CalibrationParams.dec_iterations++; | 790 | m_CalibrationParams.dec_iterations++; | ||
791 | guideLog.endCalibrationSection(DEC_INC_DIR, m_CalibrationParams.phi); | ||||
751 | } | 792 | } | ||
752 | else if (m_CalibrationParams.dec_iterations > m_CalibrationParams.turn_back_time) | 793 | else if (m_CalibrationParams.dec_iterations > m_CalibrationParams.turn_back_time) | ||
753 | { | 794 | { | ||
754 | calibrationStage = CAL_ERROR; | 795 | calibrationStage = CAL_ERROR; | ||
755 | 796 | | |||
756 | emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR); | 797 | emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR); | ||
757 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Failed: couldn't reach start point.")); | 798 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Failed: couldn't reach start point.")); | ||
758 | emit newLog(i18np("Guide DEC: Scope cannot reach the start point after %1 iteration.\nPossible mount " | 799 | emit newLog(i18np("Guide DEC: Scope cannot reach the start point after %1 iteration.\nPossible mount " | ||
759 | "or backlash problems...", | 800 | "or backlash problems...", | ||
760 | "GUIDE DEC: Scope cannot reach the start point after %1 iterations.\nPossible mount " | 801 | "GUIDE DEC: Scope cannot reach the start point after %1 iterations.\nPossible mount " | ||
761 | "or backlash problems...", | 802 | "or backlash problems...", | ||
762 | m_CalibrationParams.dec_iterations)); | 803 | m_CalibrationParams.dec_iterations)); | ||
763 | 804 | | |||
764 | KSNotification::event(QLatin1String("CalibrationFailed"), | 805 | KSNotification::event(QLatin1String("CalibrationFailed"), | ||
765 | i18n("Guiding calibration failed with errors"), KSNotification::EVENT_ALERT); | 806 | i18n("Guiding calibration failed with errors"), KSNotification::EVENT_ALERT); | ||
807 | guideLog.endCalibration(); | ||||
766 | reset(); | 808 | reset(); | ||
767 | } | 809 | } | ||
768 | else | 810 | else | ||
769 | { | 811 | { | ||
770 | if (fabs(cur_x - m_CalibrationCoords.last_x) < 0.5 && fabs(cur_y - m_CalibrationCoords.last_y) < 0.5) | 812 | if (fabs(cur_x - m_CalibrationCoords.last_x) < 0.5 && fabs(cur_y - m_CalibrationCoords.last_y) < 0.5) | ||
771 | { | 813 | { | ||
772 | // Increase pulse by 200% | 814 | // Increase pulse by 200% | ||
773 | m_CalibrationParams.last_pulse = Options::calibrationPulseDuration() * 2; | 815 | m_CalibrationParams.last_pulse = Options::calibrationPulseDuration() * 2; | ||
Show All 32 Lines | 833 | { | |||
806 | star_pos = star_pos * ROT_Z; | 848 | star_pos = star_pos * ROT_Z; | ||
807 | 849 | | |||
808 | qCDebug(KSTARS_EKOS_GUIDE) << "start Pos X " << star_pos.x << " from original point."; | 850 | qCDebug(KSTARS_EKOS_GUIDE) << "start Pos X " << star_pos.x << " from original point."; | ||
809 | 851 | | |||
810 | // Keep track of distance | 852 | // Keep track of distance | ||
811 | if (m_CalibrationCoords.de_distance == 0.0) | 853 | if (m_CalibrationCoords.de_distance == 0.0) | ||
812 | m_CalibrationCoords.de_distance = star_pos.x; | 854 | m_CalibrationCoords.de_distance = star_pos.x; | ||
813 | 855 | | |||
856 | guideLog.addCalibrationData(DEC_DEC_DIR, cur_x, cur_y, | ||||
857 | m_CalibrationCoords.start_x2, m_CalibrationCoords.start_y2); | ||||
858 | | ||||
814 | // start point reached... so exit | 859 | // start point reached... so exit | ||
815 | if (star_pos.x < 1.5) | 860 | if (star_pos.x < 1.5) | ||
816 | { | 861 | { | ||
817 | pmath->performProcessing(); | 862 | pmath->performProcessing(); | ||
818 | 863 | | |||
819 | m_CalibrationParams.de_total_pulse += m_CalibrationParams.last_pulse; | 864 | m_CalibrationParams.de_total_pulse += m_CalibrationParams.last_pulse; | ||
820 | m_CalibrationParams.last_pulse = Options::calibrationPulseDuration(); | 865 | m_CalibrationParams.last_pulse = Options::calibrationPulseDuration(); | ||
821 | axis_calibration_complete = true; | 866 | axis_calibration_complete = true; | ||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Line(s) | 913 | { | |||
878 | emit DESwapChanged(swap_dec); | 923 | emit DESwapChanged(swap_dec); | ||
879 | 924 | | |||
880 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Successful")); | 925 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Successful")); | ||
881 | KSNotification::event(QLatin1String("CalibrationSuccessful"), | 926 | KSNotification::event(QLatin1String("CalibrationSuccessful"), | ||
882 | i18n("Guiding calibration completed successfully")); | 927 | i18n("Guiding calibration completed successfully")); | ||
883 | 928 | | |||
884 | //if (ui.autoStarCheck->isChecked()) | 929 | //if (ui.autoStarCheck->isChecked()) | ||
885 | //guideModule->selectAutoStar(); | 930 | //guideModule->selectAutoStar(); | ||
931 | | ||||
932 | guideLog.endCalibration(pmath->getDitherRate(0), pmath->getDitherRate(1)); | ||||
886 | } | 933 | } | ||
887 | else | 934 | else | ||
888 | { | 935 | { | ||
889 | emit newLog(i18n("Calibration rejected. Star drift is too short. Check for mount, cable, or backlash problems.")); | 936 | emit newLog(i18n("Calibration rejected. Star drift is too short. Check for mount, cable, or backlash problems.")); | ||
890 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Failed: drift too short.")); | 937 | emit calibrationUpdate(GuideInterface::CALIBRATION_MESSAGE_ONLY, i18n("Calibration Failed: drift too short.")); | ||
891 | 938 | | |||
892 | emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR); | 939 | emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR); | ||
893 | 940 | | |||
894 | //ui.startCalibrationLED->setColor(alertColor); | 941 | //ui.startCalibrationLED->setColor(alertColor); | ||
895 | calibrationStage = CAL_ERROR; | 942 | calibrationStage = CAL_ERROR; | ||
896 | KSNotification::event(QLatin1String("CalibrationFailed"), | 943 | KSNotification::event(QLatin1String("CalibrationFailed"), | ||
897 | i18n("Guiding calibration failed with errors"), KSNotification::EVENT_ALERT); | 944 | i18n("Guiding calibration failed with errors"), KSNotification::EVENT_ALERT); | ||
945 | guideLog.endCalibration(); | ||||
898 | } | 946 | } | ||
899 | 947 | | |||
900 | reset(); | 948 | reset(); | ||
901 | 949 | | |||
902 | break; | 950 | break; | ||
903 | } | 951 | } | ||
904 | 952 | | |||
905 | default: | 953 | default: | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 1047 | { | |||
1001 | { | 1049 | { | ||
1002 | Vector star_pos = pmath->findLocalStarPosition(); | 1050 | Vector star_pos = pmath->findLocalStarPosition(); | ||
1003 | pmath->setReticleParameters(star_pos.x, star_pos.y, -1); | 1051 | pmath->setReticleParameters(star_pos.x, star_pos.y, -1); | ||
1004 | } | 1052 | } | ||
1005 | m_isFirstFrame = false; | 1053 | m_isFirstFrame = false; | ||
1006 | } | 1054 | } | ||
1007 | 1055 | | |||
1008 | // calc math. it tracks square | 1056 | // calc math. it tracks square | ||
1009 | pmath->performProcessing(); | 1057 | pmath->performProcessing(&guideLog); | ||
1010 | 1058 | | |||
1011 | if (pmath->isStarLost()) | 1059 | if (pmath->isStarLost()) | ||
1012 | m_starLostCounter++; | 1060 | m_starLostCounter++; | ||
1013 | else | 1061 | else | ||
1014 | m_starLostCounter = 0; | 1062 | m_starLostCounter = 0; | ||
1015 | 1063 | | |||
1016 | // do pulse | 1064 | // do pulse | ||
1017 | out = pmath->getOutputParameters(); | 1065 | out = pmath->getOutputParameters(); | ||
▲ Show 20 Lines • Show All 321 Lines • ▼ Show 20 Line(s) | 1385 | { | |||
1339 | m_isFirstFrame = true; | 1387 | m_isFirstFrame = true; | ||
1340 | pmath->reset(); | 1388 | pmath->reset(); | ||
1341 | // If we were in the process of dithering, wait until settle and resume | 1389 | // If we were in the process of dithering, wait until settle and resume | ||
1342 | if (rememberState == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING) | 1390 | if (rememberState == GUIDE_DITHERING || state == GUIDE_MANUAL_DITHERING) | ||
1343 | { | 1391 | { | ||
1344 | if (Options::ditherSettle() > 0) | 1392 | if (Options::ditherSettle() > 0) | ||
1345 | { | 1393 | { | ||
1346 | state = GUIDE_DITHERING_SETTLE; | 1394 | state = GUIDE_DITHERING_SETTLE; | ||
1395 | guideLog.settleStartedInfo(); | ||||
1347 | emit newStatus(state); | 1396 | emit newStatus(state); | ||
1348 | } | 1397 | } | ||
1349 | 1398 | | |||
1350 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | 1399 | QTimer::singleShot(Options::ditherSettle() * 1000, this, SLOT(setDitherSettled())); | ||
1351 | } | 1400 | } | ||
1352 | else | 1401 | else | ||
1353 | { | 1402 | { | ||
1354 | state = GUIDE_GUIDING; | 1403 | state = GUIDE_GUIDING; | ||
1355 | emit newStatus(state); | 1404 | emit newStatus(state); | ||
1356 | } | 1405 | } | ||
1357 | 1406 | | |||
1358 | } | 1407 | } | ||
1359 | else if (reacquireTimer.elapsed() > static_cast<int>(Options::guideLostStarTimeout() * 1000)) | 1408 | else if (reacquireTimer.elapsed() > static_cast<int>(Options::guideLostStarTimeout() * 1000)) | ||
1360 | { | 1409 | { | ||
1361 | emit newLog(i18n("Failed to find any suitable guide stars. Aborting...")); | 1410 | emit newLog(i18n("Failed to find any suitable guide stars. Aborting...")); | ||
1362 | abort(); | 1411 | abort(); | ||
1363 | return false; | 1412 | return false; | ||
1364 | } | 1413 | } | ||
1365 | 1414 | | |||
1366 | emit frameCaptureRequested(); | 1415 | emit frameCaptureRequested(); | ||
1367 | return rc; | 1416 | return rc; | ||
1368 | } | 1417 | } | ||
1369 | 1418 | | |||
1419 | void InternalGuider::fillGuideInfo(GuideLog::GuideInfo *info) | ||||
1420 | { | ||||
1421 | // NOTE: just using the X values, phd2logview assumes x & y the same. | ||||
1422 | // pixel scale in arc-sec / pixel. The 2nd and 3rd values seem redundent, but are | ||||
1423 | // in the phd2 logs. | ||||
1424 | info->pixelScale = this->ccdPixelSizeX * this->subBinX * this->mountFocalLength / 206.264; | ||||
1425 | info->binning = this->subBinX; | ||||
1426 | info->focalLength = this->mountFocalLength; | ||||
1427 | info->ra = this->mountRA.Degrees(); | ||||
1428 | info->dec = this->mountDEC.Degrees(); | ||||
1429 | info->azimuth = this->mountAzimuth.Degrees(); | ||||
1430 | info->altitude = this->mountAltitude.Degrees(); | ||||
1431 | info->pierSide = this->pierSide; | ||||
1432 | } | ||||
1433 | | ||||
1370 | } | 1434 | } |