mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
commander: only override according to param
This got lost in the refactor earlier.
This commit is contained in:
committed by
Matthias Grob
parent
56b2b81600
commit
2e9edfcd89
@@ -2407,13 +2407,20 @@ Commander::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const bool override_enabled =
|
||||||
|
((_param_com_rc_override.get() & static_cast<int32_t>(RcOverrideBits::AUTO_MODE_BIT))
|
||||||
|
&& _vehicle_control_mode.flag_control_auto_enabled)
|
||||||
|
|| ((_param_com_rc_override.get() & static_cast<int32_t>(RcOverrideBits::OFFBOARD_MODE_BIT))
|
||||||
|
&& _vehicle_control_mode.flag_control_offboard_enabled);
|
||||||
|
|
||||||
// Abort autonomous mode and switch to position mode if sticks are moved significantly
|
// Abort autonomous mode and switch to position mode if sticks are moved significantly
|
||||||
// but only if actually in air.
|
// but only if actually in air.
|
||||||
if ((_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING)
|
if ((_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING)
|
||||||
&& !in_low_battery_failsafe && !_geofence_warning_action_on
|
&& !in_low_battery_failsafe && !_geofence_warning_action_on
|
||||||
&& _armed.armed
|
&& _armed.armed
|
||||||
&& !_status_flags.rc_input_blocked
|
&& !_status_flags.rc_input_blocked
|
||||||
&& manual_control_setpoint.user_override) {
|
&& manual_control_setpoint.user_override
|
||||||
|
&& override_enabled) {
|
||||||
const transition_result_t posctl_result =
|
const transition_result_t posctl_result =
|
||||||
main_state_transition(_status, commander_state_s::MAIN_STATE_POSCTL, _status_flags, _internal_state);
|
main_state_transition(_status, commander_state_s::MAIN_STATE_POSCTL, _status_flags, _internal_state);
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,8 @@ private:
|
|||||||
(ParamInt<px4::params::NAV_DLL_ACT>) _param_nav_dll_act,
|
(ParamInt<px4::params::NAV_DLL_ACT>) _param_nav_dll_act,
|
||||||
(ParamInt<px4::params::COM_DL_LOSS_T>) _param_com_dl_loss_t,
|
(ParamInt<px4::params::COM_DL_LOSS_T>) _param_com_dl_loss_t,
|
||||||
|
|
||||||
|
(ParamInt<px4::params::COM_RC_OVERRIDE>) _param_com_rc_override,
|
||||||
|
|
||||||
(ParamInt<px4::params::COM_HLDL_LOSS_T>) _param_com_hldl_loss_t,
|
(ParamInt<px4::params::COM_HLDL_LOSS_T>) _param_com_hldl_loss_t,
|
||||||
(ParamInt<px4::params::COM_HLDL_REG_T>) _param_com_hldl_reg_t,
|
(ParamInt<px4::params::COM_HLDL_REG_T>) _param_com_hldl_reg_t,
|
||||||
|
|
||||||
@@ -255,7 +257,7 @@ private:
|
|||||||
(ParamInt<px4::params::CBRK_VELPOSERR>) _param_cbrk_velposerr,
|
(ParamInt<px4::params::CBRK_VELPOSERR>) _param_cbrk_velposerr,
|
||||||
(ParamInt<px4::params::CBRK_VTOLARMING>) _param_cbrk_vtolarming,
|
(ParamInt<px4::params::CBRK_VTOLARMING>) _param_cbrk_vtolarming,
|
||||||
|
|
||||||
// Geofrence
|
// Geofence
|
||||||
(ParamInt<px4::params::GF_ACTION>) _param_geofence_action,
|
(ParamInt<px4::params::GF_ACTION>) _param_geofence_action,
|
||||||
|
|
||||||
// Mavlink
|
// Mavlink
|
||||||
@@ -275,6 +277,11 @@ private:
|
|||||||
ALWAYS = 2
|
ALWAYS = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class RcOverrideBits : int32_t {
|
||||||
|
AUTO_MODE_BIT = (1 << 0),
|
||||||
|
OFFBOARD_MODE_BIT = (1 << 1),
|
||||||
|
};
|
||||||
|
|
||||||
/* Decouple update interval and hysteresis counters, all depends on intervals */
|
/* Decouple update interval and hysteresis counters, all depends on intervals */
|
||||||
static constexpr uint64_t COMMANDER_MONITORING_INTERVAL{10_ms};
|
static constexpr uint64_t COMMANDER_MONITORING_INTERVAL{10_ms};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user