Improve offboard failsafe (#18160)

* state_machine_helper: improve offboard failsafe

* state_machine_helper: add missing parameter to set_link_loss_nav_state

* state_machine_helper: fix no rc and offboard reason

* Fix offboard test by enabling rcl_except

* mavros_test fix offboard_posctl_test with rcl_except

* autopilot_tester make RcLossException bits explicit

Co-authored-by: Julian Oes <julian@oes.ch>

* autopilot_tester change rcl_except to rc_loss_exception

Co-authored-by: Julian Oes <julian@oes.ch>

* autopilot_tester fix rc_loss_exception renaming errors

Co-authored-by: Julian Oes <julian@oes.ch>
This commit is contained in:
benjinne
2021-09-08 18:19:53 +02:00
committed by GitHub
co-authored by Julian Oes
parent 686bcff8a7
commit 06a91ec752
6 changed files with 79 additions and 5 deletions
+16
View File
@@ -143,6 +143,22 @@ void AutopilotTester::set_height_source(AutopilotTester::HeightSource height_sou
}
}
void AutopilotTester::set_rc_loss_exception(AutopilotTester::RcLossException mask)
{
switch (mask) {
case RcLossException::Mission:
CHECK(_param->set_param_int("COM_RCL_EXCEPT", 1 << 0) == Param::Result::Success);
break;
case RcLossException::Hold:
CHECK(_param->set_param_int("COM_RCL_EXCEPT", 1 << 1) == Param::Result::Success);
break;
case RcLossException::Offboard:
CHECK(_param->set_param_int("COM_RCL_EXCEPT", 1 << 2) == Param::Result::Success);
}
}
void AutopilotTester::arm()
{
const auto result = _action->arm();