Browse Source

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.
mission-4.1.18
Ferrin Benjamin Katz 8 years ago committed by Andrew Tridgell
parent
commit
38581669ec
  1. 19
      ArduPlane/ArduPlane.cpp
  2. 3
      ArduPlane/Plane.h

19
ArduPlane/ArduPlane.cpp

@ -337,6 +337,18 @@ void Plane::one_second_loop() @@ -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) @@ -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) {

3
ArduPlane/Plane.h

@ -778,6 +778,9 @@ private: @@ -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…
Cancel
Save