diff options
author | Lorenz Meier <lorenz@px4.io> | 2015-04-11 00:58:57 +0200 |
---|---|---|
committer | Lorenz Meier <lorenz@px4.io> | 2015-04-11 00:58:57 +0200 |
commit | e659bbb777da77c124378f419a444fd0febe9bae (patch) | |
tree | d1fc531bd0f462a7b41bed70cbf6c7e49a8bf325 /src | |
parent | 2d985dbed315ad621f5c586adca47a4c6f19d016 (diff) | |
parent | 051b7b853e48aecc596dbaadc92c2eec2b8192df (diff) | |
download | px4-firmware-e659bbb777da77c124378f419a444fd0febe9bae.tar.gz px4-firmware-e659bbb777da77c124378f419a444fd0febe9bae.tar.bz2 px4-firmware-e659bbb777da77c124378f419a444fd0febe9bae.zip |
Merge pull request #1992 from Zefz/gps-improvements
UBlox GNSS driver improvements
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/gps/ubx.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/drivers/gps/ubx.cpp b/src/drivers/gps/ubx.cpp index f42c968d3..064ce20e5 100644 --- a/src/drivers/gps/ubx.cpp +++ b/src/drivers/gps/ubx.cpp @@ -716,7 +716,18 @@ UBX::payload_rx_done(void) case UBX_MSG_NAV_PVT: UBX_TRACE_RXMSG("Rx NAV-PVT\n"); - _gps_position->fix_type = _buf.payload_rx_nav_pvt.fixType; + //Check if position fix flag is good + if ((_buf.payload_rx_nav_pvt.flags & UBX_RX_NAV_PVT_FLAGS_GNSSFIXOK) == 1) + { + _gps_position->fix_type = _buf.payload_rx_nav_pvt.fixType; + _gps_position->vel_ned_valid = true; + } + else + { + _gps_position->fix_type = 0; + _gps_position->vel_ned_valid = false; + } + _gps_position->satellites_used = _buf.payload_rx_nav_pvt.numSV; _gps_position->lat = _buf.payload_rx_nav_pvt.lat; @@ -732,11 +743,14 @@ UBX::payload_rx_done(void) _gps_position->vel_n_m_s = (float)_buf.payload_rx_nav_pvt.velN * 1e-3f; _gps_position->vel_e_m_s = (float)_buf.payload_rx_nav_pvt.velE * 1e-3f; _gps_position->vel_d_m_s = (float)_buf.payload_rx_nav_pvt.velD * 1e-3f; - _gps_position->vel_ned_valid = true; _gps_position->cog_rad = (float)_buf.payload_rx_nav_pvt.headMot * M_DEG_TO_RAD_F * 1e-5f; _gps_position->c_variance_rad = (float)_buf.payload_rx_nav_pvt.headAcc * M_DEG_TO_RAD_F * 1e-5f; + //Check if time and date fix flags are good + if( (_buf.payload_rx_nav_pvt.valid & UBX_RX_NAV_PVT_VALID_VALIDDATE) + && (_buf.payload_rx_nav_pvt.valid & UBX_RX_NAV_PVT_VALID_VALIDTIME) + && (_buf.payload_rx_nav_pvt.valid & UBX_RX_NAV_PVT_VALID_FULLYRESOLVED)) { /* convert to unix timestamp */ struct tm timeinfo; @@ -813,6 +827,7 @@ UBX::payload_rx_done(void) case UBX_MSG_NAV_TIMEUTC: UBX_TRACE_RXMSG("Rx NAV-TIMEUTC\n"); + if(_buf.payload_rx_nav_timeutc.valid & UBX_RX_NAV_TIMEUTC_VALID_VALIDUTC) { // convert to unix timestamp struct tm timeinfo; |