summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-06 10:50:20 (GMT)
committerJasem Mutlaq <mutlaqja@ikarustech.com>2016-10-06 10:50:20 (GMT)
commitc146cc950e84bf9d9cc4e95b5403e297995dae76 (patch)
treed3d32ff36141631c47542a385fb5fc23e985758a
parenta3baa10339d9b927805b7ed00f7518214961bbe9 (diff)
More progress on guide graph
-rw-r--r--kstars/ekos/guide/guide.cpp118
-rw-r--r--kstars/ekos/guide/guide.h32
-rw-r--r--kstars/ekos/guide/guide.ui182
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.cpp20
-rw-r--r--kstars/ekos/guide/internalguide/internalguider.h2
-rw-r--r--kstars/ekos/guide/opsguide.cpp3
6 files changed, 168 insertions, 189 deletions
diff --git a/kstars/ekos/guide/guide.cpp b/kstars/ekos/guide/guide.cpp
index 7e1e4ad..b6e0f09 100644
--- a/kstars/ekos/guide/guide.cpp
+++ b/kstars/ekos/guide/guide.cpp
@@ -81,14 +81,11 @@ Guide::Guide() : QWidget()
guideDeviationRA = guideDeviationDEC = 0;
useGuideHead = false;
- rapidGuideReticleSet = false;
+ rapidGuideReticleSet = false;
// Load all settings
loadSettings();
- // Set color scheme
- refreshColorScheme();
-
// Image Filters
foreach(QString filter, FITSViewer::filterTypes)
filterCombo->addItem(filter);
@@ -173,7 +170,7 @@ Guide::Guide() : QWidget()
// Drift Graph
- /*driftGraph->setBackground(QBrush(Qt::black));
+ driftGraph->setBackground(QBrush(Qt::black));
driftGraph->xAxis->setBasePen(QPen(Qt::white, 1));
driftGraph->yAxis->setBasePen(QPen(Qt::white, 1));
driftGraph->xAxis->grid()->setPen(QPen(QColor(140, 140, 140), 1, Qt::DotLine));
@@ -191,24 +188,40 @@ Guide::Guide() : QWidget()
driftGraph->xAxis->setTickLabelColor(Qt::white);
driftGraph->yAxis->setTickLabelColor(Qt::white);
driftGraph->xAxis->setLabelColor(Qt::white);
- driftGraph->yAxis->setLabelColor(Qt::white);*/
+ driftGraph->yAxis->setLabelColor(Qt::white);
+
+ driftGraph->xAxis->setRange(0, 120, Qt::AlignRight);
- driftGraph->addGraph(); // blue line
- driftGraph->graph(0)->setPen(QPen(QColor(40, 110, 255)));
- driftGraph->addGraph(); // red line
- driftGraph->graph(1)->setPen(QPen(QColor(255, 110, 40)));
+ driftGraph->legend->setVisible(true);
+ driftGraph->legend->setFont(QFont("Helvetica",9));
+ driftGraph->legend->setTextColor(Qt::white);
+ driftGraph->legend->setBrush(QBrush(Qt::black));
+
+ // RA Curve
+ driftGraph->addGraph();
+ driftGraph->graph(0)->setPen(QPen(KStarsData::Instance()->colorScheme()->colorNamed("RAGuideError")));
+ driftGraph->graph(0)->setName("RA");
+ driftGraph->graph(0)->setLineStyle(QCPGraph::lsStepLeft);
+
+ // DE Curve
+ driftGraph->addGraph();
+ driftGraph->graph(1)->setPen(QPen(KStarsData::Instance()->colorScheme()->colorNamed("DEGuideError")));
+ driftGraph->graph(1)->setName("DE");
+ driftGraph->graph(1)->setLineStyle(QCPGraph::lsStepLeft);
QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);
timeTicker->setTimeFormat("%m:%s");
driftGraph->xAxis->setTicker(timeTicker);
driftGraph->axisRect()->setupFullAxesBox();
- //driftGraph->yAxis->setRange(-3, 3);
+ driftGraph->yAxis->setRange(-3, 3);
// make left and bottom axes transfer their ranges to right and top axes:
connect(driftGraph->xAxis, SIGNAL(rangeChanged(QCPRange)), driftGraph->xAxis2, SLOT(setRange(QCPRange)));
connect(driftGraph->yAxis, SIGNAL(rangeChanged(QCPRange)), driftGraph->yAxis2, SLOT(setRange(QCPRange)));
+ driftGraph->setInteractions(QCP::iRangeZoom);
+ connect(driftGraph, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseOverLine(QMouseEvent*)));
//driftGraph = new ScrollGraph( this, driftGraph_WIDTH, driftGraph_HEIGHT );
//driftGraphics->setSize(driftGraph_WIDTH, driftGraph_HEIGHT);
@@ -1128,6 +1141,10 @@ bool Guide::guide()
if (rc)
{
+ driftGraph->graph(0)->data().clear();
+ driftGraph->graph(1)->data().clear();
+ guideTimer = QTime::currentTime();
+ refreshColorScheme();
//TODO reset data?
//driftGraphics->resetData();
}
@@ -1135,6 +1152,11 @@ bool Guide::guide()
return rc;
}
+bool Guide::dither()
+{
+ return false;
+}
+
void Guide::setSuspended(bool enable)
{
/*
@@ -1727,13 +1749,6 @@ void Guide::saveSettings()
Options::setDECMinimumPulse(spinBox_MinPulseDEC->value());
}
-void Guide::refreshColorScheme()
-{
- // Drift color legend
- RADriftLabel->setStyleSheet(QString("background-color: %1;").arg(KStarsData::Instance()->colorScheme()->colorNamed("RAGuideError").name(QColor::HexRgb)));
- DEDriftLabel->setStyleSheet(QString("background-color: %1;").arg(KStarsData::Instance()->colorScheme()->colorNamed("DEGuideError").name(QColor::HexRgb)));
-}
-
void Guide::setTrackingStar(int x, int y)
{
QVector3D newStarPosition(x,y, -1);
@@ -1748,19 +1763,20 @@ void Guide::setTrackingStar(int x, int y)
void Guide::setAxisDelta(double ra, double de)
{
- static QTime time(QTime::currentTime());
- // calculate two new data points:
- double key = time.elapsed()/1000.0; // time elapsed since start of demo, in seconds
+ // Time since timer started.
+ double key = guideTimer.elapsed()/1000.0;
driftGraph->graph(0)->addData(key, ra);
driftGraph->graph(1)->addData(key, de);
- driftGraph->xAxis->setRange(key, 8, Qt::AlignRight);
- driftGraph->replot();
- //driftGraphics->addPoint(ra, de);
- //driftGraphics->update();
-
+ // Expand range if it doesn't fit already
+ if (driftGraph->yAxis->range().contains(de) == false)
+ driftGraph->yAxis->setRange(-1.25*de, 1.25*de);
+ // Show last 120 seconds
+ //driftGraph->xAxis->setRange(key, 120, Qt::AlignRight);
+ driftGraph->xAxis->setRange(key, driftGraph->xAxis->range().size(), Qt::AlignRight);
+ driftGraph->replot();
l_DeltaRA->setText(QString::number(ra, 'f', 2));
l_DeltaDEC->setText(QString::number(de, 'f', 2));
@@ -1780,6 +1796,56 @@ void Guide::setAxisPulse(double ra, double de)
l_PulseDEC->setText(QString::number(static_cast<int>(de)));
}
+void Guide::refreshColorScheme()
+{
+ // Drift color legend
+ //RADriftLabel->setStyleSheet(QString("background-color: %1;").arg(KStarsData::Instance()->colorScheme()->colorNamed("RAGuideError").name(QColor::HexRgb)));
+ //DEDriftLabel->setStyleSheet(QString("background-color: %1;").arg(KStarsData::Instance()->colorScheme()->colorNamed("DEGuideError").name(QColor::HexRgb)));
+
+
+ driftGraph->graph(0)->setPen(QPen(KStarsData::Instance()->colorScheme()->colorNamed("RAGuideError")));
+ driftGraph->graph(1)->setPen(QPen(KStarsData::Instance()->colorScheme()->colorNamed("DEGuideError")));
+}
+
+void Guide::mouseOverLine(QMouseEvent *event)
+{
+ double key = driftGraph->xAxis->pixelToCoord(event->localPos().x());
+
+ if (driftGraph->xAxis->range().contains(key))
+ {
+ QCPGraph *graph = qobject_cast<QCPGraph *>(driftGraph->plottableAt(event->pos(), false));
+
+ if(graph)
+ {
+ int raIndex = driftGraph->graph(0)->findBegin(key);
+ int deIndex = driftGraph->graph(1)->findBegin(key);
+
+ double raDelta = driftGraph->graph(0)->dataMainValue(raIndex);
+ double deDelta = driftGraph->graph(1)->dataMainValue(deIndex);
+
+ // Compute time value:
+ QTime localTime = guideTimer;
+
+ localTime = localTime.addSecs(key);
+
+ QToolTip::hideText();
+ QToolTip::showText(event->globalPos(),
+ i18nc("Drift graphics tooltip; %1 is local time; %2 is RA deviation; %3 is DE deviation in arcseconds",
+ "<table>"
+ "<tr><td>LT: </td><td>%1</td></tr>"
+ "<tr><td>RA: </td><td>%2 \"</td></tr>"
+ "<tr><td>DE: </td><td>%3 \"</td></tr>"
+ "</table>", localTime.toString("hh:mm:ss AP"), QString::number(raDelta, 'f', 2), QString::number(deDelta, 'f', 2)));
+ }
+ else
+ QToolTip::hideText();
+
+ driftGraph->replot();
+ }
+
+}
+
+
}
diff --git a/kstars/ekos/guide/guide.h b/kstars/ekos/guide/guide.h
index deede5a..2dda80a 100644
--- a/kstars/ekos/guide/guide.h
+++ b/kstars/ekos/guide/guide.h
@@ -191,13 +191,7 @@ public:
/**
* @brief clearLog As the name suggests
*/
- void clearLog();
-
- /**
- * @brief setDECSwap Change ST4 declination pulse direction. +DEC pulses increase DEC if swap is OFF. When on +DEC pulses result in decreasing DEC.
- * @param enable True to enable DEC swap. Off to disable it.
- */
- void setDECSwap(bool enable);
+ void clearLog();
/**
* @return Return curent log text of guide module
@@ -217,11 +211,6 @@ public:
void startRapidGuide();
void stopRapidGuide();
- /**
- * @brief refreshColorScheme Update any colors that depend on updates in the color scheme
- */
- void refreshColorScheme();
-
GuideInterface * getGuider() { return guider;}
public slots:
@@ -244,6 +233,12 @@ public slots:
*/
Q_SCRIPTABLE bool calibrate();
+ /** BUS interface function.
+ * @brief dither Starts dithering process in a random direction restricted by the number of pixels specified in dither options
+ * @return True if dither started successfully, false otherwise.
+ */
+ Q_SCRIPTABLE bool dither();
+
/** DBUS interface function.
* Capture a guide frame
* @return Returns true if capture command is sent successfully to INDI server.
@@ -312,6 +307,12 @@ public slots:
bool sendPulse( GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs );
bool sendPulse( GuideDirection dir, int msecs );
+ /**
+ * @brief setDECSwap Change ST4 declination pulse direction. +DEC pulses increase DEC if swap is OFF. When on +DEC pulses result in decreasing DEC.
+ * @param enable True to enable DEC swap. Off to disable it.
+ */
+ void setDECSwap(bool enable);
+
protected slots:
void updateCCDBin(int index);
@@ -332,6 +333,8 @@ protected slots:
void updateTrackingBoxSize(int currentIndex);
+ // Display guide information when hovering over the drift graph
+ void mouseOverLine(QMouseEvent *event);
//void onXscaleChanged( int i );
//void onYscaleChanged( int i );
@@ -388,6 +391,8 @@ private:
*/
void setBusy(bool enable);
+ void refreshColorScheme();
+
// Devices
ISD::CCD *currentCCD;
ISD::Telescope *currentTelescope;
@@ -415,6 +420,9 @@ private:
// State
GuideState state;
+ // Guide timer
+ QTime guideTimer;
+
// Drift Graph
//ScrollGraph *driftGraph;
diff --git a/kstars/ekos/guide/guide.ui b/kstars/ekos/guide/guide.ui
index ab92b5a..e4d3c1b 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>682</width>
- <height>506</height>
+ <width>686</width>
+ <height>505</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -264,21 +264,6 @@
<string>Guide Info</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
- <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>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
@@ -290,12 +275,15 @@
<string>Mount guiding rate</string>
</property>
<property name="text">
- <string>Guiding rate,x15&quot;/sec</string>
+ <string>Guiding rate</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="spinBox_GuideRate">
+ <property name="toolTip">
+ <string>Guiding rate (x15&quot;/sec)</string>
+ </property>
<property name="decimals">
<number>3</number>
</property>
@@ -313,29 +301,39 @@
<item>
<widget class="QLabel" name="l_RecommendedGain">
<property name="toolTip">
- <string>Recommended proportional rate</string>
+ <string>&lt;b&gt;Recommended&lt;/b&gt; proportional rate given the selected guiding rate</string>
</property>
<property name="text">
<string notr="true">P=xxx</string>
</property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
</widget>
</item>
</layout>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout_4">
- <property name="spacing">
- <number>1</number>
+ <widget class="Line" name="line_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="l_5">
<property name="text">
- <string>Focal,mm</string>
+ <string>Focal</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="l_Focal">
+ <property name="toolTip">
+ <string>Focal Length (mm)</string>
+ </property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -353,15 +351,18 @@
</property>
</widget>
</item>
- <item row="0" column="2" colspan="2">
+ <item row="0" column="2">
<widget class="QLabel" name="l_6">
<property name="text">
- <string>Aperture,mm</string>
+ <string>Aperture</string>
</property>
</widget>
</item>
- <item row="0" column="4">
+ <item row="0" column="3">
<widget class="QLabel" name="l_Aperture">
+ <property name="toolTip">
+ <string>Aperture (mm)</string>
+ </property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -378,6 +379,9 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="l_7">
+ <property name="toolTip">
+ <string>Focal Ratio</string>
+ </property>
<property name="text">
<string>F/D</string>
</property>
@@ -402,12 +406,15 @@
<item row="1" column="2">
<widget class="QLabel" name="l_8">
<property name="text">
- <string>FOV,'</string>
+ <string>FOV</string>
</property>
</widget>
</item>
- <item row="1" column="3" colspan="2">
+ <item row="1" column="3">
<widget class="QLabel" name="l_FOV">
+ <property name="toolTip">
+ <string>Field of View (arcmin)</string>
+ </property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@@ -433,13 +440,10 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
- <property name="spacing">
- <number>1</number>
- </property>
<item row="0" column="0">
<widget class="QLabel" name="l_16">
<property name="text">
- <string>Delta ,&quot;</string>
+ <string>Guiding Delta &quot;</string>
</property>
</widget>
</item>
@@ -485,7 +489,7 @@
<item row="1" column="0">
<widget class="QLabel" name="l_17">
<property name="text">
- <string>Pulse duration, ms</string>
+ <string>Pulse Length (ms)</string>
</property>
</widget>
</item>
@@ -530,9 +534,6 @@
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
- <property name="spacing">
- <number>1</number>
- </property>
<item>
<widget class="QLabel" name="l_20">
<property name="text">
@@ -563,9 +564,6 @@
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="spacing">
- <number>1</number>
- </property>
<item>
<widget class="QLabel" name="l_21">
<property name="text">
@@ -697,110 +695,6 @@
</item>
</layout>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <property name="spacing">
- <number>5</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="frameShape">
- <enum>QFrame::Box</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="RADriftEnableC">
- <property name="toolTip">
- <string>Draw RA deviation</string>
- </property>
- <property name="text">
- <string>RA</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </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="frameShape">
- <enum>QFrame::Box</enum>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="DEDriftEnableC">
- <property name="toolTip">
- <string>Draw DEC Deviation</string>
- </property>
- <property name="text">
- <string>DE</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="Line" name="line_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </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>
@@ -1154,8 +1048,6 @@
<tabstop>boxSizeCombo</tabstop>
<tabstop>filterCombo</tabstop>
<tabstop>spinBox_GuideRate</tabstop>
- <tabstop>RADriftEnableC</tabstop>
- <tabstop>DEDriftEnableC</tabstop>
<tabstop>checkBox_DirRA</tabstop>
<tabstop>checkBox_DirDEC</tabstop>
<tabstop>eastControlCheck</tabstop>
diff --git a/kstars/ekos/guide/internalguide/internalguider.cpp b/kstars/ekos/guide/internalguide/internalguider.cpp
index 2606f80..1ce942f 100644
--- a/kstars/ekos/guide/internalguide/internalguider.cpp
+++ b/kstars/ekos/guide/internalguide/internalguider.cpp
@@ -105,8 +105,8 @@ bool InternalGuider::guide()
#endif
- logFile.open(QIODevice::WriteOnly | QIODevice::Text);
- QTextStream out(&logFile);
+ //logFile.open(QIODevice::WriteOnly | QIODevice::Text);
+ //QTextStream out(&logFile);
/* FIXME Have to re-enable guide logging file
@@ -148,7 +148,9 @@ bool InternalGuider::guide()
#endif
- pmath->setLogFile(&logFile);
+ //pmath->setLogFile(&logFile);
+
+ isFirstFrame = true;
state = GUIDE_GUIDING;
emit newStatus(state);
@@ -903,6 +905,18 @@ bool InternalGuider::processGuiding()
}
*/
+ // On first frame, center the box (reticle) around the star so we do not start with an offset the results in
+ // unnecessary guiding pulses.
+ if (isFirstFrame)
+ {
+ if (state == GUIDE_GUIDING)
+ {
+ Vector star_pos = pmath->findLocalStarPosition();
+ pmath->setReticleParameters(star_pos.x, star_pos.y, -1);
+ }
+ isFirstFrame=false;
+ }
+
// calc math. it tracks square
pmath->performProcessing();
diff --git a/kstars/ekos/guide/internalguide/internalguider.h b/kstars/ekos/guide/internalguide/internalguider.h
index f57c44e..74e31db 100644
--- a/kstars/ekos/guide/internalguide/internalguider.h
+++ b/kstars/ekos/guide/internalguide/internalguider.h
@@ -123,7 +123,7 @@ private:
bool m_isStarted;
bool m_isReady;
bool m_isSubFramed;
- bool first_frame, first_subframe;
+ bool isFirstFrame, first_subframe;
bool half_refresh_rate;
int m_lostStarTries;
bool m_useRapidGuide;
diff --git a/kstars/ekos/guide/opsguide.cpp b/kstars/ekos/guide/opsguide.cpp
index 8d3eecf..1ed3fe0 100644
--- a/kstars/ekos/guide/opsguide.cpp
+++ b/kstars/ekos/guide/opsguide.cpp
@@ -36,8 +36,7 @@ OpsGuide::OpsGuide(InternalGuider *guiderObject) : QFrame( KStars::Instance() )
m_ConfigDialog = KConfigDialog::exists( "guidesettings" );
connect( m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL( clicked() ), SLOT( slotApply() ) );
- connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );
- connect( m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL( clicked() ), SLOT( slotCancel() ) );
+ connect( m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL( clicked() ), SLOT( slotApply() ) );
guiderTypeButtonGroup->setId(internalGuideR, Guide::GUIDE_INTERNAL);
guiderTypeButtonGroup->setId(PHD2GuideR, Guide::GUIDE_PHD2);