Skip to content

Commit

Permalink
More detail on GGA quality indicator (#38234)
Browse files Browse the repository at this point in the history
- UPDATE mTxtAltitude, mTxtHacc and mTxtVacc because GNSS receivers can output higher accuracy! (RTK)

According to https://www.gpsinformation.org/dale/nmea.htm#GGA I suggest an update to the quality information for the GGA sentence.
Since RTK solutions become more and more standard the info.quality "Fix RTK" is a very important information!
  • Loading branch information
jiargei committed Sep 1, 2020
1 parent 9f83b41 commit 4ca7cd3
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 7 deletions.
2 changes: 1 addition & 1 deletion external/nmea/info.h
Expand Up @@ -115,7 +115,7 @@ typedef struct _nmeaINFO
double speed; //!< Speed over the ground in kilometers/hour
double direction; //!< Track angle in degrees True
double declination; //!< Magnetic variation degrees (Easterly var. subtracts from true course)
double rms_pr; //!< RMS value of the pseudorange residuals;
double rms_pr; //!< RMS value of the pseudorange residuals; includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processing
double err_major; //!< Error ellipse semi-major axis 1 sigma error, in meters
double err_minor; //!< Error ellipse semi-minor axis 1 sigma error, in meters
double err_ori; //!< Error ellipse orientation, degrees from true north
Expand Down
2 changes: 1 addition & 1 deletion external/nmea/sentence.h
Expand Up @@ -64,7 +64,7 @@ typedef struct _nmeaGPGGA
typedef struct _nmeaGPGST
{
nmeaTIME utc; //!< UTC of position fix
double rms_pr; //!< RMS value of the pseudorange residuals;
double rms_pr; //!< RMS value of the pseudorange residuals; Includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processing
double err_major; //!< Error ellipse semi-major axis 1 sigma error, in meters
double err_minor; //!< Error ellipse semi-minor axis 1 sigma error, in meters
double err_ori; //!< Error ellipse orientation, degrees from true north
Expand Down
7 changes: 7 additions & 0 deletions python/core/auto_generated/gps/qgsgpsconnection.sip.in
Expand Up @@ -110,6 +110,13 @@ Returns whether the connection information is valid
Returns the fix status

.. versionadded:: 3.10
%End

QString qualityDescription() const;
%Docstring
Returns a descriptive string for the signal quality.

.. versionadded:: 3.16
%End
};

Expand Down
9 changes: 5 additions & 4 deletions src/app/gps/qgsgpsinformationwidget.cpp
Expand Up @@ -904,7 +904,8 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
{
mTxtLatitude->setText( QString::number( info.latitude, 'f', 8 ) );
mTxtLongitude->setText( QString::number( info.longitude, 'f', 8 ) );
mTxtAltitude->setText( tr( "%1 m" ).arg( info.elevation, 0, 'f', 1 ) ); // don't know of any GPS receivers that output better than 0.1 m precision
mTxtAltitude->setText( tr( "%1 m" ).arg( info.elevation, 0, 'f', 3 ) );

if ( mDateTimeFormat.isEmpty() )
{
mTxtDateTime->setText( info.utcDateTime.toString( Qt::TextDate ) ); // default format
Expand Down Expand Up @@ -939,7 +940,7 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
if ( std::isfinite( info.hacc ) )
{
mTxtHacc->setEnabled( true );
mTxtHacc->setText( tr( "%1 m" ).arg( QLocale().toString( info.hacc, 'f', 2 ) ) );
mTxtHacc->setText( tr( "%1 m" ).arg( QLocale().toString( info.hacc, 'f', 3 ) ) );
}
else
{
Expand All @@ -949,7 +950,7 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
if ( std::isfinite( info.vacc ) )
{
mTxtVacc->setEnabled( true );
mTxtVacc->setText( tr( "%1 m" ).arg( QLocale().toString( info.vacc, 'f', 2 ) ) );
mTxtVacc->setText( tr( "%1 m" ).arg( QLocale().toString( info.vacc, 'f', 3 ) ) );
}
else
{
Expand All @@ -958,7 +959,7 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
}
mTxtFixMode->setText( info.fixMode == 'A' ? tr( "Automatic" ) : info.fixMode == 'M' ? tr( "Manual" ) : QString() ); // A=automatic 2d/3d, M=manual; allowing for anything else
mTxtFixType->setText( info.fixType == 3 ? tr( "3D" ) : info.fixType == 2 ? tr( "2D" ) : info.fixType == 1 ? tr( "No fix" ) : QString::number( info.fixType ) ); // 1=no fix, 2=2D, 3=3D; allowing for anything else
mTxtQuality->setText( info.quality == 2 ? tr( "Differential" ) : info.quality == 1 ? tr( "Non-differential" ) : info.quality == 0 ? tr( "No position" ) : info.quality > 2 ? QString::number( info.quality ) : QString() ); // allowing for anything else
mTxtQuality->setText( info.qualityDescription() );
mTxtSatellitesUsed->setText( QString::number( info.satellitesUsed ) );
mTxtStatus->setText( info.status == 'A' ? tr( "Valid" ) : info.status == 'V' ? tr( "Invalid" ) : QString() );
} //position
Expand Down
35 changes: 35 additions & 0 deletions src/core/gps/qgsgpsconnection.cpp
Expand Up @@ -67,6 +67,41 @@ QgsGpsInformation::FixStatus QgsGpsInformation::fixStatus() const
return fixStatus;
}

QString QgsGpsInformation::qualityDescription() const
{
switch ( quality )
{
case 8:
return QCoreApplication::translate( "QgsGpsInformation", "Simulation mode" );

case 7:
return QCoreApplication::translate( "QgsGpsInformation", "Manual input mode" );

case 6:
return QCoreApplication::translate( "QgsGpsInformation", "Estimated" );

case 5:
return QCoreApplication::translate( "QgsGpsInformation", "Float RTK" );

case 4:
return QCoreApplication::translate( "QgsGpsInformation", "Fixed RTK" );

case 3:
return QCoreApplication::translate( "QgsGpsInformation", "PPS" );

case 2:
return QCoreApplication::translate( "QgsGpsInformation", "DGPS" );

case 1:
return QCoreApplication::translate( "QgsGpsInformation", "Autonomous" );

case 0:
return QCoreApplication::translate( "QgsGpsInformation", "Invalid" );

default:
return QCoreApplication::translate( "QgsGpsInformation", "Unknown (%1)" ).arg( QString::number( quality ) );
}
}

QgsGpsConnection::QgsGpsConnection( QIODevice *dev )
: QObject( nullptr )
Expand Down
7 changes: 7 additions & 0 deletions src/core/gps/qgsgpsconnection.h
Expand Up @@ -230,6 +230,13 @@ class CORE_EXPORT QgsGpsInformation
* \since QGIS 3.10
*/
FixStatus fixStatus() const;

/**
* Returns a descriptive string for the signal quality.
*
* \since QGIS 3.16
*/
QString qualityDescription() const;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/ui/qgsgpsinformationwidgetbase.ui
Expand Up @@ -470,7 +470,7 @@ gray = no data
<item row="17" column="1">
<widget class="QLineEdit" name="mTxtQuality">
<property name="toolTip">
<string>quality of the position fix: Differential, Non-differential or No position</string>
<string>Positioning quality indicator (NMEA GGA or comparable sentence)</string>
</property>
<property name="readOnly">
<bool>true</bool>
Expand Down

0 comments on commit 4ca7cd3

Please sign in to comment.