Skip to content
Permalink
Browse files

NMEA calculate 3D RMS

  • Loading branch information
m-kuhn authored and nyalldawson committed Jan 11, 2021
1 parent 77c59ef commit e0ad337a2f75fc04994bcadf18bc2489cb43ad90
@@ -82,6 +82,8 @@ Encapsulates information relating to a GPS position fix.
//! Vertical accuracy in meters
double vacc;

double hvacc;

QDateTime utcDateTime;

QChar fixMode;
@@ -960,6 +960,16 @@ void QgsGpsInformationWidget::displayGPSInformation( const QgsGpsInformation &in
mTxtVacc->setEnabled( false );
mTxtVacc->setText( tr( "Not available" ) );
}
if ( std::isfinite( info.hvacc ) )
{
mTxt3Dacc->setEnabled( true );
mTxt3Dacc->setText( tr( "%1 m" ).arg( QLocale().toString( info.hvacc, 'f', 3 ) ) );
}
else
{
mTxt3Dacc->setEnabled( false );
mTxt3Dacc->setText( tr( "Not available" ) );
}
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.qualityDescription() );
@@ -172,11 +172,23 @@ class CORE_EXPORT QgsGpsInformation
double hacc = std::numeric_limits< double >::quiet_NaN();
//! Vertical accuracy in meters
double vacc = std::numeric_limits< double >::quiet_NaN();

/**
* 3D RMS
* \since QGIS 3.18
*/
double hvacc = std::numeric_limits< double >::quiet_NaN();
#else
//! Horizontal accuracy in meters
double hacc;
//! Vertical accuracy in meters
double vacc;

/**
* 3D RMS
* \since QGIS 3.18
*/
double hvacc;
#endif

/**
@@ -207,6 +207,8 @@ void QgsNmeaConnection::processGstSentence( const char *data, int len )
mLastGPSInformation.hacc = sqrt( ( pow( sig_lat, 2 ) + pow( sig_lon, 2 ) ) / 2.0 );
// Vertical RMS
mLastGPSInformation.vacc = sig_alt;
// 3D RMS
mLastGPSInformation.hvacc = sqrt( ( pow( sig_lat, 2 ) + pow( sig_lon, 2 ) + pow( sig_alt, 2 ) ) / 3.0 );
}
}

0 comments on commit e0ad337

Please sign in to comment.
You can’t perform that action at this time.