• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • edu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • extragear
  • edu
  • kstars
  • kstars
  • ekos
  • guide
  • internalguide
guider.cpp
Go to the documentation of this file.
1 /* Ekos guide tool
2  Copyright (C) 2012 Andrew Stepanenko
3 
4  Modified by Jasem Mutlaq <[email protected]> for KStars.
5 
6  This application is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10  */
11 
12 #include "guider.h"
13 
14 #include "gmath.h"
15 #include "kstars.h"
16 #include "kspaths.h"
17 #include "Options.h"
18 #include "scroll_graph.h"
19 #include "../phd2.h"
20 #include "../ekosmanager.h"
21 #include "fitsviewer/fitsview.h"
22 
23 #include <KMessageBox>
24 #include <KLocalizedString>
25 #include <KNotifications/KNotification>
26 
27 #include <cmath>
28 #include <cstdlib>
29 #include <cassert>
30 
31 internalGuider::internalGuider(cgmath *mathObject, Ekos::Guide *parent) : QWidget(parent)
32 {
33  ui.setupUi(this);
34 
35  guideModule = parent;
36 
37  phd2 = nullptr;
38  targetChip = nullptr;
39 
40  m_useRapidGuide = false;
41  first_frame = false;
42  first_subframe = false;
43  m_isSubFramed = false;
44 
45  m_lostStarTries = 0;
46 
47  ui.comboBox_ThresholdAlg->clear();
48  for (int i = 0; guide_square_alg[i].idx != -1; ++i)
49  ui.comboBox_ThresholdAlg->addItem(QString(guide_square_alg[i].name));
50 
51  // connect ui
52  connect(ui.rapidGuideCheck, SIGNAL(toggled(bool)), this, SLOT(onRapidGuideChanged(bool)));
53  connect(ui.connectPHD2B, SIGNAL(clicked()), this, SLOT(connectPHD2()));
54  connect(ui.captureB, SIGNAL(clicked()), this, SLOT(capture()));
55  connect(ui.pushButton_StartStop, SIGNAL(clicked()), this, SLOT(onStartStopButtonClick()));
56  connect(ui.ditherCheck, SIGNAL(toggled(bool)), this, SIGNAL(ditherToggled(bool)));
57 
58  pmath = mathObject;
59 
60  // init drift widget
61  pDriftOut = new custom_drawer(ui.frame_Graph);
62  pDriftOut->move(ui.frame_Graph->frameWidth(), ui.frame_Graph->frameWidth());
63  pDriftOut->setAttribute(Qt::WA_NoSystemBackground, true);
64  ui.frame_Graph->setAttribute(Qt::WA_NoSystemBackground, true);
65 
66  pDriftOut->set_source(drift_graph->get_buffer(), nullptr);
67 
68  drift_graph = new ScrollGraph(this, DRIFT_GRAPH_WIDTH, DRIFT_GRAPH_HEIGHT);
69  drift_graph->set_visible_ranges(DRIFT_GRAPH_WIDTH, 60);
70  drift_graph->on_paint();
71  ui.frame_Graph->resize(DRIFT_GRAPH_WIDTH + 2 * ui.frame_Graph->frameWidth(),
72  DRIFT_GRAPH_HEIGHT + 2 * ui.frame_Graph->frameWidth());
73 
74  // not UI vars
75  m_isStarted = false;
76  m_isReady = false;
77  half_refresh_rate = false;
78  m_isDithering = false;
79 
80  ui.ditherCheck->setChecked(Options::useDither());
81  ui.ditherPixels->setValue(Options::ditherPixels());
82  ui.spinBox_AOLimit->setValue(Options::aOLimit());
83 
84  QString logFileName = KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/guide_log.txt";
85  logFile.setFileName(logFileName);
86 }
87 
88 internalGuider::~internalGuider()
89 {
90  delete pDriftOut;
91  delete drift_graph;
92 }
93 
94 void internalGuider::setHalfRefreshRate(bool is_half)
95 {
96  half_refresh_rate = is_half;
97 }
98 
99 bool internalGuider::isGuiding(void) const
100 {
101  return m_isStarted;
102 }
103 
104 void internalGuider::setMathObject(cgmath *math)
105 {
106  assert(math);
107  pmath = math;
108 }
109 
110 void internalGuider::setAO(bool enable)
111 {
112  ui.spinBox_AOLimit->setEnabled(enable);
113 }
114 
115 double internalGuider::getAOLimit()
116 {
117  return ui.spinBox_AOLimit->value();
118 }
119 
120 void internalGuider::setInterface(void)
121 {
122  const cproc_out_params *out_params;
123  info_params_t info_params;
124  QString str;
125  int rx, ry;
126 
127  assert(pmath);
128 
129  info_params = pmath->getInfoParameters();
130  out_params = pmath->getOutputParameters();
131 
132  drift_graph->get_visible_ranges(&rx, &ry);
133  ui.spinBox_XScale->setValue(rx / drift_graph->get_grid_N());
134  ui.spinBox_YScale->setValue(ry / drift_graph->get_grid_N());
135 
136  ui.comboBox_ThresholdAlg->setCurrentIndex(pmath->getSquareAlgorithmIndex());
137 
138  ui.l_RecommendedGain->setText(
139  i18n("P: %1", QString().setNum(cgmath::preCalculateProportionalGain(Options::guidingRate()), 'f', 2)));
140  ui.spinBox_GuideRate->setValue(Options::guidingRate());
141 
142  // info params...
143  ui.l_Focal->setText(str.setNum((int)info_params.focal));
144  ui.l_Aperture->setText(str.setNum((int)info_params.aperture));
145  ui.l_FbyD->setText(QString().setNum(info_params.focal_ratio, 'f', 1));
146  str = QString().setNum(info_params.fov_wd, 'f', 1) + 'x' + QString().setNum(info_params.fov_ht, 'f', 1);
147  ui.l_FOV->setText(str);
148 
149  ui.checkBox_DirRA->setChecked(Options::enableRAGuide());
150  ui.checkBox_DirDEC->setChecked(Options::enableDECGuide());
151 
152  ui.spinBox_PropGainRA->setValue(Options::rAProportionalGain());
153  ui.spinBox_PropGainDEC->setValue(Options::dECProportionalGain());
154 
155  ui.spinBox_IntGainRA->setValue(Options::rAIntegralGain());
156  ui.spinBox_IntGainDEC->setValue(Options::dECIntegralGain());
157 
158  ui.spinBox_DerGainRA->setValue(Options::rADerivativeGain());
159  ui.spinBox_DerGainDEC->setValue(Options::dECDerivativeGain());
160 
161  ui.spinBox_MaxPulseRA->setValue(Options::rAMaximumPulse());
162  ui.spinBox_MaxPulseDEC->setValue(Options::dECMaximumPulse());
163 
164  ui.spinBox_MinPulseRA->setValue(Options::rAMinimumPulse());
165  ui.spinBox_MinPulseDEC->setValue(Options::dECMinimumPulse());
166 
167  ui.l_DeltaRA->setText(QString().setNum(out_params->delta[GUIDE_RA], 'f', 2));
168  ui.l_DeltaDEC->setText(QString().setNum(out_params->delta[GUIDE_DEC], 'f', 2));
169 
170  ui.l_PulseRA->setText(QString().setNum(out_params->pulse_length[GUIDE_RA]));
171  ui.l_PulseDEC->setText(QString().setNum(out_params->pulse_length[GUIDE_DEC]));
172 
173  ui.l_ErrRA->setText(QString().setNum(out_params->sigma[GUIDE_RA], 'g', 3));
174  ui.l_ErrDEC->setText(QString().setNum(out_params->sigma[GUIDE_DEC], 'g', 3));
175 }
176 
177 void internalGuider::setTargetChip(ISD::CCDChip *chip)
178 {
179  targetChip = chip;
180  targetChip->getFrame(&fx, &fy, &fw, &fh);
181  if (phd2 == nullptr)
182  ui.subFrameCheck->setEnabled(targetChip->canSubframe());
183 }
184 
185 bool internalGuider::start()
186 {
187  Options::setUseDither(ui.ditherCheck->isChecked());
188  Options::setDitherPixels(ui.ditherPixels->value());
189  Options::setAOLimit(ui.spinBox_AOLimit->value());
190  Options::setGuidingRate(ui.spinBox_GuideRate->value());
191  Options::setEnableRAGuide(ui.checkBox_DirRA->isChecked());
192  Options::setEnableDECGuide(ui.checkBox_DirDEC->isChecked());
193  Options::setRAProportionalGain(ui.spinBox_PropGainRA->value());
194  Options::setDECProportionalGain(ui.spinBox_PropGainDEC->value());
195  Options::setRAIntegralGain(ui.spinBox_IntGainRA->value());
196  Options::setDECIntegralGain(ui.spinBox_IntGainDEC->value());
197  Options::setRADerivativeGain(ui.spinBox_DerGainRA->value());
198  Options::setDECDerivativeGain(ui.spinBox_DerGainDEC->value());
199  Options::setRAMaximumPulse(ui.spinBox_MaxPulseRA->value());
200  Options::setDECMaximumPulse(ui.spinBox_MaxPulseDEC->value());
201  Options::setRAMinimumPulse(ui.spinBox_MinPulseRA->value());
202  Options::setDECMinimumPulse(ui.spinBox_MinPulseDEC->value());
203 
204  if (guideFrame)
205  disconnect(guideFrame, SIGNAL(trackingStarSelected(int,int)), 0, 0);
206 
207  // Let everyone know about dither option status
208  emit ditherToggled(ui.ditherCheck->isChecked());
209 
210  if (phd2)
211  {
212  phd2->startGuiding();
213 
214  m_isStarted = true;
215  m_useRapidGuide = ui.rapidGuideCheck->isChecked();
216 
217  //pmain_wnd->setSuspended(false);
218 
219  ui.pushButton_StartStop->setText(i18n("Stop"));
220  guideModule->appendLogText(i18n("Autoguiding started."));
221 
222  return true;
223  }
224 
225  logFile.open(QIODevice::WriteOnly | QIODevice::Text);
226  QTextStream out(&logFile);
227  out << "Guiding rate,x15 arcsec/sec: " << ui.spinBox_GuideRate->value() << endl;
228  out << "Focal,mm: " << ui.l_Focal->text() << endl;
229  out << "Aperture,mm: " << ui.l_Aperture->text() << endl;
230  out << "F/D: " << ui.l_FbyD->text() << endl;
231  out << "FOV: " << ui.l_FOV->text() << endl;
232  out << "Frame #, Time Elapsed (ms), RA Error (arcsec), RA Correction (ms), RA Correction Direction, DEC Error "
233  "(arcsec), DEC Correction (ms), DEC Correction Direction"
234  << endl;
235 
236  drift_graph->reset_data();
237  ui.pushButton_StartStop->setText(i18n("Stop"));
238  guideModule->appendLogText(i18n("Autoguiding started."));
239  pmath->start();
240  m_lostStarTries = 0;
241  m_isStarted = true;
242  m_useRapidGuide = ui.rapidGuideCheck->isChecked();
243  if (m_useRapidGuide)
244  guideModule->startRapidGuide();
245 
246  emit newStatus(Ekos::GUIDE_GUIDING);
247 
248  guideModule->setSuspended(false);
249 
250  first_frame = true;
251 
252  if (ui.subFrameCheck->isEnabled() && ui.subFrameCheck->isChecked() && m_isSubFramed == false)
253  first_subframe = true;
254 
255  capture();
256 
257  pmath->setLogFile(&logFile);
258 
259  return true;
260 }
261 
262 bool internalGuider::stop()
263 {
264  if (phd2)
265  {
266  ui.pushButton_StartStop->setText(i18n("Start Autoguide"));
267  //emit autoGuidingToggled(false);
268 
269  m_isDithering = false;
270  m_isStarted = false;
271 
272  return phd2->stopGuiding();
273  }
274 
275  if (guideFrame)
276  connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int,int)),
277  Qt::UniqueConnection);
278  ui.pushButton_StartStop->setText(i18n("Start Autoguide"));
279  guideModule->appendLogText(i18n("Autoguiding stopped."));
280  pmath->stop();
281 
282  first_frame = false;
283  logFile.close();
284 
285  targetChip->abortExposure();
286 
287  if (m_useRapidGuide)
288  guideModule->stopRapidGuide();
289 
290  emit newStatus(Ekos::GUIDE_IDLE);
291 
292  m_isDithering = false;
293  m_isStarted = false;
294 
295  return true;
296 }
297 
298 void internalGuider::toggleExternalGuideStateGUI(Ekos::GuideState state)
299 {
300  if (phd2 == nullptr)
301  return;
302 
303  // If not started already
304  if (m_isStarted == false && state == Ekos::GUIDE_GUIDING)
305  {
306  m_isStarted = true;
307  m_useRapidGuide = ui.rapidGuideCheck->isChecked();
308 
309  ui.pushButton_StartStop->setText(i18n("Stop"));
310  guideModule->appendLogText(i18n("Autoguiding started."));
311  }
312  // if already started
313  else if (m_isStarted && state == Ekos::GUIDE_IDLE)
314  {
315  ui.pushButton_StartStop->setText(i18n("Start Autoguide"));
316  }
317 }
318 
319 // processing stuff
320 void internalGuider::onStartStopButtonClick()
321 {
322  assert(pmath);
323  assert(targetChip);
324 
325  // start
326  if (!m_isStarted)
327  start();
328  // stop
329  else
330  stop();
331 }
332 
333 void internalGuider::capture()
334 {
335  if (ui.subFrameCheck->isChecked() && m_isSubFramed == false)
336  {
337  int x, y, w, h, binX = 1, binY = 1;
338  targetChip->getBinning(&binX, &binY);
339  int square_size = guideFrame->getTrackingBox().width();
340 
341  pmath->getReticleParameters(&ret_x, &ret_y, &ret_angle);
342  x = (ret_x - square_size) * binX;
343  y = (ret_y - square_size) * binY;
344  w = square_size * 2 * binX;
345  h = square_size * 2 * binY;
346 
347  int minX, maxX, minY, maxY, minW, maxW, minH, maxH;
348  targetChip->getFrameMinMax(&minX, &maxX, &minY, &maxY, &minW, &maxW, &minH, &maxH);
349 
350  m_isSubFramed = true;
351 
352  if (x < minX)
353  x = minX;
354  if (y < minY)
355  y = minY;
356  if ((w + x) > maxW)
357  w = maxW - x;
358  if ((h + y) > maxH)
359  h = maxH - y;
360 
361  pmath->setVideoParameters(w / binX, h / binY);
362 
363  targetChip->setFrame(x, y, w, h);
364 
365  //trackingStarSelected(w/(binX*2), h/(binY*2));
366 
367  pmath->setReticleParameters(w / (binX * 2), h / (binY * 2), ret_angle);
368 
369  //emit newStarPosition(QVector3D(w/(binX*2), h/(binY*2), 0), false);
370  emit newStarPosition(QVector3D(), false);
371  }
372  else if (m_isSubFramed && ui.subFrameCheck->isChecked() == false)
373  {
374  m_isSubFramed = false;
375  targetChip->resetFrame();
376 
377  emit newStarPosition(QVector3D(), false);
378  }
379 
380  guideModule->capture();
381 }
382 
383 void internalGuider::onSetDECSwap(bool enable)
384 {
385  guideModule->setDECSwap(enable);
386 }
387 
388 void internalGuider::setDECSwap(bool enable)
389 {
390  ui.swapCheck->disconnect(this);
391  ui.swapCheck->setChecked(enable);
392  connect(ui.swapCheck, SIGNAL(toggled(bool)), this, SLOT(setDECSwap(bool)));
393 }
394 
395 void internalGuider::guide(void)
396 {
397  static int maxPulseCounter = 0;
398  const cproc_out_params *out;
399  QString str;
400  uint32_t tick = 0;
401  double drift_x = 0, drift_y = 0;
402 
403  Q_ASSERT(pmath);
404 
405  if (first_subframe)
406  {
407  first_subframe = false;
408  return;
409  }
410  else if (first_frame)
411  {
412  if (m_isDithering == false)
413  {
414  Vector star_pos = pmath->findLocalStarPosition();
415  pmath->setReticleParameters(star_pos.x, star_pos.y, -1);
416 
417  //pmath->moveSquare( round(star_pos.x) - (double)square_size/(2*binx), round(star_pos.y) - (double)square_size/(2*biny) );
418  }
419  first_frame = false;
420  }
421 
422  // calc math. it tracks square
423  pmath->performProcessing();
424 
425  if (!m_isStarted)
426  return;
427 
428  if (pmath->isStarLost() && ++m_lostStarTries > 2)
429  {
430  guideModule->appendLogText(
431  i18n("Lost track of the guide star. Try increasing the square size and check the mount."));
432  onStartStopButtonClick();
433  return;
434  }
435  else
436  m_lostStarTries = 0;
437 
438  // do pulse
439  out = pmath->getOutputParameters();
440 
441  if (out->pulse_length[GUIDE_RA] == ui.spinBox_MaxPulseRA->value() ||
442  out->pulse_length[GUIDE_DEC] == ui.spinBox_MaxPulseDEC->value())
443  maxPulseCounter++;
444  else
445  maxPulseCounter = 0;
446 
447  if (maxPulseCounter > 3)
448  {
449  guideModule->appendLogText(i18n("Lost track of the guide star. Aborting guiding..."));
450  abort();
451  maxPulseCounter = 0;
452  }
453 
454  guideModule->sendPulse(out->pulse_dir[GUIDE_RA], out->pulse_length[GUIDE_RA], out->pulse_dir[GUIDE_DEC],
455  out->pulse_length[GUIDE_DEC]);
456 
457  if (m_isDithering)
458  return;
459 
460  pmath->getStarDrift(&drift_x, &drift_y);
461 
462  drift_graph->add_point(drift_x, drift_y);
463 
464  tick = pmath->getTicks();
465 
466  if (tick & 1)
467  {
468  // draw some params in window
469  ui.l_DeltaRA->setText(str.setNum(out->delta[GUIDE_RA], 'f', 2));
470  ui.l_DeltaDEC->setText(str.setNum(out->delta[GUIDE_DEC], 'f', 2));
471 
472  ui.l_PulseRA->setText(str.setNum(out->pulse_length[GUIDE_RA]));
473  ui.l_PulseDEC->setText(str.setNum(out->pulse_length[GUIDE_DEC]));
474 
475  ui.l_ErrRA->setText(str.setNum(out->sigma[GUIDE_RA], 'g', 3));
476  ui.l_ErrDEC->setText(str.setNum(out->sigma[GUIDE_DEC], 'g', 3));
477  }
478 
479  // skip half frames
480  if (half_refresh_rate && (tick & 1))
481  return;
482 
483  drift_graph->on_paint();
484  pDriftOut->update();
485 
486  profilePixmap = pDriftOut->grab(QRect(QPoint(0, 100), QSize(pDriftOut->width(), 101)));
487  emit newProfilePixmap(profilePixmap);
488 }
489 
490 void internalGuider::setImageView(FITSView *image)
491 {
492  guideFrame = image;
493 
494  if (m_isReady && guideFrame && m_isStarted == false)
495  connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int,int)),
496  Qt::UniqueConnection);
497 }
498 
499 void internalGuider::trackingStarSelected(int x, int y)
500 {
501  pmath->setReticleParameters(x, y, guideModule->getReticleAngle());
502 
503  //pmath->moveSquare(x-square_size/(2*binx), y-square_size/(2*biny));
504  QVector3D starCenter = guideModule->getStarPosition();
505 
506  starCenter.setX(x);
507  starCenter.setY(y);
508 
509  emit newStarPosition(starCenter, true);
510 }
511 
512 bool internalGuider::abort(bool silence)
513 {
514  if (m_isStarted == true)
515  {
516  bool rc = stop();
517 
518  if (silence)
519  return rc;
520 
521  KNotification::event(QLatin1String("GuideFailed"), i18n("Autoguiding failed with errors"));
522  }
523 
524  return true;
525 }
526 
527 bool internalGuider::dither()
528 {
529  static Vector target_pos;
530  static unsigned int retries = 0;
531 
532  if (ui.ditherCheck->isChecked() == false)
533  return false;
534 
535  double cur_x, cur_y, ret_angle;
536  pmath->getReticleParameters(&cur_x, &cur_y, &ret_angle);
537  pmath->getStarScreenPosition(&cur_x, &cur_y);
538  Matrix ROT_Z = pmath->getROTZ();
539 
540  //qDebug() << "Star Pos X " << cur_x << " Y " << cur_y;
541 
542  if (m_isDithering == false)
543  {
544  retries = 0;
545 
546  // JM 2016-05-8: CCD would abort if required.
547  //targetChip->abortExposure();
548 
549  double ditherPixels = ui.ditherPixels->value();
550  int polarity = (rand() % 2 == 0) ? 1 : -1;
551  double angle = ((double)rand() / RAND_MAX) * M_PI / 2.0;
552  double diff_x = ditherPixels * cos(angle);
553  double diff_y = ditherPixels * sin(angle);
554 
555  m_isDithering = true;
556 
557  if (pmath->declinationSwapEnabled())
558  diff_y *= -1;
559 
560  if (polarity > 0)
561  target_pos = Vector(cur_x, cur_y, 0) + Vector(diff_x, diff_y, 0);
562  else
563  target_pos = Vector(cur_x, cur_y, 0) - Vector(diff_x, diff_y, 0);
564 
565  if (Options::guideLogging())
566  qDebug() << "Guide: Dithering process started.. Reticle Target Pos X " << target_pos.x << " Y "
567  << target_pos.y;
568 
569  pmath->setReticleParameters(target_pos.x, target_pos.y, ret_angle);
570 
571  guide();
572 
573  // Take a new exposure if we're not already capturing
574  if (targetChip->isCapturing() == false)
575  guideModule->capture();
576 
577  return true;
578  }
579 
580  Vector star_pos = Vector(cur_x, cur_y, 0) - Vector(target_pos.x, target_pos.y, 0);
581  star_pos.y = -star_pos.y;
582  star_pos = star_pos * ROT_Z;
583 
584  if (Options::guideLogging())
585  qDebug() << "Guide: Dithering in progress. Diff star X:" << star_pos.x << "Y:" << star_pos.y;
586 
587  if (fabs(star_pos.x) < 1 && fabs(star_pos.y) < 1)
588  {
589  pmath->setReticleParameters(cur_x, cur_y, ret_angle);
590 
591  m_isDithering = false;
592 
593  if (Options::guideLogging())
594  qDebug() << "Guide: Dither complete.";
595 
596  //emit ditherComplete();
597  emit newStatus(Ekos::GUIDE_DITHERING_SUCCESS);
598  }
599  else
600  {
601  if (++retries > MAX_DITHER_RETIRES)
602  {
603  m_isDithering = false;
604  return false;
605  }
606 
607  guide();
608  }
609 
610  guideModule->capture();
611 
612  return true;
613 }
614 
615 QString internalGuider::getAlgorithm()
616 {
617  return ui.comboBox_ThresholdAlg->currentText();
618 }
619 
620 bool internalGuider::useSubFrame()
621 {
622  return ui.subFrameCheck->isChecked();
623 }
624 
625 bool internalGuider::useRapidGuide()
626 {
627  return ui.rapidGuideCheck->isChecked();
628 }
629 
630 void internalGuider::setGuideOptions(const QString &algorithm, bool useSubFrame, bool useRapidGuide)
631 {
632  for (int i = 0; i < ui.comboBox_ThresholdAlg->count(); i++)
633  {
634  if (ui.comboBox_ThresholdAlg->itemText(i) == algorithm)
635  {
636  ui.comboBox_ThresholdAlg->setCurrentIndex(i);
637  break;
638  }
639  }
640  if (phd2 == nullptr)
641  ui.subFrameCheck->setChecked(useSubFrame);
642  ui.rapidGuideCheck->setChecked(useRapidGuide);
643 }
644 
645 void internalGuider::setDither(bool enable, double value)
646 {
647  ui.ditherCheck->setChecked(enable);
648 
649  if (enable && value > 0)
650  ui.ditherPixels->setValue(value);
651 }
652 
653 void internalGuider::setPHD2(Ekos::PHD2 *phd)
654 {
655  // If we already have PHD2 set but we are asked to unset it then we shall disconnect all signals first
656  if (phd2 && phd == nullptr)
657  phd2->disconnect();
658 
659  phd2 = phd;
660 
661  bool enable = (phd2 == nullptr) ? true : false;
662 
663  if (phd2)
664  {
665  if (phd2->isConnected())
666  setPHD2Connected();
667  else
668  setPHD2Disconnected();
669 
670  connect(phd2, SIGNAL(connected()), this, SLOT(setPHD2Connected()), Qt::UniqueConnection);
671  connect(phd2, SIGNAL(disconnected()), this, SLOT(setPHD2Disconnected()), Qt::UniqueConnection);
672  }
673 
674  ui.connectPHD2B->setHidden(enable);
675 
676  ui.pushButton_StartStop->setEnabled(enable);
677  ui.controlGroup->setEnabled(enable);
678  ui.infoGroup->setEnabled(enable);
679  ui.captureB->setEnabled(enable);
680  ui.subFrameCheck->setEnabled(enable);
681  ui.rapidGuideCheck->setEnabled(enable);
682  ui.comboBox_ThresholdAlg->setEnabled(enable);
683  ui.ditherCheck->setEnabled(enable);
684  ui.ditherPixels->setEnabled(enable);
685  ui.driftGraphicsGroup->setEnabled(enable);
686 }
687 
688 void internalGuider::connectPHD2()
689 {
690  if (phd2)
691  {
692  if (phd2->isConnected())
693  phd2->disconnectPHD2();
694  else
695  phd2->connectPHD2();
696  }
697 }
698 
699 void internalGuider::setPHD2Connected()
700 {
701  ui.connectPHD2B->setText(i18n("Disconnect PHD2"));
702 
703  ui.pushButton_StartStop->setEnabled(true);
704  ui.ditherCheck->setEnabled(true);
705  ui.ditherPixels->setEnabled(true);
706 }
707 
708 void internalGuider::setPHD2Disconnected()
709 {
710  ui.connectPHD2B->setText(i18n("Connect PHD2"));
711 
712  ui.pushButton_StartStop->setEnabled(false);
713  ui.ditherCheck->setEnabled(false);
714  ui.ditherPixels->setEnabled(false);
715 }
Ekos::Guide::sendPulse
bool sendPulse(GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs)
Definition: guide.cpp:1336
cgmath::setVideoParameters
bool setVideoParameters(int vid_wd, int vid_ht, int binX, int binY)
Definition: gmath.cpp:108
internalGuider::setInterface
void setInterface(void)
Definition: guider.cpp:120
Ekos::Guide::capture
Q_SCRIPTABLE bool capture()
DBUS interface function.
Definition: guide.cpp:1023
QWidget
Ekos::GuideState
GuideState
Definition: ekos.h:45
cgmath::getReticleParameters
bool getReticleParameters(double *x, double *y, double *ang) const
Definition: gmath.cpp:206
KSNotification::event
void event(const QLatin1String &name, const QString &message, EventType type)
Definition: ksnotification.cpp:78
internalGuider::onStartStopButtonClick
void onStartStopButtonClick()
Definition: guider.cpp:320
ISD::CCDChip::resetFrame
bool resetFrame()
Definition: indiccd.cpp:362
Ekos::Guide::appendLogText
void appendLogText(const QString &)
Definition: guide.cpp:1308
Options::setRAMaximumPulse
static void setRAMaximumPulse(uint v)
Set RAMaximumPulse.
Definition: Options.h:8609
ISD::CCDChip::setFrame
bool setFrame(int x, int y, int w, int h, bool force=false)
Definition: indiccd.cpp:403
Vector::x
double x
Definition: vect.h:21
Options::setDECIntegralGain
static void setDECIntegralGain(double v)
Set DECIntegralGain.
Definition: Options.h:8552
cgmath::getSquareAlgorithmIndex
int getSquareAlgorithmIndex(void) const
Definition: gmath.cpp:217
gmath.h
ISD::CCDChip
CCDChip class controls a particular chip in CCD device.
Definition: indiccd.h:45
internalGuider::onSetDECSwap
void onSetDECSwap(bool enable)
Definition: guider.cpp:383
internalGuider::isGuiding
bool isGuiding(void) const
Definition: guider.cpp:99
ISD::CCDChip::isCapturing
bool isCapturing()
Definition: indiccd.cpp:613
guide_square_alg
const square_alg_t guide_square_alg[]
Definition: gmath.cpp:39
Options::dECProportionalGain
static double dECProportionalGain()
Get DECProportionalGain.
Definition: Options.h:8524
internalGuider::setTargetChip
void setTargetChip(ISD::CCDChip *chip)
Definition: guider.cpp:177
Options::rAProportionalGain
static double rAProportionalGain()
Get RAProportionalGain.
Definition: Options.h:8505
Vector
Definition: vect.h:18
square_alg_t::idx
int idx
Definition: gmath.h:45
Options::rAMaximumPulse
static uint rAMaximumPulse()
Get RAMaximumPulse.
Definition: Options.h:8619
cgmath::findLocalStarPosition
Vector findLocalStarPosition(void) const
Definition: gmath.cpp:714
internalGuider::setImageView
void setImageView(FITSView *image)
Definition: guider.cpp:490
GUIDE_RA
#define GUIDE_RA
Definition: gmath.h:55
QWidget::y
int y() const
info_params_t
Definition: gmath.h:96
QFile::setFileName
void setFileName(const QString &name)
info_params_t::focal
double focal
Definition: gmath.h:100
internalGuider::setPHD2Disconnected
void setPHD2Disconnected()
Definition: guider.cpp:708
Ekos::PHD2
Uses external PHD2 for guiding.
Definition: phd2.h:32
cgmath::declinationSwapEnabled
bool declinationSwapEnabled()
Definition: gmath.h:126
internalGuider::ditherToggled
void ditherToggled(bool)
internalGuider::setDither
void setDither(bool enable, double value)
Definition: guider.cpp:645
cgmath::getInfoParameters
info_params_t getInfoParameters(void) const
Definition: gmath.cpp:222
FITSView
Definition: fitsview.h:52
KSPaths::writableLocation
static QString writableLocation(QStandardPaths::StandardLocation type)
Definition: kspaths.h:38
QPoint
internalGuider::guide
void guide(void)
Definition: guider.cpp:395
kspaths.h
Ekos::GUIDE_IDLE
Definition: ekos.h:46
cgmath::isStarLost
bool isStarLost(void) const
Definition: gmath.cpp:557
internalGuider::setPHD2
void setPHD2(Ekos::PHD2 *phd)
Definition: guider.cpp:653
Options::rAMinimumPulse
static uint rAMinimumPulse()
Get RAMinimumPulse.
Definition: Options.h:8657
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QVector3D
internalGuider::getAOLimit
double getAOLimit()
Definition: guider.cpp:115
Ekos::GUIDE_DITHERING_SUCCESS
Definition: ekos.h:64
fitsview.h
cgmath::getTicks
uint32_t getTicks(void) const
Definition: gmath.cpp:239
QTextStream
cgmath::setReticleParameters
bool setReticleParameters(double x, double y, double ang)
Definition: gmath.cpp:178
cgmath::getStarScreenPosition
void getStarScreenPosition(double *dx, double *dy) const
Definition: gmath.cpp:250
ISD::CCDChip::abortExposure
bool abortExposure()
Definition: indiccd.cpp:511
Options::setRAIntegralGain
static void setRAIntegralGain(double v)
Set RAIntegralGain.
Definition: Options.h:8533
cproc_out_params::pulse_dir
GuideDirection pulse_dir[2]
Definition: gmath.h:91
cproc_out_params
Definition: gmath.h:84
QObject::name
const char * name() const
internalGuider::setDECSwap
void setDECSwap(bool enable)
Definition: guider.cpp:388
QRect
QWidget::x
int x() const
internalGuider::internalGuider
internalGuider(cgmath *mathObject, Ekos::Guide *parent=nullptr)
Definition: guider.cpp:31
Options::setDitherPixels
static void setDitherPixels(double v)
Set How many pixels to move between subsequent exposures under auto dithering mode.
Definition: Options.h:8172
Ekos::Guide::getStarPosition
QVector3D getStarPosition()
getStarPosition Return star center as selected by the user or auto-detected by KStars ...
Definition: guide.h:229
Options::rADerivativeGain
static double rADerivativeGain()
Get RADerivativeGain.
Definition: Options.h:8581
cproc_out_params::delta
double delta[2]
Definition: gmath.h:90
internalGuider::connectPHD2
void connectPHD2()
Definition: guider.cpp:688
Options::setDECMinimumPulse
static void setDECMinimumPulse(uint v)
Set DECMinimumPulse.
Definition: Options.h:8666
Ekos::GUIDE_GUIDING
Definition: ekos.h:58
cgmath::stop
void stop(void)
Definition: gmath.cpp:542
internalGuider::useRapidGuide
bool useRapidGuide()
Definition: guider.cpp:625
Options::dECDerivativeGain
static double dECDerivativeGain()
Get DECDerivativeGain.
Definition: Options.h:8600
Options::guideLogging
static bool guideLogging()
Get GuideLogging.
Definition: Options.h:5218
Ekos::Guide
Performs calibration and autoguiding using an ST4 port or directly via the INDI driver.
Definition: guide.h:46
QString
QVector3D::setX
void setX(qreal x)
QVector3D::setY
void setY(qreal y)
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
internalGuider::toggleExternalGuideStateGUI
void toggleExternalGuideStateGUI(Ekos::GuideState state)
Definition: guider.cpp:298
Options::setDECMaximumPulse
static void setDECMaximumPulse(uint v)
Set DECMaximumPulse.
Definition: Options.h:8628
info_params_t::focal_ratio
double focal_ratio
Definition: gmath.h:98
Options::ditherPixels
static double ditherPixels()
Get How many pixels to move between subsequent exposures under auto dithering mode.
Definition: Options.h:8182
Options::setRADerivativeGain
static void setRADerivativeGain(double v)
Set RADerivativeGain.
Definition: Options.h:8571
internalGuider::newStatus
void newStatus(Ekos::GuideState)
Options::setRAProportionalGain
static void setRAProportionalGain(double v)
Set RAProportionalGain.
Definition: Options.h:8495
Options::dECMinimumPulse
static uint dECMinimumPulse()
Get DECMinimumPulse.
Definition: Options.h:8676
cgmath
Definition: gmath.h:103
internalGuider::setMathObject
void setMathObject(cgmath *math)
Definition: guider.cpp:104
QSize
Ekos::PHD2::isConnected
bool isConnected() override
Definition: phd2.h:144
ISD::CCDChip::getFrame
bool getFrame(int *x, int *y, int *w, int *h)
Definition: indiccd.cpp:316
QFile::close
virtual void close()
cgmath::performProcessing
void performProcessing(void)
Definition: gmath.cpp:1295
internalGuider::stop
bool stop()
Definition: guider.cpp:262
internalGuider::getAlgorithm
QString getAlgorithm()
Definition: guider.cpp:615
internalGuider::dither
bool dither()
Definition: guider.cpp:527
internalGuider::setGuideOptions
void setGuideOptions(const QString &algorithm, bool useSubFrame, bool useRapidGuide)
Definition: guider.cpp:630
Options.h
ISD::CCDChip::getFrameMinMax
bool getFrameMinMax(int *minX, int *maxX, int *minY, int *maxY, int *minW, int *maxW, int *minH, int *maxH)
Definition: indiccd.cpp:185
internalGuider::setAO
void setAO(bool enable)
Definition: guider.cpp:110
Options::rAIntegralGain
static double rAIntegralGain()
Get RAIntegralGain.
Definition: Options.h:8543
cgmath::start
void start(void)
Definition: gmath.cpp:509
internalGuider::capture
void capture()
Definition: guider.cpp:333
ISD::CCDChip::getBinning
CCDBinType getBinning()
Definition: indiccd.cpp:746
cproc_out_params::pulse_length
int pulse_length[2]
Definition: gmath.h:92
QLatin1String
internalGuider::~internalGuider
~internalGuider()
Definition: guider.cpp:88
Options::guidingRate
static double guidingRate()
Get GuidingRate.
Definition: Options.h:8695
Options::setRAMinimumPulse
static void setRAMinimumPulse(uint v)
Set RAMinimumPulse.
Definition: Options.h:8647
ISD::CCDChip::canSubframe
bool canSubframe() const
Definition: indiccd.cpp:549
QString::setNum
QString & setNum(short n, int base)
cgmath::getROTZ
Ekos::Matrix getROTZ()
Definition: gmath.h:120
cgmath::getStarDrift
void getStarDrift(double *dx, double *dy) const
Definition: gmath.cpp:244
info_params_t::aperture
double aperture
Definition: gmath.h:100
Options::setDECProportionalGain
static void setDECProportionalGain(double v)
Set DECProportionalGain.
Definition: Options.h:8514
Options::setGuidingRate
static void setGuidingRate(double v)
Set GuidingRate.
Definition: Options.h:8685
Ekos::Guide::setDECSwap
void setDECSwap(bool enable)
setDECSwap Change ST4 declination pulse direction.
Definition: guide.cpp:1324
internalGuider::setHalfRefreshRate
void setHalfRefreshRate(bool is_half)
Definition: guider.cpp:94
internalGuider::useSubFrame
bool useSubFrame()
Definition: guider.cpp:620
internalGuider::onRapidGuideChanged
void onRapidGuideChanged(bool enable)
internalGuider::newStarPosition
void newStarPosition(QVector3D, bool)
GUIDE_DEC
#define GUIDE_DEC
Definition: gmath.h:56
guider.h
cproc_out_params::sigma
double sigma[2]
Definition: gmath.h:93
info_params_t::fov_ht
double fov_ht
Definition: gmath.h:99
Options::dECMaximumPulse
static uint dECMaximumPulse()
Get DECMaximumPulse.
Definition: Options.h:8638
internalGuider::setPHD2Connected
void setPHD2Connected()
Definition: guider.cpp:699
Options::dECIntegralGain
static double dECIntegralGain()
Get DECIntegralGain.
Definition: Options.h:8562
Options::aOLimit
static double aOLimit()
Get The Adaptive Optics unit is utilized if the guiding deviation is less than this limit in arcsecon...
Definition: Options.h:8372
Options::setAOLimit
static void setAOLimit(double v)
Set The Adaptive Optics unit is utilized if the guiding deviation is less than this limit in arcsecon...
Definition: Options.h:8362
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject::parent
QObject * parent() const
internalGuider::abort
bool abort(bool silence=false)
Definition: guider.cpp:512
kstars.h
info_params_t::fov_wd
double fov_wd
Definition: gmath.h:99
Options::setDECDerivativeGain
static void setDECDerivativeGain(double v)
Set DECDerivativeGain.
Definition: Options.h:8590
internalGuider::start
bool start()
Definition: guider.cpp:185
Vector::y
double y
Definition: vect.h:21
cgmath::getOutputParameters
const cproc_out_params * getOutputParameters() const
Definition: gmath.h:121
internalGuider::newProfilePixmap
void newProfilePixmap(QPixmap &)
internalGuider::trackingStarSelected
void trackingStarSelected(int x, int y)
Definition: guider.cpp:499
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Thu Dec 12 2019 02:56:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

edu API Reference

Skip menu "edu API Reference"
  •     core
  • kstars

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal