summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-04 10:52:21 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-04 10:52:21 (GMT)
commitbbd21bdf708ba5796a6ab5c9d241773daa822c4f (patch)
treeff4b38d9b97780da7c0d235463f6a359bf4e6823
parent05f6fa0dc5cd09a1a493cef8d8f0dbcd47a36584 (diff)
Starting work on guide module after calibration is almost done in internal guider
-rw-r--r--kstars/ekos/guide/guide.cpp32
-rw-r--r--kstars/ekos/guide/guide.h2
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.cpp178
-rw-r--r--kstars/ekos/scheduler/scheduler.cpp2
-rw-r--r--kstars/org.kde.kstars.Ekos.Guide.xml2
5 files changed, 150 insertions, 66 deletions
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index ab8f8bc..ce5f80b 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -605,6 +605,9 @@ bool Guide::capture()
connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
targetChip->capture(seqExpose);*/
+ guideView->setBaseSize(guideWidget->size());
+ setBusy(true);
+
switch (state)
{
case GUIDE_GUIDING:
@@ -616,15 +619,11 @@ bool Guide::capture()
default:
break;
- }
-
- guideView->setBaseSize(guideWidget->size());
+ }
- connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)));
+ connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, SLOT(newFITS(IBLOB*)), Qt::UniqueConnection);
targetChip->capture(seqExpose);
- setBusy(true);
-
return true;
}
@@ -1119,24 +1118,19 @@ bool Guide::calibrate()
return rc;
}
-bool Guide::startGuiding()
+bool Guide::guide()
{
-
saveSettings();
- // FIXME
- /*
- // This will handle both internal and external guiders
- return guider->start();
+ bool rc = guider->guide();
- if (Options::useEkosGuider())
- return guider->start();
- else
- return phd2->startGuiding();
-
- */
- return true;
+ if (rc)
+ {
+ appendLogText(i18n("Autoguiding started."));
+ driftGraphics->resetData();
+ }
+ return rc;
}
void Guide::setSuspended(bool enable)
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index 68dfa13..854f712 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -216,7 +216,7 @@ public slots:
* Start the autoguiding operation.
* @return Returns true if guiding started successfully, false otherwise.
*/
- Q_SCRIPTABLE bool startGuiding();
+ Q_SCRIPTABLE bool guide();
/** DBUS interface function.
* Stop any active calibration, guiding, or dithering operation
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp b/kstars/ekos/guide/internalguide/internalguider.cpp
index 2f93446..ff606a0 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -57,7 +57,95 @@ InternalGuider::~InternalGuider()
bool InternalGuider::guide()
{
-return false;
+#if 0
+ Options::setUseDither(ui.ditherCheck->isChecked());
+ Options::setDitherPixels(ui.ditherPixels->value());
+ Options::setAOLimit(ui.spinBox_AOLimit->value());
+ Options::setGuidingRate(ui.spinBox_GuideRate->value());
+ Options::setEnableRAGuide(ui.checkBox_DirRA->isChecked());
+ Options::setEnableDECGuide(ui.checkBox_DirDEC->isChecked());
+ Options::setRAPropotionalGain(ui.spinBox_PropGainRA->value());
+ Options::setDECPropotionalGain(ui.spinBox_PropGainDEC->value());
+ Options::setRAIntegralGain(ui.spinBox_IntGainRA->value());
+ Options::setDECIntegralGain(ui.spinBox_IntGainDEC->value());
+ Options::setRADerivativeGain(ui.spinBox_DerGainRA->value());
+ Options::setDECDerivativeGain(ui.spinBox_DerGainDEC->value());
+ Options::setRAMaximumPulse(ui.spinBox_MaxPulseRA->value());
+ Options::setDECMaximumPulse(ui.spinBox_MaxPulseDEC->value());
+ Options::setRAMinimumPulse(ui.spinBox_MinPulseRA->value());
+ Options::setDECMinimumPulse(ui.spinBox_MinPulseDEC->value());
+#endif
+
+ guideFrame->disconnect(this);
+ //disconnect(guideFrame, SIGNAL(trackingStarSelected(int,int)), 0, 0);
+
+ // Let everyone know about dither option status
+ //emit ditherToggled(ui.ditherCheck->isChecked());
+
+#if 0
+ if (phd2)
+ {
+ phd2->startGuiding();
+
+ m_isStarted = true;
+ m_useRapidGuide = ui.rapidGuideCheck->isChecked();
+
+ //pmain_wnd->setSuspended(false);
+
+ ui.pushButton_StartStop->setText( i18n("Stop") );
+ guideModule->appendLogText(i18n("Autoguiding started."));
+
+ return true;
+ }
+
+#endif
+
+ logFile.open(QIODevice::WriteOnly | QIODevice::Text);
+ QTextStream out(&logFile);
+
+ /* FIXME Have to re-enable guide logging file
+
+ out << "Guiding rate,x15 arcsec/sec: " << ui.spinBox_GuideRate->value() << endl;
+ out << "Focal,mm: " << ui.l_Focal->text() << endl;
+ out << "Aperture,mm: " << ui.l_Aperture->text() << endl;
+ out << "F/D: " << ui.l_FbyD->text() << endl;
+ out << "FOV: " << ui.l_FOV->text() << endl;
+ out << "Frame #, Time Elapsed (ms), RA Error (arcsec), RA Correction (ms), RA Correction Direction, DEC Error (arcsec), DEC Correction (ms), DEC Correction Direction" << endl;
+
+ */
+
+ //drift_graph->reset_data();
+ //ui.pushButton_StartStop->setText( i18n("Stop") );
+
+ //guideModule->appendLogText(i18n("Autoguiding started."));
+
+ pmath->start();
+
+ m_lostStarTries=0;
+
+ // FIXME
+#if 0
+ m_isStarted = true;
+ m_useRapidGuide = ui.rapidGuideCheck->isChecked();
+ if (m_useRapidGuide)
+ guideModule->startRapidGuide();
+
+ emit newStatus(Ekos::GUIDE_GUIDING);
+
+ guideModule->setSuspended(false);
+
+ first_frame = true;
+
+ if (ui.subFrameCheck->isEnabled() && ui.subFrameCheck->isChecked() && m_isSubFramed == false)
+ first_subframe = true;
+
+ capture();
+
+#endif
+
+ pmath->setLogFile(&logFile);
+
+ return true;
}
bool InternalGuider::abort()
@@ -81,48 +169,6 @@ bool InternalGuider::dither(double pixels)
return false;
}
-void InternalGuider::setSquareAlgorithm(int index)
-{
- pmath->setSquareAlgorithm(index);
-}
-
-void InternalGuider::setReticleParameters(double x, double y, double angle)
-{
- pmath->setReticleParameters(x,y,angle);
-}
-
-bool InternalGuider::getReticleParameters(double *x, double *y, double *angle)
-{
- return pmath->getReticleParameters(x,y,angle);
-}
-
-bool InternalGuider::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength)
-{
- this->ccdPixelSizeX = ccdPixelSizeX;
- this->ccdPixelSizeY = ccdPixelSizeY;
- this->mountAperture = mountAperture;
- this->mountFocalLength = mountFocalLength;
- return pmath->setGuiderParameters(ccdPixelSizeX, ccdPixelSizeY, mountAperture, mountFocalLength);
-}
-
-bool InternalGuider::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t binX, uint16_t binY)
-{
- if( w <= 0 || h <= 0 )
- return false;
-
- subX = x;
- subY = y;
- subW = w;
- subH = h;
-
- subBinX = binX;
- subBinY = binY;
-
- pmath->setVideoParameters(w, h);
-
- return true;
-}
-
bool InternalGuider::calibrate()
{
bool ccdInfo=true, scopeInfo=true;
@@ -186,7 +232,8 @@ bool InternalGuider::calibrate()
return true;
}
- disconnect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ //disconnect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ guideFrame->disconnect(this);
// Must reset dec swap before we run any calibration procedure!
@@ -765,4 +812,47 @@ void InternalGuider::setDECSwap(bool enable)
{
pmath->setDeclinationSwapEnabled(enable);
}
+
+void InternalGuider::setSquareAlgorithm(int index)
+{
+ pmath->setSquareAlgorithm(index);
+}
+
+void InternalGuider::setReticleParameters(double x, double y, double angle)
+{
+ pmath->setReticleParameters(x,y,angle);
+}
+
+bool InternalGuider::getReticleParameters(double *x, double *y, double *angle)
+{
+ return pmath->getReticleParameters(x,y,angle);
+}
+
+bool InternalGuider::setGuiderParams(double ccdPixelSizeX, double ccdPixelSizeY, double mountAperture, double mountFocalLength)
+{
+ this->ccdPixelSizeX = ccdPixelSizeX;
+ this->ccdPixelSizeY = ccdPixelSizeY;
+ this->mountAperture = mountAperture;
+ this->mountFocalLength = mountFocalLength;
+ return pmath->setGuiderParameters(ccdPixelSizeX, ccdPixelSizeY, mountAperture, mountFocalLength);
+}
+
+bool InternalGuider::setFrameParams(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t binX, uint16_t binY)
+{
+ if( w <= 0 || h <= 0 )
+ return false;
+
+ subX = x;
+ subY = y;
+ subW = w;
+ subH = h;
+
+ subBinX = binX;
+ subBinY = binY;
+
+ pmath->setVideoParameters(w, h);
+
+ return true;
+}
+
}
diff --git a/kstars/ekos/scheduler/scheduler.cpp b/kstars/ekos/scheduler/scheduler.cpp
index cd3ace1..ed742a2 100644
--- a/kstars/ekos/scheduler/scheduler.cpp
+++ b/kstars/ekos/scheduler/scheduler.cpp
@@ -2804,7 +2804,7 @@ void Scheduler::checkJobStage()
{
appendLogText(i18n("%1 calibration is complete.", currentJob->getName()));
- guideReply = guideInterface->call(QDBus::AutoDetect,"startGuiding");
+ guideReply = guideInterface->call(QDBus::AutoDetect,"guide");
if(guideReply.value() == false)
{
appendLogText(i18n("%1 guiding failed!", currentJob->getName()));
diff --git a/kstars/org.kde.kstars.Ekos.Guide.xml b/kstars/org.kde.kstars.Ekos.Guide.xml
index db4a65a..5d3c4b2 100644
--- a/kstars/org.kde.kstars.Ekos.Guide.xml
+++ b/kstars/org.kde.kstars.Ekos.Guide.xml
@@ -1,7 +1,7 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kstars.Ekos.Guide">
- <method name="startGuiding">
+ <method name="guide">
<arg type="b" direction="out"/>
</method>
<method name="abort">