mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 20:01:36 +08:00
Commander: make RC override multicopter only
AAs discussed in the devcall this functionality is only useful for rotary-wing (multicopter) flying since it's a big safety hazard to accidentally bring a fixed wing out of an auto mode e.g. a mission and fly away in a straight line or into an obstacle.
This commit is contained in:
@@ -1825,6 +1825,7 @@ Commander::run()
|
|||||||
// abort auto mode or geofence reaction if sticks are moved significantly
|
// abort auto mode or geofence reaction if sticks are moved significantly
|
||||||
// but only if not in a low battery handling action
|
// but only if not in a low battery handling action
|
||||||
const bool not_in_low_battery_reaction = _battery_warning < battery_status_s::BATTERY_WARNING_CRITICAL;
|
const bool not_in_low_battery_reaction = _battery_warning < battery_status_s::BATTERY_WARNING_CRITICAL;
|
||||||
|
const bool is_rotary_wing = status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING;
|
||||||
const bool manual_mode_before_geofence =
|
const bool manual_mode_before_geofence =
|
||||||
main_state_before_rtl == commander_state_s::MAIN_STATE_MANUAL ||
|
main_state_before_rtl == commander_state_s::MAIN_STATE_MANUAL ||
|
||||||
main_state_before_rtl == commander_state_s::MAIN_STATE_ALTCTL ||
|
main_state_before_rtl == commander_state_s::MAIN_STATE_ALTCTL ||
|
||||||
@@ -1837,7 +1838,7 @@ Commander::run()
|
|||||||
internal_state.main_state == commander_state_s::MAIN_STATE_AUTO_MISSION ||
|
internal_state.main_state == commander_state_s::MAIN_STATE_AUTO_MISSION ||
|
||||||
internal_state.main_state == commander_state_s::MAIN_STATE_AUTO_LOITER;
|
internal_state.main_state == commander_state_s::MAIN_STATE_AUTO_LOITER;
|
||||||
|
|
||||||
if (rc_override != 0 && not_in_low_battery_reaction
|
if (rc_override != 0 && is_rotary_wing && not_in_low_battery_reaction
|
||||||
&& (in_auto_mode || (_geofence_warning_action_on && manual_mode_before_geofence))) {
|
&& (in_auto_mode || (_geofence_warning_action_on && manual_mode_before_geofence))) {
|
||||||
// transition to previous state if sticks are touched
|
// transition to previous state if sticks are touched
|
||||||
if ((_last_sp_man.timestamp != sp_man.timestamp) &&
|
if ((_last_sp_man.timestamp != sp_man.timestamp) &&
|
||||||
|
|||||||
@@ -613,6 +613,11 @@ PARAM_DEFINE_FLOAT(COM_ARM_MAG, 0.15f);
|
|||||||
/**
|
/**
|
||||||
* Enable RC stick override of auto modes
|
* Enable RC stick override of auto modes
|
||||||
*
|
*
|
||||||
|
* When an auto mode is active (except a critical battery reaction) moving the RC sticks
|
||||||
|
* gives control back to the pilot in manual position mode immediately.
|
||||||
|
*
|
||||||
|
* Only has an effect on multicopters and VTOLS in multicopter mode.
|
||||||
|
*
|
||||||
* @boolean
|
* @boolean
|
||||||
* @group Commander
|
* @group Commander
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user