1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

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
This commit is contained in:
edouard 2010-09-05 07:03:29 +00:00 committed by edouard
parent 2283e2e9ad
commit 1f78c63648
6 changed files with 519 additions and 334 deletions

View File

@ -107,6 +107,7 @@ void GpsDisplayGadget::loadConfiguration(IUAVGadgetConfiguration* config)
connect(parser, SIGNAL(packet(char*)), m_widget, SLOT(dumpPacket(char*))); 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(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(fixtype(QString)), m_widget, SLOT(setFixType(QString)));
connect(parser, SIGNAL(dop(double,double,double)), m_widget, SLOT(setDOP(double,double,double)));
} }
void GpsDisplayGadget::onConnect() { void GpsDisplayGadget::onConnect() {

View File

@ -72,19 +72,13 @@ void GpsDisplayWidget::setSpeedHeading(double speed, double heading)
void GpsDisplayWidget::setDateTime(double date, double time) void GpsDisplayWidget::setDateTime(double date, double time)
{ {
// QString dstring = QString::number(date,'g',10); QString dstring1 = QString::number(date,'g',10);
QString dstring; dstring1.insert(6,".");
dstring.sprintf("%06.0f",date); dstring1.insert(4,".");
dstring.insert(dstring.length()-2,"."); QString dstring2 = QString::number(time,'g',10);
dstring.insert(dstring.length()-5,"."); dstring2.insert(dstring2.length()-2,":");
gdate_value->setText(dstring); dstring2.insert(dstring2.length()-5,":");
gdate_value->adjustSize(); time_value->setText(dstring1 + " " + dstring2 + " GMT");
//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();
} }
@ -106,27 +100,39 @@ void GpsDisplayWidget::setSVs(int sv)
status_value->adjustSize(); 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) void GpsDisplayWidget::setPosition(double lat, double lon, double alt)
{ {
lat *= 1E-7;
lon *= 1E-7;
double deg = (lat>0) ? floor(lat):ceil(lat); double deg = (lat>0) ? floor(lat):ceil(lat);
double min = fabs(lat-deg)*60; double min = fabs(lat-deg)*60;
QString str; QString str1;
str.sprintf("%.0f%c%.3f'", deg,0x00b0, min); str1.sprintf("%.0f%c%.3f' ", deg,0x00b0, min);
if (lat>0) if (lat>0)
str.append("N"); str1.append("N");
else else
str.append("S"); str1.append("S");
lat_value->setText(str); coord_value->setText(str1);
lat_value->adjustSize();
deg = floor(fabs(lon)); // ABS takes an int. deg = floor(fabs(lon)); // ABS takes an int.
min = fabs(lon-deg)*60; 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) if (lon>0)
str.append("E"); str2.append("E");
else else
str.append("W"); str2.append("W");
long_value->setText(str); coord_value_2->setText(str2);
long_value->adjustSize(); QString str3;
str3.sprintf("%.2f m", alt);
coord_value_3->setText(str3);
// Now place the marker: // Now place the marker:
double wscale = flatEarth->sceneRect().width()/360; double wscale = flatEarth->sceneRect().width()/360;

View File

@ -53,6 +53,7 @@ private slots:
void setSpeedHeading(double, double); void setSpeedHeading(double, double);
void dumpPacket(char*); void dumpPacket(char*);
void setFixType(QString fixtype); void setFixType(QString fixtype);
void setDOP(double hdop, double vdop, double pdop);
private: private:
GpsConstellationWidget * gpsConstellation; GpsConstellationWidget * gpsConstellation;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>570</width> <width>592</width>
<height>319</height> <height>417</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -25,315 +25,485 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1"> <widget class="QGroupBox" name="dataStreamGroupBox">
<item> <property name="geometry">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0"> <rect>
<property name="leftMargin"> <x>10</x>
<number>0</number> <y>270</y>
</property> <width>571</width>
<item> <height>138</height>
<widget class="QGroupBox" name="statusGroupBox"> </rect>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <property name="sizePolicy">
<horstretch>0</horstretch> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<verstretch>0</verstretch> <horstretch>0</horstretch>
</sizepolicy> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="title"> </property>
<string>GPS Status</string> <property name="minimumSize">
</property> <size>
<layout class="QFormLayout" name="formLayout"> <width>0</width>
<property name="fieldGrowthPolicy"> <height>0</height>
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> </size>
</property> </property>
<property name="verticalSpacing"> <property name="title">
<number>1</number> <string>GPS Data Stream</string>
</property> </property>
<property name="margin"> <layout class="QVBoxLayout" name="verticalLayout_3" stretch="0">
<number>6</number> <property name="margin">
</property> <number>0</number>
<item row="0" column="0"> </property>
<widget class="QLabel" name="status_label"> <item>
<property name="text"> <widget class="QTextBrowser" name="textBrowser">
<string>Status:</string> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
</widget> <horstretch>0</horstretch>
</item> <verstretch>0</verstretch>
<item row="0" column="1"> </sizepolicy>
<widget class="QLabel" name="status_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lat_label">
<property name="text">
<string>Latitude:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lat_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="long_label">
<property name="text">
<string>Longitude:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="long_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="bear_label">
<property name="text">
<string>Bearing:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="bear_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="speed_label">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="speed_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="fix_label">
<property name="text">
<string>Fix Type:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="fix_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="gtime_label">
<property name="text">
<string>GPS Time:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLabel" name="gtime_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="gdate_label">
<property name="text">
<string>GPS Date:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="gdate_value">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="imagesWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>368</width>
<height>171</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>368</width>
<height>171</height>
</size>
</property>
<widget class="QGraphicsView" name="flatEarth">
<property name="geometry">
<rect>
<x>177</x>
<y>0</y>
<width>191</width>
<height>95</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>191</width>
<height>95</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>191</width>
<height>95</height>
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="toolTip">
<string extracomment="Location of GCS on the Earth"/>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="optimizationFlags">
<set>QGraphicsView::DontAdjustForAntialiasing</set>
</property>
</widget>
<widget class="GpsConstellationWidget" name="gpsSky">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>171</width>
<height>151</height>
</rect>
</property>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="dataStreamGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>GPS Data Stream</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="1,0">
<property name="margin">
<number>0</number>
</property> </property>
<item> <property name="font">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0,0"> <font>
<property name="leftMargin"> <family>Courier New</family>
<number>9</number> <pointsize>8</pointsize>
</property> </font>
<property name="rightMargin"> </property>
<number>9</number> <property name="verticalScrollBarPolicy">
</property> <enum>Qt::ScrollBarAlwaysOn</enum>
<item> </property>
<spacer name="horizontalSpacer"> <property name="lineWrapMode">
<property name="orientation"> <enum>QTextEdit::WidgetWidth</enum>
<enum>Qt::Horizontal</enum> </property>
</property> <property name="acceptRichText">
<property name="sizeType"> <bool>false</bool>
<enum>QSizePolicy::Ignored</enum> </property>
</property> </widget>
<property name="sizeHint" stdset="0"> </item>
<size> </layout>
<width>13</width> </widget>
<height>13</height> <widget class="QGraphicsView" name="flatEarth">
</size> <property name="geometry">
</property> <rect>
</spacer> <x>200</x>
</item> <y>170</y>
<item> <width>191</width>
<widget class="QPushButton" name="connectButton"> <height>95</height>
<property name="text"> </rect>
<string>Connect</string> </property>
</property> <property name="sizePolicy">
</widget> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</item> <horstretch>0</horstretch>
<item> <verstretch>0</verstretch>
<widget class="QPushButton" name="disconnectButton"> </sizepolicy>
<property name="text"> </property>
<string>Disconnect</string> <property name="minimumSize">
</property> <size>
</widget> <width>191</width>
</item> <height>95</height>
</layout> </size>
</item> </property>
<item> <property name="maximumSize">
<widget class="QTextBrowser" name="textBrowser"> <size>
<property name="sizePolicy"> <width>191</width>
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <height>95</height>
<horstretch>0</horstretch> </size>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="acceptDrops">
</property> <bool>false</bool>
<property name="font"> </property>
<font> <property name="toolTip">
<family>Courier New</family> <string extracomment="Location of GCS on the Earth"/>
<pointsize>8</pointsize> </property>
</font> <property name="verticalScrollBarPolicy">
</property> <enum>Qt::ScrollBarAlwaysOff</enum>
<property name="verticalScrollBarPolicy"> </property>
<enum>Qt::ScrollBarAlwaysOn</enum> <property name="horizontalScrollBarPolicy">
</property> <enum>Qt::ScrollBarAlwaysOff</enum>
<property name="lineWrapMode"> </property>
<enum>QTextEdit::WidgetWidth</enum> <property name="optimizationFlags">
</property> <set>QGraphicsView::DontAdjustForAntialiasing</set>
<property name="acceptRichText"> </property>
<bool>false</bool> </widget>
</property> <widget class="QGraphicsView" name="graphicsView">
</widget> <property name="geometry">
</item> <rect>
</layout> <x>400</x>
</widget> <y>200</y>
</item> <width>181</width>
</layout> <height>71</height>
</rect>
</property>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>10</x>
<y>170</y>
<width>171</width>
<height>91</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QPushButton" name="connectButton">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>85</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Connect</string>
</property>
</widget>
<widget class="QPushButton" name="disconnectButton">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>91</width>
<height>27</height>
</rect>
</property>
<property name="text">
<string>Disconnect</string>
</property>
</widget>
</widget>
<widget class="QFrame" name="frame_2">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>381</width>
<height>151</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="lat_label">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>57</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Coord:</string>
</property>
</widget>
<widget class="QLabel" name="coord_value">
<property name="geometry">
<rect>
<x>60</x>
<y>10</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="speed_label">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>51</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Speed:</string>
</property>
</widget>
<widget class="QLabel" name="speed_value">
<property name="geometry">
<rect>
<x>60</x>
<y>30</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="bear_label">
<property name="geometry">
<rect>
<x>210</x>
<y>40</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Heading:</string>
</property>
</widget>
<widget class="QLabel" name="bear_value">
<property name="geometry">
<rect>
<x>280</x>
<y>40</y>
<width>91</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>361</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="fix_label">
<property name="geometry">
<rect>
<x>10</x>
<y>120</y>
<width>57</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Fix Type:</string>
</property>
</widget>
<widget class="QLabel" name="fix_value">
<property name="geometry">
<rect>
<x>80</x>
<y>120</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="time_value">
<property name="geometry">
<rect>
<x>200</x>
<y>100</y>
<width>171</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="status_value">
<property name="geometry">
<rect>
<x>80</x>
<y>100</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>101</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>H / V / P DOP:</string>
</property>
</widget>
<widget class="QLabel" name="dop_value">
<property name="geometry">
<rect>
<x>130</x>
<y>70</y>
<width>231</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>0 / 0 / 0</string>
</property>
</widget>
<widget class="Line" name="line_2">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>361</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="Line" name="line_3">
<property name="geometry">
<rect>
<x>190</x>
<y>30</y>
<width>20</width>
<height>21</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="Line" name="line_5">
<property name="geometry">
<rect>
<x>180</x>
<y>100</y>
<width>20</width>
<height>41</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="Line" name="line_6">
<property name="geometry">
<rect>
<x>250</x>
<y>10</y>
<width>20</width>
<height>21</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="Line" name="line_7">
<property name="geometry">
<rect>
<x>140</x>
<y>10</y>
<width>20</width>
<height>21</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QLabel" name="coord_value_2">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="coord_value_3">
<property name="geometry">
<rect>
<x>280</x>
<y>10</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Unknown</string>
</property>
</widget>
<widget class="QLabel" name="fix_label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>100</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Sats Used:</string>
</property>
</widget>
</widget>
<widget class="QFrame" name="frame_3">
<property name="geometry">
<rect>
<x>400</x>
<y>10</y>
<width>181</width>
<height>181</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="GpsConstellationWidget" name="gpsSky">
<property name="geometry">
<rect>
<x>3</x>
<y>3</y>
<width>175</width>
<height>175</height>
</rect>
</property>
</widget>
</widget>
<zorder>dataStreamGroupBox</zorder>
<zorder></zorder>
<zorder>flatEarth</zorder>
<zorder>graphicsView</zorder>
<zorder>frame</zorder>
<zorder>frame_2</zorder>
<zorder>frame_3</zorder>
<zorder>gpsSky</zorder>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -51,6 +51,7 @@ signals:
void packet(char*); // Raw NMEA Packet (or just info) void packet(char*); // Raw NMEA Packet (or just info)
void satellite(int,int,int,int,int); // Index, PRN, Elevation, Azimuth, SNR void satellite(int,int,int,int,int); // Index, PRN, Elevation, Azimuth, SNR
void fixtype(QString); // Type of fix (none, 2D, 3D, etc). void fixtype(QString); // Type of fix (none, 2D, 3D, etc).
void dop(double, double, double); // HDOP, VDOP, PDOP
}; };

View File

@ -84,6 +84,12 @@ void TelemetryParser::updateGPS( UAVObject* object1) {
QString fix = object1->getField(QString("Status"))->getValue().toString(); QString fix = object1->getField(QString("Status"))->getValue().toString();
emit fixtype(fix); 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) { void TelemetryParser::updateTime( UAVObject* object1) {