From aa909cf7dd6e0124b1d116c327d5e62843f1ee69 Mon Sep 17 00:00:00 2001 From: edouard Date: Sat, 4 Sep 2010 16:42:56 +0000 Subject: [PATCH] Various updates: use PDOP on PFD since the INSGPS algo relies on it, and more work on GPS Display gadget, minute improvements... git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1524 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../plugins/gpsdisplay/gpsdisplaygadget.cpp | 1 + .../plugins/gpsdisplay/gpsdisplaywidget.cpp | 22 +++++++++---------- .../src/plugins/gpsdisplay/gpsdisplaywidget.h | 1 + ground/src/plugins/gpsdisplay/gpsparser.h | 1 + .../plugins/gpsdisplay/telemetryparser.cpp | 7 ++++++ ground/src/plugins/pfd/pfdgadgetwidget.cpp | 4 ++-- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp index 8a43c632f..8f17d8f42 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp @@ -106,6 +106,7 @@ void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config) connect(parser, SIGNAL(datetime(double,double)), m_widget,SLOT(setDateTime(double,double))); connect(parser, SIGNAL(packet(char*)), m_widget, SLOT(dumpPacket(char*))); connect(parser, SIGNAL(satellite(int,int,int,int,int)), m_widget->gpsSky, SLOT(updateSat(int,int,int,int,int))); + connect(parser, SIGNAL(fixtype(QString)), m_widget, SLOT(setFixType(QString))); } void GpsDisplayGadget::onConnect() { diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp index 642c80c42..2df122d78 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp @@ -53,30 +53,28 @@ GpsDisplayWidget::~GpsDisplayWidget() void GpsDisplayWidget::setSpeedHeading(double speed, double heading) { - QString temp = "Speed: "; - temp.append(QString::number(speed,'g',10)); - temp.append(" Heaging: "); - temp.append(QString::number(heading,'g',10)); speed_value->setText(QString::number(speed,'g',10)); speed_value->adjustSize(); bear_value->setText(QString::number(heading,'g',10)); bear_value->adjustSize(); - // widget->textBrowser->append(temp); } void GpsDisplayWidget::setDateTime(double date, double time) { - QString temp = "Date: "; - temp.append(QString::number(date,'g',10)); - temp.append(" Time: "); - temp.append(QString::number(time,'g',10)); - gdate_value->setText(QString::number(date,'g',10)); - gdate_value->adjustSize(); + QString dstring = QString::number(date,'g',10); + dstring.insert(6,"."); + dstring.insert(4,"."); + gdate_value->setText(dstring); + //gdate_value->adjustSize(); gtime_value->setText(QString::number(time,'g',10)); gdate_value->adjustSize(); - //textBrowser->append(temp); +} + +void GpsDisplayWidget::setFixType(QString fixtype) +{ + fix_value->setText(fixtype); } void GpsDisplayWidget::dumpPacket(char *packet) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h index 891d8ab06..cfb2091a5 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h @@ -52,6 +52,7 @@ private slots: void setDateTime(double, double); void setSpeedHeading(double, double); void dumpPacket(char*); + void setFixType(QString fixtype); private: GpsConstellationWidget * gpsConstellation; diff --git a/ground/src/plugins/gpsdisplay/gpsparser.h b/ground/src/plugins/gpsdisplay/gpsparser.h index 379369809..b1d931e26 100644 --- a/ground/src/plugins/gpsdisplay/gpsparser.h +++ b/ground/src/plugins/gpsdisplay/gpsparser.h @@ -50,6 +50,7 @@ signals: void speedheading(double,double); void packet(char*); // Raw NMEA Packet (or just info) void satellite(int,int,int,int,int); // Index, PRN, Elevation, Azimuth, SNR + void fixtype(QString); // Type of fix (none, 2D, 3D, etc). }; diff --git a/ground/src/plugins/gpsdisplay/telemetryparser.cpp b/ground/src/plugins/gpsdisplay/telemetryparser.cpp index 6b9159839..39bdd9e6c 100644 --- a/ground/src/plugins/gpsdisplay/telemetryparser.cpp +++ b/ground/src/plugins/gpsdisplay/telemetryparser.cpp @@ -75,6 +75,13 @@ void TelemetryParser::updateGPS( UAVObject* object1) { double alt = object1->getField(QString("Altitude"))->getDouble(); emit position(lat,lon,alt); + double hdg = object1->getField(QString("Heading"))->getDouble(); + double spd = object1->getField(QString("Groundspeed"))->getDouble(); + emit speedheading(spd,hdg); + + QString fix = object1->getField(QString("Status"))->getValue().toString(); + emit fixtype(fix); + } void TelemetryParser::updateTime( UAVObject* object1) { diff --git a/ground/src/plugins/pfd/pfdgadgetwidget.cpp b/ground/src/plugins/pfd/pfdgadgetwidget.cpp index a9ca1aac9..98f14a439 100644 --- a/ground/src/plugins/pfd/pfdgadgetwidget.cpp +++ b/ground/src/plugins/pfd/pfdgadgetwidget.cpp @@ -182,9 +182,9 @@ void PFDGadgetWidget::connectNeedles() { */ void PFDGadgetWidget::updateGPS(UAVObject *object1) { UAVObjectField* field = object1->getField(QString("Satellites")); - UAVObjectField* field1 = object1->getField(QString("HDOP")); + UAVObjectField* field1 = object1->getField(QString("PDOP")); if (field && field1) { - QString s = QString("GPS: ") + field->getValue().toString() + "\nHDP: " + QString s = QString("GPS: ") + field->getValue().toString() + "\nPDP: " + field1->getValue().toString(); if (s != satString) { gcsGPSStats->setPlainText(s);