forked from Archive/PX4-Autopilot
commander: add parameter COM_REARM_GRACE to optionally disable re-arming grace period
This commit is contained in:
parent
c1936dab1f
commit
967f741a0e
|
@ -2017,13 +2017,13 @@ Commander::run()
|
||||||
&& !arm_switch_or_button_mapped;
|
&& !arm_switch_or_button_mapped;
|
||||||
/* allow a grace period for re-arming: preflight checks don't need to pass during that time,
|
/* allow a grace period for re-arming: preflight checks don't need to pass during that time,
|
||||||
* for example for accidential in-air disarming */
|
* for example for accidential in-air disarming */
|
||||||
const bool in_arming_grace_period = (_last_disarmed_timestamp != 0)
|
const bool in_rearming_grace_period = _param_com_rearm_grace.get() && (_last_disarmed_timestamp != 0)
|
||||||
&& (hrt_elapsed_time(&_last_disarmed_timestamp) < 5_s);
|
&& (hrt_elapsed_time(&_last_disarmed_timestamp) < 5_s);
|
||||||
|
|
||||||
const bool arm_switch_to_arm_transition = !_param_arm_switch_is_button.get() &&
|
const bool arm_switch_to_arm_transition = !_param_arm_switch_is_button.get() &&
|
||||||
(_last_manual_control_setpoint_arm_switch == manual_control_setpoint_s::SWITCH_POS_OFF) &&
|
(_last_manual_control_setpoint_arm_switch == manual_control_setpoint_s::SWITCH_POS_OFF) &&
|
||||||
(_manual_control_setpoint.arm_switch == manual_control_setpoint_s::SWITCH_POS_ON) &&
|
(_manual_control_setpoint.arm_switch == manual_control_setpoint_s::SWITCH_POS_ON) &&
|
||||||
(_manual_control_setpoint.z < 0.1f || in_arming_grace_period);
|
(_manual_control_setpoint.z < 0.1f || in_rearming_grace_period);
|
||||||
|
|
||||||
if (!in_armed_state &&
|
if (!in_armed_state &&
|
||||||
(status.rc_input_mode != vehicle_status_s::RC_IN_MODE_OFF) &&
|
(status.rc_input_mode != vehicle_status_s::RC_IN_MODE_OFF) &&
|
||||||
|
@ -2051,7 +2051,7 @@ Commander::run()
|
||||||
|
|
||||||
} else if (status.arming_state == vehicle_status_s::ARMING_STATE_STANDBY) {
|
} else if (status.arming_state == vehicle_status_s::ARMING_STATE_STANDBY) {
|
||||||
arming_ret = arming_state_transition(&status, _safety, vehicle_status_s::ARMING_STATE_ARMED, &armed,
|
arming_ret = arming_state_transition(&status, _safety, vehicle_status_s::ARMING_STATE_ARMED, &armed,
|
||||||
!in_arming_grace_period /* fRunPreArmChecks */,
|
!in_rearming_grace_period /* fRunPreArmChecks */,
|
||||||
&mavlink_log_pub, &status_flags, _arm_requirements, hrt_elapsed_time(&_boot_timestamp),
|
&mavlink_log_pub, &status_flags, _arm_requirements, hrt_elapsed_time(&_boot_timestamp),
|
||||||
(arm_switch_to_arm_transition ? arm_disarm_reason_t::RC_SWITCH : arm_disarm_reason_t::RC_STICK));
|
(arm_switch_to_arm_transition ? arm_disarm_reason_t::RC_SWITCH : arm_disarm_reason_t::RC_STICK));
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,7 @@ private:
|
||||||
(ParamBool<px4::params::COM_ARM_MIS_REQ>) _param_arm_mission_required,
|
(ParamBool<px4::params::COM_ARM_MIS_REQ>) _param_arm_mission_required,
|
||||||
(ParamBool<px4::params::COM_ARM_AUTH_REQ>) _param_arm_auth_required,
|
(ParamBool<px4::params::COM_ARM_AUTH_REQ>) _param_arm_auth_required,
|
||||||
(ParamBool<px4::params::COM_ARM_CHK_ESCS>) _param_escs_checks_required,
|
(ParamBool<px4::params::COM_ARM_CHK_ESCS>) _param_escs_checks_required,
|
||||||
|
(ParamBool<px4::params::COM_REARM_GRACE>) _param_com_rearm_grace,
|
||||||
|
|
||||||
(ParamInt<px4::params::COM_FLIGHT_UUID>) _param_flight_uuid,
|
(ParamInt<px4::params::COM_FLIGHT_UUID>) _param_flight_uuid,
|
||||||
(ParamInt<px4::params::COM_TAKEOFF_ACT>) _param_takeoff_finished_action,
|
(ParamInt<px4::params::COM_TAKEOFF_ACT>) _param_takeoff_finished_action,
|
||||||
|
|
|
@ -614,6 +614,16 @@ PARAM_DEFINE_INT32(COM_ARM_MAG_ANG, 45);
|
||||||
*/
|
*/
|
||||||
PARAM_DEFINE_INT32(COM_ARM_MAG_STR, 1);
|
PARAM_DEFINE_INT32(COM_ARM_MAG_STR, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rearming grace period
|
||||||
|
*
|
||||||
|
* Re-arming grace allows to rearm the drone with manual command without running prearmcheck during 5 s after disarming.
|
||||||
|
*
|
||||||
|
* @group Commander
|
||||||
|
* @boolean
|
||||||
|
*/
|
||||||
|
PARAM_DEFINE_INT32(COM_REARM_GRACE, 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable RC stick override of auto and/or offboard modes
|
* Enable RC stick override of auto and/or offboard modes
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue