mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-28 11:00:38 +08:00
Commander: put action for low position estimation accuracy into parameter
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
1 parent
2ce390a780
commit
3093c593a5
5 files changed
+86
-12
No files matched your search
@@ -368,6 +368,49 @@ FailsafeBase::ActionOptions Failsafe::fromHighWindLimitActParam(int param_value)
|
||||
return options;
|
||||
}
|
||||
|
||||
FailsafeBase::ActionOptions Failsafe::fromPosLowActParam(int param_value)
|
||||
{
|
||||
ActionOptions options{};
|
||||
options.allow_user_takeover = UserTakeoverAllowed::AlwaysModeSwitchOnly; // ensure the user can escape again
|
||||
|
||||
switch (command_after_pos_low_failsafe(param_value)) {
|
||||
case command_after_pos_low_failsafe::None:
|
||||
options.action = Action::None;
|
||||
break;
|
||||
|
||||
case command_after_pos_low_failsafe::Warning:
|
||||
options.action = Action::Warn;
|
||||
break;
|
||||
|
||||
case command_after_pos_low_failsafe::Hold_mode:
|
||||
options.action = Action::Hold;
|
||||
options.clear_condition = ClearCondition::WhenConditionClears;
|
||||
break;
|
||||
|
||||
case command_after_pos_low_failsafe::Return_mode:
|
||||
options.action = Action::RTL;
|
||||
options.clear_condition = ClearCondition::WhenConditionClears;
|
||||
break;
|
||||
|
||||
case command_after_pos_low_failsafe::Terminate:
|
||||
options.allow_user_takeover = UserTakeoverAllowed::Never;
|
||||
options.action = Action::Terminate;
|
||||
options.clear_condition = ClearCondition::Never;
|
||||
break;
|
||||
|
||||
case command_after_pos_low_failsafe::Land_mode:
|
||||
options.action = Action::Land;
|
||||
options.clear_condition = ClearCondition::WhenConditionClears;
|
||||
break;
|
||||
|
||||
default:
|
||||
options.action = Action::Warn;
|
||||
break;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
FailsafeBase::ActionOptions Failsafe::fromRemainingFlightTimeLowActParam(int param_value)
|
||||
{
|
||||
ActionOptions options{};
|
||||
@@ -469,10 +512,10 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
|
||||
ActionOptions(fromHighWindLimitActParam(_param_com_wind_max_act.get()).cannotBeDeferred()));
|
||||
CHECK_FAILSAFE(status_flags, flight_time_limit_exceeded, ActionOptions(Action::RTL).cannotBeDeferred());
|
||||
|
||||
// trigger RTL if low position accurancy is detected
|
||||
// trigger Low Position Accuracy Failsafe (only in auto mission and auto loiter)
|
||||
if (state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION ||
|
||||
state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_LOITER) {
|
||||
CHECK_FAILSAFE(status_flags, local_position_accuracy_low, ActionOptions(Action::RTL));
|
||||
CHECK_FAILSAFE(status_flags, local_position_accuracy_low, fromPosLowActParam(_param_com_pos_low_act.get()));
|
||||
}
|
||||
|
||||
if (state.user_intended_mode == vehicle_status_s::NAVIGATION_STATE_AUTO_TAKEOFF ||
|
||||
|
||||
Reference in new issue
Block a user