summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-11 22:36:32 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-11 22:36:32 (GMT)
commitee5669cbf03ac496a0441546d482e6ae95526f29 (patch)
tree20f3c3739fda021727c8ccc8c4cdb958045080b2
parent18e7dcecf60ce76adaf6b107c5cc4bc00ee28448 (diff)
Major overhaul of guiding module to make it work better with the FITSView tracking box that is used by all modules now. Use Dark Library to capture darks whenever necessary. Tweaked GUI a bit. Subframing on different binning and box size variations work a lot more reliably now
-rw-r--r--kstars/ekos/guide.cpp154
-rw-r--r--kstars/ekos/guide.h45
-rw-r--r--kstars/ekos/guide.ui125
-rw-r--r--kstars/ekos/guide/gmath.cpp1227
-rw-r--r--kstars/ekos/guide/gmath.h264
-rw-r--r--kstars/ekos/guide/guider.cpp642
-rw-r--r--kstars/ekos/guide/guider.h37
-rw-r--r--kstars/ekos/guide/guider.ui25
-rw-r--r--kstars/ekos/guide/rcalibration.cpp775
-rw-r--r--kstars/ekos/guide/rcalibration.h58
-rw-r--r--kstars/ekos/guide/rcalibration.ui12
-rw-r--r--kstars/org.kde.kstars.Ekos.Guide.xml7
12 files changed, 1634 insertions, 1737 deletions
diff --git a/kstars/ekos/guide.cpp b/kstars/ekos/guide.cpp
index 499539d..c8a26b1 100644
--- a/kstars/ekos/guide.cpp
+++ b/kstars/ekos/guide.cpp
@@ -47,9 +47,9 @@ Guide::Guide() : QWidget()
currentCCD = NULL;
currentTelescope = NULL;
ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
- useGuideHead = false;
+ useGuideHead = false;
rapidGuideReticleSet = false;
- isSuspended = false;
+ isSuspended = false;
AODriver= NULL;
GuideDriver=NULL;
calibration=NULL;
@@ -66,24 +66,29 @@ Guide::Guide() : QWidget()
exposureIN->setValue(Options::guideExposure());
connect(exposureIN, SIGNAL(editingFinished()), this, SLOT(saveDefaultGuideExposure()));
+ boxSizeCombo->setCurrentIndex(Options::guideSquareSizeIndex());
+ connect(boxSizeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTrackingBoxSize(int)));
+
// TODO must develop a parent abstract GuideProcess class that is then inherited by both the internal guider and PHD2 and any additional future guiders
// It should provide the interface to hook its actions and results here instead of this mess.
pmath = new cgmath();
connect(pmath, SIGNAL(newAxisDelta(double,double)), this, SIGNAL(newAxisDelta(double,double)));
connect(pmath, SIGNAL(newAxisDelta(double,double)), this, SLOT(updateGuideDriver(double,double)));
+ connect(pmath, SIGNAL(newStarPosition(QVector3D,bool)), this, SLOT(setStarPosition(QVector3D,bool)));
- calibration = new rcalibration(pmath, this);
+ calibration = new internalCalibration(pmath, this);
connect(calibration, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
- guider = new rguider(pmath, this);
+ guider = new internalGuider(pmath, this);
connect(guider, SIGNAL(ditherToggled(bool)), this, SIGNAL(ditherToggled(bool)));
connect(guider, SIGNAL(autoGuidingToggled(bool)), this, SIGNAL(autoGuidingToggled(bool)));
connect(guider, SIGNAL(ditherComplete()), this, SIGNAL(ditherComplete()));
connect(guider, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
connect(guider, SIGNAL(newProfilePixmap(QPixmap &)), this, SIGNAL(newProfilePixmap(QPixmap &)));
+ connect(guider, SIGNAL(newStarPosition(QVector3D,bool)), this, SLOT(setStarPosition(QVector3D,bool)));
tabWidget->addTab(calibration, calibration->windowTitle());
tabWidget->addTab(guider, guider->windowTitle());
@@ -217,7 +222,7 @@ void Guide::checkCCD(int ccdNum)
}
void Guide::setGuiderProcess(int guiderProcess)
-{
+{
// Don't do anything unless we have a CCD and it is online
if (currentCCD == NULL || currentCCD->isConnected() == false)
return;
@@ -355,7 +360,7 @@ void Guide::updateGuideParams()
if (ccd_hor_pixel != -1 && ccd_ver_pixel != -1 && focal_length != -1 && aperture != -1)
{
- pmath->set_guider_params(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
+ pmath->setGuiderParameters(ccd_hor_pixel, ccd_ver_pixel, aperture, focal_length);
phd2->setCCDMountParams(ccd_hor_pixel, ccd_ver_pixel, focal_length);
int x,y,w,h;
@@ -365,7 +370,7 @@ void Guide::updateGuideParams()
guider->setTargetChip(targetChip);
if (targetChip->getFrame(&x,&y,&w,&h))
- pmath->set_video_params(w, h);
+ pmath->setVideoParameters(w, h);
guider->setInterface();
@@ -434,11 +439,11 @@ bool Guide::capture()
}
//If calibrating, reset frame
- if (calibration->getCalibrationStage() == rcalibration::CAL_CAPTURE_IMAGE)
+ if (calibration->getCalibrationStage() == internalCalibration::CAL_CAPTURE_IMAGE)
{
targetChip->resetFrame();
guider->setSubFramed(false);
- }
+ }
targetChip->setCaptureMode(FITS_GUIDE);
targetChip->setFrameType(FRAME_LIGHT);
@@ -476,7 +481,7 @@ void Guide::newFITS(IBLOB *bp)
// Do we need to take a dark frame?
if (Options::useGuideDarkFrame())
- {
+ {
int x,y,w,h;
int binx,biny;
@@ -497,8 +502,8 @@ void Guide::newFITS(IBLOB *bp)
DarkLibrary::Instance()->subtract(darkData, currentImage, targetChip->getCaptureFilter(), offsetX, offsetY);
else
{
- if (calibration->useAutoStar() == false)
- KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
+ //if (calibration->useAutoStar() == false)
+ //KMessageBox::information(NULL, i18n("If the guide camera is not equipped with a shutter, cover the telescope or camera in order to take a dark exposure."), i18n("Dark Exposure"), "dark_exposure_dialog_notification");
DarkLibrary::Instance()->captureAndSubtract(targetChip, currentImage, exposureIN->value(), offsetX, offsetY);
}
@@ -532,28 +537,40 @@ void Guide::setCaptureComplete()
FITSData *image_data = targetImage->getImageData();
Q_ASSERT(image_data);
- pmath->set_image(targetImage);
- guider->setImage(targetImage);
+ pmath->setImageView(targetImage);
+ guider->setImageView(targetImage);
- //fv->show();
+ int subBinX=1, subBinY=1;
+ targetChip->getBinning(&subBinX, &subBinY);
// It should be false in case we do not need to process the image for motion
// which happens when we take an image for auto star selection.
- if (calibration->setImage(targetImage) == false)
+ if (calibration->setImageView(targetImage) == false)
return;
- if (isSuspended)
+ if (starCenter.x() == 0 && starCenter.y() == 0)
{
- //capture();
+ int x,y,w,h;
+ targetChip->getFrame(&x,&y,&w,&h);
+
+ starCenter.setX(w/(2*subBinX));
+ starCenter.setY(h/(2*subBinY));
+ starCenter.setZ(subBinX);
+ }
+ syncTrackingBoxPosition();
+
+ if (isSuspended)
+ {
if (Options::guideLogging())
qDebug() << "Guide: Guider is suspended.";
+
return;
- }
+ }
if (guider->isDithering())
{
- pmath->do_processing();
+ pmath->performProcessing();
if (guider->dither() == false)
{
appendLogText(i18n("Dithering failed. Autoguiding aborted."));
@@ -571,7 +588,7 @@ void Guide::setCaptureComplete()
else if (calibration->isCalibrating())
{
GuideDriver = ST4Driver;
- pmath->do_processing();
+ pmath->performProcessing();
calibration->processCalibration();
if (calibration->isCalibrationComplete())
@@ -671,9 +688,9 @@ void Guide::processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy,
if (targetImage == NULL)
{
- pmath->set_image(NULL);
- guider->setImage(NULL);
- calibration->setImage(NULL);
+ pmath->setImageView(NULL);
+ guider->setImageView(NULL);
+ calibration->setImageView(NULL);
}
if (rapidGuideReticleSet == false)
@@ -681,8 +698,8 @@ void Guide::processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy,
// Let's set reticle parameter on first capture to those of the star, then we check if there
// is any set
double x,y,angle;
- pmath->get_reticle_params(&x, &y, &angle);
- pmath->set_reticle_params(dx, dy, angle);
+ pmath->getReticleParameters(&x, &y, &angle);
+ pmath->setReticleParameters(dx, dy, angle);
rapidGuideReticleSet = true;
}
@@ -690,7 +707,7 @@ void Guide::processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy,
if (guider->isDithering())
{
- pmath->do_processing();
+ pmath->performProcessing();
if (guider->dither() == false)
{
appendLogText(i18n("Dithering failed. Autoguiding aborted."));
@@ -842,7 +859,7 @@ bool Guide::isGuiding()
}
bool Guide::startGuiding()
-{
+{
// This will handle both internal and external guiders
return guider->start();
@@ -925,29 +942,29 @@ void Guide::setCalibrationAutoSquareSize(bool enable)
calibration->setCalibrationAutoSquareSize(enable);
}
-void Guide::setCalibrationParams(int boxSize, int pulseDuration)
+void Guide::setCalibrationPulseDuration(int pulseDuration)
{
- calibration->setCalibrationParams(boxSize, pulseDuration);
+ calibration->setCalibrationPulseDuration(pulseDuration);
}
-void Guide::setGuideBoxSize(int boxSize)
+void Guide::setGuideBoxSizeIndex(int boxSize)
{
- guider->setGuideOptions(boxSize, guider->getAlgorithm(), guider->useSubFrame(), guider->useRapidGuide());
+ boxSizeCombo->setCurrentIndex(boxSize);
}
void Guide::setGuideAlgorithm(const QString & algorithm)
{
- guider->setGuideOptions(guider->getBoxSize(), algorithm, guider->useSubFrame(), guider->useRapidGuide());
+ guider->setGuideOptions(algorithm, guider->useSubFrame(), guider->useRapidGuide());
}
void Guide::setSubFrameEnabled(bool enable)
{
- guider->setGuideOptions(guider->getBoxSize(), guider->getAlgorithm(), enable , guider->useRapidGuide());
+ guider->setGuideOptions(guider->getAlgorithm(), enable , guider->useRapidGuide());
}
void Guide::setGuideRapid(bool enable)
{
- guider->setGuideOptions(guider->getBoxSize(), guider->getAlgorithm(), guider->useSubFrame() , enable);
+ guider->setGuideOptions(guider->getAlgorithm(), guider->useSubFrame() , enable);
}
void Guide::setDither(bool enable, double value)
@@ -1062,8 +1079,6 @@ void Guide::updateCCDBin(int index)
targetChip->setBinning(index+1, index+1);
- if (pmath)
- pmath->setBinning(index+1, index+1);
}
void Guide::processCCDNumber(INumberVectorProperty *nvp)
@@ -1091,12 +1106,12 @@ void Guide::checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPStat
}
void Guide::setDarkFrameEnabled(bool enable)
-{
+{
Options::setUseGuideDarkFrame(enable);
- if (enable && calibration && calibration->useAutoStar())
+ /*if (enable && calibration && calibration->useAutoStar())
appendLogText(i18n("Warning: In auto mode, you will not be asked to cover cameras unequipped with shutters in order to capture a dark frame. The dark frame capture will proceed without warning."
- " You can capture dark frames with auto mode off and they shall be saved in the dark library for use when ever needed."));
+ " You can capture dark frames with auto mode off and they shall be saved in the dark library for use when ever needed."));*/
}
void Guide::saveDefaultGuideExposure()
@@ -1104,6 +1119,65 @@ void Guide::saveDefaultGuideExposure()
Options::setGuideExposure(exposureIN->value());
}
+void Guide::setStarPosition(const QVector3D &newCenter, bool updateNow)
+{
+ starCenter.setX(newCenter.x());
+ starCenter.setY(newCenter.y());
+ if (newCenter.z() > 0)
+ starCenter.setZ(newCenter.z());
+
+ if (updateNow)
+ syncTrackingBoxPosition();
+
+}
+
+void Guide::syncTrackingBoxPosition()
+{
+ ISD::CCDChip *targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD);
+ Q_ASSERT(targetChip);
+
+ int subBinX=1, subBinY=1;
+ targetChip->getBinning(&subBinX, &subBinY);
+
+ FITSView *targetImage = targetChip->getImage(FITS_GUIDE);
+
+ if (targetImage && starCenter.isNull() == false)
+ {
+ double boxSize = boxSizeCombo->currentText().toInt();
+ int x,y,w,h;
+ targetChip->getFrame(&x,&y,&w,&h);
+ // If box size is larger than image size, set it to lower index
+ if (boxSize/subBinX >= w || boxSize/subBinY >= h)
+ {
+ boxSizeCombo->setCurrentIndex(boxSizeCombo->currentIndex()-1);
+ return;
+ }
+
+ // If binning changed, update coords accordingly
+ if (subBinX != starCenter.z())
+ {
+ if (starCenter.z() > 0)
+ {
+ starCenter.setX(starCenter.x() * (starCenter.z()/subBinX));
+ starCenter.setY(starCenter.y() * (starCenter.z()/subBinY));
+ }
+
+ starCenter.setZ(subBinX);
+ }
+
+ QRect starRect = QRect( starCenter.x()-boxSize/(2*subBinX), starCenter.y()-boxSize/(2*subBinY), boxSize/subBinX, boxSize/subBinY);
+ targetImage->setTrackingBoxEnabled(true);
+ targetImage->setTrackingBox(starRect);
+ }
+}
+
+void Guide::updateTrackingBoxSize(int currentIndex)
+{
+ Options::setGuideSquareSizeIndex(currentIndex);
+
+ syncTrackingBoxPosition();
+}
+
}
diff --git a/kstars/ekos/guide.h b/kstars/ekos/guide.h
index baa36a2..5e304dc 100644
--- a/kstars/ekos/guide.h
+++ b/kstars/ekos/guide.h
@@ -24,8 +24,8 @@
class QTabWidget;
class cgmath;
-class rcalibration;
-class rguider;
+class internalCalibration;
+class internalGuider;
class FITSData;
namespace Ekos
@@ -35,9 +35,10 @@ class PHD2;
/**
*@class Guide
- *@short Performs calibration and autoguiding using an ST4 port or directly via the INDI driver.
+ *@short Performs calibration and autoguiding using an ST4 port or directly via the INDI driver. Can be used with the following external guiding applications:
+ * PHD2
*@author Jasem Mutlaq
- *@version 1.1
+ *@version 1.2
*/
class Guide : public QWidget, public Ui::Guide
{
@@ -50,7 +51,7 @@ public:
~Guide();
enum GuiderStage { CALIBRATION_STAGE, GUIDE_STAGE };
- enum GuiderProcess { GUIDE_INTERNAL, GUIDE_PHD2 };
+ enum GuiderProcess { GUIDE_INTERNAL, GUIDE_PHD2 };
/** @defgroup GuideDBusInterface Ekos DBus Interface - Capture Module
* Ekos::Guide interface provides advanced scripting capabilities to calibrate and guide a mount via a CCD camera.
@@ -140,16 +141,15 @@ public:
/** DBUS interface function.
* Set calibration parameters.
- * @param boxSize box size in pixels around the guide star. The box size should be suitable for the size of the guide star selected.
* @param pulseDuration Pulse duration in milliseconds to use in the calibration steps.
*/
- Q_SCRIPTABLE Q_NOREPLY void setCalibrationParams(int boxSize, int pulseDuration);
+ Q_SCRIPTABLE Q_NOREPLY void setCalibrationPulseDuration(int pulseDuration);
/** DBUS interface function.
* Set guiding box size. The options must be set before starting the guiding operation. If no options are set, the options loaded from the user configuration are used.
- * @param boxSize box size in pixels around the guide star. The box size should be suitable for the size of the guide star selected. The boxSize is also used to select the subframe size around the guide star.
+ * @param boxSizeIndex box size index (0 to 4) for box size from 8 to 128 pixels. The box size should be suitable for the size of the guide star selected. The boxSize is also used to select the subframe size around the guide star. Default is 16 pixels
*/
- Q_SCRIPTABLE Q_NOREPLY void setGuideBoxSize(int boxSize);
+ Q_SCRIPTABLE Q_NOREPLY void setGuideBoxSizeIndex(int boxSizeIndex);
/** DBUS interface function.
* Set guiding algorithm. The options must be set before starting the guiding operation. If no options are set, the options loaded from the user configuration are used.
@@ -198,12 +198,18 @@ public:
void clearLog();
- void setDECSwap(bool enable);
+ void setDECSwap(bool enable);
bool sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs );
bool sendPulse( GuideDirection dir, int msecs );
QString getLogText() { return logText.join("\n"); }
+ QVector3D getStarPosition() { return starCenter; }
+
+ // Tracking Box
+ void setTrackingBoxSize(int index) { boxSizeCombo->setCurrentIndex(index); }
+ int getTrackingBoxSize() { return boxSizeCombo->currentText().toInt(); }
+
double getReticleAngle();
void startRapidGuide();
@@ -247,15 +253,13 @@ public slots:
void checkExposureValue(ISD::CCDChip *targetChip, double exposure, IPState state);
void newFITS(IBLOB*);
void newST4(int index);
- void processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy, double fit);
+ void processRapidStarData(ISD::CCDChip *targetChip, double dx, double dy, double fit);
void updateGuideDriver(double delta_ra, double delta_dec);
// Auto Calibration Guiding (Cablirate first then start guiding immediately)
void startAutoCalibrateGuiding();
void checkAutoCalibrateGuiding(bool successful);
- //void viewerClosed();
-
void dither();
void setSuspended(bool enable);
@@ -263,6 +267,9 @@ public slots:
void setStatus(Ekos::GuideState newState);
+ // Star Position
+ void setStarPosition(const QVector3D &newCenter, bool updateNow);
+
// Capture
void setCaptureComplete();
@@ -280,6 +287,8 @@ protected slots:
void setDefaultCCD(QString ccd);
void setDefaultST4(QString st4);
+ void updateTrackingBoxSize(int currentIndex);
+
signals:
void newLog();
void newStatus(Ekos::GuideState status);
@@ -297,6 +306,7 @@ signals:
private:
void updateGuideParams();
+ void syncTrackingBoxPosition();
ISD::CCD *currentCCD;
ISD::Telescope *currentTelescope;
@@ -310,20 +320,21 @@ private:
QTabWidget *tabWidget;
cgmath *pmath;
- rcalibration *calibration;
- rguider *guider;
+ internalCalibration *calibration;
+ internalGuider *guider;
PHD2 *phd2;
bool useGuideHead;
bool isSuspended;
- bool phd2Connected;
+
+ QVector3D starCenter;
QStringList logText;
double ccd_hor_pixel, ccd_ver_pixel, focal_length, aperture, guideDeviationRA, guideDeviationDEC;
bool rapidGuideReticleSet;
- GuideState state;
+ GuideState state;
};
}
diff --git a/kstars/ekos/guide.ui b/kstars/ekos/guide.ui
index df9c8ba..6bcbb11 100644
--- a/kstars/ekos/guide.ui
+++ b/kstars/ekos/guide.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>616</width>
- <height>317</height>
+ <width>669</width>
+ <height>55</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -24,19 +24,6 @@
<widget class="QComboBox" name="guiderCombo"/>
</item>
<item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -45,6 +32,9 @@
</item>
<item>
<widget class="QLabel" name="label_2">
+ <property name="toolTip">
+ <string>Select which device receives the guiding correction commands.</string>
+ </property>
<property name="text">
<string>Via:</string>
</property>
@@ -54,19 +44,6 @@
<widget class="QComboBox" name="ST4Combo"/>
</item>
<item>
- <spacer name="horizontalSpacer_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -75,8 +52,11 @@
</item>
<item>
<widget class="QLabel" name="label_3">
+ <property name="toolTip">
+ <string>Exposure time in seconds</string>
+ </property>
<property name="text">
- <string>Exposure:</string>
+ <string>Exp:</string>
</property>
</widget>
</item>
@@ -91,19 +71,6 @@
</widget>
</item>
<item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -112,8 +79,11 @@
</item>
<item>
<widget class="QLabel" name="label_4">
+ <property name="toolTip">
+ <string>Guide camera binning. It is recommended to set binning to 2x2 or higher.</string>
+ </property>
<property name="text">
- <string>Binning:</string>
+ <string>Bin:</string>
</property>
</widget>
</item>
@@ -121,20 +91,53 @@
<widget class="QComboBox" name="binningCombo"/>
</item>
<item>
- <spacer name="horizontalSpacer_5">
+ <widget class="Line" name="line_4">
<property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="toolTip">
+ <string>Guide star tracking box size. Box size must be set in accordance to the selected star size.</string>
</property>
- </spacer>
+ <property name="text">
+ <string>Box:</string>
+ </property>
+ </widget>
</item>
<item>
- <widget class="Line" name="line_4">
+ <widget class="QComboBox" name="boxSizeCombo">
+ <item>
+ <property name="text">
+ <string>8</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>16</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>32</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>64</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>128</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item>
+ <widget class="Line" name="line_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@@ -168,24 +171,14 @@
</item>
<item>
<widget class="QCheckBox" name="darkFrameCheck">
+ <property name="toolTip">
+ <string>Subtract dark frame. If no dark frame is available, a new dark frame shall be captured and saved for future use.</string>
+ </property>
<property name="text">
- <string>Dark Frame</string>
+ <string>Dark</string>
</property>
</widget>
</item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
</layout>
</item>
<item>
diff --git a/kstars/ekos/guide/gmath.cpp b/kstars/ekos/guide/gmath.cpp
index 6af694e..1afae0b 100644
--- a/kstars/ekos/guide/gmath.cpp
+++ b/kstars/ekos/guide/gmath.cpp
@@ -28,65 +28,58 @@
#define DEF_SQR_4 (128-0)
const guide_square_t guide_squares[] = { {DEF_SQR_0, DEF_SQR_0*DEF_SQR_0*1.0},
- {DEF_SQR_1, DEF_SQR_1*DEF_SQR_1*1.0},
- {DEF_SQR_2, DEF_SQR_2*DEF_SQR_2*1.0},
- {DEF_SQR_3, DEF_SQR_3*DEF_SQR_3*1.0},
+ {DEF_SQR_1, DEF_SQR_1*DEF_SQR_1*1.0},
+ {DEF_SQR_2, DEF_SQR_2*DEF_SQR_2*1.0},
+ {DEF_SQR_3, DEF_SQR_3*DEF_SQR_3*1.0},
{DEF_SQR_4, DEF_SQR_4*DEF_SQR_4*1.0},
- {-1, -1}
- };
+ {-1, -1}
+ };
const square_alg_t guide_square_alg[] = {
- { SMART_THRESHOLD, "Smart" },
- { CENTROID_THRESHOLD, "Fast"},
- { AUTO_THRESHOLD, "Auto" },
- { NO_THRESHOLD, "No thresh." },
- { -1, {0} }
- };
+ { SMART_THRESHOLD, "Smart" },
+ { CENTROID_THRESHOLD, "Fast"},
+ { AUTO_THRESHOLD, "Auto" },
+ { NO_THRESHOLD, "No thresh." },
+ { -1, {0} }
+};
cgmath::cgmath() : QObject()
{
- // sys...
- ticks = 0;
+ // sys...
+ ticks = 0;
pdata = NULL;
- video_width = -1;
- video_height = -1;
- ccd_pixel_width = 0;
- ccd_pixel_height = 0;
+ video_width = -1;
+ video_height = -1;
+ ccd_pixel_width = 0;
+ ccd_pixel_height = 0;
focal = 0;
aperture = 0;
- ROT_Z = Matrix(0);
- preview_mode = true;
- suspended = false;
+ ROT_Z = Matrix(0);
+ preview_mode = true;
+ suspended = false;
lost_star = false;
useRapidGuide = false;
dec_swap = false;
subBinX = subBinY = lastBinX = lastBinY = 1;
- // square variables
- square_idx = DEFAULT_SQR;
+ // square variables
square_alg_idx = SMART_THRESHOLD;
- square_size = guide_squares[square_idx].size;
- square_square = guide_squares[square_idx].square;
- square_pos = Vector(0);
-
- // sky coord. system vars.
- star_pos = Vector(0);
- scr_star_pos = Vector(0);
- reticle_pos = Vector(0);
- reticle_orts[0] = Vector(0);
- reticle_orts[1] = Vector(0);
- reticle_angle = 0;
- ditherRate[0] = ditherRate[1] = -1;
+ // sky coord. system vars.
+ star_pos = Vector(0);
+ scr_star_pos = Vector(0);
+ reticle_pos = Vector(0);
+ reticle_orts[0] = Vector(0);
+ reticle_orts[1] = Vector(0);
+ reticle_angle = 0;
- // overlays
- memset( &overlays, 0, sizeof(overlays) );
+ ditherRate[0] = ditherRate[1] = -1;
- // processing
- in_params.reset();
- out_params.reset();
+ // processing
+ in_params.reset();
+ out_params.reset();
channel_ticks[GUIDE_RA] = channel_ticks[GUIDE_DEC] = 0;
accum_ticks[GUIDE_RA] = accum_ticks[GUIDE_DEC] = 0;
drift[GUIDE_RA] = new double[MAX_ACCUM_CNT];
@@ -96,10 +89,10 @@ cgmath::cgmath() : QObject()
drift_integral[GUIDE_RA] = drift_integral[GUIDE_DEC] = 0;
- // statistics
- do_statistics = true;
- sum = sqr_sum = 0;
- delta_prev = sigma_prev = sigma = 0;
+ // statistics
+ do_statistics = true;
+ sum = sqr_sum = 0;
+ delta_prev = sigma_prev = sigma = 0;
}
cgmath::~cgmath()
@@ -111,69 +104,69 @@ cgmath::~cgmath()
}
-bool cgmath::set_video_params( int vid_wd, int vid_ht )
+bool cgmath::setVideoParameters( int vid_wd, int vid_ht )
{
- if( vid_wd <= 0 || vid_ht <= 0 )
- return false;
+ if( vid_wd <= 0 || vid_ht <= 0 )
+ return false;
- video_width = vid_wd;
- video_height = vid_ht;
+ video_width = vid_wd;
+ video_height = vid_ht;
//set_reticle_params( video_width/2, video_height/2, -1 ); // keep orientation
- return true;
+ return true;
}
-void cgmath::set_buffer(float *buffer)
+void cgmath::setDataBuffer(float *buffer)
{
pdata = buffer;
}
-void cgmath::set_image(FITSView *image)
+void cgmath::setImageView(FITSView *image)
{
- guide_frame = image;
+ guideView = image;
- if (guide_frame)
+ if (guideView)
{
- FITSData *image_data = guide_frame->getImageData();
- set_buffer(image_data->getImageBuffer());
- set_video_params(image_data->getWidth(), image_data->getHeight());
+ FITSData *image_data = guideView->getImageData();
+ setDataBuffer(image_data->getImageBuffer());
+ setVideoParameters(image_data->getWidth(), image_data->getHeight());
}
}
-float *cgmath::get_data_buffer( int *width, int *height, int *length, int *size )
+float *cgmath::getDataBuffer( int *width, int *height, int *length, int *size )
{
- if( width )
- *width = video_width;
- if( height )
- *height = video_height;
- if( length )
- *length = video_width * video_height;
- if( size )
+ if( width )
+ *width = video_width;
+ if( height )
+ *height = video_height;
+ if( length )
+ *length = video_width * video_height;
+ if( size )
*size = video_width * video_height * sizeof(float);
- return pdata;
+ return pdata;
}
-bool cgmath::set_guider_params( double ccd_pix_wd, double ccd_pix_ht, double guider_aperture, double guider_focal )
+bool cgmath::setGuiderParameters( double ccd_pix_wd, double ccd_pix_ht, double guider_aperture, double guider_focal )
{
- if( ccd_pix_wd < 0 )
- ccd_pix_wd = 0;
- if( ccd_pix_ht < 0 )
- ccd_pix_ht = 0;
- if( guider_focal <= 0 )
- guider_focal = 1;
-
- ccd_pixel_width = ccd_pix_wd / 1000.0; // from mkm to mm
- ccd_pixel_height = ccd_pix_ht / 1000.0; // from mkm to mm
- aperture = guider_aperture;
- focal = guider_focal;
-
- return true;
+ if( ccd_pix_wd < 0 )
+ ccd_pix_wd = 0;
+ if( ccd_pix_ht < 0 )
+ ccd_pix_ht = 0;
+ if( guider_focal <= 0 )
+ guider_focal = 1;
+
+ ccd_pixel_width = ccd_pix_wd / 1000.0; // from mkm to mm
+ ccd_pixel_height = ccd_pix_ht / 1000.0; // from mkm to mm
+ aperture = guider_aperture;
+ focal = guider_focal;
+
+ return true;
}
-void cgmath::get_guider_params( double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal )
+void cgmath::getGuiderParameters( double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal )
{
*ccd_pix_wd = ccd_pixel_width * 1000.0;
*ccd_pix_ht = ccd_pixel_height * 1000.0;
@@ -182,90 +175,67 @@ void cgmath::get_guider_params( double *ccd_pix_wd, double *ccd_pix_ht, double *
}
-bool cgmath::set_reticle_params( double x, double y, double ang )
+bool cgmath::setReticleParameters( double x, double y, double ang )
{
- // check frame ranges
- if( x < 0 )
- x = 0;
- if( y < 0 )
- y = 0;
- if( x >= (double)video_width-1 )
- x = (double)video_width-1;
- if( y >= (double)video_height-1 )
- y = (double)video_height-1;
-
- reticle_pos = Vector( x, y, 0 );
-
- if( ang >= 0)
- reticle_angle = ang;
-
- ROT_Z = RotateZ( -M_PI*reticle_angle/180.0 ); // NOTE!!! sing '-' derotates star coordinate system
-
- reticle_orts[0] = Vector(1, 0, 0) * 100;
- reticle_orts[1] = Vector(0, 1, 0) * 100;
+ // check frame ranges
+ if( x < 0 )
+ x = 0;
+ if( y < 0 )
+ y = 0;
+ if( x >= (double)video_width-1 )
+ x = (double)video_width-1;
+ if( y >= (double)video_height-1 )
+ y = (double)video_height-1;
- reticle_orts[0] = reticle_orts[0] * ROT_Z;
- reticle_orts[1] = reticle_orts[1] * ROT_Z;
+ reticle_pos = Vector( x, y, 0 );
- // lets position static overlay
- overlays.reticle_axis_ra[0].x = reticle_pos.x;
- overlays.reticle_axis_ra[0].y = reticle_pos.y;
- overlays.reticle_axis_ra[1].x = reticle_pos.x + reticle_orts[0].x;
- overlays.reticle_axis_ra[1].y = reticle_pos.y + reticle_orts[0].y;
+ if( ang >= 0)
+ reticle_angle = ang;
- overlays.reticle_axis_dec[0].x = reticle_pos.x;
- overlays.reticle_axis_dec[0].y = reticle_pos.y;
- overlays.reticle_axis_dec[1].x = reticle_pos.x - reticle_orts[1].x;
- overlays.reticle_axis_dec[1].y = reticle_pos.y - reticle_orts[1].y; // invert y-axis
+ ROT_Z = RotateZ( -M_PI*reticle_angle/180.0 ); // NOTE!!! sing '-' derotates star coordinate system
- overlays.reticle_pos.x = reticle_pos.x;
- overlays.reticle_pos.y = reticle_pos.y;
+ reticle_orts[0] = Vector(1, 0, 0) * 100;
+ reticle_orts[1] = Vector(0, 1, 0) * 100;
- //if (pimage)
- // pimage->setGuideSquare(reticle_pos.x, reticle_pos.y);
+ reticle_orts[0] = reticle_orts[0] * ROT_Z;
+ reticle_orts[1] = reticle_orts[1] * ROT_Z;
- return true;
+ return true;
}
-bool cgmath::get_reticle_params( double *x, double *y, double *ang ) const
+bool cgmath::getReticleParameters( double *x, double *y, double *ang ) const
{
- *x = reticle_pos.x;
- *y = reticle_pos.y;
+ *x = reticle_pos.x;
+ *y = reticle_pos.y;
- *ang = reticle_angle;
+ *ang = reticle_angle;
- return true;
+ return true;
}
-int cgmath::get_square_index( void ) const
+int cgmath::getSquareAlgorithmIndex( void ) const
{
- return square_idx;
-}
-
-
-int cgmath::get_square_algorithm_index( void ) const
-{
- return square_alg_idx;
+ return square_alg_idx;
}
-cproc_in_params * cgmath::get_in_params( void )
+cproc_in_params * cgmath::getInputParameters( void )
{
- return &in_params;
+ return &in_params;
}
-void cgmath::set_in_params( const cproc_in_params *v )
+void cgmath::setInputParameters( const cproc_in_params *v )
{
- //in_params.threshold_alg_idx = v->threshold_alg_idx;
- set_square_algorithm( v->threshold_alg_idx );
- in_params.guiding_rate = v->guiding_rate;
+ //in_params.threshold_alg_idx = v->threshold_alg_idx;
+ setSquareAlgorithm( v->threshold_alg_idx );
+ in_params.guiding_rate = v->guiding_rate;
in_params.enabled[GUIDE_RA] = v->enabled[GUIDE_RA];
in_params.enabled[GUIDE_DEC] = v->enabled[GUIDE_DEC];
- in_params.average = v->average;
+ in_params.average = v->average;
in_params.accum_frame_cnt[GUIDE_RA] = v->accum_frame_cnt[GUIDE_RA];
in_params.accum_frame_cnt[GUIDE_DEC] = v->accum_frame_cnt[GUIDE_DEC];
in_params.proportional_gain[GUIDE_RA] = v->proportional_gain[GUIDE_RA];
@@ -281,69 +251,65 @@ void cgmath::set_in_params( const cproc_in_params *v )
}
-const cproc_out_params * cgmath::get_out_params( void ) const
+const cproc_out_params * cgmath::getOutputParameters( void ) const
{
- return &out_params;
+ return &out_params;
}
-info_params_t cgmath::get_info_params( void ) const
+info_params_t cgmath::getInfoParameters( void ) const
{
- info_params_t ret;
- Vector p;
-
- ret.aperture = aperture;
- ret.focal = focal;
- ret.focal_ratio = focal / aperture;
- p = Vector(video_width, video_height, 0);
- p = point2arcsec( p );
- p /= 60; // convert to minutes
- ret.fov_wd = p.x;
- ret.fov_ht = p.y;
-
- return ret;
+ info_params_t ret;
+ Vector p;
+
+ ret.aperture = aperture;
+ ret.focal = focal;
+ ret.focal_ratio = focal / aperture;
+ p = Vector(video_width, video_height, 0);
+ p = point2arcsec( p );
+ p /= 60; // convert to minutes
+ ret.fov_wd = p.x;
+ ret.fov_ht = p.y;
+
+ return ret;
}
-uint32_t cgmath::get_ticks( void ) const
+uint32_t cgmath::getTicks( void ) const
{
- return ticks;
+ return ticks;
}
-void cgmath::get_star_drift( double *dx, double *dy ) const
+void cgmath::getStarDrift( double *dx, double *dy ) const
{
- *dx = star_pos.x;
- *dy = star_pos.y;
+ *dx = star_pos.x;
+ *dy = star_pos.y;
}
-void cgmath::get_star_screen_pos( double *dx, double *dy ) const
+void cgmath::getStarScreenPosition( double *dx, double *dy ) const
{
- *dx = scr_star_pos.x;
- *dy = scr_star_pos.y;
+ *dx = scr_star_pos.x;
+ *dy = scr_star_pos.y;
}
bool cgmath::reset( void )
{
- square_idx = DEFAULT_SQR;
- square_alg_idx = AUTO_THRESHOLD;
- square_size = guide_squares[square_idx].size;
- square_square = guide_squares[square_idx].square;
- square_pos = Vector(0);
+ square_alg_idx = AUTO_THRESHOLD;
- // sky coord. system vars.
- star_pos = Vector(0);
- scr_star_pos = Vector(0);
+ // sky coord. system vars.
+ star_pos = Vector(0);
+ scr_star_pos = Vector(0);
- set_reticle_params( video_width/2, video_height/2, 0.0 );
+ setReticleParameters( video_width/2, video_height/2, 0.0 );
- return true;
+ return true;
}
-void cgmath::move_square( double newx, double newy )
+/*void cgmath::move_square( double newx, double newy )
{
square_pos.x = newx;
square_pos.y = newy;
@@ -373,7 +339,7 @@ void cgmath::move_square( double newx, double newy )
void cgmath::resize_square( int size_idx )
{
if( size_idx < 0 || size_idx >= (int)(sizeof(guide_squares)/sizeof(guide_square_t))-1)
- return;
+ return;
if (square_size != guide_squares[size_idx].size)
{
@@ -381,205 +347,190 @@ void cgmath::resize_square( int size_idx )
square_pos.y += (square_size-guide_squares[size_idx].size)/2;
}
- square_size = guide_squares[size_idx].size;
- square_square = guide_squares[size_idx].square;
- square_idx = size_idx;
+ square_size = guide_squares[size_idx].size;
+ square_square = guide_squares[size_idx].square;
+ square_idx = size_idx;
- // check position
+ // check position
if (guide_frame)
- {
+ {
guide_frame->setTrackingBoxEnabled(true);
//guide_frame->setTrackingBoxSize(QSize(square_size,square_size));
guide_frame->setTrackingBox(QRect(square_pos.x/subBinX, square_pos.y/subBinY, square_size/subBinX, square_size/subBinY));
}
-}
-
+}*/
-void cgmath::set_square_algorithm( int alg_idx )
-{
- if( alg_idx < 0 || alg_idx >= (int)(sizeof(guide_square_alg)/sizeof(square_alg_t))-1 )
- return;
-
- square_alg_idx = alg_idx;
-
- in_params.threshold_alg_idx = square_alg_idx;
-}
-
-ovr_params_t *cgmath::prepare_overlays( void )
+void cgmath::setSquareAlgorithm( int alg_idx )
{
- // square
- overlays.square_size = square_size;
- overlays.square_pos.x = (int)square_pos.x;
- overlays.square_pos.y = (int)square_pos.y;
-
- // reticle
- // sets by set_reticle_params() as soon as it does not move every frame
+ if( alg_idx < 0 || alg_idx >= (int)(sizeof(guide_square_alg)/sizeof(square_alg_t))-1 )
+ return;
+ square_alg_idx = alg_idx;
- return &overlays;
+ in_params.threshold_alg_idx = square_alg_idx;
}
Vector cgmath::point2arcsec( const Vector &p ) const
{
- Vector arcs;
+ Vector arcs;
- // arcs = 3600*180/pi * (pix*ccd_pix_sz) / focal_len
- arcs.x = 206264.8062470963552 * p.x * ccd_pixel_width / focal;
- arcs.y = 206264.8062470963552 * p.y * ccd_pixel_height / focal;
+ // arcs = 3600*180/pi * (pix*ccd_pix_sz) / focal_len
+ arcs.x = 206264.8062470963552 * p.x * ccd_pixel_width / focal;
+ arcs.y = 206264.8062470963552 * p.y * ccd_pixel_height / focal;
- return arcs;
+ return arcs;
}
-double cgmath::precalc_proportional_gain( double g_rate )
+double cgmath::preCalculatePropotionalGain( double g_rate )
{
- if( g_rate <= 0.01 )
- return 0;
+ if( g_rate <= 0.01 )
+ return 0;
- return 1000.0 / (g_rate * 15.0);
+ return 1000.0 / (g_rate * 15.0);
}
-bool cgmath::calc_and_set_reticle( double start_x, double start_y, double end_x, double end_y, int totalPulse )
+bool cgmath::calculateAndSetReticle1D( double start_x, double start_y, double end_x, double end_y, int totalPulse )
{
- double phi;
+ double phi;
- phi = calc_phi( start_x, start_y, end_x, end_y );
+ phi = calculatePhi( start_x, start_y, end_x, end_y );
- if( phi < 0 )
- return false;
+ if( phi < 0 )
+ return false;
- set_reticle_params( start_x, start_y, phi );
+ setReticleParameters( start_x, start_y, phi );
- if (totalPulse > 0)
- {
- double x = end_x-start_x;
- double y = end_y - start_y;
- double len = sqrt(x*x + y*y);
+ if (totalPulse > 0)
+ {
+ double x = end_x-start_x;
+ double y = end_y - start_y;
+ double len = sqrt(x*x + y*y);
- ditherRate[GUIDE_RA] = totalPulse / len;
+ ditherRate[GUIDE_RA] = totalPulse / len;
- if (Options::guideLogging())
+ if (Options::guideLogging())
qDebug() << "Guide: Dither RA Rate " << ditherRate[GUIDE_RA] << " ms/Pixel";
- }
+ }
- return true;
+ return true;
}
-bool cgmath::calc_and_set_reticle2( double start_ra_x, double start_ra_y, double end_ra_x, double end_ra_y, double start_dec_x, double start_dec_y, double end_dec_x, double end_dec_y, bool *swap_dec, int totalPulse)
+bool cgmath::calculateAndSetReticle2D( double start_ra_x, double start_ra_y, double end_ra_x, double end_ra_y, double start_dec_x, double start_dec_y, double end_dec_x, double end_dec_y, bool *swap_dec, int totalPulse)
{
- double phi_ra = 0; // angle calculated by GUIDE_RA drift
- double phi_dec = 0; // angle calculated by GUIDE_DEC drift
- double phi = 0;
+ double phi_ra = 0; // angle calculated by GUIDE_RA drift
+ double phi_dec = 0; // angle calculated by GUIDE_DEC drift
+ double phi = 0;
- Vector ra_vect = Normalize( Vector(end_ra_x - start_ra_x, -(end_ra_y - start_ra_y), 0) );
- Vector dec_vect = Normalize( Vector(end_dec_x - start_dec_x, -(end_dec_y - start_dec_y), 0) );
+ Vector ra_vect = Normalize( Vector(end_ra_x - start_ra_x, -(end_ra_y - start_ra_y), 0) );
+ Vector dec_vect = Normalize( Vector(end_dec_x - start_dec_x, -(end_dec_y - start_dec_y), 0) );
- Vector try_increase = dec_vect * RotateZ( M_PI/2 );
- Vector try_decrease = dec_vect * RotateZ( -M_PI/2 );
+ Vector try_increase = dec_vect * RotateZ( M_PI/2 );
+ Vector try_decrease = dec_vect * RotateZ( -M_PI/2 );
- double cos_increase = try_increase & ra_vect;
- double cos_decrease = try_decrease & ra_vect;
+ double cos_increase = try_increase & ra_vect;
+ double cos_decrease = try_decrease & ra_vect;
- bool do_increase = cos_increase > cos_decrease ? true : false;
+ bool do_increase = cos_increase > cos_decrease ? true : false;
- phi_ra = calc_phi( start_ra_x, start_ra_y, end_ra_x, end_ra_y );
- if( phi_ra < 0 )
- return false;
+ phi_ra = calculatePhi( start_ra_x, start_ra_y, end_ra_x, end_ra_y );
+ if( phi_ra < 0 )
+ return false;
- phi_dec = calc_phi( start_dec_x, start_dec_y, end_dec_x, end_dec_y );
- if( phi_dec < 0 )
- return false;
+ phi_dec = calculatePhi( start_dec_x, start_dec_y, end_dec_x, end_dec_y );
+ if( phi_dec < 0 )
+ return false;
+
+ if( do_increase )
+ phi_dec += 90;
+ else
+ phi_dec -= 90;
- if( do_increase )
- phi_dec += 90;
- else
- phi_dec -= 90;
-
- if( phi_dec > 360 )phi_dec -= 360.0;
- if( phi_dec < 0 )phi_dec += 360.0;
+ if( phi_dec > 360 )phi_dec -= 360.0;
+ if( phi_dec < 0 )phi_dec += 360.0;
- if( fabs(phi_dec - phi_ra) > 180 )
- {
- if( phi_ra > phi_dec )
- phi_ra -= 360;
- else
- phi_dec -= 360;
- }
+ if( fabs(phi_dec - phi_ra) > 180 )
+ {
+ if( phi_ra > phi_dec )
+ phi_ra -= 360;
+ else
+ phi_dec -= 360;
+ }
- // average angles
- phi = (phi_ra + phi_dec) / 2;
- if( phi < 0 )phi += 360.0;
+ // average angles
+ phi = (phi_ra + phi_dec) / 2;
+ if( phi < 0 )phi += 360.0;
- // check DEC
- if( swap_dec )
- *swap_dec = dec_swap = do_increase ? false : true;
+ // check DEC
+ if( swap_dec )
+ *swap_dec = dec_swap = do_increase ? false : true;
- set_reticle_params( start_ra_x, start_ra_y, phi );
+ setReticleParameters( start_ra_x, start_ra_y, phi );
- if (totalPulse > 0)
- {
- double x = end_ra_x-start_ra_x;
- double y = end_ra_y - start_ra_y;
- double len = sqrt(x*x + y*y);
+ if (totalPulse > 0)
+ {
+ double x = end_ra_x-start_ra_x;
+ double y = end_ra_y - start_ra_y;
+ double len = sqrt(x*x + y*y);
- ditherRate[GUIDE_RA] = totalPulse / len;
+ ditherRate[GUIDE_RA] = totalPulse / len;
- if (Options::guideLogging())
+ if (Options::guideLogging())
qDebug() << "Guide: Dither RA Rate " << ditherRate[GUIDE_RA] << " ms/Pixel";
- x = end_dec_x-start_dec_x;
- y = end_dec_y - start_dec_y;
- len = sqrt(x*x + y*y);
+ x = end_dec_x-start_dec_x;
+ y = end_dec_y - start_dec_y;
+ len = sqrt(x*x + y*y);
- ditherRate[GUIDE_DEC] = totalPulse / len;
+ ditherRate[GUIDE_DEC] = totalPulse / len;
- if (Options::guideLogging())
+ if (Options::guideLogging())
qDebug() << "Guide: Dither DEC Rate " << ditherRate[GUIDE_DEC] << " ms/Pixel";
- }
+ }
- return true;
+ return true;
}
-double cgmath::calc_phi( double start_x, double start_y, double end_x, double end_y ) const
+double cgmath::calculatePhi( double start_x, double start_y, double end_x, double end_y ) const
{
- double delta_x, delta_y;
- double phi;
+ double delta_x, delta_y;
+ double phi;
- delta_x = end_x - start_x;
- delta_y = -(end_y - start_y);
+ delta_x = end_x - start_x;
+ delta_y = -(end_y - start_y);
//if( (!Vector(delta_x, delta_y, 0)) < 2.5 )
// JM 2015-12-10: Lower threshold to 1 pixel
if( (!Vector(delta_x, delta_y, 0)) < 1 )
- return -1;
-
- // 90 or 270 degrees
- if( fabs(delta_x) < fabs(delta_y) / 1000000.0 )
- {
- phi = delta_y > 0 ? 90.0 : 270;
- }
- else
- {
- phi = 180.0/M_PI*atan2( delta_y, delta_x );
- if( phi < 0 )phi += 360.0;
- }
-
- return phi;
+ return -1;
+
+ // 90 or 270 degrees
+ if( fabs(delta_x) < fabs(delta_y) / 1000000.0 )
+ {
+ phi = delta_y > 0 ? 90.0 : 270;
+ }
+ else
+ {
+ phi = 180.0/M_PI*atan2( delta_y, delta_x );
+ if( phi < 0 )phi += 360.0;
+ }
+
+ return phi;
}
void cgmath::do_ticks( void )
{
- ticks++;
+ ticks++;
channel_ticks[GUIDE_RA]++;
channel_ticks[GUIDE_DEC]++;
@@ -587,7 +538,7 @@ void cgmath::do_ticks( void )
channel_ticks[GUIDE_RA] = 0;
if( channel_ticks[GUIDE_DEC] >= MAX_ACCUM_CNT )
channel_ticks[GUIDE_DEC] = 0;
-
+
accum_ticks[GUIDE_RA]++;
accum_ticks[GUIDE_DEC]++;
if( accum_ticks[GUIDE_RA] >= in_params.accum_frame_cnt[GUIDE_RA] )
@@ -600,77 +551,84 @@ void cgmath::do_ticks( void )
//-------------------- Processing ---------------------------
void cgmath::start( void )
{
- ticks = 0;
+ ticks = 0;
channel_ticks[GUIDE_RA] = channel_ticks[GUIDE_DEC] = 0;
accum_ticks[GUIDE_RA] = accum_ticks[GUIDE_DEC] = 0;
drift_integral[GUIDE_RA] = drift_integral[GUIDE_DEC] = 0;
- out_params.reset();
+ out_params.reset();
memset( drift[GUIDE_RA], 0, sizeof(double)*MAX_ACCUM_CNT );
memset( drift[GUIDE_DEC], 0, sizeof(double)*MAX_ACCUM_CNT );
- // cleanup stat vars.
- sum = sqr_sum = 0;
- delta_prev = sigma_prev = sigma = 0;
+ // cleanup stat vars.
+ sum = sqr_sum = 0;
+ delta_prev = sigma_prev = sigma = 0;
- preview_mode = false;
+ preview_mode = false;
}
void cgmath::stop( void )
{
- preview_mode = true;
+ preview_mode = true;
}
void cgmath::suspend( bool mode )
{
- suspended = mode;
+ suspended = mode;
}
-bool cgmath::is_suspended( void ) const
+bool cgmath::isSuspended( void ) const
{
- return suspended;
+ return suspended;
}
-bool cgmath::is_lost_star(void) const
+bool cgmath::isStarLost(void) const
{
return lost_star;
}
-void cgmath::set_lost_star(bool is_lost)
+void cgmath::setLostStar(bool is_lost)
{
lost_star = is_lost;
}
-Vector cgmath::find_star_local_pos( void ) const
+Vector cgmath::findLocalStarPosition( void ) const
{
static double P0 = 0.906, P1 = 0.584, P2 = 0.365, P3 = 0.117, P4 = 0.049, P5 = -0.05, P6 = -0.064, P7 = -0.074, P8 = -0.094;
- Vector ret;
- int i, j;
- double resx, resy, mass, threshold, pval;
- float *psrc = NULL, *porigin = NULL;
- float *pptr;
+ Vector ret;
+ int i, j;
+ double resx, resy, mass, threshold, pval;
+ float *psrc = NULL, *porigin = NULL;
+ float *pptr;
+
+ if (useRapidGuide)
+ {
+ return (ret = Vector(rapidDX , rapidDY, 0));
+ }
- if (useRapidGuide)
- {
- return (ret = Vector(rapidDX , rapidDY, 0));
- }
+ QRect trackingBox = guideView->getTrackingBox();
+ if (trackingBox.isValid() == false)
+ return Vector(-1,-1,-1);
- psrc = porigin = pdata + (int)square_pos.y*video_width + (int)square_pos.x;
+ double square_square = trackingBox.width()*trackingBox.width();
- resx = resy = 0;
- threshold = mass = 0;
+ //psrc = porigin = pdata + trackingBox.y()*video_width + trackingBox.x();
+ psrc = porigin = pdata + trackingBox.y()*video_width + trackingBox.x();
- // several threshold adaptive smart agorithms
- switch( square_alg_idx )
- {
+ resx = resy = 0;
+ threshold = mass = 0;
+
+ // several threshold adaptive smart agorithms
+ switch( square_alg_idx )
+ {
case CENTROID_THRESHOLD:
- {
- int width = square_size;
- int height = square_size;
+ {
+ int width = trackingBox.width();
+ int height = trackingBox.width();
float i0, i1, i2, i3, i4, i5, i6, i7, i8;
int ix = 0, iy = 0;
int xM4;
@@ -681,243 +639,243 @@ Vector cgmath::find_star_local_pos( void ) const
int miny = 0;
int maxy = height;
for (int x = minx; x < maxx; x++)
- for (int y = miny; y < maxy; y++)
- {
- i0 = i1 = i2 = i3 = i4 = i5 = i6 = i7 = i8 = 0;
- xM4 = x - 4;
- p = psrc + (y - 4) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y - 3) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i7 += *p++; i6 += *p++; i7 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y - 2) * video_width + xM4; i8 += *p++; i8 += *p++; i5 += *p++; i4 += *p++; i3 += *p++; i4 += *p++; i5 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y - 1) * video_width + xM4; i8 += *p++; i7 += *p++; i4 += *p++; i2 += *p++; i1 += *p++; i2 += *p++; i4 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y + 0) * video_width + xM4; i8 += *p++; i6 += *p++; i3 += *p++; i1 += *p++; i0 += *p++; i1 += *p++; i3 += *p++; i6 += *p++; i8 += *p++;
- p = psrc + (y + 1) * video_width + xM4; i8 += *p++; i7 += *p++; i4 += *p++; i2 += *p++; i1 += *p++; i2 += *p++; i4 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y + 2) * video_width + xM4; i8 += *p++; i8 += *p++; i5 += *p++; i4 += *p++; i3 += *p++; i4 += *p++; i5 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y + 3) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i7 += *p++; i6 += *p++; i7 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
- p = psrc + (y + 4) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
- average = (i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8) / 85.0;
- fit = P0 * (i0 - average) + P1 * (i1 - 4 * average) + P2 * (i2 - 4 * average) + P3 * (i3 - 4 * average) + P4 * (i4 - 8 * average) + P5 * (i5 - 4 * average) + P6 * (i6 - 4 * average) + P7 * (i7 - 8 * average) + P8 * (i8 - 48 * average);
- if (bestFit < fit)
+ for (int y = miny; y < maxy; y++)
{
- bestFit = fit;
- ix = x;
- iy = y;
+ i0 = i1 = i2 = i3 = i4 = i5 = i6 = i7 = i8 = 0;
+ xM4 = x - 4;
+ p = psrc + (y - 4) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y - 3) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i7 += *p++; i6 += *p++; i7 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y - 2) * video_width + xM4; i8 += *p++; i8 += *p++; i5 += *p++; i4 += *p++; i3 += *p++; i4 += *p++; i5 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y - 1) * video_width + xM4; i8 += *p++; i7 += *p++; i4 += *p++; i2 += *p++; i1 += *p++; i2 += *p++; i4 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y + 0) * video_width + xM4; i8 += *p++; i6 += *p++; i3 += *p++; i1 += *p++; i0 += *p++; i1 += *p++; i3 += *p++; i6 += *p++; i8 += *p++;
+ p = psrc + (y + 1) * video_width + xM4; i8 += *p++; i7 += *p++; i4 += *p++; i2 += *p++; i1 += *p++; i2 += *p++; i4 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y + 2) * video_width + xM4; i8 += *p++; i8 += *p++; i5 += *p++; i4 += *p++; i3 += *p++; i4 += *p++; i5 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y + 3) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i7 += *p++; i6 += *p++; i7 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
+ p = psrc + (y + 4) * video_width + xM4; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++; i8 += *p++;
+ average = (i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8) / 85.0;
+ fit = P0 * (i0 - average) + P1 * (i1 - 4 * average) + P2 * (i2 - 4 * average) + P3 * (i3 - 4 * average) + P4 * (i4 - 8 * average) + P5 * (i5 - 4 * average) + P6 * (i6 - 4 * average) + P7 * (i7 - 8 * average) + P8 * (i8 - 48 * average);
+ if (bestFit < fit)
+ {
+ bestFit = fit;
+ ix = x;
+ iy = y;
+ }
}
- }
if (bestFit > 50)
{
- double sumX = 0;
- double sumY = 0;
- double total = 0;
- for (int y = iy - 4; y <= iy + 4; y++) {
- p = psrc + y * width + ix - 4;
- for (int x = ix - 4; x <= ix + 4; x++) {
- double w = *p++;
- sumX += x * w;
- sumY += y * w;
- total += w;
+ double sumX = 0;
+ double sumY = 0;
+ double total = 0;
+ for (int y = iy - 4; y <= iy + 4; y++) {
+ p = psrc + y * width + ix - 4;
+ for (int x = ix - 4; x <= ix + 4; x++) {
+ double w = *p++;
+ sumX += x * w;
+ sumY += y * w;
+ total += w;
+ }
+ }
+ if (total > 0)
+ {
+ ret = (Vector(trackingBox.x(), trackingBox.y(), 0) + Vector(sumX/total , sumY/total, 0));
+ return ret;
+ }
+ }
+ }
+ break;
+ // Alexander's Stepanenko smart threshold algorithm
+ case SMART_THRESHOLD:
+ {
+ point_t bbox_lt = { trackingBox.x()-SMART_FRAME_WIDTH, trackingBox.y()-SMART_FRAME_WIDTH };
+ point_t bbox_rb = { trackingBox.x()+trackingBox.width()+SMART_FRAME_WIDTH, trackingBox.y()+trackingBox.width()+SMART_FRAME_WIDTH };
+ int offset = 0;
+
+ // clip frame
+ if( bbox_lt.x < 0 )
+ bbox_lt.x = 0;
+ if( bbox_lt.y < 0 )
+ bbox_lt.y = 0;
+ if( bbox_rb.x > video_width )
+ bbox_rb.x = video_width;
+ if( bbox_rb.y > video_height )
+ bbox_rb.y = video_height;
+
+ // calc top bar
+ int box_wd = bbox_rb.x - bbox_lt.x;
+ int box_ht = trackingBox.y() - bbox_lt.y;
+ int pix_cnt = 0;
+ if( box_wd > 0 && box_ht > 0 )
+ {
+ pix_cnt += box_wd * box_ht;
+ for( j = bbox_lt.y;j < trackingBox.y();++j )
+ {
+ offset = j*video_width;
+ for( i = bbox_lt.x;i < bbox_rb.x;++i )
+ {
+ pptr = pdata + offset + i;
+ threshold += *pptr;
+ }
+ }
+ }
+ // calc left bar
+ box_wd = trackingBox.x() - bbox_lt.x;
+ box_ht = trackingBox.width();
+ if( box_wd > 0 && box_ht > 0 )
+ {
+ pix_cnt += box_wd * box_ht;
+ for( j = trackingBox.y();j < trackingBox.y()+box_ht;++j )
+ {
+ offset = j*video_width;
+ for( i = bbox_lt.x;i < trackingBox.x();++i )
+ {
+ pptr = pdata + offset + i;
+ threshold += *pptr;
+ }
+ }
+ }
+ // calc right bar
+ box_wd = bbox_rb.x - trackingBox.x() - trackingBox.width();
+ box_ht = trackingBox.width();
+ if( box_wd > 0 && box_ht > 0 )
+ {
+ pix_cnt += box_wd * box_ht;
+ for( j = trackingBox.y();j < trackingBox.y()+box_ht;++j )
+ {
+ offset = j*video_width;
+ for( i = trackingBox.x()+trackingBox.width();i < bbox_rb.x;++i )
+ {
+ pptr = pdata + offset + i;
+ threshold += *pptr;
+ }
+ }
+ }
+ // calc bottom bar
+ box_wd = bbox_rb.x - bbox_lt.x;
+ box_ht = bbox_rb.y - trackingBox.y() - trackingBox.width();
+ if( box_wd > 0 && box_ht > 0 )
+ {
+ pix_cnt += box_wd * box_ht;
+ for( j = trackingBox.y()+trackingBox.width();j < bbox_rb.y;++j )
+ {
+ offset = j*video_width;
+ for( i = bbox_lt.x;i < bbox_rb.x;++i )
+ {
+ pptr = pdata + offset + i;
+ threshold += *pptr;
+ }
+ }
+ }
+ // find maximum
+ double max_val = 0;
+ for( j = 0;j < trackingBox.width();++j )
+ {
+ for( i = 0;i < trackingBox.width();++i )
+ {
+ pptr = psrc+i;
+ if( *pptr > max_val )
+ max_val = *pptr;
+ }
+ psrc += video_width;
+ }
+ threshold /= (double)pix_cnt;
+ // cut by 10% higher then average threshold
+ if( max_val > threshold )
+ threshold += (max_val - threshold) * SMART_CUT_FACTOR;
+
+ //log_i("smart thr. = %f cnt = %d", threshold, pix_cnt);
+ break;
+ }
+ // simple adaptive threshold
+ case AUTO_THRESHOLD:
+ {
+ for( j = 0;j < trackingBox.width();++j )
+ {
+ for( i = 0;i < trackingBox.width();++i )
+ {
+ pptr = psrc+i;
+ threshold += *pptr;
}
- }
- if (total > 0)
- {
- ret = (square_pos + Vector(sumX/total , sumY/total, 0));
- return ret;
- }
+ psrc += video_width;
+ }
+ threshold /= square_square;
+ break;
+ }
+ // no threshold subtracion
+ default:
+ {
+ }
+ }
+
+ psrc = porigin;
+ for( j = 0;j < trackingBox.width();++j )
+ {
+ for( i = 0;i < trackingBox.width();++i )
+ {
+ pptr = psrc+i;
+ pval = *pptr - threshold;
+ pval = pval < 0 ? 0 : pval;
+
+ resx += (double)i * pval;
+ resy += (double)j * pval;
+
+ mass += pval;
}
+ psrc += video_width;
}
- break;
- // Alexander's Stepanenko smart threshold algorithm
- case SMART_THRESHOLD:
- {
- point_t bbox_lt = { (int)square_pos.x-SMART_FRAME_WIDTH, (int)square_pos.y-SMART_FRAME_WIDTH };
- point_t bbox_rb = { (int)square_pos.x+square_size+SMART_FRAME_WIDTH, (int)square_pos.y+square_size+SMART_FRAME_WIDTH };
- int offset = 0;
-
- // clip frame
- if( bbox_lt.x < 0 )
- bbox_lt.x = 0;
- if( bbox_lt.y < 0 )
- bbox_lt.y = 0;
- if( bbox_rb.x > video_width )
- bbox_rb.x = video_width;
- if( bbox_rb.y > video_height )
- bbox_rb.y = video_height;
-
- // calc top bar
- int box_wd = bbox_rb.x - bbox_lt.x;
- int box_ht = (int)square_pos.y - bbox_lt.y;
- int pix_cnt = 0;
- if( box_wd > 0 && box_ht > 0 )
- {
- pix_cnt += box_wd * box_ht;
- for( j = bbox_lt.y;j < (int)square_pos.y;++j )
- {
- offset = j*video_width;
- for( i = bbox_lt.x;i < bbox_rb.x;++i )
- {
- pptr = pdata + offset + i;
- threshold += *pptr;
- }
- }
- }
- // calc left bar
- box_wd = (int)square_pos.x - bbox_lt.x;
- box_ht = square_size;
- if( box_wd > 0 && box_ht > 0 )
- {
- pix_cnt += box_wd * box_ht;
- for( j = (int)square_pos.y;j < (int)square_pos.y+box_ht;++j )
- {
- offset = j*video_width;
- for( i = bbox_lt.x;i < (int)square_pos.x;++i )
- {
- pptr = pdata + offset + i;
- threshold += *pptr;
- }
- }
- }
- // calc right bar
- box_wd = bbox_rb.x - (int)square_pos.x - square_size;
- box_ht = square_size;
- if( box_wd > 0 && box_ht > 0 )
- {
- pix_cnt += box_wd * box_ht;
- for( j = (int)square_pos.y;j < (int)square_pos.y+box_ht;++j )
- {
- offset = j*video_width;
- for( i = (int)square_pos.x+square_size;i < bbox_rb.x;++i )
- {
- pptr = pdata + offset + i;
- threshold += *pptr;
- }
- }
- }
- // calc bottom bar
- box_wd = bbox_rb.x - bbox_lt.x;
- box_ht = bbox_rb.y - (int)square_pos.y - square_size;
- if( box_wd > 0 && box_ht > 0 )
- {
- pix_cnt += box_wd * box_ht;
- for( j = (int)square_pos.y+square_size;j < bbox_rb.y;++j )
- {
- offset = j*video_width;
- for( i = bbox_lt.x;i < bbox_rb.x;++i )
- {
- pptr = pdata + offset + i;
- threshold += *pptr;
- }
- }
- }
- // find maximum
- double max_val = 0;
- for( j = 0;j < square_size;++j )
- {
- for( i = 0;i < square_size;++i )
- {
- pptr = psrc+i;
- if( *pptr > max_val )
- max_val = *pptr;
- }
- psrc += video_width;
- }
- threshold /= (double)pix_cnt;
- // cut by 10% higher then average threshold
- if( max_val > threshold )
- threshold += (max_val - threshold) * SMART_CUT_FACTOR;
-
- //log_i("smart thr. = %f cnt = %d", threshold, pix_cnt);
- break;
- }
- // simple adaptive threshold
- case AUTO_THRESHOLD:
- {
- for( j = 0;j < square_size;++j )
- {
- for( i = 0;i < square_size;++i )
- {
- pptr = psrc+i;
- threshold += *pptr;
- }
- psrc += video_width;
- }
- threshold /= square_square;
- break;
- }
- // no threshold subtracion
- default:
- {
- }
- }
-
- psrc = porigin;
- for( j = 0;j < square_size;++j )
- {
- for( i = 0;i < square_size;++i )
- {
- pptr = psrc+i;
- pval = *pptr - threshold;
- pval = pval < 0 ? 0 : pval;
-
- resx += (double)i * pval;
- resy += (double)j * pval;
-
- mass += pval;
- }
- psrc += video_width;
- }
-
- if( mass == 0 )mass = 1;
-
- resx /= mass;
- resy /= mass;
-
- ret = square_pos + Vector( resx, resy, 0 );
-
- return ret;
+
+ if( mass == 0 )mass = 1;
+
+ resx /= mass;
+ resy /= mass;
+
+ ret = Vector(trackingBox.x(), trackingBox.y(), 0) + Vector( resx, resy, 0 );
+
+ return ret;
}
void cgmath::process_axes( void )
{
- int cnt = 0;
- double t_delta = 0;
+ int cnt = 0;
+ double t_delta = 0;
if (Options::guideLogging())
qDebug() << "Guide: Processing Axes";
- // process axes...
+ // process axes...
for( int k = GUIDE_RA;k <= GUIDE_DEC;k++ )
- {
- // zero all out commands
- out_params.pulse_dir[k] = NO_DIR;
+ {
+ // zero all out commands
+ out_params.pulse_dir[k] = NO_DIR;
- if( accum_ticks[k] < in_params.accum_frame_cnt[k]-1 )
- continue;
+ if( accum_ticks[k] < in_params.accum_frame_cnt[k]-1 )
+ continue;
- t_delta = 0;
- drift_integral[k] = 0;
+ t_delta = 0;
+ drift_integral[k] = 0;
- cnt = in_params.accum_frame_cnt[ k ];
-
- for( int i = 0, idx = channel_ticks[k];i < cnt;++i )
- {
- t_delta += drift[k][idx];
+ cnt = in_params.accum_frame_cnt[ k ];
+
+ for( int i = 0, idx = channel_ticks[k];i < cnt;++i )
+ {
+ t_delta += drift[k][idx];
if (Options::guideLogging())
qDebug() << "Guide: At #" << idx << "drift[" << k << "][" << idx << "] = " << drift[k][idx] << " , t_delta: " << t_delta ;
-
- if( idx > 0 )
- --idx;
- else
- idx = MAX_ACCUM_CNT-1;
- }
-
- for( int i = 0;i < MAX_ACCUM_CNT;++i )
- drift_integral[k] += drift[k][i];
-
- out_params.delta[k] = t_delta / (double)cnt;
- drift_integral[k] /= (double)MAX_ACCUM_CNT;
-
+
+ if( idx > 0 )
+ --idx;
+ else
+ idx = MAX_ACCUM_CNT-1;
+ }
+
+ for( int i = 0;i < MAX_ACCUM_CNT;++i )
+ drift_integral[k] += drift[k][i];
+
+ out_params.delta[k] = t_delta / (double)cnt;
+ drift_integral[k] /= (double)MAX_ACCUM_CNT;
+
if (Options::guideLogging())
{
//qDebug() << "cnt: " << cnt;
@@ -925,59 +883,59 @@ void cgmath::process_axes( void )
qDebug() << "Guide: drift_integral[" << k << "]= " << drift_integral[k];
}
- out_params.pulse_length[k] = fabs(out_params.delta[k]*in_params.proportional_gain[k] + drift_integral[k]*in_params.integral_gain[k]);
- out_params.pulse_length[k] = out_params.pulse_length[k] <= in_params.max_pulse_length[k] ? out_params.pulse_length[k] : in_params.max_pulse_length[k];
+ out_params.pulse_length[k] = fabs(out_params.delta[k]*in_params.proportional_gain[k] + drift_integral[k]*in_params.integral_gain[k]);
+ out_params.pulse_length[k] = out_params.pulse_length[k] <= in_params.max_pulse_length[k] ? out_params.pulse_length[k] : in_params.max_pulse_length[k];
if (Options::guideLogging())
qDebug() << "Guide: pulse_length [" << k << "]= " << out_params.pulse_length[k];
- // calc direction
- if( !in_params.enabled[k] )
- {
- out_params.pulse_dir[k] = NO_DIR;
- continue;
- }
+ // calc direction
+ if( !in_params.enabled[k] )
+ {
+ out_params.pulse_dir[k] = NO_DIR;
+ continue;
+ }
- if( out_params.pulse_length[k] >= in_params.min_pulse_length[k] )
- {
+ if( out_params.pulse_length[k] >= in_params.min_pulse_length[k] )
+ {
if( k == GUIDE_RA )
out_params.pulse_dir[k] = out_params.delta[k] > 0 ? RA_DEC_DIR : RA_INC_DIR; // GUIDE_RA. right dir - decreases GUIDE_RA
- else
+ else
{
out_params.pulse_dir[k] = out_params.delta[k] > 0 ? DEC_INC_DIR : DEC_DEC_DIR; // GUIDE_DEC.
// Reverse DEC direction if we are looking eastward
//if (ROT_Z.x[0][0] > 0 || (ROT_Z.x[0][0] ==0 && ROT_Z.x[0][1] > 0))
- //out_params.pulse_dir[k] = (out_params.pulse_dir[k] == DEC_INC_DIR) ? DEC_DEC_DIR : DEC_INC_DIR;
+ //out_params.pulse_dir[k] = (out_params.pulse_dir[k] == DEC_INC_DIR) ? DEC_DEC_DIR : DEC_INC_DIR;
}
- }
- else
- out_params.pulse_dir[k] = NO_DIR;
+ }
+ else
+ out_params.pulse_dir[k] = NO_DIR;
- if (Options::guideLogging())
+ if (Options::guideLogging())
qDebug() << "Guide: Direction : " << get_direction_string(out_params.pulse_dir[k]);
- }
+ }
emit newAxisDelta(out_params.delta[0], out_params.delta[1]);
- QTextStream out(logFile);
- out << ticks << "," << logTime.elapsed() << "," << out_params.delta[0] << "," << out_params.pulse_length[0] << "," << get_direction_string(out_params.pulse_dir[0])
- << "," << out_params.delta[1] << "," << out_params.pulse_length[1] << "," << get_direction_string(out_params.pulse_dir[1]) << endl;
+ QTextStream out(logFile);
+ out << ticks << "," << logTime.elapsed() << "," << out_params.delta[0] << "," << out_params.pulse_length[0] << "," << get_direction_string(out_params.pulse_dir[0])
+ << "," << out_params.delta[1] << "," << out_params.pulse_length[1] << "," << get_direction_string(out_params.pulse_dir[1]) << endl;
}
-void cgmath::do_processing( void )
+void cgmath::performProcessing( void )
{
- Vector arc_star_pos, arc_reticle_pos, pos, p;
+ Vector arc_star_pos, arc_reticle_pos, pos, p;
// do nothing if suspended
- if( suspended )
- return;
+ if( suspended )
+ return;
- // find guiding star location in
- scr_star_pos = star_pos = find_star_local_pos();
+ // find guiding star location in
+ scr_star_pos = star_pos = findLocalStarPosition();
if (star_pos.x == -1 || star_pos.y == -1)
{
@@ -988,21 +946,25 @@ void cgmath::do_processing( void )
lost_star = false;
- // move square overlay
- move_square( round(star_pos.x) - (double)square_size/(2*subBinX), round(star_pos.y) - (double)square_size/(2*subBinY) );
- //move_square( ceil(star_pos.x) - (double)square_size/2, ceil(star_pos.y) - (double)square_size/2 );
+ // move square overlay
+
+ //TODO FIXME
+ //moveSquare( round(star_pos.x) - (double)square_size/(2*subBinX), round(star_pos.y) - (double)square_size/(2*subBinY) );
- if( preview_mode )
- return;
+ QVector3D starCenter(star_pos.x,star_pos.y, 0);
+ emit newStarPosition(starCenter, true);
+
+ if( preview_mode )
+ return;
if (Options::guideLogging())
qDebug() << "Guide: ################## BEGIN PROCESSING ##################";
- // translate star coords into sky coord. system
+ // translate star coords into sky coord. system
- // convert from pixels into arcsecs
- arc_star_pos = point2arcsec( star_pos );
- arc_reticle_pos = point2arcsec( reticle_pos );
+ // convert from pixels into arcsecs
+ arc_star_pos = point2arcsec( star_pos );
+ arc_reticle_pos = point2arcsec( reticle_pos );
if (Options::guideLogging())
@@ -1013,17 +975,17 @@ void cgmath::do_processing( void )
qDebug() << "Guide: Reticle RA: " << arc_reticle_pos.x << " DEC: " << arc_reticle_pos.y;
}
- // translate into sky coords.
- star_pos = arc_star_pos - arc_reticle_pos;
+ // translate into sky coords.
+ star_pos = arc_star_pos - arc_reticle_pos;
star_pos.y = -star_pos.y; // invert y-axis as y picture axis is inverted
if (Options::guideLogging())
qDebug() << "Guide: -------> BEFORE ROTATION Diff RA: " << star_pos.x << " DEC: " << star_pos.y;
- star_pos = star_pos * ROT_Z;
+ star_pos = star_pos * ROT_Z;
- // both coords are ready for math processing
- //put coord to drift list
+ // both coords are ready for math processing
+ //put coord to drift list
drift[GUIDE_RA][channel_ticks[GUIDE_RA]] = star_pos.x;
drift[GUIDE_DEC][channel_ticks[GUIDE_DEC]] = star_pos.y;
@@ -1033,14 +995,14 @@ void cgmath::do_processing( void )
qDebug() << "Guide: RA channel ticks: " << channel_ticks[GUIDE_RA] << " DEC channel ticks: " << channel_ticks[GUIDE_DEC];
}
- // make decision by axes
- process_axes();
+ // make decision by axes
+ process_axes();
- // process statistics
- calc_square_err();
+ // process statistics
+ calc_square_err();
- // finally process tickers
- do_ticks();
+ // finally process tickers
+ do_ticks();
if (Options::guideLogging())
qDebug() << "Guide: ################## FINISH PROCESSING ##################";
@@ -1050,20 +1012,20 @@ void cgmath::do_processing( void )
void cgmath::calc_square_err( void )
{
- if( !do_statistics )
- return;
- // through MAX_ACCUM_CNT values
- if( ticks == 0 )
- return;
+ if( !do_statistics )
+ return;
+ // through MAX_ACCUM_CNT values
+ if( ticks == 0 )
+ return;
for( int k = GUIDE_RA;k <= GUIDE_DEC;k++ )
- {
- double sqr_avg = 0;
- for( int i = 0;i < MAX_ACCUM_CNT;++i )
- sqr_avg += drift[k][i] * drift[k][i];
+ {
+ double sqr_avg = 0;
+ for( int i = 0;i < MAX_ACCUM_CNT;++i )
+ sqr_avg += drift[k][i] * drift[k][i];
- out_params.sigma[k] = sqrt( sqr_avg / (double)MAX_ACCUM_CNT );
- }
+ out_params.sigma[k] = sqrt( sqr_avg / (double)MAX_ACCUM_CNT );
+ }
}
@@ -1073,7 +1035,7 @@ void cgmath::setRapidGuide(bool enable)
useRapidGuide = enable;
}
-double cgmath::get_dither_rate(int axis)
+double cgmath::getDitherRate(int axis)
{
if (axis < 0 || axis > 1)
return -1;
@@ -1090,10 +1052,10 @@ void cgmath::setRapidStarData(double dx, double dy)
}
-void cgmath::set_log_file(QFile *file)
+void cgmath::setLogFile(QFile *file)
{
- logFile = file;
- logTime.restart();
+ logFile = file;
+ logTime.restart();
}
const char *cgmath::get_direction_string(GuideDirection dir)
@@ -1101,23 +1063,23 @@ const char *cgmath::get_direction_string(GuideDirection dir)
switch (dir)
{
- case RA_DEC_DIR:
- return "Decrease RA";
+ case RA_DEC_DIR:
+ return "Decrease RA";
break;
- case RA_INC_DIR:
- return "Increase RA";
+ case RA_INC_DIR:
+ return "Increase RA";
break;
- case DEC_DEC_DIR:
- return "Decrease DEC";
+ case DEC_DEC_DIR:
+ return "Decrease DEC";
break;
- case DEC_INC_DIR:
- return "Increase DEC";
+ case DEC_INC_DIR:
+ return "Increase DEC";
break;
- default:
+ default:
break;
}
@@ -1125,54 +1087,45 @@ const char *cgmath::get_direction_string(GuideDirection dir)
}
-void cgmath::setBinning(int binx, int biny)
-{
- lastBinX = subBinX;
- lastBinY = subBinY;
-
- subBinX = binx;
- subBinY = biny;
-}
-
//---------------------------------------------------------------------------------------
cproc_in_params::cproc_in_params()
{
- reset();
+ reset();
}
void cproc_in_params::reset( void )
{
threshold_alg_idx = CENTROID_THRESHOLD;
- guiding_rate = 0.5;
- average = true;
+ guiding_rate = 0.5;
+ average = true;
for( int k = GUIDE_RA;k <= GUIDE_DEC;k++ )
- {
- enabled[k] = true;
- accum_frame_cnt[k] = 1;
- proportional_gain[k] = cgmath::precalc_proportional_gain( guiding_rate );
- integral_gain[k] = 0;
- derivative_gain[k] = 0;
- max_pulse_length[k] = 5000;
- min_pulse_length[k] = 100;
- }
+ {
+ enabled[k] = true;
+ accum_frame_cnt[k] = 1;
+ proportional_gain[k] = cgmath::preCalculatePropotionalGain( guiding_rate );
+ integral_gain[k] = 0;
+ derivative_gain[k] = 0;
+ max_pulse_length[k] = 5000;
+ min_pulse_length[k] = 100;
+ }
}
cproc_out_params::cproc_out_params()
{
- reset();
+ reset();
}
void cproc_out_params::reset( void )
{
for( int k = GUIDE_RA;k <= GUIDE_DEC;k++ )
- {
- delta[k] = 0;
- pulse_dir[k] = NO_DIR;
- pulse_length[k] = 0;
- sigma[k] = 0;
- }
+ {
+ delta[k] = 0;
+ pulse_dir[k] = NO_DIR;
+ pulse_length[k] = 0;
+ sigma[k] = 0;
+ }
}
diff --git a/kstars/ekos/guide/gmath.h b/kstars/ekos/guide/gmath.h
index 53f5ae1..59730bf 100644
--- a/kstars/ekos/guide/gmath.h
+++ b/kstars/ekos/guide/gmath.h
@@ -27,8 +27,8 @@
typedef struct
{
- int size;
- double square;
+ int size;
+ double square;
}guide_square_t;
#define SMART_THRESHOLD 0
@@ -38,8 +38,8 @@ typedef struct
typedef struct
{
- int idx;
- const char name[32];
+ int idx;
+ const char name[32];
}square_alg_t;
// smart threshold algorithm param
@@ -58,41 +58,23 @@ typedef struct
extern const guide_square_t guide_squares[];
extern const square_alg_t guide_square_alg[];
-
-
-typedef struct
-{
- enum type_t
- {
- OVR_SQUARE = 1,
- OVR_RETICLE = 2
- };
- int visible;
- int square_size;
- point_t square_pos;
- point_t reticle_axis_ra[2];
- point_t reticle_axis_dec[2];
- point_t reticle_pos;
-}ovr_params_t;
-
-
// input params
class cproc_in_params
{
public:
- cproc_in_params();
- void reset( void );
-
- int threshold_alg_idx;
- double guiding_rate;
- bool enabled[CHANNEL_CNT];
- bool average;
- uint32_t accum_frame_cnt[CHANNEL_CNT];
- double proportional_gain[CHANNEL_CNT];
- double integral_gain[CHANNEL_CNT];
- double derivative_gain[CHANNEL_CNT];
- int max_pulse_length[CHANNEL_CNT];
- int min_pulse_length[CHANNEL_CNT];
+ cproc_in_params();
+ void reset( void );
+
+ int threshold_alg_idx;
+ double guiding_rate;
+ bool enabled[CHANNEL_CNT];
+ bool average;
+ uint32_t accum_frame_cnt[CHANNEL_CNT];
+ double proportional_gain[CHANNEL_CNT];
+ double integral_gain[CHANNEL_CNT];
+ double derivative_gain[CHANNEL_CNT];
+ int max_pulse_length[CHANNEL_CNT];
+ int min_pulse_length[CHANNEL_CNT];
};
@@ -100,13 +82,13 @@ public:
class cproc_out_params
{
public:
- cproc_out_params();
- void reset( void );
+ cproc_out_params();
+ void reset( void );
- double delta[2];
+ double delta[2];
GuideDirection pulse_dir[2];
- int pulse_length[2];
- double sigma[2];
+ int pulse_length[2];
+ double sigma[2];
};
@@ -123,114 +105,118 @@ class cgmath : public QObject
Q_OBJECT
public:
- cgmath();
- virtual ~cgmath();
-
- // functions
- bool set_video_params( int vid_wd, int vid_ht );
- float *get_data_buffer( int *width, int *height, int *length, int *size );
- bool set_guider_params( double ccd_pix_wd, double ccd_pix_ht, double guider_aperture, double guider_focal );
- void get_guider_params( double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal );
- bool set_reticle_params( double x, double y, double ang );
- bool get_reticle_params( double *x, double *y, double *ang ) const;
- int get_square_index( void ) const;
- int get_square_algorithm_index( void ) const;
- int get_square_size() { return square_size; }
- void set_square_algorithm( int alg_idx );
- Matrix get_ROTZ() { return ROT_Z; }
- cproc_in_params *get_in_params( void );
- void set_in_params( const cproc_in_params *v );
- const cproc_out_params *get_out_params( void ) const;
- info_params_t get_info_params( void ) const;
- uint32_t get_ticks( void ) const;
- void get_star_drift( double *dx, double *dy ) const;
- void get_star_screen_pos( double *dx, double *dy ) const;
- bool reset( void );
- void set_buffer(float *buffer);
- void set_image(FITSView *image);
- bool get_dec_swap() { return dec_swap;}
- void set_dec_swap(bool enable) { dec_swap = enable;}
- FITSView *get_image() { return guide_frame; }
- void set_preview_mode(bool enable) { preview_mode = enable;}
-
- ovr_params_t *prepare_overlays( void );
- void move_square( double newx, double newy );
- void resize_square( int size_idx );
- Vector get_square_pos() { return square_pos; }
-
+ cgmath();
+ virtual ~cgmath();
+
+ // functions
+ bool setVideoParameters( int vid_wd, int vid_ht );
+ float *getDataBuffer( int *width, int *height, int *length, int *size );
+ bool setGuiderParameters( double ccd_pix_wd, double ccd_pix_ht, double guider_aperture, double guider_focal );
+ void getGuiderParameters( double *ccd_pix_wd, double *ccd_pix_ht, double *guider_aperture, double *guider_focal );
+ bool setReticleParameters( double x, double y, double ang );
+ bool getReticleParameters( double *x, double *y, double *ang ) const;
+ int getSquareIndex( void ) const;
+ int getSquareAlgorithmIndex( void ) const;
+ int getSquareSize() { return squareSize; }
+ void setSquareAlgorithm( int alg_idx );
+
+ Matrix getROTZ() { return ROT_Z; }
+ cproc_in_params *getInputParameters( void );
+ void setInputParameters( const cproc_in_params *v );
+ const cproc_out_params *getOutputParameters( void ) const;
+ info_params_t getInfoParameters( void ) const;
+ uint32_t getTicks( void ) const;
+
+ void setDataBuffer(float *buffer);
+ void setImageView(FITSView *image);
+ bool declinationSwapEnabled() { return dec_swap;}
+ void setDeclinationSwapEnabled(bool enable) { dec_swap = enable;}
+ FITSView *getImageView() { return guideView; }
+ void setPreviewMode(bool enable) { preview_mode = enable;}
+
+ /*void moveSquare( double newx, double newy );
+ void resizeSquare( int size_idx );
+ Vector getSquarePosition() { return square_pos; }*/
+
+ // Rapid Guide
void setRapidGuide(bool enable);
void setRapidStarData(double dx, double dy);
- void setBinning(int binx, int biny);
- int getBinX() { return subBinX; }
- int getBinY() { return subBinY; }
- int getLastBinX() { return lastBinX; }
- int getLastBinY() { return lastBinY; }
-
- // proc
- void start( void );
- void stop( void );
- void suspend( bool mode );
- bool is_suspended( void ) const;
- bool is_lost_star(void) const;
- void set_lost_star(bool is_lost);
- void do_processing( void );
- static double precalc_proportional_gain( double g_rate );
- bool calc_and_set_reticle( double start_x, double start_y, double end_x, double end_y, int totalPulse=-1);
- bool calc_and_set_reticle2( double start_ra_x, double start_ra_y, double end_ra_x, double end_ra_y, double start_dec_x, double start_dec_y, double end_dec_x, double end_dec_y, bool *swap_dec, int totalPulse=-1);
- double calc_phi( double start_x, double start_y, double end_x, double end_y ) const;
- Vector find_star_local_pos( void ) const;
- double get_dither_rate(int axis);
- void set_log_file(QFile *file);
+
+ // Operations
+ void start( void );
+ void stop( void );
+ bool reset( void );
+ void suspend( bool mode );
+ bool isSuspended( void ) const;
+
+ // Star tracking
+ void getStarDrift( double *dx, double *dy ) const;
+ void getStarScreenPosition( double *dx, double *dy ) const;
+ Vector findLocalStarPosition( void ) const;
+ bool isStarLost(void) const;
+ void setLostStar(bool is_lost);
+
+ // Main processing function
+ void performProcessing( void );
+
+ // Math
+ static double preCalculatePropotionalGain( double g_rate );
+ bool calculateAndSetReticle1D( double start_x, double start_y, double end_x, double end_y, int totalPulse=-1);
+ bool calculateAndSetReticle2D( double start_ra_x, double start_ra_y, double end_ra_x, double end_ra_y, double start_dec_x, double start_dec_y, double end_dec_x, double end_dec_y, bool *swap_dec, int totalPulse=-1);
+ double calculatePhi( double start_x, double start_y, double end_x, double end_y ) const;
+
+ // Dither
+ double getDitherRate(int axis);
+
+ // Logging
+ void setLogFile(QFile *file);
signals:
void newAxisDelta(double delta_ra, double delta_dec);
+ void newStarPosition(QVector3D, bool);
private:
- // sys...
- uint32_t ticks; // global channel ticker
+ // sys...
+ uint32_t ticks; // global channel ticker
float *pdata; // pointer to data buffer
- QPointer<FITSView> guide_frame; // pointer to image
- int video_width, video_height; // video frame dimensions
- double ccd_pixel_width, ccd_pixel_height, aperture, focal;
- Matrix ROT_Z;
+ QPointer<FITSView> guideView; // pointer to image
+ int video_width, video_height; // video frame dimensions
+ double ccd_pixel_width, ccd_pixel_height, aperture, focal;
+ Matrix ROT_Z;
bool preview_mode, suspended, lost_star, dec_swap;
-
- // square variables
- int square_size; // size of analysing square
- double square_square; // square of guiding rect
- Vector square_pos; // integer values in double vars.
- int square_idx; // index in size list
- int square_alg_idx; // index of threshold algorithm
+
+ // square variables
+ int squareSize; // size of analysing square
+ int square_alg_idx; // index of threshold algorithm
int subBinX,subBinY, lastBinX, lastBinY;
-
- // sky coord. system vars.
- Vector star_pos; // position of star in reticle coord. system
- Vector scr_star_pos; // sctreen star position
- Vector reticle_pos;
- Vector reticle_orts[2];
- double reticle_angle;
-
- // processing
- uint32_t channel_ticks[2];
- uint32_t accum_ticks[2];
- double *drift[2];
- double drift_integral[2];
-
- // overlays...
- ovr_params_t overlays;
- cproc_in_params in_params;
- cproc_out_params out_params;
-
- // stat math...
- bool do_statistics;
- double sum, sqr_sum;
- double delta_prev, sigma_prev, sigma;
-
- // proc
- void do_ticks( void );
- Vector point2arcsec( const Vector &p ) const;
- void process_axes( void );
- void calc_square_err( void );
+
+ // sky coord. system vars.
+ Vector star_pos; // position of star in reticle coord. system
+ Vector scr_star_pos; // sctreen star position
+ Vector reticle_pos;
+ Vector reticle_orts[2];
+ double reticle_angle;
+
+ // processing
+ uint32_t channel_ticks[2];
+ uint32_t accum_ticks[2];
+ double *drift[2];
+ double drift_integral[2];
+
+ // overlays...
+ cproc_in_params in_params;
+ cproc_out_params out_params;
+
+ // stat math...
+ bool do_statistics;
+ double sum, sqr_sum;
+ double delta_prev, sigma_prev, sigma;
+
+ // proc
+ void do_ticks( void );
+ Vector point2arcsec( const Vector &p ) const;
+ void process_axes( void );
+ void calc_square_err( void );
const char *get_direction_string(GuideDirection dir);
// rapid guide
@@ -242,7 +228,7 @@ private:
QFile *logFile;
QTime logTime;
-
+
};
#endif /*GMATH_H_*/
diff --git a/kstars/ekos/guide/guider.cpp b/kstars/ekos/guide/guider.cpp
index 6715030..b9a7ce2 100644
--- a/kstars/ekos/guide/guider.cpp
+++ b/kstars/ekos/guide/guider.cpp
@@ -33,14 +33,14 @@
#define DRIFT_GRAPH_HEIGHT 300
#define MAX_DITHER_RETIRES 20
-rguider::rguider(cgmath *mathObject, Ekos::Guide *parent)
+internalGuider::internalGuider(cgmath *mathObject, Ekos::Guide *parent)
: QWidget(parent)
{
- int i;
+ int i;
- ui.setupUi(this);
+ ui.setupUi(this);
- pmain_wnd = parent;
+ guideModule = parent;
phd2 = NULL;
targetChip = NULL;
@@ -52,138 +52,132 @@ rguider::rguider(cgmath *mathObject, Ekos::Guide *parent)
m_lostStarTries=0;
- ui.comboBox_SquareSize->clear();
- for( i = 0;guide_squares[i].size != -1;++i )
- ui.comboBox_SquareSize->addItem( QString().setNum( guide_squares[i].size ) );
-
- ui.comboBox_ThresholdAlg->clear();
- for( i = 0;guide_square_alg[i].idx != -1;++i )
- ui.comboBox_ThresholdAlg->addItem( QString( guide_square_alg[i].name ) );
-
- // connect ui
- connect( ui.spinBox_XScale, SIGNAL(valueChanged(int)), this, SLOT(onXscaleChanged(int)) );
- connect( ui.spinBox_YScale, SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
- connect( ui.comboBox_SquareSize, SIGNAL(activated(int)), this, SLOT(onSquareSizeChanged(int)) );
- connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(int)), this, SLOT(onThresholdChanged(int)) );
- connect( ui.spinBox_GuideRate, SIGNAL(valueChanged(double)), this, SLOT(onInfoRateChanged(double)) );
- connect( ui.checkBox_DirRA, SIGNAL(stateChanged(int)), this, SLOT(onEnableDirRA(int)) );
- connect( ui.checkBox_DirDEC, SIGNAL(stateChanged(int)), this, SLOT(onEnableDirDEC(int)) );
- connect( ui.spinBox_PropGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_PropGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_IntGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_IntGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_DerGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_DerGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_MaxPulseRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_MaxPulseDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_MinPulseRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
- connect( ui.spinBox_MinPulseDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ ui.comboBox_ThresholdAlg->clear();
+ for( i = 0;guide_square_alg[i].idx != -1;++i )
+ ui.comboBox_ThresholdAlg->addItem( QString( guide_square_alg[i].name ) );
+
+ // connect ui
+ connect( ui.spinBox_XScale, SIGNAL(valueChanged(int)), this, SLOT(onXscaleChanged(int)) );
+ connect( ui.spinBox_YScale, SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
+ connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(int)), this, SLOT(onThresholdChanged(int)) );
+ connect( ui.spinBox_GuideRate, SIGNAL(valueChanged(double)), this, SLOT(onInfoRateChanged(double)) );
+ connect( ui.checkBox_DirRA, SIGNAL(stateChanged(int)), this, SLOT(onEnableDirRA(int)) );
+ connect( ui.checkBox_DirDEC, SIGNAL(stateChanged(int)), this, SLOT(onEnableDirDEC(int)) );
+ connect( ui.spinBox_PropGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_PropGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_IntGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_IntGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_DerGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_DerGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_MaxPulseRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_MaxPulseDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_MinPulseRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( ui.spinBox_MinPulseDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
connect( ui.rapidGuideCheck, SIGNAL(toggled(bool)), this, SLOT(onRapidGuideChanged(bool)));
connect( ui.connectPHD2B, SIGNAL(clicked()), this, SLOT(connectPHD2()));
connect(ui.captureB, SIGNAL(clicked()), this, SLOT(capture()));
- connect( ui.pushButton_StartStop, SIGNAL(clicked()), this, SLOT(onStartStopButtonClick()) );
+ connect( ui.pushButton_StartStop, SIGNAL(clicked()), this, SLOT(onStartStopButtonClick()) );
connect( ui.ditherCheck, SIGNAL(toggled(bool)), this, SIGNAL(ditherToggled(bool)));
pmath = mathObject;
- // init drift widget
+ // init drift widget
pDriftOut = new custom_drawer( ui.frame_Graph );
- pDriftOut->move( ui.frame_Graph->frameWidth(), ui.frame_Graph->frameWidth() );
- pDriftOut->setAttribute( Qt::WA_NoSystemBackground, true );
+ pDriftOut->move( ui.frame_Graph->frameWidth(), ui.frame_Graph->frameWidth() );
+ pDriftOut->setAttribute( Qt::WA_NoSystemBackground, true );
ui.frame_Graph->setAttribute( Qt::WA_NoSystemBackground, true );
- drift_graph = new cscroll_graph( this, DRIFT_GRAPH_WIDTH, DRIFT_GRAPH_HEIGHT );
- drift_graph->set_visible_ranges( DRIFT_GRAPH_WIDTH, 60 );
+ drift_graph = new cscroll_graph( this, DRIFT_GRAPH_WIDTH, DRIFT_GRAPH_HEIGHT );
+ drift_graph->set_visible_ranges( DRIFT_GRAPH_WIDTH, 60 );
pDriftOut->set_source( drift_graph->get_buffer(), NULL );
- drift_graph->on_paint();
+ drift_graph->on_paint();
- ui.frame_Graph->resize( DRIFT_GRAPH_WIDTH + 2*ui.frame_Graph->frameWidth(), DRIFT_GRAPH_HEIGHT + 2*ui.frame_Graph->frameWidth() );
+ ui.frame_Graph->resize( DRIFT_GRAPH_WIDTH + 2*ui.frame_Graph->frameWidth(), DRIFT_GRAPH_HEIGHT + 2*ui.frame_Graph->frameWidth() );
- // not UI vars
+ // not UI vars
m_isStarted = false;
m_isReady = false;
- half_refresh_rate = false;
+ half_refresh_rate = false;
m_isDithering = false;
ui.ditherCheck->setChecked(Options::useDither());
ui.ditherPixels->setValue(Options::ditherPixels());
- ui.spinBox_AOLimit->setValue(Options::aOLimit());
+ ui.spinBox_AOLimit->setValue(Options::aOLimit());
QString logFileName = KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/guide_log.txt";
logFile.setFileName(logFileName);
}
-rguider::~rguider()
+internalGuider::~internalGuider()
{
delete pDriftOut;
- delete drift_graph;
+ delete drift_graph;
}
-void rguider::setHalfRefreshRate( bool is_half )
+void internalGuider::setHalfRefreshRate( bool is_half )
{
- half_refresh_rate = is_half;
+ half_refresh_rate = is_half;
}
-bool rguider::isGuiding( void ) const
+bool internalGuider::isGuiding( void ) const
{
return m_isStarted;
}
-void rguider::setMathObject( cgmath *math )
+void internalGuider::setMathObject( cgmath *math )
{
- assert( math );
- pmath = math;
+ assert( math );
+ pmath = math;
}
-void rguider::setAO(bool enable)
+void internalGuider::setAO(bool enable)
{
ui.spinBox_AOLimit->setEnabled(enable);
}
-double rguider::getAOLimit()
+double internalGuider::getAOLimit()
{
return ui.spinBox_AOLimit->value();
}
-void rguider::setInterface( void )
+void internalGuider::setInterface( void )
{
- const cproc_out_params *out_params;
- info_params_t info_params;
- QString str;
- int rx, ry;
+ const cproc_out_params *out_params;
+ info_params_t info_params;
+ QString str;
+ int rx, ry;
- assert( pmath );
+ assert( pmath );
- info_params = pmath->get_info_params();
- out_params = pmath->get_out_params();
+ info_params = pmath->getInfoParameters();
+ out_params = pmath->getOutputParameters();
- drift_graph->get_visible_ranges( &rx, &ry );
- ui.spinBox_XScale->setValue( rx / drift_graph->get_grid_N() );
- ui.spinBox_YScale->setValue( ry / drift_graph->get_grid_N() );
+ drift_graph->get_visible_ranges( &rx, &ry );
+ ui.spinBox_XScale->setValue( rx / drift_graph->get_grid_N() );
+ ui.spinBox_YScale->setValue( ry / drift_graph->get_grid_N() );
- ui.comboBox_SquareSize->setCurrentIndex( pmath->get_square_index() );
- ui.comboBox_ThresholdAlg->setCurrentIndex( pmath->get_square_algorithm_index() );
+ ui.comboBox_ThresholdAlg->setCurrentIndex( pmath->getSquareAlgorithmIndex() );
- ui.l_RecommendedGain->setText( i18n("P: %1", QString().setNum(cgmath::precalc_proportional_gain(Options::guidingRate()), 'f', 2 )) );
+ ui.l_RecommendedGain->setText( i18n("P: %1", QString().setNum(cgmath::preCalculatePropotionalGain(Options::guidingRate()), 'f', 2 )) );
ui.spinBox_GuideRate->setValue( Options::guidingRate() );
- // info params...
- ui.l_Focal->setText( str.setNum( (int)info_params.focal) );
- ui.l_Aperture->setText( str.setNum( (int)info_params.aperture) );
- ui.l_FbyD->setText( QString().setNum( info_params.focal_ratio, 'f', 1) );
- str = QString().setNum(info_params.fov_wd, 'f', 1) + 'x' + QString().setNum(info_params.fov_ht, 'f', 1);
- ui.l_FOV->setText( str );
+ // info params...
+ ui.l_Focal->setText( str.setNum( (int)info_params.focal) );
+ ui.l_Aperture->setText( str.setNum( (int)info_params.aperture) );
+ ui.l_FbyD->setText( QString().setNum( info_params.focal_ratio, 'f', 1) );
+ str = QString().setNum(info_params.fov_wd, 'f', 1) + 'x' + QString().setNum(info_params.fov_ht, 'f', 1);
+ ui.l_FOV->setText( str );
ui.checkBox_DirRA->setChecked( Options::enableRAGuide() );
ui.checkBox_DirDEC->setChecked( Options::enableDECGuide() );
@@ -215,151 +209,144 @@ void rguider::setInterface( void )
}
-void rguider::onXscaleChanged( int i )
+void internalGuider::onXscaleChanged( int i )
{
- int rx, ry;
+ int rx, ry;
- drift_graph->get_visible_ranges( &rx, &ry );
- drift_graph->set_visible_ranges( i*drift_graph->get_grid_N(), ry );
+ drift_graph->get_visible_ranges( &rx, &ry );
+ drift_graph->set_visible_ranges( i*drift_graph->get_grid_N(), ry );
- // refresh if not started
+ // refresh if not started
if( !m_isStarted )
- {
- drift_graph->on_paint();
- // pDriftOut->update();
- }
+ {
+ drift_graph->on_paint();
+ // pDriftOut->update();
+ }
}
-void rguider::onYscaleChanged( int i )
+void internalGuider::onYscaleChanged( int i )
{
- int rx, ry;
+ int rx, ry;
- drift_graph->get_visible_ranges( &rx, &ry );
- drift_graph->set_visible_ranges( rx, i*drift_graph->get_grid_N() );
+ drift_graph->get_visible_ranges( &rx, &ry );
+ drift_graph->set_visible_ranges( rx, i*drift_graph->get_grid_N() );
- // refresh if not started
+ // refresh if not started
if( !m_isStarted )
- {
- drift_graph->on_paint();
-// pDriftOut->update();
- }
-}
-
-
-void rguider::onSquareSizeChanged( int index )
-{
- if( pmath )
- pmath->resize_square( index );
+ {
+ drift_graph->on_paint();
+ // pDriftOut->update();
+ }
}
-void rguider::onThresholdChanged( int index )
+void internalGuider::onThresholdChanged( int index )
{
- if( pmath )
- pmath->set_square_algorithm( index );
+ if( pmath )
+ pmath->setSquareAlgorithm( index );
}
// params changing stuff
-void rguider::onInfoRateChanged( double val )
+void internalGuider::onInfoRateChanged( double val )
{
- cproc_in_params *in_params;
+ cproc_in_params *in_params;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- in_params = pmath->get_in_params();
+ in_params = pmath->getInputParameters();
- in_params->guiding_rate = val;
+ in_params->guiding_rate = val;
- ui.l_RecommendedGain->setText( i18n("P: %1", QString().setNum(pmath->precalc_proportional_gain(in_params->guiding_rate), 'f', 2 )) );
+ ui.l_RecommendedGain->setText( i18n("P: %1", QString().setNum(pmath->preCalculatePropotionalGain(in_params->guiding_rate), 'f', 2 )) );
}
-void rguider::onEnableDirRA( int state )
+void internalGuider::onEnableDirRA( int state )
{
- cproc_in_params *in_params;
+ cproc_in_params *in_params;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- in_params = pmath->get_in_params();
+ in_params = pmath->getInputParameters();
in_params->enabled[GUIDE_RA] = (state == Qt::Checked);
}
-void rguider::onEnableDirDEC( int state )
+void internalGuider::onEnableDirDEC( int state )
{
- cproc_in_params *in_params;
+ cproc_in_params *in_params;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- in_params = pmath->get_in_params();
+ in_params = pmath->getInputParameters();
in_params->enabled[GUIDE_DEC] = (state == Qt::Checked);
}
-void rguider::onInputParamChanged()
+void internalGuider::onInputParamChanged()
{
- QObject *obj;
- QSpinBox *pSB;
- QDoubleSpinBox *pDSB;
- cproc_in_params *in_params;
+ QObject *obj;
+ QSpinBox *pSB;
+ QDoubleSpinBox *pDSB;
+ cproc_in_params *in_params;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- obj = sender();
+ obj = sender();
- in_params = pmath->get_in_params();
+ in_params = pmath->getInputParameters();
- if( (pSB = dynamic_cast<QSpinBox *>(obj)) )
- {
- if( pSB == ui.spinBox_MaxPulseRA )
+ if( (pSB = dynamic_cast<QSpinBox *>(obj)) )
+ {
+ if( pSB == ui.spinBox_MaxPulseRA )
in_params->max_pulse_length[GUIDE_RA] = pSB->value();
- else
- if( pSB == ui.spinBox_MaxPulseDEC )
- in_params->max_pulse_length[GUIDE_DEC] = pSB->value();
- else
- if( pSB == ui.spinBox_MinPulseRA )
- in_params->min_pulse_length[GUIDE_RA] = pSB->value();
- else
- if( pSB == ui.spinBox_MinPulseDEC )
- in_params->min_pulse_length[GUIDE_DEC] = pSB->value();
- }
- else
- if( (pDSB = dynamic_cast<QDoubleSpinBox *>(obj)) )
- {
- if( pDSB == ui.spinBox_PropGainRA )
- in_params->proportional_gain[GUIDE_RA] = pDSB->value();
- else
- if( pDSB == ui.spinBox_PropGainDEC )
- in_params->proportional_gain[GUIDE_DEC] = pDSB->value();
- else
- if( pDSB == ui.spinBox_IntGainRA )
- in_params->integral_gain[GUIDE_RA] = pDSB->value();
- else
- if( pDSB == ui.spinBox_IntGainDEC )
- in_params->integral_gain[GUIDE_DEC] = pDSB->value();
- else
- if( pDSB == ui.spinBox_DerGainRA )
- in_params->derivative_gain[GUIDE_RA] = pDSB->value();
- else
- if( pDSB == ui.spinBox_DerGainDEC )
- in_params->derivative_gain[GUIDE_DEC] = pDSB->value();
- }
-
-}
-
-
-
-void rguider::setTargetChip(ISD::CCDChip *chip)
+ else
+ if( pSB == ui.spinBox_MaxPulseDEC )
+ in_params->max_pulse_length[GUIDE_DEC] = pSB->value();
+ else
+ if( pSB == ui.spinBox_MinPulseRA )
+ in_params->min_pulse_length[GUIDE_RA] = pSB->value();
+ else
+ if( pSB == ui.spinBox_MinPulseDEC )
+ in_params->min_pulse_length[GUIDE_DEC] = pSB->value();
+ }
+ else
+ if( (pDSB = dynamic_cast<QDoubleSpinBox *>(obj)) )
+ {
+ if( pDSB == ui.spinBox_PropGainRA )
+ in_params->proportional_gain[GUIDE_RA] = pDSB->value();
+ else
+ if( pDSB == ui.spinBox_PropGainDEC )
+ in_params->proportional_gain[GUIDE_DEC] = pDSB->value();
+ else
+ if( pDSB == ui.spinBox_IntGainRA )
+ in_params->integral_gain[GUIDE_RA] = pDSB->value();
+ else
+ if( pDSB == ui.spinBox_IntGainDEC )
+ in_params->integral_gain[GUIDE_DEC] = pDSB->value();
+ else
+ if( pDSB == ui.spinBox_DerGainRA )
+ in_params->derivative_gain[GUIDE_RA] = pDSB->value();
+ else
+ if( pDSB == ui.spinBox_DerGainDEC )
+ in_params->derivative_gain[GUIDE_DEC] = pDSB->value();
+ }
+
+}
+
+
+
+void internalGuider::setTargetChip(ISD::CCDChip *chip)
{
targetChip = chip;
targetChip->getFrame(&fx, &fy, &fw, &fh);
@@ -367,7 +354,7 @@ void rguider::setTargetChip(ISD::CCDChip *chip)
ui.subFrameCheck->setEnabled(targetChip->canSubframe());
}
-bool rguider::start()
+bool internalGuider::start()
{
Options::setUseDither(ui.ditherCheck->isChecked());
Options::setDitherPixels(ui.ditherPixels->value());
@@ -402,7 +389,7 @@ bool rguider::start()
//pmain_wnd->setSuspended(false);
ui.pushButton_StartStop->setText( i18n("Stop") );
- pmain_wnd->appendLogText(i18n("Autoguiding started."));
+ guideModule->appendLogText(i18n("Autoguiding started."));
return true;
}
@@ -418,19 +405,19 @@ bool rguider::start()
drift_graph->reset_data();
ui.pushButton_StartStop->setText( i18n("Stop") );
- pmain_wnd->appendLogText(i18n("Autoguiding started."));
+ guideModule->appendLogText(i18n("Autoguiding started."));
pmath->start();
m_lostStarTries=0;
m_isStarted = true;
m_useRapidGuide = ui.rapidGuideCheck->isChecked();
if (m_useRapidGuide)
- pmain_wnd->startRapidGuide();
+ guideModule->startRapidGuide();
emit autoGuidingToggled(true);
// FIXME use only one signal, remove the previous one
emit newStatus(Ekos::GUIDE_GUIDING);
- pmain_wnd->setSuspended(false);
+ guideModule->setSuspended(false);
first_frame = true;
@@ -439,17 +426,17 @@ bool rguider::start()
capture();
- pmath->set_log_file(&logFile);
+ pmath->setLogFile(&logFile);
return true;
}
-bool rguider::stop()
+bool internalGuider::stop()
{
if (phd2)
{
ui.pushButton_StartStop->setText( i18n("Start Autoguide") );
- emit autoGuidingToggled(false);
+ emit autoGuidingToggled(false);
m_isDithering = false;
m_isStarted = false;
@@ -460,7 +447,7 @@ bool rguider::stop()
if (guideFrame)
connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int,int)), Qt::UniqueConnection);
ui.pushButton_StartStop->setText( i18n("Start Autoguide") );
- pmain_wnd->appendLogText(i18n("Autoguiding stopped."));
+ guideModule->appendLogText(i18n("Autoguiding stopped."));
pmath->stop();
first_frame = false;
@@ -469,7 +456,7 @@ bool rguider::stop()
targetChip->abortExposure();
if (m_useRapidGuide)
- pmain_wnd->stopRapidGuide();
+ guideModule->stopRapidGuide();
emit autoGuidingToggled(false);
// FIXME use only one signal, remove the previous one
@@ -481,7 +468,7 @@ bool rguider::stop()
return true;
}
-void rguider::setGuideState(bool guiding)
+void internalGuider::setGuideState(bool guiding)
{
if (phd2 == NULL)
return;
@@ -493,7 +480,7 @@ void rguider::setGuideState(bool guiding)
m_useRapidGuide = ui.rapidGuideCheck->isChecked();
ui.pushButton_StartStop->setText( i18n("Stop") );
- pmain_wnd->appendLogText(i18n("Autoguiding started."));
+ guideModule->appendLogText(i18n("Autoguiding started."));
}
// if already started
else if (m_isStarted && guiding == false)
@@ -504,34 +491,29 @@ void rguider::setGuideState(bool guiding)
}
// processing stuff
-void rguider::onStartStopButtonClick()
+void internalGuider::onStartStopButtonClick()
{
- assert( pmath );
+ assert( pmath );
assert (targetChip);
- // start
+ // start
if( !m_isStarted )
- start();
- // stop
- else
- stop();
+ start();
+ // stop
+ else
+ stop();
}
-void rguider::capture()
+void internalGuider::capture()
{
- int binX=1, binY=1, lastBinX=1,lastBinY=1;
-
- int square_size = pmath->get_square_size();
- binX = pmath->getBinX();
- binY = pmath->getBinY();
- lastBinX = pmath->getLastBinX();
- lastBinY = pmath->getLastBinY();
-
if (ui.subFrameCheck->isChecked() && m_isSubFramed == false)
{
- int x,y,w,h;
- pmath->get_reticle_params(&ret_x, &ret_y, &ret_angle);
+ int x,y,w,h,binX=1,binY=1;
+ targetChip->getBinning(&binX, &binY);
+ int square_size = guideFrame->getTrackingBox().width();
+
+ pmath->getReticleParameters(&ret_x, &ret_y, &ret_angle);
x = (ret_x - square_size)*binX;
y = (ret_y - square_size)*binY;
w=square_size*2*binX;
@@ -551,150 +533,139 @@ void rguider::capture()
if ((h+y)>maxH)
h=maxH-y;
- pmath->set_video_params(w/binX, h/binY);
+ pmath->setVideoParameters(w/binX, h/binY);
targetChip->setFrame(x, y, w, h);
- trackingStarSelected(w/(binX*2), h/(binY*2));
- }
- else if (ui.subFrameCheck->isChecked() == false/* && is_subframed == true*/)
- {
- m_isSubFramed = false;
- targetChip->resetFrame();
+ //trackingStarSelected(w/(binX*2), h/(binY*2));
- Vector square_pos = pmath->get_square_pos();
+ pmath->setReticleParameters(w/(binX*2), h/(binY*2), ret_angle);
- if (square_pos.x == 0 && square_pos.y == 0)
- {
- int x,y,w,h;
- targetChip->getFrame(&x,&y,&w,&h);
- pmath->move_square(w/(2*binX) - square_size / (2*binX), h/(2*binY) - square_size / (2*binY));
- }
+ //emit newStarPosition(QVector3D(w/(binX*2), h/(binY*2), 0), false);
+ emit newStarPosition(QVector3D(), false);
}
-
- if (binX != lastBinX)
+ else if (m_isSubFramed && ui.subFrameCheck->isChecked() == false)
{
- Vector square_pos = pmath->get_square_pos();
- double newX = square_pos.x * lastBinX/binX;
- double newY = square_pos.y * lastBinY/binY;
- pmath->move_square(newX, newY);
- pmath->setBinning(binX, binY);
+ m_isSubFramed = false;
+ targetChip->resetFrame();
+
+ emit newStarPosition(QVector3D(), false);
}
- pmain_wnd->capture();
+ guideModule->capture();
}
-void rguider::onSetDECSwap(bool enable)
+void internalGuider::onSetDECSwap(bool enable)
{
- pmain_wnd->setDECSwap(enable);
+ guideModule->setDECSwap(enable);
}
-void rguider::setDECSwap(bool enable)
+void internalGuider::setDECSwap(bool enable)
{
ui.swapCheck->disconnect(this);
ui.swapCheck->setChecked(enable);
connect(ui.swapCheck, SIGNAL(toggled(bool)), this, SLOT(setDECSwap(bool)));
}
-void rguider::guide( void )
+void internalGuider::guide( void )
{
- static int maxPulseCounter=0;
- const cproc_out_params *out;
- QString str;
- uint32_t tick = 0;
- double drift_x = 0, drift_y = 0;
+ static int maxPulseCounter=0;
+ const cproc_out_params *out;
+ QString str;
+ uint32_t tick = 0;
+ double drift_x = 0, drift_y = 0;
- assert( pmath );
+ assert( pmath );
- if (first_subframe)
- {
+ if (first_subframe)
+ {
first_subframe = false;
return;
- }
- else if (first_frame)
- {
- if (m_isDithering == false)
- {
- Vector star_pos = pmath->find_star_local_pos();
- int square_size = pmath->get_square_size();
- double ret_x,ret_y,ret_angle;
- int binx=1,biny=1;
- targetChip->getBinning(&binx, &biny);
- pmath->get_reticle_params(&ret_x, &ret_y, &ret_angle);
- pmath->move_square( round(star_pos.x) - (double)square_size/(2*binx), round(star_pos.y) - (double)square_size/(2*biny) );
- pmath->set_reticle_params(star_pos.x, star_pos.y, ret_angle);
- }
- first_frame=false;
- }
-
- // calc math. it tracks square
- pmath->do_processing();
-
- if(!m_isStarted )
- return;
-
- if (pmath->is_lost_star() && ++m_lostStarTries > 2)
- {
- onStartStopButtonClick();
- KMessageBox::error(NULL, i18n("Lost track of the guide star. Try increasing the square size and check the mount."));
- return;
- }
- else
- m_lostStarTries = 0;
-
- // do pulse
- out = pmath->get_out_params();
-
- if (out->pulse_length[GUIDE_RA] == ui.spinBox_MaxPulseRA->value() || out->pulse_length[GUIDE_DEC] == ui.spinBox_MaxPulseDEC->value())
+ }
+ else if (first_frame)
+ {
+ if (m_isDithering == false)
+ {
+ Vector star_pos = pmath->findLocalStarPosition();
+ double ret_x,ret_y,ret_angle;
+ int binx=1,biny=1;
+ targetChip->getBinning(&binx, &biny);
+ pmath->getReticleParameters(&ret_x, &ret_y, &ret_angle);
+
+ //pmath->moveSquare( round(star_pos.x) - (double)square_size/(2*binx), round(star_pos.y) - (double)square_size/(2*biny) );
+ pmath->setReticleParameters(star_pos.x, star_pos.y, ret_angle);
+ }
+ first_frame=false;
+ }
+
+ // calc math. it tracks square
+ pmath->performProcessing();
+
+ if(!m_isStarted )
+ return;
+
+ if (pmath->isStarLost() && ++m_lostStarTries > 2)
+ {
+ onStartStopButtonClick();
+ KMessageBox::error(NULL, i18n("Lost track of the guide star. Try increasing the square size and check the mount."));
+ return;
+ }
+ else
+ m_lostStarTries = 0;
+
+ // do pulse
+ out = pmath->getOutputParameters();
+
+ if (out->pulse_length[GUIDE_RA] == ui.spinBox_MaxPulseRA->value() || out->pulse_length[GUIDE_DEC] == ui.spinBox_MaxPulseDEC->value())
maxPulseCounter++;
- else
- maxPulseCounter=0;
+ else
+ maxPulseCounter=0;
- if (maxPulseCounter > 3)
- {
- pmain_wnd->appendLogText(i18n("Lost track of the guide star. Aborting guiding..."));
- abort();
- maxPulseCounter=0;
- }
+ if (maxPulseCounter > 3)
+ {
+ guideModule->appendLogText(i18n("Lost track of the guide star. Aborting guiding..."));
+ abort();
+ maxPulseCounter=0;
+ }
- pmain_wnd->sendPulse( out->pulse_dir[GUIDE_RA], out->pulse_length[GUIDE_RA], out->pulse_dir[GUIDE_DEC], out->pulse_length[GUIDE_DEC] );
+ guideModule->sendPulse( out->pulse_dir[GUIDE_RA], out->pulse_length[GUIDE_RA], out->pulse_dir[GUIDE_DEC], out->pulse_length[GUIDE_DEC] );
- if (m_isDithering)
- return;
+ if (m_isDithering)
+ return;
- pmath->get_star_drift( &drift_x, &drift_y );
+ pmath->getStarDrift( &drift_x, &drift_y );
- drift_graph->add_point( drift_x, drift_y );
+ drift_graph->add_point( drift_x, drift_y );
- tick = pmath->get_ticks();
+ tick = pmath->getTicks();
- if( tick & 1 )
- {
- // draw some params in window
- ui.l_DeltaRA->setText(str.setNum(out->delta[GUIDE_RA], 'f', 2) );
- ui.l_DeltaDEC->setText(str.setNum(out->delta[GUIDE_DEC], 'f', 2) );
+ if( tick & 1 )
+ {
+ // draw some params in window
+ ui.l_DeltaRA->setText(str.setNum(out->delta[GUIDE_RA], 'f', 2) );
+ ui.l_DeltaDEC->setText(str.setNum(out->delta[GUIDE_DEC], 'f', 2) );
- ui.l_PulseRA->setText(str.setNum(out->pulse_length[GUIDE_RA]) );
- ui.l_PulseDEC->setText(str.setNum(out->pulse_length[GUIDE_DEC]) );
+ ui.l_PulseRA->setText(str.setNum(out->pulse_length[GUIDE_RA]) );
+ ui.l_PulseDEC->setText(str.setNum(out->pulse_length[GUIDE_DEC]) );
- ui.l_ErrRA->setText( str.setNum(out->sigma[GUIDE_RA], 'g', 3));
- ui.l_ErrDEC->setText( str.setNum(out->sigma[GUIDE_DEC], 'g', 3 ));
- }
+ ui.l_ErrRA->setText( str.setNum(out->sigma[GUIDE_RA], 'g', 3));
+ ui.l_ErrDEC->setText( str.setNum(out->sigma[GUIDE_DEC], 'g', 3 ));
+ }
- // skip half frames
- if( half_refresh_rate && (tick & 1) )
- return;
+ // skip half frames
+ if( half_refresh_rate && (tick & 1) )
+ return;
- drift_graph->on_paint();
- pDriftOut->update();
+ drift_graph->on_paint();
+ pDriftOut->update();
- profilePixmap = pDriftOut->grab(QRect(QPoint(0, 100), QSize(pDriftOut->width(), 101)));
- emit newProfilePixmap(profilePixmap);
+ profilePixmap = pDriftOut->grab(QRect(QPoint(0, 100), QSize(pDriftOut->width(), 101)));
+ emit newProfilePixmap(profilePixmap);
}
-void rguider::setImage(FITSView *image)
+void internalGuider::setImageView(FITSView *image)
{
guideFrame = image;
@@ -702,25 +673,26 @@ void rguider::setImage(FITSView *image)
connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
}
-void rguider::trackingStarSelected(int x, int y)
+void internalGuider::trackingStarSelected(int x, int y)
{
- int square_size = guide_squares[pmath->get_square_index()].size;
+ pmath->setReticleParameters(x, y, guideModule->getReticleAngle());
+
- int binx=1,biny=1;
- targetChip->getBinning(&binx, &biny);
+ //pmath->moveSquare(x-square_size/(2*binx), y-square_size/(2*biny));
+ QVector3D starCenter = guideModule->getStarPosition();
- pmath->set_reticle_params(x, y, pmain_wnd->getReticleAngle());
- pmath->move_square(x-square_size/(2*binx), y-square_size/(2*biny));
+ starCenter.setX(x);
+ starCenter.setY(y);
- //disconnect(pimage, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ emit newStarPosition(starCenter, true);
}
-void rguider::onRapidGuideChanged(bool enable)
+void internalGuider::onRapidGuideChanged(bool enable)
{
if (m_isStarted)
{
- pmain_wnd->appendLogText(i18n("You must stop auto guiding before changing this setting."));
+ guideModule->appendLogText(i18n("You must stop auto guiding before changing this setting."));
return;
}
@@ -728,14 +700,14 @@ void rguider::onRapidGuideChanged(bool enable)
if (m_useRapidGuide)
{
- pmain_wnd->appendLogText(i18n("Rapid Guiding is enabled. Guide star will be determined automatically by the CCD driver. No frames are sent to Ekos unless explicitly enabled by the user in the CCD driver settings."));
+ guideModule->appendLogText(i18n("Rapid Guiding is enabled. Guide star will be determined automatically by the CCD driver. No frames are sent to Ekos unless explicitly enabled by the user in the CCD driver settings."));
}
else
- pmain_wnd->appendLogText(i18n("Rapid Guiding is disabled."));
+ guideModule->appendLogText(i18n("Rapid Guiding is disabled."));
}
-bool rguider::abort(bool silence)
+bool internalGuider::abort(bool silence)
{
if (m_isStarted == true)
{
@@ -750,7 +722,7 @@ bool rguider::abort(bool silence)
return true;
}
-bool rguider::dither()
+bool internalGuider::dither()
{
static Vector target_pos;
static unsigned int retries=0;
@@ -759,9 +731,9 @@ bool rguider::dither()
return false;
double cur_x, cur_y, ret_angle;
- pmath->get_reticle_params(&cur_x, &cur_y, &ret_angle);
- pmath->get_star_screen_pos( &cur_x, &cur_y );
- Matrix ROT_Z = pmath->get_ROTZ();
+ pmath->getReticleParameters(&cur_x, &cur_y, &ret_angle);
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
+ Matrix ROT_Z = pmath->getROTZ();
//qDebug() << "Star Pos X " << cur_x << " Y " << cur_y;
@@ -780,24 +752,24 @@ bool rguider::dither()
m_isDithering = true;
- if (pmath->get_dec_swap())
+ if (pmath->declinationSwapEnabled())
diff_y *= -1;
if (polarity > 0)
- target_pos = Vector( cur_x, cur_y, 0 ) + Vector( diff_x, diff_y, 0 );
+ target_pos = Vector( cur_x, cur_y, 0 ) + Vector( diff_x, diff_y, 0 );
else
target_pos = Vector( cur_x, cur_y, 0 ) - Vector( diff_x, diff_y, 0 );
if (Options::guideLogging())
qDebug() << "Guide: Dithering process started.. Reticle Target Pos X " << target_pos.x << " Y " << target_pos.y;
- pmath->set_reticle_params(target_pos.x, target_pos.y, ret_angle);
+ pmath->setReticleParameters(target_pos.x, target_pos.y, ret_angle);
guide();
// Take a new exposure if we're not already capturing
if (targetChip->isCapturing() == false)
- pmain_wnd->capture();
+ guideModule->capture();
return true;
}
@@ -811,7 +783,7 @@ bool rguider::dither()
if (fabs(star_pos.x) < 1 && fabs(star_pos.y) < 1)
{
- pmath->set_reticle_params(cur_x, cur_y, ret_angle);
+ pmath->setReticleParameters(cur_x, cur_y, ret_angle);
m_isDithering = false;
@@ -831,40 +803,29 @@ bool rguider::dither()
guide();
}
- pmain_wnd->capture();
+ guideModule->capture();
return true;
}
-int rguider::getBoxSize()
-{
- return ui.comboBox_SquareSize->currentText().toInt();
-}
-QString rguider::getAlgorithm()
+QString internalGuider::getAlgorithm()
{
- return ui.comboBox_ThresholdAlg->currentText();
+ return ui.comboBox_ThresholdAlg->currentText();
}
-bool rguider::useSubFrame()
+bool internalGuider::useSubFrame()
{
return ui.subFrameCheck->isChecked();
}
-bool rguider::useRapidGuide()
+bool internalGuider::useRapidGuide()
{
return ui.rapidGuideCheck->isChecked();
}
-void rguider::setGuideOptions(int boxSize, const QString & algorithm, bool useSubFrame, bool useRapidGuide)
+void internalGuider::setGuideOptions(const QString & algorithm, bool useSubFrame, bool useRapidGuide)
{
- for (int i=0; i < ui.comboBox_SquareSize->count(); i++)
- if (ui.comboBox_SquareSize->itemText(i).toInt() == boxSize)
- {
- ui.comboBox_SquareSize->setCurrentIndex(i);
- break;
- }
-
for (int i=0; i < ui.comboBox_ThresholdAlg->count(); i++)
if (ui.comboBox_ThresholdAlg->itemText(i) == algorithm)
{
@@ -877,7 +838,7 @@ void rguider::setGuideOptions(int boxSize, const QString & algorithm, bool useSu
ui.rapidGuideCheck->setChecked(useRapidGuide);
}
-void rguider::setDither(bool enable, double value)
+void internalGuider::setDither(bool enable, double value)
{
ui.ditherCheck->setChecked(enable);
@@ -885,7 +846,7 @@ void rguider::setDither(bool enable, double value)
ui.ditherPixels->setValue(value);
}
-void rguider::setPHD2(Ekos::PHD2 *phd)
+void internalGuider::setPHD2(Ekos::PHD2 *phd)
{
// If we already have PHD2 set but we are asked to unset it then we shall disconnect all signals first
if (phd2 && phd == NULL)
@@ -913,7 +874,6 @@ void rguider::setPHD2(Ekos::PHD2 *phd)
ui.captureB->setEnabled(enable);
ui.subFrameCheck->setEnabled(enable);
ui.rapidGuideCheck->setEnabled(enable);
- ui.comboBox_SquareSize->setEnabled(enable);
ui.comboBox_ThresholdAlg->setEnabled(enable);
ui.ditherCheck->setEnabled(enable);
ui.ditherPixels->setEnabled(enable);
@@ -921,7 +881,7 @@ void rguider::setPHD2(Ekos::PHD2 *phd)
}
-void rguider::connectPHD2()
+void internalGuider::connectPHD2()
{
if (phd2)
{
@@ -932,7 +892,7 @@ void rguider::connectPHD2()
}
}
-void rguider::setPHD2Connected()
+void internalGuider::setPHD2Connected()
{
ui.connectPHD2B->setText(i18n("Disconnect PHD2"));
@@ -941,7 +901,7 @@ void rguider::setPHD2Connected()
ui.ditherPixels->setEnabled(true);
}
-void rguider::setPHD2Disconnected()
+void internalGuider::setPHD2Disconnected()
{
ui.connectPHD2B->setText(i18n("Connect PHD2"));
diff --git a/kstars/ekos/guide/guider.h b/kstars/ekos/guide/guider.h
index 352d188..32797db 100644
--- a/kstars/ekos/guide/guider.h
+++ b/kstars/ekos/guide/guider.h
@@ -22,31 +22,31 @@
#include "../guide.h"
-class rguider : public QWidget
+class internalGuider : public QWidget
{
Q_OBJECT
public:
- explicit rguider(cgmath *mathObject, Ekos::Guide *parent = 0);
- ~rguider();
+ explicit internalGuider(cgmath *mathObject, Ekos::Guide *parent = 0);
+ ~internalGuider();
void guide( void );
bool start();
bool stop();
- bool abort(bool silence=false);
+ bool abort(bool silence=false);
void setHalfRefreshRate( bool is_half );
bool isGuiding( void ) const;
void setMathObject( cgmath *math );
void setAO(bool enable);
void setInterface( void );
- void setImage(FITSView *image);
+ void setImageView(FITSView *image);
void setReady(bool enable) { m_isReady = enable;}
void setTargetChip(ISD::CCDChip *chip);
bool isRapidGuide() { return m_useRapidGuide;}
double getAOLimit();
void setSubFramed(bool enable) { m_isSubFramed = enable;}
- void setGuideOptions(int boxSize, const QString & algorithm, bool useSubFrame, bool useRapidGuide);
+ void setGuideOptions(const QString & algorithm, bool useSubFrame, bool useRapidGuide);
// Dither
bool isDitherChecked() { return ui.ditherCheck->isChecked(); }
@@ -55,7 +55,6 @@ public:
void setDither(bool enable, double value);
double getDitherPixels() { return ui.ditherPixels->value(); }
- int getBoxSize();
QString getAlgorithm();
bool useSubFrame();
bool useRapidGuide();
@@ -71,18 +70,17 @@ public slots:
void setGuideState(bool guiding);
protected slots:
- void onXscaleChanged( int i );
- void onYscaleChanged( int i );
- void onSquareSizeChanged( int index );
- void onThresholdChanged( int i );
- void onInfoRateChanged( double val );
- void onEnableDirRA( int state );
- void onEnableDirDEC( int state );
- void onInputParamChanged();
+ void onXscaleChanged( int i );
+ void onYscaleChanged( int i );
+ void onThresholdChanged( int i );
+ void onInfoRateChanged( double val );
+ void onEnableDirRA( int state );
+ void onEnableDirDEC( int state );
+ void onInputParamChanged();
void onRapidGuideChanged(bool enable);
void capture();
void trackingStarSelected(int x, int y);
- void onStartStopButtonClick();
+ void onStartStopButtonClick();
void onSetDECSwap(bool enable);
signals:
@@ -91,10 +89,11 @@ signals:
void autoGuidingToggled(bool);
void newStatus(Ekos::GuideState);
void newProfilePixmap(QPixmap &);
+ void newStarPosition(QVector3D, bool);
private:
- cgmath *pmath;
- Ekos::Guide *pmain_wnd;
+ cgmath *pmath;
+ Ekos::Guide *guideModule;
Ekos::PHD2 *phd2;
custom_drawer *pDriftOut;
@@ -105,7 +104,7 @@ private:
bool m_isReady;
bool m_isSubFramed;
bool first_frame, first_subframe;
- bool half_refresh_rate;
+ bool half_refresh_rate;
int m_lostStarTries;
bool m_useRapidGuide;
ISD::CCDChip *targetChip;
diff --git a/kstars/ekos/guide/guider.ui b/kstars/ekos/guide/guider.ui
index 203db81..5eb42ab 100644
--- a/kstars/ekos/guide/guider.ui
+++ b/kstars/ekos/guide/guider.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>821</width>
- <height>423</height>
+ <width>833</width>
+ <height>415</height>
</rect>
</property>
<property name="sizePolicy">
@@ -492,26 +492,16 @@
</widget>
</item>
<item row="1" column="0">
- <widget class="QLabel" name="l_18">
- <property name="text">
- <string>Square size</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QComboBox" name="comboBox_SquareSize"/>
- </item>
- <item row="2" column="0">
<widget class="QLabel" name="l_19">
<property name="text">
<string>Algorithm</string>
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="1" column="1">
<widget class="QComboBox" name="comboBox_ThresholdAlg"/>
</item>
- <item row="3" column="0">
+ <item row="2" column="0">
<widget class="QCheckBox" name="subFrameCheck">
<property name="toolTip">
<string>Subframe the image around the guide star</string>
@@ -521,14 +511,14 @@
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="2" column="1">
<widget class="QCheckBox" name="rapidGuideCheck">
<property name="text">
<string>Rapid Guide</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="3" column="0">
<widget class="QCheckBox" name="ditherCheck">
<property name="toolTip">
<string>Subframe the image around the guide star</string>
@@ -538,7 +528,7 @@
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QDoubleSpinBox" name="ditherPixels">
@@ -874,7 +864,6 @@
<tabstops>
<tabstop>spinBox_XScale</tabstop>
<tabstop>spinBox_YScale</tabstop>
- <tabstop>comboBox_SquareSize</tabstop>
<tabstop>comboBox_ThresholdAlg</tabstop>
<tabstop>spinBox_GuideRate</tabstop>
<tabstop>checkBox_DirRA</tabstop>
diff --git a/kstars/ekos/guide/rcalibration.cpp b/kstars/ekos/guide/rcalibration.cpp
index 65af7f9..0c091cb 100644
--- a/kstars/ekos/guide/rcalibration.cpp
+++ b/kstars/ekos/guide/rcalibration.cpp
@@ -39,12 +39,10 @@
#define MAX_GUIDE_STARS 10
-rcalibration::rcalibration(cgmath *mathObject, Ekos::Guide *parent)
+internalCalibration::internalCalibration(cgmath *mathObject, Ekos::Guide *parent)
: QWidget(parent)
{
- int i;
-
- ui.setupUi(this);
+ ui.setupUi(this);
setWindowTitle(i18n("Calibration"));
@@ -52,42 +50,33 @@ rcalibration::rcalibration(cgmath *mathObject, Ekos::Guide *parent)
calibrationStage = CAL_CAPTURE_IMAGE;
- pmain_wnd = parent;
+ guideModule = parent;
- is_started = false;
+ is_started = false;
axis = GUIDE_RA;
auto_drift_time = 5;
-
- start_x1 = start_y1 = 0;
- end_x1 = end_y1 = 0;
- start_x2 = start_y2 = 0;
- end_x2 = end_y2 = 0;
+
+ start_x1 = start_y1 = 0;
+ end_x1 = end_y1 = 0;
+ start_x2 = start_y2 = 0;
+ end_x2 = end_y2 = 0;
ui.spinBox_DriftTime->setVisible( true );
ui.progressBar->setVisible( false );
- ui.spinBox_ReticleAngle->setMaximum( 360 );
-
- for( i = 0;guide_squares[i].size != -1;++i )
- ui.comboBox_SquareSize->addItem( QString().setNum( guide_squares[i].size ) );
+ ui.spinBox_ReticleAngle->setMaximum( 360 );
- ui.comboBox_SquareSize->setCurrentIndex(1);
-
- // connect ui
- connect( ui.comboBox_SquareSize, SIGNAL(activated(int)), this, SLOT(onSquareSizeChanged(int)) );
- connect( ui.spinBox_ReticleX, SIGNAL(valueChanged(double)), this, SLOT(onReticleXChanged(double)) );
- connect( ui.spinBox_ReticleY, SIGNAL(valueChanged(double)), this, SLOT(onReticleYChanged(double)) );
- connect( ui.spinBox_ReticleAngle, SIGNAL(valueChanged(double)), this, SLOT(onReticleAngChanged(double)) );
+ // connect ui
+ connect( ui.spinBox_ReticleX, SIGNAL(valueChanged(double)), this, SLOT(onReticleXChanged(double)) );
+ connect( ui.spinBox_ReticleY, SIGNAL(valueChanged(double)), this, SLOT(onReticleYChanged(double)) );
+ connect( ui.spinBox_ReticleAngle, SIGNAL(valueChanged(double)), this, SLOT(onReticleAngChanged(double)) );
connect( ui.pushButton_StartCalibration, SIGNAL(clicked()), this, SLOT(onStartReticleCalibrationButtonClick()) );
- connect( ui.autoModeCheck, SIGNAL(stateChanged(int)), this, SLOT(onEnableAutoMode(int)) );
+ connect( ui.autoModeCheck, SIGNAL(stateChanged(int)), this, SLOT(onEnableAutoMode(int)) );
connect( ui.autoStarCheck, SIGNAL(toggled(bool)), this, SLOT(toggleAutoSquareSize(bool)));
- connect( ui.captureB, SIGNAL(clicked()), this, SLOT(capture()));
+ connect( ui.captureB, SIGNAL(clicked()), this, SLOT(capture()));
ui.autoModeCheck->setChecked( Options::useAutoMode() );
ui.spinBox_Pulse->setValue( Options::calibrationPulseDuration());
- ui.comboBox_SquareSize->setCurrentIndex(Options::calibrationSquareSizeIndex());
- pmath->resize_square(ui.comboBox_SquareSize->currentIndex());
-
ui.twoAxisCheck->setChecked( Options::useTwoAxis());
ui.spinBox_DriftTime->setValue( Options::autoModeIterations() );
ui.autoStarCheck->setChecked(Options::autoStar());
@@ -107,25 +96,24 @@ rcalibration::rcalibration(cgmath *mathObject, Ekos::Guide *parent)
}
-rcalibration::~rcalibration()
+internalCalibration::~internalCalibration()
{
}
-void rcalibration::fillInterface( void )
+void internalCalibration::fillInterface( void )
{
- double rx, ry, rang;
+ double rx, ry, rang;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- pmath->get_reticle_params( &rx, &ry, &rang );
+ pmath->getReticleParameters( &rx, &ry, &rang );
- ui.comboBox_SquareSize->setCurrentIndex( pmath->get_square_index() );
- ui.spinBox_ReticleX->setValue( rx );
- ui.spinBox_ReticleY->setValue( ry );
- ui.spinBox_ReticleAngle->setValue( rang );
- ui.progressBar->setValue( 0 );
+ ui.spinBox_ReticleX->setValue( rx );
+ ui.spinBox_ReticleY->setValue( ry );
+ ui.spinBox_ReticleAngle->setValue( rang );
+ ui.progressBar->setValue( 0 );
if (isCalibrating() && ui.autoModeCheck->isChecked())
ui.progressBar->setVisible(true);
@@ -135,102 +123,91 @@ void rcalibration::fillInterface( void )
}
-bool rcalibration::setVideoParams( int vid_wd, int vid_ht )
+bool internalCalibration::setVideoParams( int vid_wd, int vid_ht )
{
- if( vid_wd <= 0 || vid_ht <= 0 )
- return false;
+ if( vid_wd <= 0 || vid_ht <= 0 )
+ return false;
- ui.spinBox_ReticleX->setMaximum( (double)vid_wd );
- ui.spinBox_ReticleY->setMaximum( (double)vid_ht );
+ ui.spinBox_ReticleX->setMaximum( (double)vid_wd );
+ ui.spinBox_ReticleY->setMaximum( (double)vid_ht );
- return true;
+ return true;
}
-void rcalibration::update_reticle_pos( double x, double y )
+void internalCalibration::update_reticle_pos( double x, double y )
{
- if( ui.spinBox_ReticleX->value() == x && ui.spinBox_ReticleY->value() == y )
- return;
+ if( ui.spinBox_ReticleX->value() == x && ui.spinBox_ReticleY->value() == y )
+ return;
ui.spinBox_ReticleX->setValue( x );
- ui.spinBox_ReticleY->setValue( y );
-}
-
-void rcalibration::setMathObject( cgmath *math )
-{
- assert( math );
- pmath = math;
-
- //pmath->calc_and_set_reticle2( 100, 100, 200, 90, 100, 100, 60, 200);
+ ui.spinBox_ReticleY->setValue( y );
}
-
-void rcalibration::onSquareSizeChanged( int index )
+void internalCalibration::setMathObject( cgmath *math )
{
- if( !pmath )
- return;
-
- pmath->resize_square( index );
-
+ assert( math );
+ pmath = math;
+ //pmath->calc_and_set_reticle2( 100, 100, 200, 90, 100, 100, 60, 200);
}
-void rcalibration::onEnableAutoMode( int state )
+void internalCalibration::onEnableAutoMode( int state )
{
- ui.spinBox_DriftTime->setVisible( state == Qt::Checked );
- ui.progressBar->setVisible( state == Qt::Checked );
+ ui.spinBox_DriftTime->setVisible( state == Qt::Checked );
+ ui.progressBar->setVisible( state == Qt::Checked );
ui.autoStarCheck->setEnabled( state == Qt::Checked);
}
-void rcalibration::onReticleXChanged( double val )
+void internalCalibration::onReticleXChanged( double val )
{
- double x, y, ang;
+ double x, y, ang;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- pmath->get_reticle_params( &x, &y, &ang );
- pmath->set_reticle_params( val, y, ang );
+ pmath->getReticleParameters( &x, &y, &ang );
+ pmath->setReticleParameters( val, y, ang );
}
-void rcalibration::onReticleYChanged( double val )
+void internalCalibration::onReticleYChanged( double val )
{
- double x, y, ang;
+ double x, y, ang;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- pmath->get_reticle_params( &x, &y, &ang );
- pmath->set_reticle_params( x, val, ang );
+ pmath->getReticleParameters( &x, &y, &ang );
+ pmath->setReticleParameters( x, val, ang );
}
-void rcalibration::onReticleAngChanged( double val )
+void internalCalibration::onReticleAngChanged( double val )
{
- double x, y, ang;
+ double x, y, ang;
- if( !pmath )
- return;
+ if( !pmath )
+ return;
- pmath->get_reticle_params( &x, &y, &ang );
- pmath->set_reticle_params( x, y, val );
+ pmath->getReticleParameters( &x, &y, &ang );
+ pmath->setReticleParameters( x, y, val );
}
-void rcalibration::onStartReticleCalibrationButtonClick()
+void internalCalibration::onStartReticleCalibrationButtonClick()
{
// Capture final image
if (calibrationType == CAL_MANUAL && calibrationStage == CAL_START)
{
- pmain_wnd->capture();
+ guideModule->capture();
return;
}
@@ -244,7 +221,7 @@ void rcalibration::onStartReticleCalibrationButtonClick()
}
-bool rcalibration::stopCalibration()
+bool internalCalibration::stopCalibration()
{
if (!pmath)
return false;
@@ -258,14 +235,14 @@ bool rcalibration::stopCalibration()
return true;
}
-bool rcalibration::startCalibration()
+bool internalCalibration::startCalibration()
{
if (!pmath)
return false;
- if (pmain_wnd->isGuiding())
+ if (guideModule->isGuiding())
{
- pmain_wnd->appendLogText(i18n("Cannot calibrate while autoguiding is active."));
+ guideModule->appendLogText(i18n("Cannot calibrate while autoguiding is active."));
return false;
}
@@ -279,7 +256,7 @@ bool rcalibration::startCalibration()
QString errMsg;
double ccd_w, ccd_h, g_aperture, g_focal;
- pmath->get_guider_params(&ccd_w, &ccd_h, &g_aperture, &g_focal);
+ pmath->getGuiderParameters(&ccd_w, &ccd_h, &g_aperture, &g_focal);
if (ccd_w == 0 || ccd_h == 0)
{
@@ -298,12 +275,12 @@ bool rcalibration::startCalibration()
if (ccdInfo == false || scopeInfo == false)
{
- KMessageBox::error(this, i18n("%1 info are missing. Please set the values in INDI Control Panel.", errMsg));
- return false;
+ KMessageBox::error(this, i18n("%1 info are missing. Please set the values in INDI Control Panel.", errMsg));
+ return false;
}
- if (pmath->get_image())
- disconnect(pmath->get_image(), SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
+ if (pmath->getImageView())
+ disconnect(pmath->getImageView(), SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)));
ui.captureLED->setColor(okColor);
ui.selectStarLED->setColor(okColor);
@@ -312,46 +289,45 @@ bool rcalibration::startCalibration()
emit newStatus(Ekos::GUIDE_CALIBRATING);
// Must reset dec swap before we run any calibration procedure!
- pmain_wnd->setDECSwap(false);
- pmath->set_dec_swap(false);
+ guideModule->setDECSwap(false);
+ pmath->setDeclinationSwapEnabled(false);
- pmath->set_lost_star(false);
+ pmath->setLostStar(false);
//pmain_wnd->capture();
Options::setCalibrationPulseDuration(ui.spinBox_Pulse->value());
- Options::setCalibrationSquareSizeIndex(ui.comboBox_SquareSize->currentIndex());
Options::setUseAutoMode(ui.autoModeCheck->isChecked());
- Options::setUseTwoAxis(ui.twoAxisCheck->isChecked());
+ Options::setUseTwoAxis(ui.twoAxisCheck->isChecked());
Options::setAutoModeIterations(ui.spinBox_DriftTime->value());
Options::setAutoStar(ui.autoStarCheck->isChecked());
if (ui.autoStarCheck->isChecked())
Options::setAutoSquareSize(ui.autoSquareSizeCheck->isChecked());
- // manual
+ // manual
if( ui.autoModeCheck->checkState() != Qt::Checked )
- {
+ {
calibrateManualReticle();
return true;
- }
+ }
- ui.progressBar->setVisible(true);
+ ui.progressBar->setVisible(true);
- // automatic
+ // automatic
if( ui.twoAxisCheck->checkState() == Qt::Checked )
calibrateRADECRecticle(false);
- else
+ else
calibrateRADECRecticle(true);
return true;
}
-void rcalibration::processCalibration()
-{
+void internalCalibration::processCalibration()
+{
//if (pmath->get_image())
- //guide_frame->setTrackingBox(QRect(pmath-> square_pos.x, square_pos.y, square_size*2, square_size*2));
- //pmath->get_image()->setTrackingBoxSize(QSize(pmath->get_square_size(), pmath->get_square_size()));
+ //guide_frame->setTrackingBox(QRect(pmath-> square_pos.x, square_pos.y, square_size*2, square_size*2));
+ //pmath->get_image()->setTrackingBoxSize(QSize(pmath->get_square_size(), pmath->get_square_size()));
- if (pmath->is_lost_star())
+ if (pmath->isStarLost())
{
calibrationStage = CAL_ERROR;
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
@@ -364,24 +340,24 @@ void rcalibration::processCalibration()
switch (calibrationType)
{
- case CAL_NONE:
+ case CAL_NONE:
break;
- case CAL_MANUAL:
- calibrateManualReticle();
- break;
+ case CAL_MANUAL:
+ calibrateManualReticle();
+ break;
- case CAL_RA_AUTO:
- calibrateRADECRecticle(true);
- break;
+ case CAL_RA_AUTO:
+ calibrateRADECRecticle(true);
+ break;
- case CAL_RA_DEC_AUTO:
- calibrateRADECRecticle(false);
- break;
+ case CAL_RA_DEC_AUTO:
+ calibrateRADECRecticle(false);
+ break;
}
}
-bool rcalibration::isCalibrating()
+bool internalCalibration::isCalibrating()
{
if (calibrationStage >= CAL_START)
return true;
@@ -389,71 +365,71 @@ bool rcalibration::isCalibrating()
return false;
}
-void rcalibration::reset()
+void internalCalibration::reset()
{
is_started = false;
ui.pushButton_StartCalibration->setText( i18n("Start") );
ui.startCalibrationLED->setColor(idleColor);
ui.progressBar->setVisible(false);
- connect(pmath->get_image(), SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
+ connect(pmath->getImageView(), SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
}
-void rcalibration::calibrateManualReticle( void )
+void internalCalibration::calibrateManualReticle( void )
{
- //----- manual mode ----
- // get start point
+ //----- manual mode ----
+ // get start point
calibrationType = CAL_MANUAL;
- if( !is_started )
- {
+ if( !is_started )
+ {
if( ui.twoAxisCheck->checkState() == Qt::Checked )
- {
+ {
ui.pushButton_StartCalibration->setText( i18n("Stop GUIDE_RA") );
- }
- else
- {
+ }
+ else
+ {
ui.pushButton_StartCalibration->setText( i18n("Stop") );
- }
- pmain_wnd->appendLogText(i18n("Drift scope in RA. Press stop when done."));
+ }
+ guideModule->appendLogText(i18n("Drift scope in RA. Press stop when done."));
calibrationStage = CAL_START;
- pmath->get_star_screen_pos( &start_x1, &start_y1 );
-
+ pmath->getStarScreenPosition( &start_x1, &start_y1 );
+
axis = GUIDE_RA;
- is_started = true;
- }
- else // get end point and calc orientation
- {
+ is_started = true;
+ }
+ else // get end point and calc orientation
+ {
if( ui.twoAxisCheck->checkState() == Qt::Checked )
- {
+ {
if( axis == GUIDE_RA )
- {
- pmath->get_star_screen_pos( &end_x1, &end_y1 );
-
- start_x2 = end_x1;
- start_y2 = end_y1;
-
+ {
+ pmath->getStarScreenPosition( &end_x1, &end_y1 );
+
+ start_x2 = end_x1;
+ start_y2 = end_y1;
+
axis = GUIDE_DEC;
-
+
ui.pushButton_StartCalibration->setText( i18n("Stop GUIDE_DEC") );
- pmain_wnd->appendLogText(i18n("Drift scope in DEC. Press Stop when done."));
- return;
- }
- else
- {
- pmath->get_star_screen_pos( &end_x2, &end_y2 );
+ guideModule->appendLogText(i18n("Drift scope in DEC. Press Stop when done."));
+ return;
+ }
+ else
+ {
+ pmath->getStarScreenPosition( &end_x2, &end_y2 );
bool dec_swap=false;
- // calc orientation
- if( pmath->calc_and_set_reticle2( start_x1, start_y1, end_x1, end_y1, start_x2, start_y2, end_x2, end_y2, &dec_swap ) )
- {
+ // calc orientation
+ if( pmath->calculateAndSetReticle2D( start_x1, start_y1, end_x1, end_y1, start_x2, start_y2, end_x2, end_y2, &dec_swap ) )
+ {
fillInterface();
if (dec_swap)
- pmain_wnd->appendLogText(i18n("DEC swap enabled."));
+ guideModule->appendLogText(i18n("DEC swap enabled."));
else
- pmain_wnd->appendLogText(i18n("DEC swap disabled."));
+ guideModule->appendLogText(i18n("DEC swap disabled."));
- pmain_wnd->appendLogText(i18n("Calibration completed."));
+ guideModule->appendLogText(i18n("Calibration completed."));
KNotification::event( QLatin1String( "CalibrationSuccessful" ) , i18n("Guiding calibration completed successfully"));
calibrationStage = CAL_FINISH;
@@ -462,37 +438,37 @@ void rcalibration::calibrateManualReticle( void )
// FIXME Just one signal is enough. Remove previous signal
emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
- pmain_wnd->setDECSwap(dec_swap);
- }
- else
- {
+ guideModule->setDECSwap(dec_swap);
+ }
+ else
+ {
QMessageBox::warning( this, i18n("Error"), i18n("Calibration rejected. Start drift is too short."), QMessageBox::Ok );
is_started = false;
calibrationStage = CAL_ERROR;
emit calibrationCompleted(false);
// FIXME Just one signal is enough. Remove previous signal
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- }
- }
- }
- else
- {
- pmath->get_star_screen_pos( &end_x1, &end_y1 );
-
- if( pmath->calc_and_set_reticle( start_x1, start_y1, end_x1, end_y1 ) )
- {
+ }
+ }
+ }
+ else
+ {
+ pmath->getStarScreenPosition( &end_x1, &end_y1 );
+
+ if( pmath->calculateAndSetReticle1D( start_x1, start_y1, end_x1, end_y1 ) )
+ {
calibrationStage = CAL_FINISH;
fillInterface();
- pmain_wnd->appendLogText(i18n("Calibration completed."));
+ guideModule->appendLogText(i18n("Calibration completed."));
emit calibrationCompleted(true);
// FIXME Just one signal is enough. Remove previous signal
emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
KNotification::event( QLatin1String( "CalibrationSuccessful" ) , i18n("Guiding calibration completed successfully"));
- }
- else
- {
+ }
+ else
+ {
calibrationStage = CAL_ERROR;
emit calibrationCompleted(false);
@@ -502,17 +478,17 @@ void rcalibration::calibrateManualReticle( void )
QMessageBox::warning( this, i18n("Error"), i18n("Calibration rejected. Start drift is too short."), QMessageBox::Ok );
is_started = false;
KNotification::event( QLatin1String( "CalibrationFailed" ) , i18n("Guiding calibration failed with errors"));
- }
- }
+ }
+ }
reset();
- }
+ }
}
-void rcalibration::calibrateRADECRecticle( bool ra_only )
+void internalCalibration::calibrateRADECRecticle( bool ra_only )
{
- bool auto_term_ok = false;
+ bool auto_term_ok = false;
if( !pmath )
@@ -529,114 +505,114 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
switch(calibrationStage)
{
- case CAL_START:
- //----- automatic mode -----
- auto_drift_time = ui.spinBox_DriftTime->value();
+ case CAL_START:
+ //----- automatic mode -----
+ auto_drift_time = ui.spinBox_DriftTime->value();
- if (ra_only)
- turn_back_time = auto_drift_time*2 + auto_drift_time/2;
- else
- turn_back_time = auto_drift_time*6;
- iterations = 0;
+ if (ra_only)
+ turn_back_time = auto_drift_time*2 + auto_drift_time/2;
+ else
+ turn_back_time = auto_drift_time*6;
+ iterations = 0;
- ui.progressBar->setMaximum( turn_back_time );
+ ui.progressBar->setMaximum( turn_back_time );
- ui.progressBar->setValue( 0 );
+ ui.progressBar->setValue( 0 );
- ui.pushButton_StartCalibration->setText(i18n("Abort"));
+ ui.pushButton_StartCalibration->setText(i18n("Abort"));
- pmain_wnd->appendLogText(i18n("GUIDE_RA drifting forward..."));
+ guideModule->appendLogText(i18n("GUIDE_RA drifting forward..."));
- // get start point
- //pmath->get_star_screen_pos( &start_x1, &start_y1 );
+ // get start point
+ //pmath->get_star_screen_pos( &start_x1, &start_y1 );
- start_x1 = ui.spinBox_ReticleX->value();
- start_y1 = ui.spinBox_ReticleY->value();
+ start_x1 = ui.spinBox_ReticleX->value();
+ start_y1 = ui.spinBox_ReticleY->value();
- if (Options::guideLogging())
- qDebug() << "Guide: Start X1 " << start_x1 << " Start Y1 " << start_y1;
+ if (Options::guideLogging())
+ qDebug() << "Guide: Start X1 " << start_x1 << " Start Y1 " << start_y1;
- pmain_wnd->sendPulse( RA_INC_DIR, pulseDuration );
- if (Options::guideLogging())
- qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
+ guideModule->sendPulse( RA_INC_DIR, pulseDuration );
+ if (Options::guideLogging())
+ qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
- iterations++;
+ iterations++;
- ui.progressBar->setValue( iterations );
+ ui.progressBar->setValue( iterations );
- calibrationStage = CAL_RA_INC;
+ calibrationStage = CAL_RA_INC;
- ui.startCalibrationLED->setColor(busyColor);
+ ui.startCalibrationLED->setColor(busyColor);
- break;
+ break;
- case CAL_RA_INC:
- pmain_wnd->sendPulse( RA_INC_DIR, pulseDuration );
+ case CAL_RA_INC:
+ guideModule->sendPulse( RA_INC_DIR, pulseDuration );
- if (Options::guideLogging())
- {
- // Star position resulting from LAST guiding pulse to mount
- double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
- qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
+ if (Options::guideLogging())
+ {
+ // Star position resulting from LAST guiding pulse to mount
+ double cur_x, cur_y;
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
+ qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
- qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
- }
+ qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
+ }
- iterations++;
- ui.progressBar->setValue( iterations );
+ iterations++;
+ ui.progressBar->setValue( iterations );
- if (iterations == auto_drift_time)
- calibrationStage = CAL_RA_DEC;
+ if (iterations == auto_drift_time)
+ calibrationStage = CAL_RA_DEC;
- break;
+ break;
- case CAL_RA_DEC:
+ case CAL_RA_DEC:
+ {
+ if (iterations == auto_drift_time)
{
- if (iterations == auto_drift_time)
- {
- pmath->get_star_screen_pos( &end_x1, &end_y1 );
- if (Options::guideLogging())
- qDebug() << "Guide: End X1 " << end_x1 << " End Y1 " << end_y1;
+ pmath->getStarScreenPosition( &end_x1, &end_y1 );
+ if (Options::guideLogging())
+ qDebug() << "Guide: End X1 " << end_x1 << " End Y1 " << end_y1;
- phi = pmath->calc_phi( start_x1, start_y1, end_x1, end_y1 );
- ROT_Z = RotateZ( -M_PI*phi/180.0 ); // derotates...
+ phi = pmath->calculatePhi( start_x1, start_y1, end_x1, end_y1 );
+ ROT_Z = RotateZ( -M_PI*phi/180.0 ); // derotates...
- pmain_wnd->appendLogText(i18n("GUIDE_RA drifting reverse..."));
+ guideModule->appendLogText(i18n("GUIDE_RA drifting reverse..."));
- }
+ }
- //----- Z-check (new!) -----
- double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
+ //----- Z-check (new!) -----
+ double cur_x, cur_y;
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
- Vector star_pos = Vector( cur_x, cur_y, 0 ) - Vector( start_x1, start_y1, 0 );
- star_pos.y = -star_pos.y;
- star_pos = star_pos * ROT_Z;
+ Vector star_pos = Vector( cur_x, cur_y, 0 ) - Vector( start_x1, start_y1, 0 );
+ star_pos.y = -star_pos.y;
+ star_pos = star_pos * ROT_Z;
- if (Options::guideLogging())
- qDebug() << "Guide: Star x pos is " << star_pos.x << " from original point.";
+ if (Options::guideLogging())
+ qDebug() << "Guide: Star x pos is " << star_pos.x << " from original point.";
- // start point reached... so exit
- if( star_pos.x < 1.5 )
- {
- pmath->do_processing();
- auto_term_ok = true;
- }
+ // start point reached... so exit
+ if( star_pos.x < 1.5 )
+ {
+ pmath->performProcessing();
+ auto_term_ok = true;
+ }
- //----- Z-check end -----
+ //----- Z-check end -----
if( !auto_term_ok )
{
if (iterations < turn_back_time)
{
- pmain_wnd->sendPulse( RA_DEC_DIR, pulseDuration );
+ guideModule->sendPulse( RA_DEC_DIR, pulseDuration );
if (Options::guideLogging())
{
// Star position resulting from LAST guiding pulse to mount
double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
@@ -655,7 +631,7 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
if (ui.autoStarCheck->isChecked())
- pmain_wnd->appendLogText(i18np("GUIDE_RA: Scope cannot reach the start point after %1 iteration. Possible mount or drive problems...", "GUIDE_RA: Scope cannot reach the start point after %1 iterations. Possible mount or drive problems...", turn_back_time));
+ guideModule->appendLogText(i18np("GUIDE_RA: Scope cannot reach the start point after %1 iteration. Possible mount or drive problems...", "GUIDE_RA: Scope cannot reach the start point after %1 iterations. Possible mount or drive problems...", turn_back_time));
else
QMessageBox::warning( this, i18n("Warning"), i18np("GUIDE_RA: Scope cannot reach the start point after %1 iteration. Possible mount or drive problems...", "GUIDE_RA: Scope cannot reach the start point after %1 iterations. Possible mount or drive problems...", turn_back_time), QMessageBox::Ok );
@@ -670,16 +646,16 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
start_x2 = cur_x;
start_y2 = cur_y;
- if (Options::guideLogging())
- qDebug() << "Guide: Start X2 " << start_x2 << " start Y2 " << start_y2;
+ if (Options::guideLogging())
+ qDebug() << "Guide: Start X2 " << start_x2 << " start Y2 " << start_y2;
- pmain_wnd->sendPulse( DEC_INC_DIR, pulseDuration );
+ guideModule->sendPulse( DEC_INC_DIR, pulseDuration );
if (Options::guideLogging())
{
// Star position resulting from LAST guiding pulse to mount
double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
@@ -688,15 +664,15 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
iterations++;
dec_iterations = 1;
ui.progressBar->setValue( iterations );
- pmain_wnd->appendLogText(i18n("GUIDE_DEC drifting forward..."));
+ guideModule->appendLogText(i18n("GUIDE_DEC drifting forward..."));
break;
}
// calc orientation
- if( pmath->calc_and_set_reticle( start_x1, start_y1, end_x1, end_y1, totalPulse) )
+ if( pmath->calculateAndSetReticle1D( start_x1, start_y1, end_x1, end_y1, totalPulse) )
{
calibrationStage = CAL_FINISH;
fillInterface();
- pmain_wnd->appendLogText(i18n("Calibration completed."));
+ guideModule->appendLogText(i18n("Calibration completed."));
emit calibrationCompleted(true);
// FIXME Just one signal is enough. Remove previous signal
@@ -705,15 +681,15 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
ui.startCalibrationLED->setColor(okColor);
KNotification::event( QLatin1String( "CalibrationFailed" ) , i18n("Guiding calibration failed with errors"));
if (ui.autoStarCheck->isChecked())
- selectAutoStar(pmath->get_image());
+ selectAutoStar(pmath->getImageView());
}
else
{
if (ui.autoStarCheck->isChecked())
- pmain_wnd->appendLogText(i18n("Calibration rejected. Star drift is too short."));
+ guideModule->appendLogText(i18n("Calibration rejected. Star drift is too short."));
else
QMessageBox::warning( this, i18n("Error"), i18n("Calibration rejected. Star drift is too short."), QMessageBox::Ok );
- ui.startCalibrationLED->setColor(alertColor);
+ ui.startCalibrationLED->setColor(alertColor);
calibrationStage = CAL_ERROR;
emit calibrationCompleted(false);
@@ -725,16 +701,16 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
reset();
break;
- }
+ }
case CAL_DEC_INC:
- pmain_wnd->sendPulse( DEC_INC_DIR, pulseDuration );
+ guideModule->sendPulse( DEC_INC_DIR, pulseDuration );
if (Options::guideLogging())
{
// Star position resulting from LAST guiding pulse to mount
double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
@@ -753,19 +729,19 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
{
if (dec_iterations == auto_drift_time)
{
- pmath->get_star_screen_pos( &end_x2, &end_y2 );
+ pmath->getStarScreenPosition( &end_x2, &end_y2 );
if (Options::guideLogging())
qDebug() << "Guide: End X2 " << end_x2 << " End Y2 " << end_y2;
- phi = pmath->calc_phi( start_x2, start_y2, end_x2, end_y2 );
+ phi = pmath->calculatePhi( start_x2, start_y2, end_x2, end_y2 );
ROT_Z = RotateZ( -M_PI*phi/180.0 ); // derotates...
- pmain_wnd->appendLogText(i18n("GUIDE_DEC drifting reverse..."));
+ guideModule->appendLogText(i18n("GUIDE_DEC drifting reverse..."));
}
//----- Z-check (new!) -----
double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
//pmain_wnd->appendLogText(i18n("GUIDE_DEC running back...");
@@ -782,111 +758,111 @@ void rcalibration::calibrateRADECRecticle( bool ra_only )
// start point reached... so exit
if( star_pos.x < 1.5 )
{
- pmath->do_processing();
+ pmath->performProcessing();
auto_term_ok = true;
}
//----- Z-check end -----
- if( !auto_term_ok )
- {
- if (iterations < turn_back_time)
+ if( !auto_term_ok )
{
- pmain_wnd->sendPulse( DEC_DEC_DIR, pulseDuration );
-
- if (Options::guideLogging())
+ if (iterations < turn_back_time)
{
- // Star position resulting from LAST guiding pulse to mount
- double cur_x, cur_y;
- pmath->get_star_screen_pos( &cur_x, &cur_y );
- qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
+ guideModule->sendPulse( DEC_DEC_DIR, pulseDuration );
- qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
- }
+ if (Options::guideLogging())
+ {
+ // Star position resulting from LAST guiding pulse to mount
+ double cur_x, cur_y;
+ pmath->getStarScreenPosition( &cur_x, &cur_y );
+ qDebug() << "Guide: Iteration #" << iterations-1 << ": STAR " << cur_x << "," << cur_y;
- iterations++;
- dec_iterations++;
+ qDebug() << "Guide: Iteration " << iterations << " Direction: " << RA_INC_DIR << " Duration: " << pulseDuration << " ms.";
+ }
- ui.progressBar->setValue( iterations );
- break;
- }
+ iterations++;
+ dec_iterations++;
- calibrationStage = CAL_ERROR;
+ ui.progressBar->setValue( iterations );
+ break;
+ }
- emit calibrationCompleted(false);
- // FIXME Just one signal is enough. Remove previous signal
- emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
+ calibrationStage = CAL_ERROR;
- if (ui.autoStarCheck->isChecked())
- pmain_wnd->appendLogText(i18np("GUIDE_DEC: Scope cannot reach the start point after %1 iteration.\nPossible mount or drive problems...", "GUIDE_DEC: Scope cannot reach the start point after %1 iterations.\nPossible mount or drive problems...", turn_back_time));
- else
- QMessageBox::warning( this, i18n("Warning"), i18np("GUIDE_DEC: Scope cannot reach the start point after %1 iteration.\nPossible mount or drive problems...", "GUIDE_DEC: Scope cannot reach the start point after %1 iterations.\nPossible mount or drive problems...", turn_back_time), QMessageBox::Ok );
+ emit calibrationCompleted(false);
+ // FIXME Just one signal is enough. Remove previous signal
+ emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- KNotification::event( QLatin1String( "CalibrationFailed" ) , i18n("Guiding calibration failed with errors"));
- reset();
- break;
- }
+ if (ui.autoStarCheck->isChecked())
+ guideModule->appendLogText(i18np("GUIDE_DEC: Scope cannot reach the start point after %1 iteration.\nPossible mount or drive problems...", "GUIDE_DEC: Scope cannot reach the start point after %1 iterations.\nPossible mount or drive problems...", turn_back_time));
+ else
+ QMessageBox::warning( this, i18n("Warning"), i18np("GUIDE_DEC: Scope cannot reach the start point after %1 iteration.\nPossible mount or drive problems...", "GUIDE_DEC: Scope cannot reach the start point after %1 iterations.\nPossible mount or drive problems...", turn_back_time), QMessageBox::Ok );
- bool swap_dec=false;
- // calc orientation
- if( pmath->calc_and_set_reticle2( start_x1, start_y1, end_x1, end_y1, start_x2, start_y2, end_x2, end_y2, &swap_dec, totalPulse ) )
- {
- calibrationStage = CAL_FINISH;
- fillInterface();
- if (swap_dec)
- pmain_wnd->appendLogText(i18n("DEC swap enabled."));
- else
- pmain_wnd->appendLogText(i18n("DEC swap disabled."));
- pmain_wnd->appendLogText(i18n("Calibration completed."));
+ KNotification::event( QLatin1String( "CalibrationFailed" ) , i18n("Guiding calibration failed with errors"));
+ reset();
+ break;
+ }
- emit calibrationCompleted(true);
- // FIXME Just one signal is enough. Remove previous signal
- emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
+ bool swap_dec=false;
+ // calc orientation
+ if( pmath->calculateAndSetReticle2D( start_x1, start_y1, end_x1, end_y1, start_x2, start_y2, end_x2, end_y2, &swap_dec, totalPulse ) )
+ {
+ calibrationStage = CAL_FINISH;
+ fillInterface();
+ if (swap_dec)
+ guideModule->appendLogText(i18n("DEC swap enabled."));
+ else
+ guideModule->appendLogText(i18n("DEC swap disabled."));
+ guideModule->appendLogText(i18n("Calibration completed."));
- ui.startCalibrationLED->setColor(okColor);
- pmain_wnd->setDECSwap(swap_dec);
+ emit calibrationCompleted(true);
+ // FIXME Just one signal is enough. Remove previous signal
+ emit newStatus(Ekos::GUIDE_CALIBRATION_SUCESS);
- KNotification::event( QLatin1String( "CalibrationSuccessful" ) , i18n("Guiding calibration completed successfully"));
+ ui.startCalibrationLED->setColor(okColor);
+ guideModule->setDECSwap(swap_dec);
- if (ui.autoStarCheck->isChecked())
- selectAutoStar(pmath->get_image());
+ KNotification::event( QLatin1String( "CalibrationSuccessful" ) , i18n("Guiding calibration completed successfully"));
- }
- else
- {
- if (ui.autoStarCheck->isChecked())
- pmain_wnd->appendLogText(i18n("Calibration rejected. Star drift is too short."));
+ if (ui.autoStarCheck->isChecked())
+ selectAutoStar(pmath->getImageView());
+
+ }
else
- QMessageBox::warning( this, i18n("Error"), i18n("Calibration rejected. Star drift is too short."), QMessageBox::Ok );
+ {
+ if (ui.autoStarCheck->isChecked())
+ guideModule->appendLogText(i18n("Calibration rejected. Star drift is too short."));
+ else
+ QMessageBox::warning( this, i18n("Error"), i18n("Calibration rejected. Star drift is too short."), QMessageBox::Ok );
- emit calibrationCompleted(false);
- // FIXME Just one signal is enough. Remove previous signal
- emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
+ emit calibrationCompleted(false);
+ // FIXME Just one signal is enough. Remove previous signal
+ emit newStatus(Ekos::GUIDE_CALIBRATION_ERROR);
- ui.startCalibrationLED->setColor(alertColor);
- calibrationStage = CAL_ERROR;
- KNotification::event( QLatin1String( "CalibrationFailed" ) , i18n("Guiding calibration failed with errors"));
- }
+ ui.startCalibrationLED->setColor(alertColor);
+ calibrationStage = CAL_ERROR;
+ KNotification::event( QLatin1String( "CalibrationFailed" ) , i18n("Guiding calibration failed with errors"));
+ }
- reset();
+ reset();
- break;
+ break;
}
default:
- break;
+ break;
- }
+ }
}
-void rcalibration::trackingStarSelected(int x, int y)
+void internalCalibration::trackingStarSelected(int x, int y)
{
- int square_size = guide_squares[pmath->get_square_index()].size;
+ //int square_size = guide_squares[pmath->getSquareIndex()].size;
- pmath->set_reticle_params(x, y, ui.spinBox_ReticleAngle->value());
- pmath->move_square(x-square_size/(2*pmath->getBinX()), y-square_size/(2*pmath->getBinY()));
+ pmath->setReticleParameters(x, y, ui.spinBox_ReticleAngle->value());
+ //pmath->moveSquare(x-square_size/(2*pmath->getBinX()), y-square_size/(2*pmath->getBinY()));
update_reticle_pos(x, y);
@@ -899,21 +875,26 @@ void rcalibration::trackingStarSelected(int x, int y)
ui.pushButton_StartCalibration->setEnabled(true);
+ QVector3D starCenter = guideModule->getStarPosition();
+ starCenter.setX(x);
+ starCenter.setY(y);
+ guideModule->setStarPosition(starCenter, true);
+
if (ui.autoStarCheck->isChecked())
startCalibration();
}
-void rcalibration::capture()
+void internalCalibration::capture()
{
if (isCalibrating())
stopCalibration();
calibrationStage = CAL_CAPTURE_IMAGE;
- if (pmain_wnd->capture())
+ if (guideModule->capture())
{
- ui.captureLED->setColor(busyColor);
- pmain_wnd->appendLogText(i18n("Capturing image..."));
+ ui.captureLED->setColor(busyColor);
+ guideModule->appendLogText(i18n("Capturing image..."));
}
else
{
@@ -923,66 +904,49 @@ void rcalibration::capture()
}
}
-bool rcalibration::setImage(FITSView *image)
+bool internalCalibration::setImageView(FITSView *image)
{
guideFrame = image;
switch (calibrationStage)
{
- case CAL_CAPTURE_IMAGE:
- case CAL_SELECT_STAR:
- {
- pmain_wnd->appendLogText(i18n("Image captured..."));
+ case CAL_CAPTURE_IMAGE:
+ case CAL_SELECT_STAR:
+ {
+ guideModule->appendLogText(i18n("Image captured..."));
- ui.captureLED->setColor(okColor);
- calibrationStage = CAL_SELECT_STAR;
- ui.selectStarLED->setColor(busyColor);
+ ui.captureLED->setColor(okColor);
+ calibrationStage = CAL_SELECT_STAR;
+ ui.selectStarLED->setColor(busyColor);
- FITSData *image_data = guideFrame->getImageData();
+ FITSData *image_data = guideFrame->getImageData();
- setVideoParams(image_data->getWidth(), image_data->getHeight());
+ setVideoParams(image_data->getWidth(), image_data->getHeight());
- if (ui.autoStarCheck->isChecked())
- {
- QPair<double,double> star = selectAutoStar(guideFrame);
+ if (ui.autoStarCheck->isChecked())
+ {
+ QPair<double,double> star = selectAutoStar(guideFrame);
- if (star.first == 0 && star.second == 0)
- {
- pmain_wnd->appendLogText(i18n("Failed to automatically select a guide star. Please select a guide star..."));
- connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
- pmath->move_square(image_data->getWidth()/2-pmath->get_square_size()/2, image_data->getHeight()/2 - pmath->get_square_size()/2);
- return true;
- }
- else
- trackingStarSelected(star.first, star.second);
- return false;
- }
- else
+ if (star.first == 0 && star.second == 0)
{
- Vector square_pos = pmath->get_square_pos();
- double currentBin = pmath->getBinX();
- double lastBin = pmath->getLastBinX();
-
- if (square_pos.x == 0 && square_pos.y == 0)
- pmath->move_square(image_data->getWidth()/2-pmath->get_square_size()/2, image_data->getHeight()/2 - pmath->get_square_size()/2);
- else if (currentBin != lastBin)
- {
- double newX = square_pos.x * lastBin/currentBin;
- double newY = square_pos.y * lastBin/currentBin;
- //pmath->move_square(newX-pmath->get_square_size()/(2*currentBin), newY- pmath->get_square_size()/(2*currentBin));
- pmath->move_square(newX, newY);
- pmath->setBinning(currentBin, currentBin);
- }
- else
- pmath->resize_square(pmath->get_square_index());
-
+ guideModule->appendLogText(i18n("Failed to automatically select a guide star. Please select a guide star..."));
connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
+ //pmath->moveSquare(image_data->getWidth()/2-pmath->getSquareSize()/2, image_data->getHeight()/2 - pmath->getSquareSize()/2);
+ return true;
}
- }
- break;
+ else
+ trackingStarSelected(star.first, star.second);
+ return false;
+ }
+ else
+ {
+ connect(guideFrame, SIGNAL(trackingStarSelected(int,int)), this, SLOT(trackingStarSelected(int, int)), Qt::UniqueConnection);
+ }
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
return true;
@@ -993,7 +957,7 @@ bool brighterThan(Edge *s1, Edge *s2)
return s1->width > s2->width;
}
-QPair<double,double> rcalibration::selectAutoStar(FITSView *image)
+QPair<double,double> internalCalibration::selectAutoStar(FITSView *image)
{
Q_ASSERT(image);
@@ -1070,52 +1034,33 @@ QPair<double,double> rcalibration::selectAutoStar(FITSView *image)
if (Options::guideLogging())
qDebug() << "Guide: Ideal calibration box size for star width: " << starCenters[maxScoreIndex]->width << " is " << idealSize << " pixels";
- for (int i=0; i < ui.comboBox_SquareSize->count(); i++)
- {
- if (idealSize < ui.comboBox_SquareSize->itemText(i).toInt())
- {
- ui.comboBox_SquareSize->setCurrentIndex(i);
-
- if (Options::guideLogging())
- qDebug() << "Guide: Selecting standard square size " << ui.comboBox_SquareSize->itemText(i).toInt() << " pixels";
-
- pmath->resize_square(i);
- break;
- }
- }
+ // TODO Set square size in GuideModule
}
return star;
}
-void rcalibration::setCalibrationTwoAxis(bool enable)
+void internalCalibration::setCalibrationTwoAxis(bool enable)
{
ui.twoAxisCheck->setChecked(enable);
}
-void rcalibration::setCalibrationAutoStar(bool enable)
+void internalCalibration::setCalibrationAutoStar(bool enable)
{
ui.autoStarCheck->setChecked(enable);
}
-void rcalibration::setCalibrationAutoSquareSize(bool enable)
+void internalCalibration::setCalibrationAutoSquareSize(bool enable)
{
ui.autoSquareSizeCheck->setChecked(enable);
}
-void rcalibration::setCalibrationParams(int boxSize, int pulseDuration)
+void internalCalibration::setCalibrationPulseDuration(int pulseDuration)
{
- for (int i=0; i < ui.comboBox_SquareSize->count(); i++)
- if (ui.comboBox_SquareSize->itemText(i).toInt() == boxSize)
- {
- ui.comboBox_SquareSize->setCurrentIndex(i);
- break;
- }
-
ui.spinBox_Pulse->setValue(pulseDuration);
}
-void rcalibration::toggleAutoSquareSize(bool enable)
+void internalCalibration::toggleAutoSquareSize(bool enable)
{
ui.autoSquareSizeCheck->setEnabled(enable);
}
diff --git a/kstars/ekos/guide/rcalibration.h b/kstars/ekos/guide/rcalibration.h
index e817a2e..946408b 100644
--- a/kstars/ekos/guide/rcalibration.h
+++ b/kstars/ekos/guide/rcalibration.h
@@ -22,21 +22,21 @@
typedef struct
{
- bool two_axis;
- bool auto_mode;
- int dift_time;
- int frame_count;
+ bool two_axis;
+ bool auto_mode;
+ int dift_time;
+ int frame_count;
}calibrationparams_t;
-class rcalibration: public QWidget
+class internalCalibration: public QWidget
{
Q_OBJECT
public:
- explicit rcalibration(cgmath *mathObject, Ekos::Guide *parent = 0);
- ~rcalibration();
+ explicit internalCalibration(cgmath *mathObject, Ekos::Guide *parent = 0);
+ ~internalCalibration();
enum CalibrationStage { CAL_CAPTURE_IMAGE, CAL_SELECT_STAR, CAL_FINISH, CAL_ERROR, CAL_START, CAL_RA_INC, CAL_RA_DEC, CAL_DEC_INC, CAL_DEC_DEC };
enum CalibrationType { CAL_NONE, CAL_MANUAL, CAL_RA_AUTO, CAL_RA_DEC_AUTO };
@@ -50,21 +50,20 @@ public:
void setCalibrationAutoStar(bool enable);
void setCalibrationAutoSquareSize(bool enable);
void setCalibrationDarkFrame(bool enable);
-
- void setCalibrationParams(int boxSize, int pulseDuration);
+ void setCalibrationPulseDuration(int pulseDuration);
// 2015-09-05 return false in case of auto star selection because we don't want the guide module to do any processing
// otherwise return true
- bool setImage(FITSView *image);
+ bool setImageView(FITSView *image);
double getReticleAngle() { return ui.spinBox_ReticleAngle->value();}
- bool isCalibrating();
+ bool isCalibrating();
bool isCalibrationComplete() { return (calibrationStage == CAL_FINISH || calibrationStage == CAL_ERROR); }
bool isCalibrationSuccessful() { return (calibrationStage == CAL_FINISH); }
bool useAutoStar() { return ui.autoStarCheck->isChecked(); }
- bool useAutoSquareSize() { return ui.autoSquareSizeCheck->isChecked(); }
+ bool useAutoSquareSize() { return ui.autoSquareSizeCheck->isChecked(); }
bool useTwoAxis() { return ui.twoAxisCheck->isChecked(); }
void processCalibration();
@@ -75,13 +74,12 @@ public:
bool stopCalibration();
protected slots:
- void onSquareSizeChanged( int index );
- void onEnableAutoMode( int state );
- void onReticleXChanged( double val );
- void onReticleYChanged( double val );
- void onReticleAngChanged( double val );
- void onStartReticleCalibrationButtonClick();
- void toggleAutoSquareSize(bool enable);
+ void onEnableAutoMode( int state );
+ void onReticleXChanged( double val );
+ void onReticleYChanged( double val );
+ void onReticleAngChanged( double val );
+ void onStartReticleCalibrationButtonClick();
+ void toggleAutoSquareSize(bool enable);
public slots:
void capture();
@@ -98,22 +96,22 @@ private:
void calibrateManualReticle( void );
void calibrateRADECRecticle( bool ra_only ); // 1 or 2-axis calibration
- bool is_started;
-
- calibrationparams_t calibration_params;
- int axis;
- int auto_drift_time;
+ bool is_started;
+
+ calibrationparams_t calibration_params;
+ int axis;
+ int auto_drift_time;
int turn_back_time;
- double start_x1, start_y1;
- double end_x1, end_y1;
- double start_x2, start_y2;
- double end_x2, end_y2;
+ double start_x1, start_y1;
+ double end_x1, end_y1;
+ double start_x2, start_y2;
+ double end_x2, end_y2;
int iterations, dec_iterations;
double phi;
Matrix ROT_Z;
- cgmath *pmath;
- Ekos::Guide *pmain_wnd;
+ cgmath *pmath;
+ Ekos::Guide *guideModule;
QColor idleColor, okColor, busyColor, alertColor;
diff --git a/kstars/ekos/guide/rcalibration.ui b/kstars/ekos/guide/rcalibration.ui
index 42c6695..e955a34 100644
--- a/kstars/ekos/guide/rcalibration.ui
+++ b/kstars/ekos/guide/rcalibration.ui
@@ -148,23 +148,13 @@
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
- <widget class="QLabel" name="l_25">
- <property name="text">
- <string>Square size:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QComboBox" name="comboBox_SquareSize"/>
- </item>
- <item row="1" column="0">
<widget class="QLabel" name="l_29">
<property name="text">
<string>Pulse:</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="0" column="1">
<widget class="QSpinBox" name="spinBox_Pulse">
<property name="minimum">
<number>100</number>
diff --git a/kstars/org.kde.kstars.Ekos.Guide.xml b/kstars/org.kde.kstars.Ekos.Guide.xml
index fe85b6d..809ff00 100644
--- a/kstars/org.kde.kstars.Ekos.Guide.xml
+++ b/kstars/org.kde.kstars.Ekos.Guide.xml
@@ -67,13 +67,12 @@
<arg name="enable" type="b" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
- <method name="setCalibrationParams">
- <arg name="boxSize" type="i" direction="in"/>
+ <method name="setCalibrationPulseDuration">
<arg name="pulseDuration" type="i" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
- <method name="setGuideBoxSize">
- <arg name="boxSize" type="i" direction="in"/>
+ <method name="setGuideBoxSizeIndex">
+ <arg name="boxSizeIndex" type="i" direction="in"/>
<annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/>
</method>
<method name="setGuideAlgorithm">