Merge pull request #1658 from srcejon/fix_1641

Sat & Star tracker: Plot target on Az/El chart.
pull/1664/head
Edouard Griffiths 2023-04-14 18:50:19 +02:00 zatwierdzone przez GitHub
commit 32d5a2cfdd
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 83 dodań i 14 usunięć

Wyświetl plik

@ -132,6 +132,7 @@ bool SatelliteTrackerGUI::handleMessage(const Message& message)
ui->azimuth->setText(convertDegreesToText(satState->m_azimuth));
ui->elevation->setText(convertDegreesToText(satState->m_elevation));
plotChart();
if (satState->m_passes.size() > 0)
{
@ -143,7 +144,6 @@ bool SatelliteTrackerGUI::handleMessage(const Message& message)
m_nextTargetAOS = pass.m_aos;
m_nextTargetLOS = pass.m_los;
m_geostationarySatVisible = geostationary;
plotChart();
updateTimeToAOS();
}
}
@ -1084,14 +1084,11 @@ void SatelliteTrackerGUI::plotPolarChart()
m_polarChart->addSeries(nowSeries);
nowSeries->attachAxis(angularAxis);
nowSeries->attachAxis(radialAxis);
if (!redrawTime) {
redrawTime = 5000;
}
}
if (redrawTime > 0)
{
// Redraw to show updated satellite position or rotator position
// Redraw to show updated rotator position
m_redrawTimer.setSingleShot(true);
m_redrawTimer.start(redrawTime);
}
@ -1239,6 +1236,30 @@ void SatelliteTrackerGUI::plotAzElChart()
azSeriesList[i]->attachAxis(yRightAxis);
}
// Plot current target on elevation series
if (m_targetSatState && (m_targetSatState->m_elevation > 0.0))
{
QDateTime currentTime;
if (m_settings.m_dateTime == "") {
currentTime = m_satelliteTracker->currentDateTimeUtc();
} else if (m_settings.m_utc) {
currentTime = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
} else {
currentTime = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs).toUTC();
}
QScatterSeries *posSeries = new QScatterSeries();
posSeries->setMarkerSize(3);
posSeries->append(currentTime.toMSecsSinceEpoch(), m_targetSatState->m_elevation);
posSeries->setPointLabelsVisible(true);
posSeries->setPointLabelsFormat(m_settings.m_target);
posSeries->setPointLabelsClipping(false);
m_lineChart->addSeries(posSeries);
posSeries->attachAxis(xAxis);
posSeries->attachAxis(yLeftAxis);
}
xAxis->setRange(pass.m_aos, pass.m_los);
xAxis->setFormat("hh:mm");
yLeftAxis->setRange(0.0, 90.0);

Wyświetl plik

@ -473,7 +473,8 @@ void getSatelliteState(QDateTime dateTime,
QTime passStartTime, QTime passFinishTime, bool utc,
int noOfPasses, int groundTrackSteps, SatelliteState *satState)
{
try {
try
{
Tle tle = Tle(tle0.toStdString(), tle1.toStdString(), tle2.toStdString());
SGP4 sgp4(tle);
Observer obs(latitude, longitude, altitude);
@ -522,14 +523,14 @@ void getSatelliteState(QDateTime dateTime,
}
catch (SatelliteException& se)
{
qDebug() << "getSatelliteState: " << satState->m_name << ": " << se.what();
qDebug() << "getSatelliteState:SatelliteException " << satState->m_name << ": " << se.what();
}
catch (DecayedException& de)
{
qDebug() << "getSatelliteState: " << satState->m_name << ": " << de.what();
qDebug() << "getSatelliteState:DecayedException " << satState->m_name << ": " << de.what();
}
catch (TleException& tlee)
{
qDebug() << "getSatelliteState: " << satState->m_name << ": " << tlee.what();
qDebug() << "getSatelliteState:TleException " << satState->m_name << ": " << tlee.what() << "\n" << tle0 << "\n" << tle1 << "\n" << tle2;
}
}

Wyświetl plik

@ -1540,12 +1540,14 @@ void StarTrackerGUI::plotElevationLineChart()
azSeries->setPen(pen);
QDateTime dt;
QDateTime currentTime;
if (m_settings.m_dateTime.isEmpty()) {
dt = QDateTime::currentDateTime();
currentTime = QDateTime::currentDateTime();
} else {
dt = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
currentTime = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
}
dt = currentTime;
dt.setTime(QTime(0,0));
QDateTime startTime = dt;
@ -1635,6 +1637,28 @@ void StarTrackerGUI::plotElevationLineChart()
azSeriesList[i]->attachAxis(yRightAxis);
}
// Plot current target on elevation series
if (ui->azimuth->hasValue() && ui->elevation->hasValue() && (ui->elevation->value() > 0.0))
{
QScatterSeries *posSeries = new QScatterSeries();
posSeries->setMarkerSize(3);
posSeries->append(currentTime.toMSecsSinceEpoch(), ui->elevation->value());
if (m_settings.m_target.startsWith("Custom"))
{
posSeries->setPointLabelsVisible(false);
posSeries->setPointLabelsFormat("");
}
else
{
posSeries->setPointLabelsVisible(true);
posSeries->setPointLabelsFormat(m_settings.m_target);
}
posSeries->setPointLabelsClipping(false);
m_azElLineChart->addSeries(posSeries);
posSeries->attachAxis(xAxis);
posSeries->attachAxis(yLeftAxis);
}
elSeries->attachAxis(xAxis);
elSeries->attachAxis(yLeftAxis);
xAxis->setTitleText(QString("%1 %2").arg(startTime.date().toString()).arg(startTime.timeZoneAbbreviation()));
@ -1719,14 +1743,15 @@ void StarTrackerGUI::plotElevationPolarChart()
double maxElevation = -90.0;
QLineSeries *polarSeries = new QLineSeries();
QDateTime currentTime;
QDateTime dt;
if (m_settings.m_dateTime.isEmpty()) {
dt = QDateTime::currentDateTime();
currentTime = QDateTime::currentDateTime();
} else {
dt = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
currentTime = QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs);
}
dt = currentTime;
dt.setTime(QTime(0,0));
QDateTime startTime = dt;
QDateTime endTime = dt;
@ -1978,6 +2003,28 @@ void StarTrackerGUI::plotElevationPolarChart()
setSeries->attachAxis(radialAxis);
}
// Plot target current position
if (ui->azimuth->hasValue() && ui->elevation->hasValue() && (ui->elevation->value() > 0.0))
{
QScatterSeries *posSeries = new QScatterSeries();
posSeries->setMarkerSize(3);
posSeries->append(ui->azimuth->value(), 90 - ui->elevation->value());
if (m_settings.m_target.startsWith("Custom"))
{
posSeries->setPointLabelsVisible(false);
posSeries->setPointLabelsFormat("");
}
else
{
posSeries->setPointLabelsVisible(true);
posSeries->setPointLabelsFormat(m_settings.m_target);
}
posSeries->setPointLabelsClipping(false);
m_azElPolarChart->addSeries(posSeries);
posSeries->attachAxis(angularAxis);
posSeries->attachAxis(radialAxis);
}
if (maxElevation < 0) {
m_azElPolarChart->setTitle("Not visible from this latitude");
} else {