Commit fcc87c1b authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

More progress on guide module

parent fb55ed2f
......@@ -10,6 +10,7 @@
#include "guide.h"
#include <QDateTime>
#include <QSharedPointer>
#include <KMessageBox>
#include <KLed>
......@@ -38,6 +39,7 @@
#include "guideadaptor.h"
#include "kspaths.h"
#include "kstarsdata.h"
#include "auxiliary/qcustomplot.h"
#define driftGraph_WIDTH 200
#define driftGraph_HEIGHT 200
......@@ -118,8 +120,8 @@ Guide::Guide() : QWidget()
connect(binningCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateCCDBin(int)));
// Drift Graph scales
connect( spinBox_XScale, SIGNAL(valueChanged(int)), this, SLOT(onXscaleChanged(int)) );
connect( spinBox_YScale, SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
//connect( spinBox_XScale, SIGNAL(valueChanged(int)), this, SLOT(onXscaleChanged(int)) );
//connect( spinBox_YScale, SIGNAL(valueChanged(int)), this, SLOT(onYscaleChanged(int)) );
// Guiding Rate - Advisory only
connect( spinBox_GuideRate, SIGNAL(valueChanged(double)), this, SLOT(onInfoRateChanged(double)) );
......@@ -170,6 +172,44 @@ Guide::Guide() : QWidget()
connect(guideB, SIGNAL(clicked()), this, SLOT(guide()));
// Drift Graph
/*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));
driftGraph->yAxis->grid()->setPen(QPen(QColor(140, 140, 140), 1, Qt::DotLine));
driftGraph->xAxis->grid()->setSubGridPen(QPen(QColor(80, 80, 80), 1, Qt::DotLine));
driftGraph->yAxis->grid()->setSubGridPen(QPen(QColor(80, 80, 80), 1, Qt::DotLine));
driftGraph->xAxis->grid()->setZeroLinePen(Qt::NoPen);
driftGraph->yAxis->grid()->setZeroLinePen(Qt::NoPen);
driftGraph->xAxis->setBasePen(QPen(Qt::white, 1));
driftGraph->yAxis->setBasePen(QPen(Qt::white, 1));
driftGraph->xAxis->setTickPen(QPen(Qt::white, 1));
driftGraph->yAxis->setTickPen(QPen(Qt::white, 1));
driftGraph->xAxis->setSubTickPen(QPen(Qt::white, 1));
driftGraph->yAxis->setSubTickPen(QPen(Qt::white, 1));
driftGraph->xAxis->setTickLabelColor(Qt::white);
driftGraph->yAxis->setTickLabelColor(Qt::white);
driftGraph->xAxis->setLabelColor(Qt::white);
driftGraph->yAxis->setLabelColor(Qt::white);*/
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)));
QSharedPointer<QCPAxisTickerTime> timeTicker(new QCPAxisTickerTime);
timeTicker->setTimeFormat("%m:%s");
driftGraph->xAxis->setTicker(timeTicker);
driftGraph->axisRect()->setupFullAxesBox();
//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 = new ScrollGraph( this, driftGraph_WIDTH, driftGraph_HEIGHT );
//driftGraphics->setSize(driftGraph_WIDTH, driftGraph_HEIGHT);
//driftGraphics->setSize(200, 200);
......@@ -1088,7 +1128,8 @@ bool Guide::guide()
if (rc)
{
driftGraphics->resetData();
//TODO reset data?
//driftGraphics->resetData();
}
return rc;
......@@ -1477,6 +1518,7 @@ bool Guide::selectAutoStar()
return true;
}
/*
void Guide::onXscaleChanged( int i )
{
int rx, ry;
......@@ -1495,6 +1537,7 @@ void Guide::onYscaleChanged( int i )
driftGraphics->setVisibleRanges( rx, i*driftGraphics->getGridN() );
driftGraphics->update();
}
*/
void Guide::onThresholdChanged( int index )
......@@ -1705,8 +1748,19 @@ void Guide::setTrackingStar(int x, int y)
void Guide::setAxisDelta(double ra, double de)
{
driftGraphics->addPoint(ra, de);
driftGraphics->update();
static QTime time(QTime::currentTime());
// calculate two new data points:
double key = time.elapsed()/1000.0; // time elapsed since start of demo, in seconds
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();
l_DeltaRA->setText(QString::number(ra, 'f', 2));
l_DeltaDEC->setText(QString::number(de, 'f', 2));
......
......@@ -333,8 +333,8 @@ protected slots:
void updateTrackingBoxSize(int currentIndex);
void onXscaleChanged( int i );
void onYscaleChanged( int i );
//void onXscaleChanged( int i );
//void onYscaleChanged( int i );
void onThresholdChanged( int i );
void onInfoRateChanged( double val );
void onEnableDirRA( bool enable );
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>697</width>
<height>510</height>
<width>682</width>
<height>506</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
......@@ -664,21 +664,18 @@
</spacer>
</item>
<item>
<widget class="ScrollGraph" name="driftGraphics" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QCustomPlot" name="driftGraph" native="true">
<property name="minimumSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
......@@ -703,7 +700,7 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="spacing">
<number>1</number>
<number>5</number>
</property>
<item>
<widget class="QLabel" name="RADriftLabel">
......@@ -789,52 +786,6 @@
</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">
......@@ -1182,12 +1133,48 @@
</widget>
<customwidgets>
<customwidget>
<class>ScrollGraph</class>
<class>QCustomPlot</class>
<extends>QWidget</extends>
<header>ekos/guide/scroll_graph.h</header>
<header>auxiliary/qcustomplot.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>captureB</tabstop>
<tabstop>subFrameCheck</tabstop>
<tabstop>darkFrameCheck</tabstop>
<tabstop>calibrateB</tabstop>
<tabstop>guideB</tabstop>
<tabstop>stopB</tabstop>
<tabstop>guideOptionsB</tabstop>
<tabstop>guiderCombo</tabstop>
<tabstop>ST4Combo</tabstop>
<tabstop>exposureIN</tabstop>
<tabstop>binningCombo</tabstop>
<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>
<tabstop>westControlCheck</tabstop>
<tabstop>northControlCheck</tabstop>
<tabstop>southControlCheck</tabstop>
<tabstop>swapCheck</tabstop>
<tabstop>spinBox_PropGainRA</tabstop>
<tabstop>spinBox_PropGainDEC</tabstop>
<tabstop>spinBox_IntGainRA</tabstop>
<tabstop>spinBox_IntGainDEC</tabstop>
<tabstop>spinBox_DerGainRA</tabstop>
<tabstop>spinBox_DerGainDEC</tabstop>
<tabstop>spinBox_MaxPulseRA</tabstop>
<tabstop>spinBox_MaxPulseDEC</tabstop>
<tabstop>spinBox_MinPulseRA</tabstop>
<tabstop>spinBox_MinPulseDEC</tabstop>
<tabstop>spinBox_AOLimit</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
......@@ -794,6 +794,24 @@ void cgmath::process_axes( void )
if (Options::guideLogging())
qDebug() << "Guide: Processing Axes";
in_params.proportional_gain[0] = Options::rAPropotionalGain();
in_params.proportional_gain[1] = Options::dECPropotionalGain();
in_params.integral_gain[0] = Options::rAIntegralGain();
in_params.integral_gain[1] = Options::rAIntegralGain();
in_params.derivative_gain[0] = Options::rADerivativeGain();
in_params.derivative_gain[1] = Options::dECDerivativeGain();
in_params.enabled[0] = Options::rAGuideEnabled();
in_params.enabled[1] = Options::dECGuideEnabled();
in_params.min_pulse_length[0] = Options::rAMinimumPulse();
in_params.min_pulse_length[1] = Options::dECMinimumPulse();
in_params.max_pulse_length[0] = Options::rAMaximumPulse();
in_params.max_pulse_length[1] = Options::dECMaximumPulse();
// process axes...
for( int k = GUIDE_RA;k <= GUIDE_DEC;k++ )
{
......
......@@ -119,9 +119,7 @@ public:
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 );
Matrix getROTZ() { return ROT_Z; }
const cproc_out_params *getOutputParameters() const { return &out_params; }
info_params_t getInfoParameters( void ) const;
uint32_t getTicks( void ) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment