forked from Archive/PX4-Autopilot
Minor polishing, fixed rate and last measurement indication
This commit is contained in:
parent
d4bd7225ba
commit
cb0fd834ae
|
@ -430,7 +430,7 @@ GPS::task_main()
|
|||
|
||||
/* measure update rate every 5 seconds */
|
||||
if (hrt_absolute_time() - last_rate_measurement > 5000000) {
|
||||
_rate = last_rate_count / (float)((hrt_absolute_time() - last_rate_measurement)) / 1000000.0f;
|
||||
_rate = last_rate_count / ((float)((hrt_absolute_time() - last_rate_measurement)) / 1000000.0f);
|
||||
last_rate_measurement = hrt_absolute_time();
|
||||
last_rate_count = 0;
|
||||
}
|
||||
|
@ -523,8 +523,8 @@ GPS::print_info()
|
|||
}
|
||||
warnx("baudrate: %d, status: %s", _baudrate, (_config_needed) ? "NOT OK" : "OK");
|
||||
if (_report.timestamp != 0) {
|
||||
warnx("position lock: %dD, last update %d seconds ago", (int)_report.fix_type,
|
||||
int((hrt_absolute_time() - _report.timestamp) / 1000000));
|
||||
warnx("position lock: %dD, last update %4.2f seconds ago", (int)_report.fix_type,
|
||||
((float)(hrt_absolute_time() - _report.timestamp) / 1000000.0f));
|
||||
warnx("lat: %d, lon: %d, alt: %d", _report.lat, _report.lon, _report.alt);
|
||||
warnx("update rate: %6.2f Hz", (double)_rate);
|
||||
}
|
||||
|
|
|
@ -429,7 +429,6 @@ UBX::parse(uint8_t b, struct vehicle_gps_position_s* gps_position)
|
|||
|
||||
gps_position->fix_type = packet->gpsFix;
|
||||
|
||||
gps_position->timestamp = hrt_absolute_time();
|
||||
gps_position->counter++;
|
||||
gps_position->s_variance = packet->sAcc;
|
||||
gps_position->p_variance = packet->pAcc;
|
||||
|
@ -457,7 +456,6 @@ UBX::parse(uint8_t b, struct vehicle_gps_position_s* gps_position)
|
|||
gps_position->eph = packet->hDOP;
|
||||
gps_position->epv = packet->vDOP;
|
||||
|
||||
gps_position->timestamp = hrt_absolute_time();
|
||||
gps_position->counter++;
|
||||
|
||||
_new_nav_dop = true;
|
||||
|
@ -493,7 +491,6 @@ UBX::parse(uint8_t b, struct vehicle_gps_position_s* gps_position)
|
|||
gps_position->time_gps_usec = (uint64_t)epoch * 1000000; //TODO: test this
|
||||
gps_position->time_gps_usec += (uint64_t)(packet->time_nanoseconds * 1e-3f);
|
||||
|
||||
gps_position->timestamp = hrt_absolute_time();
|
||||
gps_position->counter++;
|
||||
|
||||
_new_nav_timeutc = true;
|
||||
|
@ -587,7 +584,6 @@ UBX::parse(uint8_t b, struct vehicle_gps_position_s* gps_position)
|
|||
}
|
||||
|
||||
gps_position->satellites_visible = satellites_used++; // visible ~= used but we are interested in the used ones
|
||||
gps_position->timestamp = hrt_absolute_time();
|
||||
gps_position->counter++;
|
||||
|
||||
// as this message arrives only with 1Hz and is not essential, we don't take it into account for the report
|
||||
|
@ -617,7 +613,6 @@ UBX::parse(uint8_t b, struct vehicle_gps_position_s* gps_position)
|
|||
gps_position->vel_ned_valid = true;
|
||||
gps_position->cog = (uint16_t)((float)(packet->heading) * 1e-3f);
|
||||
|
||||
gps_position->timestamp = hrt_absolute_time();
|
||||
gps_position->counter++;
|
||||
|
||||
|
||||
|
@ -645,7 +640,6 @@ UBX::parse(uint8_t b, struct vehicle_gps_position_s* gps_position)
|
|||
// if (_rx_ck_a == _rx_buffer[_rx_count - 1] && _rx_ck_b == _rx_buffer[_rx_count]) {
|
||||
//
|
||||
// gps_position->satellites_visible = packet->numVis;
|
||||
// gps_position->timestamp = hrt_absolute_time();
|
||||
// gps_position->counter++;
|
||||
// _last_message_timestamps[RXM_SVSI - 1] = hrt_absolute_time();
|
||||
// ret = 1;
|
||||
|
|
|
@ -698,7 +698,7 @@ uorb_receive_start(void)
|
|||
|
||||
/* --- GPS VALUE --- */
|
||||
mavlink_subs.gps_sub = orb_subscribe(ORB_ID(vehicle_gps_position));
|
||||
orb_set_interval(mavlink_subs.gps_sub, 1000); /* 1Hz updates */
|
||||
orb_set_interval(mavlink_subs.gps_sub, 200); /* 5Hz updates */
|
||||
|
||||
/* --- HOME POSITION --- */
|
||||
mavlink_subs.home_sub = orb_subscribe(ORB_ID(home_position));
|
||||
|
|
Loading…
Reference in New Issue