Support more failsafe actions on data link and RC loss

This commit is contained in:
Lorenz Meier 2016-04-23 16:31:03 +02:00
parent b402cd9336
commit 82d51c5d17
3 changed files with 37 additions and 16 deletions

View File

@ -266,8 +266,8 @@ private:
control::BlockParamFloat _param_loiter_radius; /**< loiter radius for fixedwing */
control::BlockParamFloat _param_acceptance_radius; /**< acceptance for takeoff */
control::BlockParamInt _param_datalinkloss_obc; /**< if true: obc mode on data link loss enabled */
control::BlockParamInt _param_rcloss_obc; /**< if true: obc mode on rc loss enabled */
control::BlockParamInt _param_datalinkloss_act; /**< select data link loss action */
control::BlockParamInt _param_rcloss_act; /**< select data link loss action */
control::BlockParamFloat _param_cruising_speed_hover;
control::BlockParamFloat _param_cruising_speed_plane;

View File

@ -153,8 +153,8 @@ Navigator::Navigator() :
_follow_target(this, "TAR"),
_param_loiter_radius(this, "LOITER_RAD"),
_param_acceptance_radius(this, "ACC_RAD"),
_param_datalinkloss_obc(this, "DLL_OBC"),
_param_rcloss_obc(this, "RCL_OBC"),
_param_datalinkloss_act(this, "DLL_ACT"),
_param_rcloss_act(this, "RCL_ACT"),
_param_cruising_speed_hover(this, "MPC_XY_CRUISE", false),
_param_cruising_speed_plane(this, "FW_AIRSPD_TRIM", false),
_mission_cruising_speed(-1.0f)
@ -481,9 +481,13 @@ Navigator::task_main()
break;
case vehicle_status_s::NAVIGATION_STATE_AUTO_RCRECOVER:
_pos_sp_triplet_published_invalid_once = false;
if (_param_rcloss_obc.get() != 0) {
if (_param_rcloss_act.get() == 0) {
_navigation_mode = &_loiter;
} else if (_param_rcloss_act.get() == 2) {
_navigation_mode = &_land;
} else if (_param_rcloss_act.get() == 3) {
_navigation_mode = &_rcLoss;
} else {
} else { /* if == 1 or unknown, RTL */
_navigation_mode = &_rtl;
}
break;
@ -507,9 +511,13 @@ Navigator::task_main()
/* Use complex data link loss mode only when enabled via param
* otherwise use rtl */
_pos_sp_triplet_published_invalid_once = false;
if (_param_datalinkloss_obc.get() != 0) {
if (_param_datalinkloss_act.get() == 0) {
_navigation_mode = &_loiter;
} else if (_param_datalinkloss_act.get() == 2) {
_navigation_mode = &_land;
} else if (_param_datalinkloss_act.get() == 3) {
_navigation_mode = &_dataLinkLoss;
} else {
} else { /* if == 1 or unknown, RTL */
_navigation_mode = &_rtl;
}
break;

View File

@ -65,24 +65,37 @@ PARAM_DEFINE_FLOAT(NAV_LOITER_RAD, 50.0f);
PARAM_DEFINE_FLOAT(NAV_ACC_RAD, 10.0f);
/**
* Set OBC mode for data link loss
* Set data link loss failsafe mode
*
* If set to 1 the behaviour on data link loss is set to a mode according to the Outback Challenge (OBC) rules
* The data link loss failsafe will only be entered after a timeout,
* set by a DIFFERENT parameter. If the timeout value is smaller than
* zero it will never be entered.
*
* @value 0 Loiter
* @value 1 Return to Land
* @value 2 Land at current position
* @value 3 Outback Challenge (OBC) rules
*
* @boolean
* @group Mission
*/
PARAM_DEFINE_INT32(NAV_DLL_OBC, 0);
PARAM_DEFINE_INT32(NAV_DLL_ACT, 1);
/**
* Set OBC mode for rc loss
* Set RC loss failsafe mode
*
* If set to 1 the behaviour on data link loss is set to a mode according to the Outback Challenge (OBC) rules
* The RC loss failsafe will only be entered after a timeout,
* set by a DIFFERENT parameter. If the timeout value is smaller than
* zero it will never be entered. If RC input checks have been disabled
* by setting the COM_RC_IN_MODE param it will also not be triggered.
*
* @value 0 Loiter
* @value 1 Return to Land
* @value 2 Land at current position
* @value 3 Outback Challenge (OBC) rules
*
* @boolean
* @group Mission
*/
PARAM_DEFINE_INT32(NAV_RCL_OBC, 0);
PARAM_DEFINE_INT32(NAV_RCL_ACT, 1);
/**
* Airfield home Lat