diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp index 17dc911d51..e0689e1052 100644 --- a/src/modules/commander/Commander.cpp +++ b/src/modules/commander/Commander.cpp @@ -2308,8 +2308,8 @@ Commander::run() status_flags, land_detector.landed, (link_loss_actions_t)_param_nav_rcl_act.get(), - _param_com_obl_act.get(), - _param_com_obl_rc_act.get(), + (offboard_loss_actions_t)_param_com_obl_act.get(), + (offboard_loss_rc_actions_t)_param_com_obl_rc_act.get(), (position_nav_loss_actions_t)_param_com_posctl_navl.get()); if (status.failsafe != failsafe_old) { diff --git a/src/modules/commander/commander_params.c b/src/modules/commander/commander_params.c index 59b052397d..c8656f7c56 100644 --- a/src/modules/commander/commander_params.c +++ b/src/modules/commander/commander_params.c @@ -344,9 +344,12 @@ PARAM_DEFINE_FLOAT(COM_OF_LOSS_T, 0.0f); * The offboard loss failsafe will only be entered after a timeout, * set by COM_OF_LOSS_T in seconds. * - * @value 0 Land mode - * @value 1 Hold mode - * @value 2 Return mode + * @value -1 Disabled + * @value 0 Land mode + * @value 1 Hold mode + * @value 2 Return mode + * @value 3 Terminate + * @value 4 Lockdown * * @group Commander */ @@ -358,12 +361,15 @@ PARAM_DEFINE_INT32(COM_OBL_ACT, 0); * The offboard loss failsafe will only be entered after a timeout, * set by COM_OF_LOSS_T in seconds. * - * @value 0 Position mode - * @value 1 Altitude mode - * @value 2 Manual - * @value 3 Return mode - * @value 4 Land mode - * @value 5 Hold mode + * @value -1 Disabled + * @value 0 Position mode + * @value 1 Altitude mode + * @value 2 Manual + * @value 3 Return mode + * @value 4 Land mode + * @value 5 Hold mode + * @value 6 Terminate + * @value 7 Lockdown * @group Commander */ PARAM_DEFINE_INT32(COM_OBL_RC_ACT, 0); diff --git a/src/modules/commander/state_machine_helper.h b/src/modules/commander/state_machine_helper.h index 879f3a0eb4..e22486f0d1 100644 --- a/src/modules/commander/state_machine_helper.h +++ b/src/modules/commander/state_machine_helper.h @@ -68,6 +68,27 @@ enum class link_loss_actions_t { LOCKDOWN = 6, // Kill the motors, same result as kill switch }; +enum class offboard_loss_actions_t { + DISABLED = -1, + AUTO_LAND = 0, // Land mode + AUTO_LOITER = 1, // Hold mode + AUTO_RTL = 2, // Return mode + TERMINATE = 3, // Turn off all controllers and set PWM outputs to failsafe value + LOCKDOWN = 4, // Kill the motors, same result as kill switch +}; + +enum class offboard_loss_rc_actions_t { + DISABLED = -1, // Disabled + MANUAL_POSITION = 0, // Position mode + MANUAL_ALTITUDE = 1, // Altitude mode + MANUAL_ATTITUDE = 2, // Manual + AUTO_RTL = 3, // Return mode + AUTO_LAND = 4, // Land mode + AUTO_LOITER = 5, // Hold mode + TERMINATE = 6, // Turn off all controllers and set PWM outputs to failsafe value + LOCKDOWN = 7, // Kill the motors, same result as kill switch +}; + enum class position_nav_loss_actions_t { ALTITUDE_MANUAL = 0, // Altitude/Manual. Assume use of remote control after fallback. Switch to Altitude mode if a height estimate is available, else switch to MANUAL. LAND_TERMINATE = 1, // Land/Terminate. Assume no use of remote control after fallback. Switch to Land mode if a height estimate is available, else switch to TERMINATION. @@ -99,7 +120,8 @@ void enable_failsafe(vehicle_status_s *status, bool old_failsafe, orb_advert_t * bool set_nav_state(vehicle_status_s *status, actuator_armed_s *armed, commander_state_s *internal_state, orb_advert_t *mavlink_log_pub, const link_loss_actions_t data_link_loss_act, const bool mission_finished, const bool stay_in_failsafe, const vehicle_status_flags_s &status_flags, bool landed, - const link_loss_actions_t rc_loss_act, const int offb_loss_act, const int offb_loss_rc_act, + const link_loss_actions_t rc_loss_act, const offboard_loss_actions_t offb_loss_act, + const offboard_loss_rc_actions_t offb_loss_rc_act, const position_nav_loss_actions_t posctl_nav_loss_act); /*