From a7f7b37c8071987f5199025a9cc0085447bfea59 Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Sun, 22 Dec 2024 13:39:44 -0600 Subject: [PATCH] AP_Landing: add AutoLand fixed-wing mode --- libraries/AP_Landing/AP_Landing.cpp | 12 ++++++++++++ libraries/AP_Landing/AP_Landing.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/libraries/AP_Landing/AP_Landing.cpp b/libraries/AP_Landing/AP_Landing.cpp index 16cb32630e..ac080c52db 100644 --- a/libraries/AP_Landing/AP_Landing.cpp +++ b/libraries/AP_Landing/AP_Landing.cpp @@ -463,6 +463,18 @@ void AP_Landing::setup_landing_glide_slope(const Location &prev_WP_loc, const Lo } } +/* + reset landing state + */ +void AP_Landing::reset(void) +{ + initial_slope = 0; + slope = 0; + type_slope_flags.post_stats = false; + type_slope_flags.has_aborted_due_to_slope_recalc = false; + type_slope_stage = SlopeStage::NORMAL; +} + /* Restart a landing by first checking for a DO_LAND_START and jump there. Otherwise decrement waypoint so we would re-start diff --git a/libraries/AP_Landing/AP_Landing.h b/libraries/AP_Landing/AP_Landing.h index 80349010bc..bd85696c96 100644 --- a/libraries/AP_Landing/AP_Landing.h +++ b/libraries/AP_Landing/AP_Landing.h @@ -66,6 +66,8 @@ public: void convert_parameters(void); + void reset(void); + void do_land(const AP_Mission::Mission_Command& cmd, const float relative_altitude); bool verify_abort_landing(const Location &prev_WP_loc, Location &next_WP_loc, const Location ¤t_loc, const int32_t auto_state_takeoff_altitude_rel_cm, bool &throttle_suppressed);