framework: added dead-reckon rtl to the failsafe framework

This commit is contained in:
oravla5
2025-07-03 16:57:01 +02:00
parent 85366a80db
commit 63d9ab84af
3 changed files with 21 additions and 3 deletions
+7 -3
View File
@@ -421,18 +421,22 @@
"description": "RTL"
},
"7": {
"name": "dead_reckon_rtl",
"description": "Dead Reckoning RTL"
},
"8": {
"name": "land",
"description": "Land"
},
"8": {
"9": {
"name": "descend",
"description": "Descend"
},
"9": {
"10": {
"name": "disarm",
"description": "disarm"
},
"10": {
"11": {
"name": "terminate",
"description": "terminate"
}
@@ -571,6 +571,15 @@ void FailsafeBase::getSelectedAction(const State &state, const failsafe_flags_s
returned_state.cause = Cause::Generic;
// fallthrough
case Action::DeadReckonRTL:
if (modeCanRun(status_flags, vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR)) {
selected_action = Action::DeadReckonRTL;
break;
}
returned_state.cause = Cause::Generic;
// fallthrough
case Action::Land:
if (modeCanRun(status_flags, vehicle_status_s::NAVIGATION_STATE_AUTO_LAND)) {
@@ -671,6 +680,8 @@ uint8_t FailsafeBase::modeFromAction(const Action &action, uint8_t user_intended
case Action::RTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL;
case Action::DeadReckonRTL: return vehicle_status_s::NAVIGATION_STATE_AUTO_RTL_DR;
case Action::Land: return vehicle_status_s::NAVIGATION_STATE_AUTO_LAND;
case Action::Descend: return vehicle_status_s::NAVIGATION_STATE_DESCEND;
@@ -61,6 +61,7 @@ public:
Hold,
RTL,
DeadReckonRTL,
Land,
Descend,
Disarm,
@@ -105,6 +106,8 @@ public:
case Action::RTL: return "RTL";
case Action::DeadReckonRTL: return "Dead Reckoning RTL";
case Action::Land: return "Land";
case Action::Descend: return "Descend";