Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_AdvancedFailsafe: option to continue the mission even after data link is recovered #23334

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ const AP_Param::GroupInfo AP_AdvancedFailsafe::var_info[] = {
// @User: Advanced
// @Units: km
AP_GROUPINFO("MAX_RANGE", 20, AP_AdvancedFailsafe, _max_range_km, 0),

// @Param: OPTIONS
// @DisplayName: AFS options
// @Description: See description for each bitmask bit description
// @Bitmask: 0: Continue the mission even after comms are recovered (does not go to the mission item at the time comms were lost)
AP_GROUPINFO("OPTIONS", 21, AP_AdvancedFailsafe, options, 0),

AP_GROUPEND
};
Expand Down Expand Up @@ -277,6 +283,11 @@ AP_AdvancedFailsafe::check(uint32_t last_valid_rc_ms)
} else if (gcs_link_ok) {
_state = STATE_AUTO;
gcs().send_text(MAV_SEVERITY_DEBUG, "AFS State: AFS_AUTO, GCS now OK");

if (option_is_set(Option::CONTINUE_AFTER_RECOVERED)) {
break;
}

// we only return to the mission if we have not exceeded AFS_MAX_COM_LOSS
if (_saved_wp != 0 &&
(_max_comms_loss <= 0 ||
Expand Down
8 changes: 8 additions & 0 deletions libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ class AP_AdvancedFailsafe

// update maximum range check
void max_range_update();

AP_Int16 options;
enum class Option {
CONTINUE_AFTER_RECOVERED = (1U<<0),
};
bool option_is_set(Option option) const {
return (options.get() & int16_t(option)) != 0;
}
};

namespace AP {
Expand Down