mirror of https://github.com/ArduPilot/ardupilot
Plane: slow down home update
Moved the code theat updates the home position while the aircraft is unarmed from 10hz loop to one second loop and ensured that is does not update more then once every 5 seconds. Closes issue 4311.
This commit is contained in:
parent
54c1efe5e1
commit
38581669ec
|
@ -337,6 +337,18 @@ void Plane::one_second_loop()
|
|||
#endif
|
||||
|
||||
ins.set_raw_logging(should_log(MASK_LOG_IMU_RAW));
|
||||
|
||||
// update home position if soft armed and gps position has
|
||||
// changed. Update every 5s at most
|
||||
if (!hal.util->get_soft_armed() &&
|
||||
gps.last_message_time_ms() - last_home_update_ms > 5000 &&
|
||||
gps.status() >= AP_GPS::GPS_OK_FIX_3D) {
|
||||
last_home_update_ms = gps.last_message_time_ms();
|
||||
update_home();
|
||||
|
||||
// reset the landing altitude correction
|
||||
auto_state.land_alt_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Plane::log_perf_info()
|
||||
|
@ -481,13 +493,6 @@ void Plane::update_GPS_10Hz(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (!hal.util->get_soft_armed()) {
|
||||
update_home();
|
||||
|
||||
// reset the landing altitude correction
|
||||
auto_state.land_alt_offset = 0;
|
||||
}
|
||||
|
||||
// update wind estimate
|
||||
ahrs.estimate_wind();
|
||||
} else if (gps.status() < AP_GPS::GPS_OK_FIX_3D && ground_start_count != 0) {
|
||||
|
|
|
@ -778,6 +778,9 @@ private:
|
|||
uint32_t last_trim_check;
|
||||
uint32_t last_trim_save;
|
||||
} auto_trim;
|
||||
|
||||
// last time home was updated while disarmed
|
||||
uint32_t last_home_update_ms;
|
||||
|
||||
// Camera/Antenna mount tracking and stabilisation stuff
|
||||
#if MOUNT == ENABLED
|
||||
|
|
Loading…
Reference in New Issue