GPS driver: Populate HDOP / VDOP fields

This commit is contained in:
Lorenz Meier 2016-02-24 11:29:37 +01:00
parent 9b5c9b0c8a
commit 56c95dc9c8
3 changed files with 11 additions and 1 deletions

View File

@ -269,7 +269,7 @@ int ASHTECH::handle_message(int len)
double ashtech_time __attribute__((unused)) = 0.0, lat = 0.0, lon = 0.0, alt = 0.0;
int num_of_sv __attribute__((unused)) = 0, fix_quality = 0;
double track_true = 0.0, ground_speed = 0.0 , age_of_corr __attribute__((unused)) = 0.0;
double hdop __attribute__((unused)) = 99.9, vdop __attribute__((unused)) = 99.9, pdop __attribute__((unused)) = 99.9,
double hdop = 99.9, vdop = 99.9, pdop __attribute__((unused)) = 99.9,
tdop __attribute__((unused)) = 99.9, vertic_vel = 0.0;
char ns = '?', ew = '?';
@ -338,6 +338,8 @@ int ASHTECH::handle_message(int len)
_gps_position->lat = static_cast<int>((int(lat * 0.01) + (lat * 0.01 - int(lat * 0.01)) * 100.0 / 60.0) * 10000000);
_gps_position->lon = static_cast<int>((int(lon * 0.01) + (lon * 0.01 - int(lon * 0.01)) * 100.0 / 60.0) * 10000000);
_gps_position->alt = static_cast<int>(alt * 1000);
_gps_position->hdop = (float)hdop / 100.0f;
_gps_position->vdop = (float)vdop / 100.0f;
_rate_count_lat_lon++;
if (coordinatesFound < 3) {

View File

@ -261,6 +261,8 @@ MTK::handle_message(gps_mtk_packet_t &packet)
_gps_position->fix_type = packet.fix_type;
_gps_position->eph = packet.hdop / 100.0f; // from cm to m
_gps_position->epv = _gps_position->eph; // unknown in mtk custom mode, so we cheat with eph
_gps_position->hdop = packet.hdop / 100.0f;
_gps_position->vdop = _gps_position->hdop;
_gps_position->vel_m_s = ((float)packet.ground_speed) / 100.0f; // from cm/s to m/s
_gps_position->cog_rad = ((float)packet.heading) * M_DEG_TO_RAD_F * 1e-2f; //from deg *100 to rad
_gps_position->satellites_used = packet.satellites;

View File

@ -808,6 +808,9 @@ UBX::payload_rx_done(void)
_gps_position->epv = (float)_buf.payload_rx_nav_pvt.vAcc * 1e-3f;
_gps_position->s_variance_m_s = (float)_buf.payload_rx_nav_pvt.sAcc * 1e-3f;
_gps_position->hdop = (float)_buf.payload_rx_nav_pvt.pDOP * 0.01f;
_gps_position->vdop = _gps_position->hdop;
_gps_position->vel_m_s = (float)_buf.payload_rx_nav_pvt.gSpeed * 1e-3f;
_gps_position->vel_n_m_s = (float)_buf.payload_rx_nav_pvt.velN * 1e-3f;
@ -891,6 +894,9 @@ UBX::payload_rx_done(void)
_gps_position->s_variance_m_s = (float)_buf.payload_rx_nav_sol.sAcc * 1e-2f; // from cm to m
_gps_position->satellites_used = _buf.payload_rx_nav_sol.numSV;
_gps_position->hdop = (float)_buf.payload_rx_nav_sol.pDOP * 0.01f;
_gps_position->vdop = _gps_position->hdop;
_gps_position->timestamp_variance = hrt_absolute_time();
ret = 1;