summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-25 10:50:36 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-09-25 10:50:36 (GMT)
commit120af427cfaa1bb4e9ecc4668eea5b6259abab14 (patch)
treef53da2653231f493b242092949ed94ae5b1a6aee
parentaf6d5f38e2c5fbe7c091b7655d17e43e26b3fab4 (diff)
More progress on migrating guide stuff
-rw-r--r--kstars/CMakeLists.txt6
-rw-r--r--kstars/ekos/capture/capture.cpp13
-rw-r--r--kstars/ekos/capture/capture.h10
-rw-r--r--kstars/ekos/ekos.h7
-rw-r--r--kstars/ekos/guide/externalguide/phd2.cpp15
-rw-r--r--kstars/ekos/guide/externalguide/phd2.h51
-rw-r--r--kstars/ekos/guide/guide.cpp258
-rw-r--r--kstars/ekos/guide/guide.h94
-rw-r--r--kstars/ekos/guide/guide.ui471
-rw-r--r--kstars/ekos/guide/guideinterface.h22
-rw-r--r--kstars/ekos/guide/internalguide/guider.cpp136
-rw-r--r--kstars/ekos/guide/internalguide/guider.h2
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.cpp20
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.h84
-rw-r--r--kstars/ekos/guide/scroll_graph.cpp (renamed from kstars/ekos/guide/internalguide/scroll_graph.cpp)28
-rw-r--r--kstars/ekos/guide/scroll_graph.h (renamed from kstars/ekos/guide/internalguide/scroll_graph.h)12
-rw-r--r--kstars/kstars.kcfg29
17 files changed, 765 insertions, 493 deletions
diff --git a/kstars/CMakeLists.txt b/kstars/CMakeLists.txt
index 2bef1d3..46dcfa1 100644
--- a/kstars/CMakeLists.txt
+++ b/kstars/CMakeLists.txt
@@ -177,14 +177,16 @@ if (INDI_FOUND)
# Guide
ekos/guide/guide.cpp
ekos/guide/guideinterface.cpp
+ ekos/guide/scroll_graph.cpp
+ # Internal Guide
ekos/guide/internalguide/common.cpp
ekos/guide/internalguide/gmath.cpp
ekos/guide/internalguide/internalguider.cpp
ekos/guide/internalguide/guider.cpp
ekos/guide/internalguide/matr.cpp
- ekos/guide/internalguide/rcalibration.cpp
- ekos/guide/internalguide/scroll_graph.cpp
+ ekos/guide/internalguide/rcalibration.cpp
ekos/guide/internalguide/vect.cpp
+ # External Guide
ekos/guide/externalguide/phd2.cpp
)
endif(CFITSIO_FOUND)
diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp
index 0f7b1aa..113522c 100644
--- a/kstars/ekos/capture/capture.cpp
+++ b/kstars/ekos/capture/capture.cpp
@@ -93,8 +93,7 @@ Capture::Capture()
dustCapLightEnabled = lightBoxLightEnabled = false;
- //isAutoGuiding = false;
- guideDither = false;
+ //isAutoGuiding = false;
isAutoFocus = false;
autoFocusStatus = false;
resumeAlignmentAfterFlip= false;
@@ -176,8 +175,7 @@ Capture::Capture()
seqCurrentCount = 0;
seqDelay = 0;
fileHFR=0;
- useGuideHead = false;
- guideDither = false;
+ useGuideHead = false;
firstAutoFocus = true;
foreach(QString filter, FITSViewer::filterTypes)
@@ -1115,7 +1113,7 @@ bool Capture::resumeSequence()
emit suspendGuiding(false);
//if (isAutoGuiding && guideDither && activeJob->getFrameType() == FRAME_LIGHT)
- if (guideState == GUIDE_GUIDING && guideDither && activeJob->getFrameType() == FRAME_LIGHT)
+ if (guideState == GUIDE_GUIDING && Options::useDither() && activeJob->getFrameType() == FRAME_LIGHT)
{
secondsLabel->setText(i18n("Dithering..."));
//emit exposureComplete();
@@ -1963,11 +1961,6 @@ void Capture::setGuideDeviation(double delta_ra, double delta_dec)
}
}
-void Capture::setGuideDither(bool enable)
-{
- guideDither = enable;
-}
-
void Capture::setFocusStatus(FocusState state)
{
focusState = state;
diff --git a/kstars/ekos/capture/capture.h b/kstars/ekos/capture/capture.h
index 34335b3..5875949 100644
--- a/kstars/ekos/capture/capture.h
+++ b/kstars/ekos/capture/capture.h
@@ -360,12 +360,6 @@ public slots:
void setGuideDeviation(double delta_ra, double delta_dec);
/**
- * @brief setGuideDither Set whether dithering is enable/disabled in guiding module.
- * @param enable True if dithering is enabled, false otherwise.
- */
- void setGuideDither(bool enable);
-
- /**
* @brief resumeCapture Resume capture after dither and/or focusing processes are complete.
*/
bool resumeCapture();
@@ -531,10 +525,6 @@ private:
bool deviationDetected;
bool spikeDetected;
- // Dither
- bool guideDither;
- //bool isAutoGuiding;
-
// Autofocus
bool isAutoFocus;
bool autoFocusStatus;
diff --git a/kstars/ekos/ekos.h b/kstars/ekos/ekos.h
index 2b4ccf6..f162531 100644
--- a/kstars/ekos/ekos.h
+++ b/kstars/ekos/ekos.h
@@ -7,10 +7,11 @@ namespace Ekos
{
// Guide States
- static const QStringList guideStates = { I18N_NOOP("Idle"), I18N_NOOP("Calibrating"), I18N_NOOP("Calibration successful"), I18N_NOOP("Calibration error"), I18N_NOOP("Guiding"),
- I18N_NOOP("Aborted"), I18N_NOOP("Suspended"), I18N_NOOP("Dithering"), I18N_NOOP("Dithering Successful"), I18N_NOOP("Dithering error")};
+ static const QStringList guideStates = { I18N_NOOP("Idle"), I18N_NOOP("Connected"), I18N_NOOP("Disconnected"), I18N_NOOP("Calibrating"), I18N_NOOP("Calibration successful"),
+ I18N_NOOP("Calibration error"), I18N_NOOP("Guiding"), I18N_NOOP("Aborted"), I18N_NOOP("Suspended"), I18N_NOOP("Dithering"),
+ I18N_NOOP("Dithering successful"), I18N_NOOP("Dithering error")};
- typedef enum { GUIDE_IDLE, GUIDE_CALIBRATING, GUIDE_CALIBRATION_SUCESS, GUIDE_CALIBRATION_ERROR, GUIDE_GUIDING,
+ typedef enum { GUIDE_IDLE, GUIDE_CONNECTED, GUIDE_DISCONNECTED, GUIDE_CALIBRATING, GUIDE_CALIBRATION_SUCESS, GUIDE_CALIBRATION_ERROR, GUIDE_GUIDING,
GUIDE_ABORTED, GUIDE_SUSPENDED, GUIDE_DITHERING, GUIDE_DITHERING_SUCCESS, GUIDE_DITHERING_ERROR } GuideState;
const QString & getGuideStatusString(GuideState state);
diff --git a/kstars/ekos/guide/externalguide/phd2.cpp b/kstars/ekos/guide/externalguide/phd2.cpp
index b64db81..ab052a3 100644
--- a/kstars/ekos/guide/externalguide/phd2.cpp
+++ b/kstars/ekos/guide/externalguide/phd2.cpp
@@ -71,7 +71,7 @@ PHD2::~PHD2()
}
-void PHD2::connectPHD2()
+void PHD2::Connect()()
{
if (connection == DISCONNECTED)
{
@@ -264,7 +264,6 @@ void PHD2::processPHD2Event(const QJsonObject &jsonEvent)
emit connected();
}
emit newLog(i18n("PHD2: Guiding Started."));
- //emit autoGuidingToggled(true);
emit newStatus(Ekos::GUIDE_GUIDING);
break;
@@ -467,9 +466,8 @@ void PHD2::setEquipmentConnected(bool enable)
sendJSONRPCRequest("set_connected", args);
}
-bool PHD2::startGuiding()
+bool PHD2::guide()
{
-
if (connection != EQUIPMENT_CONNECTED)
{
emit newLog(i18n("PHD2 Error: Equipment not connected."));
@@ -493,7 +491,7 @@ bool PHD2::startGuiding()
return true;
}
-bool PHD2::stopGuiding()
+bool PHD2::stop()
{
if (connection != EQUIPMENT_CONNECTED)
{
@@ -505,7 +503,7 @@ bool PHD2::stopGuiding()
return true;
}
-bool PHD2::pauseGuiding()
+bool PHD2::suspend()
{
if (connection != EQUIPMENT_CONNECTED)
{
@@ -526,7 +524,7 @@ bool PHD2::pauseGuiding()
}
-bool PHD2::resumeGuiding()
+bool PHD2::resume()
{
if (connection != EQUIPMENT_CONNECTED)
{
@@ -579,11 +577,12 @@ bool PHD2::isConnected()
return (connection >= CONNECTED);
}
-void PHD2::setCCDMountParams(double ccd_pix_w, double ccd_pix_h, double mount_focal)
+void PHD2::setCCDMountParams(double ccd_pix_w, double ccd_pix_h, double mount_aperture, double mount_focal)
{
ccd_pixel_width = ccd_pix_w/1000.0;
ccd_pixel_height= ccd_pix_h/1000.0;
focal = mount_focal;
+ aperture = mount_aperture;
}
}
diff --git a/kstars/ekos/guide/externalguide/phd2.h b/kstars/ekos/guide/externalguide/phd2.h
index 23fb523..b78b2f7 100644
--- a/kstars/ekos/guide/externalguide/phd2.h
+++ b/kstars/ekos/guide/externalguide/phd2.h
@@ -13,7 +13,7 @@
#include <QAbstractSocket>
#include <QJsonArray>
-#include "guide.h"
+#include "../guideinterface.h"
class QTcpSocket;
@@ -24,9 +24,10 @@ namespace Ekos
* @class PHD2
* Uses external PHD2 for guiding.
*
- * @authro Jasem Mutlaq
+ * @author Jasem Mutlaq
+ * @version 1.1
*/
-class PHD2 : public QObject
+class PHD2 : public GuideInterface
{
Q_OBJECT
@@ -41,45 +42,25 @@ public:
PHD2();
~PHD2();
- void connectPHD2();
- void disconnectPHD2();
+ void Connect() override;
+ void Disconnect() override;
- bool isConnected();
- bool isCalibrating() { return state == CALIBRATING; }
- bool isCalibrationComplete() { return state > CALIBRATING; }
- bool isCalibrationSuccessful() { return state >= CALIBRATION_SUCCESSFUL; }
- bool isGuiding() { return state == GUIDING; }
- bool isDithering() { return state == DITHERING; }
-
- void setCCDMountParams(double ccd_pix_w, double ccd_pix_h, double mount_focal);
-
- void setEquipmentConnected(bool enable);
-
- bool startGuiding();
- bool stopGuiding();
- bool pauseGuiding();
- bool resumeGuiding();
- bool dither(double pixels);
+ bool calibrate() override;
+ bool guide() override;
+ bool stop() override;
+ bool suspend() override;
+ bool resume() override;
+ bool dither(double pixels) override;
private slots:
void readPHD2();
- void displayError(QAbstractSocket::SocketError socketError);
-
-signals:
-
- void newLog(const QString &);
- void connected();
- void disconnected();
- //void ditherComplete();
- //void ditherFailed();
- void newAxisDelta(double delta_ra, double delta_dec);
- //void autoGuidingToggled(bool);
- //void guideReady();
- void newStatus(Ekos::GuideState);
+ void displayError(QAbstractSocket::SocketError socketError);
private:
+ void setEquipmentConnected(bool enable);
+
void sendJSONRPCRequest(const QString & method, const QJsonArray args = QJsonArray());
void processJSON(const QJsonObject &jsonObj);
@@ -96,7 +77,7 @@ private:
PHD2Connection connection;
PHD2Event event;
- double ccd_pixel_width, ccd_pixel_height, focal;
+ double ccd_pixel_width, ccd_pixel_height, aperture, focal;
};
}
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index f5e99ec..e1b206b 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -19,18 +19,16 @@
#include "Options.h"
-#include "guide/gmath.h"
-#include "guide/guider.h"
-#include "phd2.h"
+#include "internalguide/internalguider.h"
+#include "externalguide/phd2.h"
-#include "darklibrary.h"
+#include "ekos/auxiliary/darklibrary.h"
#include "indi/driverinfo.h"
#include "indi/clientmanager.h"
#include "fitsviewer/fitsviewer.h"
#include "fitsviewer/fitsview.h"
-#include "guide/rcalibration.h"
#include "guideadaptor.h"
#include "kspaths.h"
@@ -48,78 +46,112 @@ Guide::Guide() : QWidget()
currentCCD = NULL;
currentTelescope = NULL;
- ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
- useGuideHead = false;
- rapidGuideReticleSet = false;
- isSuspended = false;
AODriver= NULL;
GuideDriver=NULL;
- calibration=NULL;
- guider=NULL;
-
- state = GUIDE_IDLE;
+ ccd_hor_pixel = ccd_ver_pixel = focal_length = aperture = -1;
guideDeviationRA = guideDeviationDEC = 0;
+ useGuideHead = false;
+ rapidGuideReticleSet = false;
+
+ // Exposure
exposureIN->setValue(Options::guideExposure());
connect(exposureIN, SIGNAL(editingFinished()), this, SLOT(saveDefaultGuideExposure()));
+ // Guiding Box Size
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();
+ // Guider CCD Selection
+ connect(guiderCombo, SIGNAL(activated(QString)), this, SLOT(setDefaultCCD(QString)));
+ connect(guiderCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCCD(int)));
- 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)));
+ // Dark Frame Check
+ darkFrameCheck->setChecked(Options::useGuideDarkFrame());
+ connect(darkFrameCheck, SIGNAL(toggled(bool)), this, SLOT(setDarkFrameEnabled(bool)));
- calibration = new internalCalibration(pmath, this);
+ // ST4 Selection
+ connect(ST4Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(newST4(int)));
+ connect(ST4Combo, SIGNAL(activated(QString)), this, SLOT(setDefaultST4(QString)));
- connect(calibration, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
+ // Binning Combo Selection
+ connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
- guider = new internalGuider(pmath, this);
+ // Drift Graph scales
+ connect( spinBox_XScale, SIGNAL(valueChanged(int)), this, SLOT(onXscaleChanged(int)) );
+ connect( spinBox_YScale, SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
- 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());
- tabWidget->setTabEnabled(1, false);
+ // MOVE THIS TO GUIDE OPTIONS
+ connect( ui.comboBox_ThresholdAlg, SIGNAL(activated(int)), this, SLOT(onThresholdChanged(int)) );
+ connect( ui.rapidGuideCheck, SIGNAL(toggled(bool)), this, SLOT(onRapidGuideChanged(bool)));
- connect(ST4Combo, SIGNAL(currentIndexChanged(int)), this, SLOT(newST4(int)));
- connect(ST4Combo, SIGNAL(activated(QString)), this, SLOT(setDefaultST4(QString)));
+ // Guiding Rate - Advisory only
+ connect( spinBox_GuideRate, SIGNAL(valueChanged(double)), this, SLOT(onInfoRateChanged(double)) );
- connect(guiderCombo, SIGNAL(activated(QString)), this, SLOT(setDefaultCCD(QString)));
- connect(guiderCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(checkCCD(int)));
+ // RA/DEC Enable directions
+ connect( checkBox_DirRA, SIGNAL(stateChanged(int)), this, SLOT(onEnableDirRA(int)) );
+ connect( checkBox_DirDEC, SIGNAL(stateChanged(int)), this, SLOT(onEnableDirDEC(int)) );
- connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
+ // Declination Swap
+ connect(swapCheck, SIGNAL(toggled(bool)), this, SLOT(setDECSwap(bool)));
+
+ // PID Control - Propotional Gain
+ connect( spinBox_PropGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( spinBox_PropGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+
+ // PID Control - Integral Gain
+ connect( spinBox_IntGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( spinBox_IntGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+
+ // PID Control - Derivative Gain
+ connect( spinBox_DerGainRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( spinBox_DerGainDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ // Max Pulse Duration (ms)
+ connect( spinBox_MaxPulseRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( spinBox_MaxPulseDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+
+ // Min Pulse Duration (ms)
+ connect( spinBox_MinPulseRA, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+ connect( spinBox_MinPulseDEC, SIGNAL(editingFinished()), this, SLOT(onInputParamChanged()) );
+
+
+
+
+ // Image Filters
foreach(QString filter, FITSViewer::filterTypes)
filterCombo->addItem(filter);
- darkFrameCheck->setChecked(Options::useGuideDarkFrame());
- connect(darkFrameCheck, SIGNAL(toggled(bool)), this, SLOT(setDarkFrameEnabled(bool)));
- phd2 = new PHD2();
- connect(phd2, SIGNAL(newLog(QString)), this, SLOT(appendLogText(QString)));
- connect(phd2, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
- connect(phd2, SIGNAL(newStatus(Ekos::GuideState)), guider, SLOT(toggleExternalGuideStateGUI(Ekos::GuideState)));
+ guiderType = static_cast<GuiderType>(Options::GuiderType());
+
+ switch (guiderType)
+ {
+ case GUIDE_INTERNAL:
+ guider= new InternalGuider();
+ break;
+
+ case GUIDE_PHD2:
+ guider = new PHD2();
+ break;
+
+
+ case GUIDE_LINGUIDER:
+ //guider = new LINGuider();
+ break;
+ }
- connect(phd2, SIGNAL(newAxisDelta(double,double)), this, SIGNAL(newAxisDelta(double,double)));
- //connect(phd2, SIGNAL(guideReady()), this, SIGNAL(guideReady()));
- //connect(phd2, SIGNAL(autoGuidingToggled(bool)), this, SIGNAL(autoGuidingToggled(bool)));
- //connect(phd2, SIGNAL(autoGuidingToggled(bool)), guider, SLOT(setGuideState(bool)));
- //connect(phd2, SIGNAL(ditherComplete()), this, SIGNAL(ditherComplete()));
- if (Options::usePHD2Guider())
- phd2->connectPHD2();
+ state = GUIDE_IDLE;
+
+ 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)));
+
+ guider->Connect();
}
Guide::~Guide()
@@ -1274,6 +1306,134 @@ bool Guide::selectAutoStar()
return true;
}
+void Guide::onXscaleChanged( int i )
+{
+ int rx, ry;
+
+ drift_graph->get_visible_ranges( &rx, &ry );
+ drift_graph->set_visible_ranges( i*drift_graph->get_grid_N(), ry );
+
+ // refresh if not started
+ if( state != GUIDE_GUIDING )
+ drift_graph->on_paint();
+}
+
+void Guide::onYscaleChanged( int i )
+{
+ int rx, ry;
+
+ drift_graph->get_visible_ranges( &rx, &ry );
+ drift_graph->set_visible_ranges( rx, i*drift_graph->get_grid_N() );
+
+ // refresh if not started
+ if( state != GUIDE_GUIDING )
+ drift_graph->on_paint();
+}
+
+
+void internalGuider::onThresholdChanged( int index )
+{
+ if( pmath )
+ pmath->setSquareAlgorithm( index );
+}
+
+
+
+// params changing stuff
+void internalGuider::onInfoRateChanged( double val )
+{
+ cproc_in_params *in_params;
+
+
+ if( !pmath )
+ return;
+
+ in_params = pmath->getInputParameters();
+
+ in_params->guiding_rate = val;
+
+ ui.l_RecommendedGain->setText( i18n("P: %1", QString().setNum(pmath->preCalculatePropotionalGain(in_params->guiding_rate), 'f', 2 )) );
+}
+
+
+void internalGuider::onEnableDirRA( int state )
+{
+ cproc_in_params *in_params;
+
+ if( !pmath )
+ return;
+
+ in_params = pmath->getInputParameters();
+ in_params->enabled[GUIDE_RA] = (state == Qt::Checked);
+}
+
+
+void internalGuider::onEnableDirDEC( int state )
+{
+ cproc_in_params *in_params;
+
+ if( !pmath )
+ return;
+
+ in_params = pmath->getInputParameters();
+ in_params->enabled[GUIDE_DEC] = (state == Qt::Checked);
+}
+
+
+void internalGuider::onInputParamChanged()
+{
+ QObject *obj;
+ QSpinBox *pSB;
+ QDoubleSpinBox *pDSB;
+ cproc_in_params *in_params;
+
+
+ if( !pmath )
+ return;
+
+ obj = sender();
+
+ in_params = pmath->getInputParameters();
+
+ 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();
+ }
+
+}
+
+
}
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index 709a8e6..b1edfa0 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -13,32 +13,34 @@
#include <QTimer>
#include <QtDBus/QtDBus>
-#include "ekos.h"
-#include "guide/common.h"
-#include "guide.h"
-#include "fitsviewer/fitscommon.h"
+#include "ekos/ekos.h"
+
#include "indi/indistd.h"
#include "indi/inditelescope.h"
#include "indi/indiccd.h"
+
+#include "guide.h"
+
+
+#include "fitsviewer/fitscommon.h"
+
#include "ui_guide.h"
class QTabWidget;
-class cgmath;
-class internalCalibration;
-class internalGuider;
class FITSData;
+class ScrollGraph;
namespace Ekos
{
-class PHD2;
+class GuideInterface;
/**
*@class Guide
*@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.2
+ *@version 1.3
*/
class Guide : public QWidget, public Ui::Guide
{
@@ -51,7 +53,7 @@ public:
~Guide();
enum GuiderStage { CALIBRATION_STAGE, GUIDE_STAGE };
- enum GuiderProcess { GUIDE_INTERNAL, GUIDE_PHD2 };
+ enum GuiderType { GUIDE_INTERNAL, GUIDE_PHD2, GUIDE_LINGUIDER };
/** @defgroup GuideDBusInterface Ekos DBus Interface - Capture Module
* Ekos::Guide interface provides advanced scripting capabilities to calibrate and guide a mount via a CCD camera.
@@ -181,7 +183,7 @@ public:
* Selects which guiding process to utilize for calibration & guiding.
* @param guideProcess Either use Ekos internal guider or external PHD2 process.
*/
- Q_SCRIPTABLE Q_NOREPLY void setGuiderProcess(int guiderProcess);
+ Q_SCRIPTABLE Q_NOREPLY void setGuguiderTypent guiderProcess);
/** @}*/
@@ -280,65 +282,81 @@ public slots:
void setCaptureComplete();
protected slots:
- void updateCCDBin(int index);
+ void updateCCDBin(int index);
- /**
+ /**
* @brief processCCDNumber Process number properties arriving from CCD. Currently, binning changes are processed.
* @param nvp pointer to number property.
*/
- void processCCDNumber(INumberVectorProperty *nvp);
+ void processCCDNumber(INumberVectorProperty *nvp);
+
+ void saveDefaultGuideExposure();
+
+ void setDefaultCCD(QString ccd);
+ void setDefaultST4(QString st4);
- void saveDefaultGuideExposure();
+ void updateTrackingBoxSize(int currentIndex);
- void setDefaultCCD(QString ccd);
- void setDefaultST4(QString st4);
- void updateTrackingBoxSize(int currentIndex);
+ 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 onSetDECSwap(bool enable);
signals:
- void newLog();
- void newStatus(Ekos::GuideState status);
+ void newLog();
+ void newStatus(Ekos::GuideState status);
- void newStarPixmap(QPixmap &);
- void newProfilePixmap(QPixmap &);
+ void newStarPixmap(QPixmap &);
+ void newProfilePixmap(QPixmap &);
- //void guideReady();
- void newAxisDelta(double delta_ra, double delta_dec);
- //void autoGuidingToggled(bool);
- //void ditherComplete();
- //void ditherFailed();
- void ditherToggled(bool);
- void guideChipUpdated(ISD::CCDChip*);
+ void newAxisDelta(double delta_ra, double delta_dec);
+ void guideChipUpdated(ISD::CCDChip*);
private:
void updateGuideParams();
void syncTrackingBoxPosition();
+ // Devices
ISD::CCD *currentCCD;
ISD::Telescope *currentTelescope;
ISD::ST4* ST4Driver;
ISD::ST4* AODriver;
ISD::ST4* GuideDriver;
+ // Device Containers
QList<ISD::ST4*> ST4List;
QList<ISD::CCD *> CCDs;
- cgmath *pmath;
- internalCalibration *calibration;
- internalGuider *guider;
- PHD2 *phd2;
-
- bool useGuideHead;
- bool isSuspended;
+ // Guider process
+ GuideInterface *guider;
+ GuiderType guiderType;
+ // Star
QVector3D starCenter;
- QStringList logText;
-
+ // Guide Params
double ccd_hor_pixel, ccd_ver_pixel, focal_length, aperture, guideDeviationRA, guideDeviationDEC;
+
+ // Rapid Guide
bool rapidGuideReticleSet;
+ // State
GuideState state;
+
+ // Drift Graph
+ ScrollGraph *driftGraph;
+
+ // Log
+ QStringList logText;
+
+ // Misc
+ bool useGuideHead;
};
}
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index a546d1a..a92fbba 100644
--- a/kstars/ekos/guide/guide.ui
+++ b/kstars/ekos/guide/guide.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>683</width>
- <height>457</height>
+ <width>694</width>
+ <height>513</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -15,19 +15,19 @@
<number>1</number>
</property>
<property name="leftMargin">
- <number>1</number>
+ <number>3</number>
</property>
<property name="topMargin">
- <number>1</number>
+ <number>3</number>
</property>
<property name="rightMargin">
- <number>1</number>
+ <number>3</number>
</property>
<property name="bottomMargin">
- <number>1</number>
+ <number>3</number>
</property>
<item>
- <layout class="QHBoxLayout" name="mainLayout">
+ <layout class="QHBoxLayout" name="horizontalLayout_10">
<property name="spacing">
<number>1</number>
</property>
@@ -82,7 +82,7 @@
<item row="1" column="0">
<widget class="QPushButton" name="calibrationB">
<property name="enabled">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="text">
<string>Calibrate</string>
@@ -98,6 +98,9 @@
</item>
<item row="2" column="0">
<widget class="QPushButton" name="guideB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>Guide</string>
</property>
@@ -124,9 +127,6 @@
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
- <widget class="QComboBox" name="guiderCombo"/>
- </item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
@@ -137,9 +137,6 @@
</property>
</widget>
</item>
- <item row="1" column="1" colspan="2">
- <widget class="QComboBox" name="ST4Combo"/>
- </item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="toolTip">
@@ -168,6 +165,9 @@
<property name="text">
<string>Bin:</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
</widget>
</item>
<item row="2" column="3">
@@ -231,6 +231,12 @@
</item>
</widget>
</item>
+ <item row="0" column="1" colspan="3">
+ <widget class="QComboBox" name="guiderCombo"/>
+ </item>
+ <item row="1" column="1" colspan="3">
+ <widget class="QComboBox" name="ST4Combo"/>
+ </item>
</layout>
</item>
</layout>
@@ -581,154 +587,217 @@
</item>
<item>
<layout class="QVBoxLayout" name="rightLayout">
- <property name="spacing">
- <number>1</number>
- </property>
<item>
- <widget class="QFrame" name="guideFrame">
+ <widget class="FITSView" name="guideView">
<property name="minimumSize">
<size>
- <width>200</width>
- <height>200</height>
+ <width>320</width>
+ <height>240</height>
</size>
</property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
+ <property name="styleSheet">
+ <string notr="true">background-color:gray;</string>
</property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
+ <property name="sizeAdjustPolicy">
+ <enum>QAbstractScrollArea::AdjustToContentsOnFirstShow</enum>
</property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents_2">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>462</width>
+ <height>238</height>
+ </rect>
+ </property>
+ </widget>
</widget>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_7">
- <property name="spacing">
- <number>1</number>
- </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
- <widget class="QDockWidget" name="dockWidget">
- <property name="minimumSize">
- <size>
- <width>225</width>
- <height>247</height>
- </size>
- </property>
- <property name="features">
- <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
- </property>
- <property name="windowTitle">
+ <widget class="QGroupBox" name="draftGraphicsGroup">
+ <property name="title">
<string>Drift Graphics</string>
</property>
- <widget class="QWidget" name="dockWidgetContents">
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <property name="spacing">
- <number>1</number>
- </property>
- <property name="leftMargin">
- <number>3</number>
- </property>
- <property name="topMargin">
- <number>3</number>
- </property>
- <property name="rightMargin">
- <number>3</number>
- </property>
- <property name="bottomMargin">
- <number>3</number>
- </property>
- <item>
- <widget class="QFrame" name="frame_Graph">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>200</width>
- <height>200</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>500</width>
- <height>500</height>
- </size>
- </property>
- <property name="baseSize">
- <size>
- <width>300</width>
- <height>300</height>
- </size>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <widget class="QLabel" name="l_1">
- <property name="text">
- <string>X scale(frm.)</string>
- </property>
- <property name="margin">
- <number>0</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="spinBox_XScale">
- <property name="minimum">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="l_2">
- <property name="text">
- <string>Y scale(&quot;)</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="spinBox_YScale">
- <property name="minimum">
- <number>5</number>
- </property>
- <property name="maximum">
- <number>30</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>13</width>
- <height>17</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <property name="leftMargin">
+ <number>3</number>
+ </property>
+ <property name="topMargin">
+ <number>3</number>
+ </property>
+ <property name="rightMargin">
+ <number>3</number>
+ </property>
+ <property name="bottomMargin">
+ <number>3</number>
+ </property>
+ <item>
+ <widget class="QFrame" name="frame_Graph">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>200</width>
+ <height>200</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="sizeIncrement">
+ <size>
+ <width>50</width>
+ <height>50</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>300</width>
+ <height>300</height>
+ </size>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="RADriftLabel">
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="RADriftEnableC">
+ <property name="text">
+ <string>RA</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="DEDriftLabel">
+ <property name="minimumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="DEDriftEnableC">
+ <property name="text">
+ <string>DE</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="l_1">
+ <property name="text">
+ <string>X</string>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox_XScale">
+ <property name="toolTip">
+ <string>Horizontal scale: Number of frames per division</string>
+ </property>
+ <property name="minimum">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="l_2">
+ <property name="text">
+ <string>Y</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox_YScale">
+ <property name="toolTip">
+ <string>Vertical scale: Deviation in arcseconds per division</string>
+ </property>
+ <property name="minimum">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <number>30</number>
+ </property>
+ <property name="singleStep">
+ <number>5</number>
+ </property>
+ <property name="value">
+ <number>5</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>13</width>
+ <height>17</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
</widget>
</item>
<item>
@@ -738,7 +807,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="spacing">
- <number>1</number>
+ <number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
@@ -757,18 +826,14 @@
<property name="spacing">
<number>1</number>
</property>
- <item row="1" column="2">
- <widget class="QCheckBox" name="swapCheck">
+ <item row="0" column="2">
+ <widget class="QCheckBox" name="checkBox_DirDEC">
<property name="toolTip">
- <string>Swap DEC direction pulses. This value is determined automatically from the calibration procedure, only override if necessary.</string>
+ <string>Guide Declination Axis</string>
</property>
- <property name="text">
- <string>Swap</string>
+ <property name="styleSheet">
+ <string notr="true">margin-left:18;</string>
</property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QCheckBox" name="checkBox_DirDEC">
<property name="text">
<string>DEC</string>
</property>
@@ -781,13 +846,86 @@
</property>
</widget>
</item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="eastControlCheck">
+ <property name="toolTip">
+ <string>East Direction Guiding</string>
+ </property>
+ <property name="text">
+ <string>E</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="westControlCheck">
+ <property name="toolTip">
+ <string>West Direction Guiding</string>
+ </property>
+ <property name="text">
+ <string>W</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item row="0" column="1">
<widget class="QCheckBox" name="checkBox_DirRA">
+ <property name="toolTip">
+ <string>Guide Right Ascention Axis</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">margin-left:18;</string>
+ </property>
<property name="text">
<string>RA</string>
</property>
</widget>
</item>
+ <item row="1" column="2">
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <property name="spacing">
+ <number>1</number>
+ </property>
+ <item>
+ <widget class="QCheckBox" name="northControlCheck">
+ <property name="toolTip">
+ <string>North Direction Guiding</string>
+ </property>
+ <property name="text">
+ <string>N</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="southControlCheck">
+ <property name="toolTip">
+ <string>South Direction Guiding</string>
+ </property>
+ <property name="text">
+ <string>S</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="swapCheck">
+ <property name="toolTip">
+ <string>Swap DEC direction pulses. This value is determined automatically from the calibration procedure, only override if necessary.</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">margin-left:10;</string>
+ </property>
+ <property name="text">
+ <string>Swap</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
@@ -986,15 +1124,18 @@
</spacer>
</item>
</layout>
- <zorder>layoutWidget</zorder>
- <zorder>guideFrame</zorder>
- <zorder>dockWidget</zorder>
- <zorder>groupBox</zorder>
<zorder>mainVerticalSpacer</zorder>
- <zorder>frame_Graph</zorder>
<zorder></zorder>
- <zorder>frame_Graph</zorder>
+ <zorder>dockWidget</zorder>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>FITSView</class>
+ <extends>QScrollArea</extends>
+ <header>fitsview.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
diff --git a/kstars/ekos/guide/guideinterface.h b/kstars/ekos/guide/guideinterface.h
index 703f926..486c843 100644
--- a/kstars/ekos/guide/guideinterface.h
+++ b/kstars/ekos/guide/guideinterface.h
@@ -11,6 +11,7 @@
#define GUIDEINTERFACE_H
#include <QObject>
+#include "ekos/ekos.h"
namespace Ekos
{
@@ -30,6 +31,27 @@ public:
GuideInterface();
virtual ~GuideInterface() {}
+ virtual bool Connect() = 0;
+ virtual bool Disconnect() = 0;
+
+ virtual bool calibrate() = 0;
+ virtual bool guide() = 0;
+ virtual bool suspend() = 0;
+ virtual bool resume() = 0;
+ virtual bool stop() = 0;
+ virtual bool dither(double pixels) = 0;
+
+ virtual void setGuiderParams(double ccdpixel_x, double ccdpixel_y, double aperture, double focal);
+
+signals:
+ void newLog(const QString &);
+ void newStatus(Ekos::GuideState);
+ void newAxisDelta(double delta_ra, double delta_dec);
+ void newStarPosition(QVector3D, bool);
+
+private:
+ Ekos::GuideState state;
+
};
}
diff --git a/kstars/ekos/guide/internalguide/guider.cpp b/kstars/ekos/guide/internalguide/guider.cpp
index 9ebd7ef..162efbd 100644
--- a/kstars/ekos/guide/internalguide/guider.cpp
+++ b/kstars/ekos/guide/internalguide/guider.cpp
@@ -92,7 +92,7 @@ internalGuider::internalGuider(cgmath *mathObject, Ekos::Guide *parent)
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 = new ScrollGraph( this, DRIFT_GRAPH_WIDTH, DRIFT_GRAPH_HEIGHT );
drift_graph->set_visible_ranges( DRIFT_GRAPH_WIDTH, 60 );
pDriftOut->set_source( drift_graph->get_buffer(), NULL );
@@ -209,140 +209,6 @@ void internalGuider::setInterface( void )
}
-void internalGuider::onXscaleChanged( int i )
-{
- int rx, ry;
-
- drift_graph->get_visible_ranges( &rx, &ry );
- drift_graph->set_visible_ranges( i*drift_graph->get_grid_N(), ry );
-
- // refresh if not started
- if( !m_isStarted )
- {
- drift_graph->on_paint();
- // pDriftOut->update();
- }
-
-}
-
-
-void internalGuider::onYscaleChanged( int i )
-{
- int rx, ry;
-
- drift_graph->get_visible_ranges( &rx, &ry );
- drift_graph->set_visible_ranges( rx, i*drift_graph->get_grid_N() );
-
- // refresh if not started
- if( !m_isStarted )
- {
- drift_graph->on_paint();
- // pDriftOut->update();
- }
-}
-
-
-void internalGuider::onThresholdChanged( int index )
-{
- if( pmath )
- pmath->setSquareAlgorithm( index );
-}
-
-
-
-// params changing stuff
-void internalGuider::onInfoRateChanged( double val )
-{
- cproc_in_params *in_params;
-
-
- if( !pmath )
- return;
-
- in_params = pmath->getInputParameters();
-
- in_params->guiding_rate = val;
-
- ui.l_RecommendedGain->setText( i18n("P: %1", QString().setNum(pmath->preCalculatePropotionalGain(in_params->guiding_rate), 'f', 2 )) );
-}
-
-
-void internalGuider::onEnableDirRA( int state )
-{
- cproc_in_params *in_params;
-
- if( !pmath )
- return;
-
- in_params = pmath->getInputParameters();
- in_params->enabled[GUIDE_RA] = (state == Qt::Checked);
-}
-
-
-void internalGuider::onEnableDirDEC( int state )
-{
- cproc_in_params *in_params;
-
- if( !pmath )
- return;
-
- in_params = pmath->getInputParameters();
- in_params->enabled[GUIDE_DEC] = (state == Qt::Checked);
-}
-
-
-void internalGuider::onInputParamChanged()
-{
- QObject *obj;
- QSpinBox *pSB;
- QDoubleSpinBox *pDSB;
- cproc_in_params *in_params;
-
-
- if( !pmath )
- return;
-
- obj = sender();
-
- in_params = pmath->getInputParameters();
-
- 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();
- }
-
-}
diff --git a/kstars/ekos/guide/internalguide/guider.h b/kstars/ekos/guide/internalguide/guider.h
index 5e1edc2..48b6f3a 100644
--- a/kstars/ekos/guide/internalguide/guider.h
+++ b/kstars/ekos/guide/internalguide/guider.h
@@ -97,7 +97,7 @@ private:
Ekos::PHD2 *phd2;
custom_drawer *pDriftOut;
- cscroll_graph *drift_graph;
+ ScrollGraph *drift_graph;
QPointer<FITSView> guideFrame;
bool m_isStarted;
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp b/kstars/ekos/guide/internalguide/internalguider.cpp
index bc1694c..761f13c 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -13,12 +13,30 @@
#include "Options.h"
+namespace Ekos
+{
+
InternalGuider::InternalGuider()
{
+
+ // 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 internalCalibration(pmath, this);
+
+ connect(calibration, SIGNAL(newStatus(Ekos::GuideState)), this, SLOT(setStatus(Ekos::GuideState)));
+
+ guider = new internalGuider(pmath, this);
+
}
InternalGuider::~InternalGuider()
{
}
-
+}
diff --git a/kstars/ekos/guide/internalguide/internalguider.h b/kstars/ekos/guide/internalguide/internalguider.h
index 95edc98..c7f6d0d 100644
--- a/kstars/ekos/guide/internalguide/internalguider.h
+++ b/kstars/ekos/guide/internalguide/internalguider.h
@@ -14,13 +14,95 @@
#include "../guideinterface.h"
+namespace Ekos
+{
+
class InternalGuider : public GuideInterface
{
- Q_OBJECT
public:
InternalGuider();
~InternalGuider();
+
+ void Connect() override;
+ void Disconnect() override;
+
+ bool calibrate() override;
+ bool guide() override;
+ bool stop() override;
+ bool suspend() override;
+ bool resume() override;
+ bool dither(double pixels) override;
+
+ void guide( void );
+ bool start();
+ bool stop();
+ 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 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(const QString & algorithm, bool useSubFrame, bool useRapidGuide);
+
+ // Dither
+ bool isDitherChecked() { return ui.ditherCheck->isChecked(); }
+ bool dither();
+ bool isDithering() { return m_isDithering; }
+ void setDither(bool enable, double value);
+ double getDitherPixels() { return ui.ditherPixels->value(); }
+
+ setSquareAlgorithm( index );
+
+ QString getAlgorithm();
+ bool useSubFrame();
+ bool useRapidGuide();
+
+ void setPHD2(Ekos::PHD2 *phd);
+
+public slots:
+ void setDECSwap(bool enable);
+ void connectPHD2();
+ void setPHD2Connected();
+ void setPHD2Disconnected();
+ // Only called by PHD2
+ void toggleExternalGuideStateGUI(Ekos::GuideState state);
+
+protected slots:
+ void onStartStopButtonClick();
+
+ void capture();
+ void trackingStarSelected(int x, int y);
+
+
+signals:
+ void newProfilePixmap(QPixmap &);
+
+private:
+ cgmath *pmath;
+ QPointer<FITSView> guideFrame;
+ bool m_isStarted;
+ bool m_isReady;
+ bool m_isSubFramed;
+ bool first_frame, first_subframe;
+ bool half_refresh_rate;
+ int m_lostStarTries;
+ bool m_useRapidGuide;
+ ISD::CCDChip *targetChip;
+ int fx,fy,fw,fh;
+ double ret_x, ret_y, ret_angle;
+ bool m_isDithering;
+ QFile logFile;
+ QPixmap profilePixmap;
};
+}
+
#endif // INTERNALGUIDER_H
diff --git a/kstars/ekos/guide/internalguide/scroll_graph.cpp b/kstars/ekos/guide/scroll_graph.cpp
index de8e998..b8df666 100644
--- a/kstars/ekos/guide/internalguide/scroll_graph.cpp
+++ b/kstars/ekos/guide/scroll_graph.cpp
@@ -18,7 +18,7 @@
#include "kstarsdata.h"
#include "colorscheme.h"
-cscroll_graph::cscroll_graph( QWidget *own, int client_width, int client_height )
+ScrollGraph::ScrollGraph( QWidget *own, int client_width, int client_height )
{
owner = own;
@@ -59,7 +59,7 @@ cscroll_graph::cscroll_graph( QWidget *own, int client_width, int client_height
}
-cscroll_graph::~cscroll_graph()
+ScrollGraph::~ScrollGraph()
{
delete buffer;
delete [] data.line[ RA_LINE ];
@@ -67,7 +67,7 @@ cscroll_graph::~cscroll_graph()
}
-void cscroll_graph::init_render_vars( void )
+void ScrollGraph::init_render_vars( void )
{
half_buffer_size_wd = client_rect_wd / 2;
half_buffer_size_ht = client_rect_ht / 2;
@@ -85,7 +85,7 @@ void cscroll_graph::init_render_vars( void )
}
-void cscroll_graph::set_visible_ranges( int rx, int ry )
+void ScrollGraph::set_visible_ranges( int rx, int ry )
{
if( rx >= 10*grid_N && rx < (double)data_cnt )
{
@@ -115,20 +115,20 @@ void cscroll_graph::set_visible_ranges( int rx, int ry )
}
-void cscroll_graph::get_visible_ranges( int *rx, int *ry )
+void ScrollGraph::get_visible_ranges( int *rx, int *ry )
{
*rx = vis_range_x;
*ry = vis_range_y;
}
-int cscroll_graph::get_grid_N( void )
+int ScrollGraph::get_grid_N( void )
{
return grid_N;
}
-void cscroll_graph::reset_view( void )
+void ScrollGraph::reset_view( void )
{
set_visible_ranges( client_rect_wd, 100 );
@@ -139,7 +139,7 @@ void cscroll_graph::reset_view( void )
}
-void cscroll_graph::reset_data( void )
+void ScrollGraph::reset_data( void )
{
memset( data.line[RA_LINE], 0, sizeof(double)*data_cnt );
memset( data.line[DEC_LINE], 0, sizeof(double)*data_cnt );
@@ -151,20 +151,20 @@ void cscroll_graph::reset_data( void )
-QImage *cscroll_graph::get_buffer( void )
+QImage *ScrollGraph::get_buffer( void )
{
return buffer;
}
-void cscroll_graph::get_screen_size( int *sx, int *sy )
+void ScrollGraph::get_screen_size( int *sx, int *sy )
{
*sx = client_rect_wd;
*sy = client_rect_ht;
}
-void cscroll_graph::on_paint( void )
+void ScrollGraph::on_paint( void )
{
canvas.begin( buffer );
@@ -179,7 +179,7 @@ void cscroll_graph::on_paint( void )
* Main Drawing function
*
**************/
-void cscroll_graph::refresh( void )
+void ScrollGraph::refresh( void )
{
int i, j, k;
double kx, ky, step;
@@ -331,7 +331,7 @@ void cscroll_graph::refresh( void )
}
-void cscroll_graph::draw_grid( double kx, double )
+void ScrollGraph::draw_grid( double kx, double )
{
int i, x, sx, y;
int grid_column, val;
@@ -383,7 +383,7 @@ void cscroll_graph::draw_grid( double kx, double )
-bool cscroll_graph::add_point( double ra, double dec )
+bool ScrollGraph::add_point( double ra, double dec )
{
data_idx++;
diff --git a/kstars/ekos/guide/internalguide/scroll_graph.h b/kstars/ekos/guide/scroll_graph.h
index 3a73f62..e1f375c 100644
--- a/kstars/ekos/guide/internalguide/scroll_graph.h
+++ b/kstars/ekos/guide/scroll_graph.h
@@ -9,8 +9,8 @@
version 2 of the License, or (at your option) any later version.
*/
-#ifndef CSCROLL_GRAPH_H_
-#define CSCROLL_GRAPH_H_
+#ifndef ScrollGraph_H_
+#define ScrollGraph_H_
#include <QtGui>
#include <QWidget>
@@ -28,11 +28,11 @@ typedef struct
-class cscroll_graph
+class ScrollGraph
{
public:
- cscroll_graph( QWidget *own, int client_width, int client_height );
- virtual ~cscroll_graph();
+ ScrollGraph( QWidget *own, int client_width, int client_height );
+ virtual ~ScrollGraph();
QImage *get_buffer( void );
bool add_point( double ra, double dec );
@@ -79,4 +79,4 @@ private:
};
-#endif /*CSCROLL_GRAPH_H_*/
+#endif /*ScrollGraph_H_*/
diff --git a/kstars/kstars.kcfg b/kstars/kstars.kcfg
index 13675fb..8122d83 100644
--- a/kstars/kstars.kcfg
+++ b/kstars/kstars.kcfg
@@ -1238,7 +1238,7 @@
<whatsthis>Log Ekos Focus Module activity.</whatsthis>
<default>false</default>
</entry>
- <entry name="GuideLogging" type="Bool">
+ <entry name="Logging" type="Bool">
<whatsthis>Log Ekos Guide Module activity.</whatsthis>
<default>false</default>
</entry>
@@ -1582,26 +1582,25 @@
<label>Guider exposure duration in seconds.</label>
<default>1.0</default>
</entry>
- <entry name="UseEkosGuider" type="Bool">
- <label>Use Ekos Internal Guider Module for guiding</label>
- <default>true</default>
- </entry>
- <entry name="UsePHD2Guider" type="Bool">
- <label>Use External PHD2 Application for guiding</label>
- <default>false</default>
- </entry>
- <entry name="PHD2Exec" type="String">
- <label>PHD2 Executable</label>
- <default>/usr/bin/phd2</default>
- </entry>
- <entry name="PHD2Host" type="String">
- <label>PHD2 Event Monitoring Host name</label>
+ <entry name="GuiderType" type="UInt">
+ <label>Which guider process to utilize for guiding (0 Internal Guider, 1 PHD2, 2 lin_guider)</label>
+ <default>0</default>
+ </entry>
+ <entry name="ExternalGuiderHost" type="String">
+ <label>Host name of external guider service</label>
<default>localhost</default>
</entry>
+ <entry name="ExternalGuiderPort" type="UInt">
+ <label>Port of external guider service</label>
+ </entry>
<entry name="PHD2Port" type="UInt">
<label>PHD2 Event Monitoring Port</label>
<default>4400</default>
</entry>
+ <entry name="LINGuiderPort" type="UInt">
+ <label>Lin_guider Event Monitoring Port</label>
+ <default>59000</default>
+ </entry>
<entry name="CalibrationPulseDuration" type="UInt">
<label>Pulse duration in milliseconds used for guiding pulses during calibration stage.</label>
<default>1000</default>