mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:48:52 +08:00
splitting preflight and land disarm times into 2 parameters
This commit is contained in:
committed by
Mathieu Bresciani
parent
e25db01620
commit
963467b4df
@@ -561,7 +561,7 @@ Commander::Commander() :
|
||||
ModuleParams(nullptr),
|
||||
_failure_detector(this)
|
||||
{
|
||||
_auto_disarm_landed.set_hysteresis_time_from(false, 10_s);
|
||||
_auto_disarm_landed.set_hysteresis_time_from(false, _param_com_disarm_preflight.get() * 1_s);
|
||||
_auto_disarm_killed.set_hysteresis_time_from(false, 5_s);
|
||||
|
||||
// We want to accept RC inputs as default
|
||||
@@ -1670,25 +1670,23 @@ Commander::run()
|
||||
// Auto disarm when landed or kill switch engaged
|
||||
if (armed.armed) {
|
||||
|
||||
// Check for auto-disarm on landing
|
||||
if (_param_com_disarm_land.get() > 0) {
|
||||
// Check for auto-disarm on landing or pre-flight
|
||||
if (_param_com_disarm_land.get() > 0 || _param_com_disarm_preflight.get() > 0) {
|
||||
|
||||
if (!have_taken_off_since_arming) {
|
||||
// pilot has ten seconds time to take off
|
||||
_auto_disarm_landed.set_hysteresis_time_from(false, 10_s);
|
||||
|
||||
} else {
|
||||
if (_param_com_disarm_land.get() > 0 && have_taken_off_since_arming) {
|
||||
_auto_disarm_landed.set_hysteresis_time_from(false, _param_com_disarm_land.get() * 1_s);
|
||||
}
|
||||
_auto_disarm_landed.set_state_and_update(land_detector.landed, hrt_absolute_time());
|
||||
|
||||
_auto_disarm_landed.set_state_and_update(land_detector.landed, hrt_absolute_time());
|
||||
} else if (_param_com_disarm_preflight.get() > 0 && !have_taken_off_since_arming) {
|
||||
_auto_disarm_landed.set_hysteresis_time_from(false, _param_com_disarm_preflight.get() * 1_s);
|
||||
_auto_disarm_landed.set_state_and_update(true, hrt_absolute_time());
|
||||
}
|
||||
|
||||
if (_auto_disarm_landed.get_state()) {
|
||||
arm_disarm(false, &mavlink_log_pub, "Auto disarm on land");
|
||||
arm_disarm(false, &mavlink_log_pub, "Auto disarm initiated");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Auto disarm after 5 seconds if kill switch is engaged
|
||||
_auto_disarm_killed.set_state_and_update(armed.manual_lockdown, hrt_absolute_time());
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ private:
|
||||
|
||||
(ParamInt<px4::params::COM_LOW_BAT_ACT>) _param_com_low_bat_act,
|
||||
(ParamFloat<px4::params::COM_DISARM_LAND>) _param_com_disarm_land,
|
||||
(ParamFloat<px4::params::COM_DISARM_PRFLT>) _param_com_disarm_preflight,
|
||||
|
||||
(ParamInt<px4::params::COM_OBS_AVOID>) _param_com_obs_avoid,
|
||||
(ParamInt<px4::params::COM_OA_BOOT_T>) _param_com_oa_boot_t,
|
||||
|
||||
@@ -262,18 +262,29 @@ PARAM_DEFINE_INT32(COM_RC_ARM_HYST, 1000);
|
||||
* A non-zero, positive value specifies the time-out period in seconds after which the vehicle will be
|
||||
* automatically disarmed in case a landing situation has been detected during this period.
|
||||
*
|
||||
* The vehicle will also auto-disarm right after arming if it has not even flown, however the time
|
||||
* will always be 10 seconds such that the pilot has enough time to take off.
|
||||
*
|
||||
* A negative value means that automatic disarming triggered by landing detection is disabled.
|
||||
*
|
||||
* @group Commander
|
||||
* @min -1
|
||||
* @max 20
|
||||
* @unit s
|
||||
* @decimal 2
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(COM_DISARM_LAND, 2.0f);
|
||||
|
||||
PARAM_DEFINE_FLOAT(COM_DISARM_LAND, 5.0f);
|
||||
|
||||
/**
|
||||
* Time-out for auto disarm before the first take off
|
||||
*
|
||||
* A non-zero, positive value specifies the time-out period in seconds after which the vehicle will be
|
||||
* automatically disarmed when the vehicle has never taken off.
|
||||
*
|
||||
* A negative value means that automatic disarming triggered by a pre-takeoff timeout is disabled.
|
||||
*
|
||||
* @group Commander
|
||||
* @unit s
|
||||
* @decimal 2
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(COM_DISARM_PRFLT, 2.0f);
|
||||
|
||||
|
||||
/**
|
||||
* Allow arming without GPS
|
||||
|
||||
Reference in New Issue
Block a user