mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 08:38:53 +08:00
Removed hardcoded onboard controller timeouts thresholds.
Added COM_ONB_LOSS_T and COM_ONB_REG_T parameters to specify thresholds that triggers "onboard link lost" and "onboard link regained". Signed-off-by: Claudio Micheli <claudio@auterion.com>
This commit is contained in:
committed by
Beat Küng
parent
156317e546
commit
14415b29c1
@@ -3907,7 +3907,7 @@ void Commander::data_link_check(bool &status_changed)
|
||||
_datalink_last_heartbeat_onboard_controller = telemetry.heartbeat_time;
|
||||
|
||||
if (_onboard_controller_lost) {
|
||||
if (hrt_elapsed_time(&_datalink_last_heartbeat_onboard_controller) < (5_s)) {
|
||||
if (hrt_elapsed_time(&_datalink_last_heartbeat_onboard_controller) < _onboard_regain_threshold.get() * 1_s) {
|
||||
mavlink_log_info(&mavlink_log_pub, "ONBOARD CONTROLLER REGAINED");
|
||||
_onboard_controller_lost = false;
|
||||
}
|
||||
@@ -3951,7 +3951,8 @@ void Commander::data_link_check(bool &status_changed)
|
||||
|
||||
// ONBOARD CONTROLLER data link loss failsafe (hard coded 5 seconds)
|
||||
if ((_datalink_last_heartbeat_onboard_controller > 0)
|
||||
&& (hrt_elapsed_time(&_datalink_last_heartbeat_onboard_controller) > 5_s) && !_onboard_controller_lost) {
|
||||
&& (hrt_elapsed_time(&_datalink_last_heartbeat_onboard_controller) > _onboard_loss_timeout.get() * 1_s)
|
||||
&& !_onboard_controller_lost) {
|
||||
|
||||
mavlink_log_critical(&mavlink_log_pub, "ONBOARD CONTROLLER LOST");
|
||||
_onboard_controller_lost = true;
|
||||
|
||||
@@ -118,7 +118,10 @@ private:
|
||||
(ParamInt<px4::params::COM_LOW_BAT_ACT>) _low_bat_action,
|
||||
(ParamFloat<px4::params::COM_DISARM_LAND>) _disarm_when_landed_timeout,
|
||||
|
||||
(ParamInt<px4::params::COM_OBS_AVOID>) _obs_avoid
|
||||
(ParamInt<px4::params::COM_OBS_AVOID>) _obs_avoid,
|
||||
|
||||
(ParamInt<px4::params::COM_ONB_LOSS_T>) _onboard_loss_timeout,
|
||||
(ParamInt<px4::params::COM_ONB_REG_T>) _onboard_regain_threshold
|
||||
)
|
||||
|
||||
const int64_t POSVEL_PROBATION_MIN = 1_s; /**< minimum probation duration (usec) */
|
||||
|
||||
@@ -820,3 +820,29 @@ PARAM_DEFINE_INT32(NAV_RCL_ACT, 2);
|
||||
* @group Mission
|
||||
*/
|
||||
PARAM_DEFINE_INT32(COM_OBS_AVOID, 0);
|
||||
|
||||
/**
|
||||
* Time-out to wait when onboard connection is lost before triggering onboard lost action.
|
||||
* TODO: Define parameters to specify proper action to trigger.
|
||||
*
|
||||
* @group Commander
|
||||
* @unit s
|
||||
* @min 0
|
||||
* @max 60
|
||||
* @increment 1
|
||||
*/
|
||||
PARAM_DEFINE_INT32(COM_ONB_LOSS_T, 5);
|
||||
|
||||
/**
|
||||
* Onboard link regain time threshold
|
||||
*
|
||||
* After a onboard link loss: Amount of time between two heartbeats to consider connection healthy again.
|
||||
*
|
||||
* @group Commander
|
||||
* @unit s
|
||||
* @min 0
|
||||
* @max 3
|
||||
* @decimal 1
|
||||
* @increment 0.5
|
||||
*/
|
||||
PARAM_DEFINE_INT32(COM_ONB_REG_T, 1);
|
||||
|
||||
Reference in New Issue
Block a user