1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +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(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() {

View File

@ -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;

View File

@ -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;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>570</width>
<height>319</height>
<width>592</width>
<height>417</height>
</rect>
</property>
<property name="sizePolicy">
@ -25,315 +25,485 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="statusGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>GPS Status</string>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<property name="verticalSpacing">
<number>1</number>
</property>
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="status_label">
<property name="text">
<string>Status:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<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>
<widget class="QGroupBox" name="dataStreamGroupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>270</y>
<width>571</width>
<height>138</height>
</rect>
</property>
<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="0">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0,0">
<property name="leftMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Ignored</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>13</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="connectButton">
<property name="text">
<string>Connect</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="disconnectButton">
<property name="text">
<string>Disconnect</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<family>Courier New</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::WidgetWidth</enum>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
<property name="font">
<font>
<family>Courier New</family>
<pointsize>8</pointsize>
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="lineWrapMode">
<enum>QTextEdit::WidgetWidth</enum>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGraphicsView" name="flatEarth">
<property name="geometry">
<rect>
<x>200</x>
<y>170</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="QGraphicsView" name="graphicsView">
<property name="geometry">
<rect>
<x>400</x>
<y>200</y>
<width>181</width>
<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>
<customwidgets>
<customwidget>

View File

@ -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
};

View File

@ -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) {