From a39b193018488fb36b71474d5b5cf43c47fce975 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Thu, 17 Oct 2024 13:38:21 +0200 Subject: [PATCH 1/3] Allow manual disarming when landed Sending a disarm request while in landed state now allows you to skip waiting for the timeout and disarm early. --- src/modules/src/supervisor.c | 4 ++-- src/modules/src/supervisor_state_machine.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/src/supervisor.c b/src/modules/src/supervisor.c index d9e6ae3e7..b7fce677b 100644 --- a/src/modules/src/supervisor.c +++ b/src/modules/src/supervisor.c @@ -263,9 +263,9 @@ static void postTransitionActions(SupervisorMem_t* this, const supervisorState_t if (newState == supervisorStateLanded) { supervisorSetLatestLandingTime(this, currentTick); } - + if ((previousState == supervisorStateLanded) && (newState == supervisorStateReset)) { - DEBUG_PRINT("Landing timeout, disarming\n"); + DEBUG_PRINT("Disarming\n"); } if (newState == supervisorStateLocked) { diff --git a/src/modules/src/supervisor_state_machine.c b/src/modules/src/supervisor_state_machine.c index 636b6e378..ae3ae72eb 100644 --- a/src/modules/src/supervisor_state_machine.c +++ b/src/modules/src/supervisor_state_machine.c @@ -199,8 +199,8 @@ static SupervisorStateTransition_t transitionsLanded[] = { .newState = supervisorStateReset, .triggers = SUPERVISOR_CB_LANDING_TIMEOUT, - .negatedTriggers = SUPERVISOR_CB_NONE, - .triggerCombiner = supervisorAll, + .negatedTriggers = SUPERVISOR_CB_ARMED, + .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, }, From 13f16ff20edec33385519a51238dc93f72abd7f7 Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Thu, 17 Oct 2024 14:12:37 +0200 Subject: [PATCH 2/3] Stop using disarming as an alternative emergency stop / crashed state trigger. If you try to disarm before landing has been registered, this will no longer trigger an emergency stop and the resulting system lock. Fixes #1425. --- src/modules/src/supervisor_state_machine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/src/supervisor_state_machine.c b/src/modules/src/supervisor_state_machine.c index ae3ae72eb..f663e0705 100644 --- a/src/modules/src/supervisor_state_machine.c +++ b/src/modules/src/supervisor_state_machine.c @@ -160,7 +160,7 @@ static SupervisorStateTransition_t transitionsFlying[] = { .newState = supervisorStateExceptFreeFall, .triggers = SUPERVISOR_CB_COMMANDER_WDT_TIMEOUT | SUPERVISOR_CB_EMERGENCY_STOP, - .negatedTriggers = SUPERVISOR_CB_ARMED, + .negatedTriggers = SUPERVISOR_CB_NONE, .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, @@ -169,7 +169,7 @@ static SupervisorStateTransition_t transitionsFlying[] = { .newState = supervisorStateCrashed, .triggers = SUPERVISOR_CB_IS_TUMBLED, - .negatedTriggers = SUPERVISOR_CB_ARMED, + .negatedTriggers = SUPERVISOR_CB_NONE, .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, @@ -230,7 +230,7 @@ static SupervisorStateTransition_t transitionsWarningLevelOut[] = { .newState = supervisorStateExceptFreeFall, .triggers = SUPERVISOR_CB_COMMANDER_WDT_TIMEOUT | SUPERVISOR_CB_IS_TUMBLED | SUPERVISOR_CB_EMERGENCY_STOP, - .negatedTriggers = SUPERVISOR_CB_ARMED, + .negatedTriggers = SUPERVISOR_CB_NONE, .triggerCombiner = supervisorAny, .blockerCombiner = supervisorNever, From 6e1dc3061e4ecd4d12a74a57f6469eca379b06ac Mon Sep 17 00:00:00 2001 From: Rik Bouwmeester Date: Mon, 21 Oct 2024 16:28:56 +0200 Subject: [PATCH 3/3] Allow disarming in-flight This commit introduces the ability to disarm the drone mid-flight without triggering an emergency stop or crash state. However, disarming should not be used as a substitute for an emergency stop, as the disarm signal could be lost or delayed in critical situations. The emergency stop command is specifically designed for higher reliability and should continue to be used when immediate and secure halting of the drone is necessary. --- src/modules/src/supervisor.c | 2 +- src/modules/src/supervisor_state_machine.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/src/supervisor.c b/src/modules/src/supervisor.c index b7fce677b..57816d650 100644 --- a/src/modules/src/supervisor.c +++ b/src/modules/src/supervisor.c @@ -264,7 +264,7 @@ static void postTransitionActions(SupervisorMem_t* this, const supervisorState_t supervisorSetLatestLandingTime(this, currentTick); } - if ((previousState == supervisorStateLanded) && (newState == supervisorStateReset)) { + if ((previousState == supervisorStateFlying || previousState == supervisorStateLanded) && (newState == supervisorStateReset)) { DEBUG_PRINT("Disarming\n"); } diff --git a/src/modules/src/supervisor_state_machine.c b/src/modules/src/supervisor_state_machine.c index f663e0705..73a1b9400 100644 --- a/src/modules/src/supervisor_state_machine.c +++ b/src/modules/src/supervisor_state_machine.c @@ -174,6 +174,15 @@ static SupervisorStateTransition_t transitionsFlying[] = { .blockerCombiner = supervisorNever, }, + { + .newState = supervisorStateReset, + + .triggers = SUPERVISOR_CB_NONE, + .negatedTriggers = SUPERVISOR_CB_ARMED, + .triggerCombiner = supervisorAll, + + .blockerCombiner = supervisorNever, + }, { .newState = supervisorStateWarningLevelOut,