Skip to content

Commit

Permalink
wip..add entry checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Nov 27, 2024
1 parent 6f02b50 commit 5c98d37
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ArduPlane/mode_autoland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,22 @@ ModeAutoLand::ModeAutoLand() :

bool ModeAutoLand::_enter()
{
//is flying check here and DO_LAND_START check here
//must be flying to enter
if (!plane.is_flying()) {
return false;
}

//if do_land_start exists, jump to it
if( (plane.mission.contains_item(MAV_CMD_DO_LAND_START)) && (plane.arming.is_armed())) {
if (plane.have_position && plane.mission.jump_to_landing_sequence(plane.current_loc)) {
// switch to AUTO
plane.mission.set_force_resume(true);
if (plane.set_mode(plane.mode_auto, ModeReason::FIXED_WING_AUTOLAND)) {
return true;
}
}
}

plane.prev_WP_loc = plane.current_loc;
const Location &home = ahrs.get_home();
plane.set_target_altitude_current();
Expand Down
1 change: 1 addition & 0 deletions libraries/AP_Vehicle/ModeReason.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,5 @@ enum class ModeReason : uint8_t {
MODE_TAKEOFF_FAILSAFE = 51,
DDS_COMMAND = 52,
AUX_FUNCTION = 53,
FIXED_WING_AUTOLAND = 54,
};

0 comments on commit 5c98d37

Please sign in to comment.