mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 02:18:29 -04:00
Plane: prevent calling jump_to_landing_sequence() too often
This commit is contained in:
parent
8d329f6b5a
commit
f87da51b37
@ -546,6 +546,9 @@ static struct {
|
|||||||
// in FBWA taildragger takeoff mode
|
// in FBWA taildragger takeoff mode
|
||||||
bool fbwa_tdrag_takeoff_mode:1;
|
bool fbwa_tdrag_takeoff_mode:1;
|
||||||
|
|
||||||
|
// have we checked for an auto-land?
|
||||||
|
bool checked_for_autoland:1;
|
||||||
|
|
||||||
// Altitude threshold to complete a takeoff command in autonomous modes. Centimeters
|
// Altitude threshold to complete a takeoff command in autonomous modes. Centimeters
|
||||||
int32_t takeoff_altitude_cm;
|
int32_t takeoff_altitude_cm;
|
||||||
|
|
||||||
@ -574,6 +577,7 @@ static struct {
|
|||||||
next_wp_no_crosstrack : true,
|
next_wp_no_crosstrack : true,
|
||||||
no_crosstrack : true,
|
no_crosstrack : true,
|
||||||
fbwa_tdrag_takeoff_mode : false,
|
fbwa_tdrag_takeoff_mode : false,
|
||||||
|
checked_for_autoland : false,
|
||||||
takeoff_altitude_cm : 0,
|
takeoff_altitude_cm : 0,
|
||||||
takeoff_pitch_cd : 0,
|
takeoff_pitch_cd : 0,
|
||||||
highest_airspeed : 0,
|
highest_airspeed : 0,
|
||||||
@ -1421,12 +1425,18 @@ static void update_navigation()
|
|||||||
|
|
||||||
case RTL:
|
case RTL:
|
||||||
if (g.rtl_autoland &&
|
if (g.rtl_autoland &&
|
||||||
|
!auto_state.checked_for_autoland &&
|
||||||
nav_controller->reached_loiter_target() &&
|
nav_controller->reached_loiter_target() &&
|
||||||
labs(altitude_error_cm) < 1000) {
|
labs(altitude_error_cm) < 1000) {
|
||||||
if (mission.jump_to_landing_sequence()) {
|
// we've reached the RTL point, see if we have a landing sequence
|
||||||
gcs_send_text_P(PSTR("Starting auto landing"));
|
if (!auto_state.checked_for_autoland &&
|
||||||
|
mission.jump_to_landing_sequence()) {
|
||||||
|
gcs_send_text_P(SEVERITY_LOW, PSTR("Starting auto landing"));
|
||||||
set_mode(AUTO);
|
set_mode(AUTO);
|
||||||
}
|
}
|
||||||
|
// prevent running the expensive jump_to_landing_sequence
|
||||||
|
// on every loop
|
||||||
|
auto_state.checked_for_autoland = true;
|
||||||
}
|
}
|
||||||
// fall through to LOITER
|
// fall through to LOITER
|
||||||
|
|
||||||
|
@ -297,6 +297,9 @@ static void set_mode(enum FlightMode mode)
|
|||||||
// don't cross-track when starting a mission
|
// don't cross-track when starting a mission
|
||||||
auto_state.next_wp_no_crosstrack = true;
|
auto_state.next_wp_no_crosstrack = true;
|
||||||
|
|
||||||
|
// reset landing check
|
||||||
|
auto_state.checked_for_autoland = false;
|
||||||
|
|
||||||
// zero locked course
|
// zero locked course
|
||||||
steer_state.locked_course_err = 0;
|
steer_state.locked_course_err = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user