From 1f78c63648c66f3ff5450c8ec4984beafea02a45 Mon Sep 17 00:00:00 2001 From: edouard Date: Sun, 5 Sep 2010 07:03:29 +0000 Subject: [PATCH] OP-52 Ground / GPS Display: overhaul of UI - should not change anymore hopefully - to be more compact and more readable, with more info git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1534 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../plugins/gpsdisplay/gpsdisplaygadget.cpp | 1 + .../plugins/gpsdisplay/gpsdisplaywidget.cpp | 54 +- .../src/plugins/gpsdisplay/gpsdisplaywidget.h | 1 + .../plugins/gpsdisplay/gpsdisplaywidget.ui | 790 +++++++++++------- ground/src/plugins/gpsdisplay/gpsparser.h | 1 + .../plugins/gpsdisplay/telemetryparser.cpp | 6 + 6 files changed, 519 insertions(+), 334 deletions(-) diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp index 8f17d8f42..6305f03a5 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaygadget.cpp @@ -107,6 +107,7 @@ void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config) 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))); + connect(parser, SIGNAL(dop(double,double,double)), m_widget, SLOT(setDOP(double,double,double))); } void GpsDisplayGadget::onConnect() { diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp index 28b74b4dd..1a1d859a1 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp @@ -72,19 +72,13 @@ void GpsDisplayWidget::setSpeedHeading(double speed, double heading) void GpsDisplayWidget::setDateTime(double date, double time) { -// QString dstring = QString::number(date,'g',10); - QString dstring; - dstring.sprintf("%06.0f",date); - dstring.insert(dstring.length()-2,"."); - dstring.insert(dstring.length()-5,"."); - gdate_value->setText(dstring); - gdate_value->adjustSize(); - //dstring = QString::number(time,'g',10); - dstring.sprintf("%06.0f",time); - dstring.insert(dstring.length()-2,":"); - dstring.insert(dstring.length()-5,":"); - gtime_value->setText(dstring + " GMT"); - gdate_value->adjustSize(); + QString dstring1 = QString::number(date,'g',10); + dstring1.insert(6,"."); + dstring1.insert(4,"."); + QString dstring2 = QString::number(time,'g',10); + dstring2.insert(dstring2.length()-2,":"); + dstring2.insert(dstring2.length()-5,":"); + time_value->setText(dstring1 + " " + dstring2 + " GMT"); } @@ -106,27 +100,39 @@ void GpsDisplayWidget::setSVs(int sv) status_value->adjustSize(); } +void GpsDisplayWidget::setDOP(double hdop, double vdop, double pdop) +{ + + QString str; + str.sprintf("%.2f / %.2f / %.2f", hdop, vdop, pdop); + +} + void GpsDisplayWidget::setPosition(double lat, double lon, double alt) { + lat *= 1E-7; + lon *= 1E-7; double deg = (lat>0) ? floor(lat):ceil(lat); double min = fabs(lat-deg)*60; - QString str; - str.sprintf("%.0f%c%.3f'", deg,0x00b0, min); + QString str1; + str1.sprintf("%.0f%c%.3f' ", deg,0x00b0, min); if (lat>0) - str.append("N"); + str1.append("N"); else - str.append("S"); - lat_value->setText(str); - lat_value->adjustSize(); + str1.append("S"); + coord_value->setText(str1); deg = floor(fabs(lon)); // ABS takes an int. min = fabs(lon-deg)*60; - str.sprintf("%.0f%c%.3f'", deg,0x00b0, min); + QString str2; + str2.sprintf("%.0f%c%.3f' ", deg,0x00b0, min); if (lon>0) - str.append("E"); + str2.append("E"); else - str.append("W"); - long_value->setText(str); - long_value->adjustSize(); + str2.append("W"); + coord_value_2->setText(str2); + QString str3; + str3.sprintf("%.2f m", alt); + coord_value_3->setText(str3); // Now place the marker: double wscale = flatEarth->sceneRect().width()/360; diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h index 25324d784..fe7228e36 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.h @@ -53,6 +53,7 @@ private slots: void setSpeedHeading(double, double); void dumpPacket(char*); void setFixType(QString fixtype); + void setDOP(double hdop, double vdop, double pdop); private: GpsConstellationWidget * gpsConstellation; diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui index 9177205f2..c7a1b954b 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui @@ -6,8 +6,8 @@ 0 0 - 570 - 319 + 592 + 417 @@ -25,315 +25,485 @@ Form - - - - - 0 - - - - - - 0 - 0 - - - - GPS Status - - - - QFormLayout::AllNonFixedFieldsGrow - - - 1 - - - 6 - - - - - Status: - - - - - - - Unknown - - - - - - - Latitude: - - - - - - - Unknown - - - - - - - Longitude: - - - - - - - Unknown - - - - - - - Bearing: - - - - - - - Unknown - - - - - - - Speed: - - - - - - - Unknown - - - - - - - Fix Type: - - - - - - - Unknown - - - - - - - GPS Time: - - - - - - - Unknown - - - - - - - GPS Date: - - - - - - - Unknown - - - - - - - - - - - 0 - 0 - - - - - 368 - 171 - - - - - 368 - 171 - - - - - - 177 - 0 - 191 - 95 - - - - - 0 - 0 - - - - - 191 - 95 - - - - - 191 - 95 - - - - false - - - - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QGraphicsView::DontAdjustForAntialiasing - - - - - - 0 - 0 - 171 - 151 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - GPS Data Stream - - - - 0 + + + + 10 + 270 + 571 + 138 + + + + + 0 + 0 + + + + + 0 + 0 + + + + GPS Data Stream + + + + 0 + + + + + + 0 + 0 + - - - - 9 - - - 9 - - - - - Qt::Horizontal - - - QSizePolicy::Ignored - - - - 13 - 13 - - - - - - - - Connect - - - - - - - Disconnect - - - - - - - - - - 0 - 0 - - - - - Courier New - 8 - - - - Qt::ScrollBarAlwaysOn - - - QTextEdit::WidgetWidth - - - false - - - - - - - + + + Courier New + 8 + + + + Qt::ScrollBarAlwaysOn + + + QTextEdit::WidgetWidth + + + false + + + + + + + + + 200 + 170 + 191 + 95 + + + + + 0 + 0 + + + + + 191 + 95 + + + + + 191 + 95 + + + + false + + + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QGraphicsView::DontAdjustForAntialiasing + + + + + + 400 + 200 + 181 + 71 + + + + + + + 10 + 170 + 171 + 91 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 10 + 10 + 85 + 27 + + + + Connect + + + + + + 10 + 50 + 91 + 27 + + + + Disconnect + + + + + + + 10 + 10 + 381 + 151 + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 10 + 10 + 57 + 16 + + + + Coord: + + + + + + 60 + 10 + 81 + 16 + + + + Unknown + + + + + + 10 + 30 + 51 + 16 + + + + Speed: + + + + + + 60 + 30 + 71 + 16 + + + + Unknown + + + + + + 210 + 40 + 71 + 16 + + + + Heading: + + + + + + 280 + 40 + 91 + 16 + + + + Unknown + + + + + + 10 + 50 + 361 + 20 + + + + Qt::Horizontal + + + + + + 10 + 120 + 57 + 17 + + + + Fix Type: + + + + + + 80 + 120 + 101 + 17 + + + + Unknown + + + + + + 200 + 100 + 171 + 21 + + + + Unknown + + + + + + 80 + 100 + 101 + 17 + + + + Unknown + + + + + + 10 + 70 + 101 + 17 + + + + H / V / P DOP: + + + + + + 130 + 70 + 231 + 17 + + + + 0 / 0 / 0 + + + + + + 10 + 80 + 361 + 20 + + + + Qt::Horizontal + + + + + + 190 + 30 + 20 + 21 + + + + Qt::Vertical + + + + + + 180 + 100 + 20 + 41 + + + + Qt::Vertical + + + + + + 250 + 10 + 20 + 21 + + + + Qt::Vertical + + + + + + 140 + 10 + 20 + 21 + + + + Qt::Vertical + + + + + + 160 + 10 + 81 + 16 + + + + Unknown + + + + + + 280 + 10 + 81 + 16 + + + + Unknown + + + + + + 10 + 100 + 71 + 17 + + + + Sats Used: + + + + + + + 400 + 10 + 181 + 181 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 3 + 3 + 175 + 175 + + + + + dataStreamGroupBox + + flatEarth + graphicsView + frame + frame_2 + frame_3 + gpsSky diff --git a/ground/src/plugins/gpsdisplay/gpsparser.h b/ground/src/plugins/gpsdisplay/gpsparser.h index b1d931e26..a45d54732 100644 --- a/ground/src/plugins/gpsdisplay/gpsparser.h +++ b/ground/src/plugins/gpsdisplay/gpsparser.h @@ -51,6 +51,7 @@ signals: 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). + void dop(double, double, double); // HDOP, VDOP, PDOP }; diff --git a/ground/src/plugins/gpsdisplay/telemetryparser.cpp b/ground/src/plugins/gpsdisplay/telemetryparser.cpp index a4f11a15c..e08d2be52 100644 --- a/ground/src/plugins/gpsdisplay/telemetryparser.cpp +++ b/ground/src/plugins/gpsdisplay/telemetryparser.cpp @@ -84,6 +84,12 @@ void TelemetryParser::updateGPS( UAVObject* object1) { QString fix = object1->getField(QString("Status"))->getValue().toString(); emit fixtype(fix); + double hdop = object1->getField(QString("HDOP"))->getDouble(); + double vdop = object1->getField(QString("VDOP"))->getDouble(); + double pdop = object1->getField(QString("PDOP"))->getDouble(); + emit dop(hdop,vdop,pdop); + + } void TelemetryParser::updateTime( UAVObject* object1) {