Commander: windCheck: add COM_WIND_MAX_ACT param to set high wind failsafe action (#21373)

Has options *None where the check is disabled, and *Warning, where only a warning is
published (which replaces the high wind warning from the COM_WIND_WARN limit).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2023-11-06 11:58:21 +01:00
committed by GitHub
parent a29b07fa73
commit 54d26e084a
5 changed files with 98 additions and 16 deletions
+43 -2
View File
@@ -323,6 +323,48 @@ FailsafeBase::Action Failsafe::fromOffboardLossActParam(int param_value, uint8_t
return action;
}
FailsafeBase::ActionOptions Failsafe::fromHighWindLimitActParam(int param_value)
{
ActionOptions options{};
switch (command_after_high_wind_failsafe(param_value)) {
case command_after_high_wind_failsafe::None:
options.action = Action::None;
break;
case command_after_high_wind_failsafe::Warning:
options.action = Action::Warn;
break;
case command_after_high_wind_failsafe::Hold_mode:
options.allow_user_takeover = UserTakeoverAllowed::AlwaysModeSwitchOnly; // ensure the user can escape again
options.action = Action::Hold;
options.clear_condition = ClearCondition::OnModeChangeOrDisarm;
break;
case command_after_high_wind_failsafe::Return_mode:
options.action = Action::RTL;
options.clear_condition = ClearCondition::OnModeChangeOrDisarm;
break;
case command_after_high_wind_failsafe::Terminate:
options.allow_user_takeover = UserTakeoverAllowed::Never;
options.action = Action::Terminate;
options.clear_condition = ClearCondition::Never;
break;
case command_after_high_wind_failsafe::Land_mode:
options.action = Action::Land;
break;
default:
options.action = Action::Warn;
break;
}
return options;
}
void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
const failsafe_flags_s &status_flags)
{
@@ -390,9 +432,8 @@ void Failsafe::checkStateAndMode(const hrt_abstime &time_us, const State &state,
}
}
CHECK_FAILSAFE(status_flags, wind_limit_exceeded,
ActionOptions(Action::RTL).clearOn(ClearCondition::OnModeChangeOrDisarm).cannotBeDeferred());
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
+12 -1
View File
@@ -132,6 +132,15 @@ private:
StickInputDisabled = 4 // input disabled
};
enum class command_after_high_wind_failsafe : int32_t {
None = 0,
Warning = 1,
Hold_mode = 2,
Return_mode = 3,
Terminate = 4,
Land_mode = 5
};
static ActionOptions fromNavDllOrRclActParam(int param_value);
static ActionOptions fromGfActParam(int param_value);
@@ -140,6 +149,7 @@ private:
static ActionOptions fromBatteryWarningActParam(int param_value, uint8_t battery_warning);
static ActionOptions fromQuadchuteActParam(int param_value);
static Action fromOffboardLossActParam(int param_value, uint8_t &user_intended_mode);
static ActionOptions fromHighWindLimitActParam(int param_value);
const int _caller_id_mode_fallback{genCallerId()};
bool _last_state_mode_fallback{false};
@@ -171,7 +181,8 @@ private:
(ParamInt<px4::params::COM_ACT_FAIL_ACT>) _param_com_actuator_failure_act,
(ParamInt<px4::params::COM_LOW_BAT_ACT>) _param_com_low_bat_act,
(ParamInt<px4::params::COM_OBL_RC_ACT>) _param_com_obl_rc_act,
(ParamInt<px4::params::COM_QC_ACT>) _param_com_qc_act
(ParamInt<px4::params::COM_QC_ACT>) _param_com_qc_act,
(ParamInt<px4::params::COM_WIND_MAX_ACT>) _param_com_wind_max_act
);
};