diff options
author | Johan Jansen <jnsn.johan@gmail.com> | 2015-04-07 17:15:17 +0200 |
---|---|---|
committer | Johan Jansen <jnsn.johan@gmail.com> | 2015-04-07 17:15:17 +0200 |
commit | a121f6101fb763ec61e5f447731ad0a155e2ac72 (patch) | |
tree | f1ca925813a3df605dc803180a26fdc7107dd162 /src/drivers/gps/ubx.cpp | |
parent | 1219ef8d43b5e05e334b22441b2bd3b222e76bc5 (diff) | |
download | px4-firmware-a121f6101fb763ec61e5f447731ad0a155e2ac72.tar.gz px4-firmware-a121f6101fb763ec61e5f447731ad0a155e2ac72.tar.bz2 px4-firmware-a121f6101fb763ec61e5f447731ad0a155e2ac72.zip |
UBlox: Only use fix and velocity if flags are valid
Diffstat (limited to 'src/drivers/gps/ubx.cpp')
-rw-r--r-- | src/drivers/gps/ubx.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/drivers/gps/ubx.cpp b/src/drivers/gps/ubx.cpp index f42c968d3..96b26b699 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,7 +743,6 @@ 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; |