mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Consistently use "stick gesture" for "rc stick gesture"
This commit is contained in:
parent
8eaf93468e
commit
e4d25df58a
@ -11,7 +11,7 @@ uint8 ACTION_VTOL_TRANSITION_TO_MULTICOPTER = 6
|
||||
uint8 ACTION_VTOL_TRANSITION_TO_FIXEDWING = 7
|
||||
|
||||
uint8 source # how the request was triggered
|
||||
uint8 SOURCE_MANUAL_CONTROL_GESTURE = 0
|
||||
uint8 SOURCE_STICK_GESTURE = 0
|
||||
uint8 SOURCE_RC_SWITCH = 1
|
||||
uint8 SOURCE_RC_BUTTON = 2
|
||||
uint8 SOURCE_RC_MODE_SLOT = 3
|
||||
|
||||
@ -12,7 +12,7 @@ uint8 ARMING_STATE_ARMED = 2
|
||||
uint8 latest_arming_reason
|
||||
uint8 latest_disarming_reason
|
||||
uint8 ARM_DISARM_REASON_TRANSITION_TO_STANDBY = 0
|
||||
uint8 ARM_DISARM_REASON_RC_STICK = 1
|
||||
uint8 ARM_DISARM_REASON_STICK_GESTURE = 1
|
||||
uint8 ARM_DISARM_REASON_RC_SWITCH = 2
|
||||
uint8 ARM_DISARM_REASON_COMMAND_INTERNAL = 3
|
||||
uint8 ARM_DISARM_REASON_COMMAND_EXTERNAL = 4
|
||||
|
||||
@ -447,12 +447,12 @@
|
||||
"description": "Transition to standby"
|
||||
},
|
||||
"1": {
|
||||
"name": "rc_stick",
|
||||
"name": "stick_gesture",
|
||||
"description": "Stick gesture"
|
||||
},
|
||||
"2": {
|
||||
"name": "rc_switch",
|
||||
"description": "RC (switch)"
|
||||
"description": "RC switch"
|
||||
},
|
||||
"3": {
|
||||
"name": "command_internal",
|
||||
|
||||
@ -503,9 +503,9 @@ static constexpr const char *arm_disarm_reason_str(arm_disarm_reason_t calling_r
|
||||
switch (calling_reason) {
|
||||
case arm_disarm_reason_t::transition_to_standby: return "";
|
||||
|
||||
case arm_disarm_reason_t::rc_stick: return "Stick gesture";
|
||||
case arm_disarm_reason_t::stick_gesture: return "Stick gesture";
|
||||
|
||||
case arm_disarm_reason_t::rc_switch: return "RC (switch)";
|
||||
case arm_disarm_reason_t::rc_switch: return "RC switch";
|
||||
|
||||
case arm_disarm_reason_t::command_internal: return "internal command";
|
||||
|
||||
@ -583,7 +583,7 @@ transition_result_t Commander::arm(arm_disarm_reason_t calling_reason, bool run_
|
||||
return TRANSITION_DENIED;
|
||||
}
|
||||
|
||||
} else if (calling_reason == arm_disarm_reason_t::rc_stick
|
||||
} else if (calling_reason == arm_disarm_reason_t::stick_gesture
|
||||
|| calling_reason == arm_disarm_reason_t::rc_switch
|
||||
|| calling_reason == arm_disarm_reason_t::rc_button) {
|
||||
|
||||
@ -634,12 +634,12 @@ transition_result_t Commander::disarm(arm_disarm_reason_t calling_reason, bool f
|
||||
const bool mc_manual_thrust_mode = _vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
|
||||
&& _vehicle_control_mode.flag_control_manual_enabled
|
||||
&& !_vehicle_control_mode.flag_control_climb_rate_enabled;
|
||||
const bool commanded_by_rc = (calling_reason == arm_disarm_reason_t::rc_stick)
|
||||
const bool commanded_by_rc = (calling_reason == arm_disarm_reason_t::stick_gesture)
|
||||
|| (calling_reason == arm_disarm_reason_t::rc_switch)
|
||||
|| (calling_reason == arm_disarm_reason_t::rc_button);
|
||||
|
||||
if (!landed && !(mc_manual_thrust_mode && commanded_by_rc && _param_com_disarm_man.get())) {
|
||||
if (calling_reason != arm_disarm_reason_t::rc_stick) {
|
||||
if (calling_reason != arm_disarm_reason_t::stick_gesture) {
|
||||
mavlink_log_critical(&_mavlink_log_pub, "Disarming denied: not landed\t");
|
||||
events::send(events::ID("commander_disarm_denied_not_landed"),
|
||||
{events::Log::Critical, events::LogInternal::Info},
|
||||
@ -1629,7 +1629,7 @@ void Commander::executeActionRequest(const action_request_s &action_request)
|
||||
|
||||
// Silently ignore RC actions during RC calibration
|
||||
if (_vehicle_status.rc_calibration_in_progress
|
||||
&& (action_request.source == action_request_s::SOURCE_MANUAL_CONTROL_GESTURE
|
||||
&& (action_request.source == action_request_s::SOURCE_STICK_GESTURE
|
||||
|| action_request.source == action_request_s::SOURCE_RC_SWITCH
|
||||
|| action_request.source == action_request_s::SOURCE_RC_BUTTON
|
||||
|| action_request.source == action_request_s::SOURCE_RC_MODE_SLOT)) {
|
||||
@ -1637,7 +1637,7 @@ void Commander::executeActionRequest(const action_request_s &action_request)
|
||||
}
|
||||
|
||||
switch (action_request.source) {
|
||||
case action_request_s::SOURCE_MANUAL_CONTROL_GESTURE: arm_disarm_reason = arm_disarm_reason_t::rc_stick; break;
|
||||
case action_request_s::SOURCE_STICK_GESTURE: arm_disarm_reason = arm_disarm_reason_t::stick_gesture; break;
|
||||
|
||||
case action_request_s::SOURCE_RC_SWITCH: arm_disarm_reason = arm_disarm_reason_t::rc_switch; break;
|
||||
|
||||
|
||||
@ -316,7 +316,7 @@ void ManualControl::updateParams()
|
||||
/* EVENT
|
||||
* @description <param>MAN_ARM_GESTURE</param> is now set to disable arm/disarm stick gesture.
|
||||
*/
|
||||
events::send(events::ID("rc_update_arm_stick_gesture_disabled_with_switch"), {events::Log::Info, events::LogInternal::Disabled},
|
||||
events::send(events::ID("stick_gesture_disabled_by_arm_switch"), {events::Log::Info, events::LogInternal::Disabled},
|
||||
"Arm stick gesture disabled if arm switch in use");
|
||||
}
|
||||
}
|
||||
@ -356,7 +356,7 @@ void ManualControl::processStickArming(const manual_control_setpoint_s &input)
|
||||
_stick_arm_hysteresis.set_state_and_update(left_stick_lower_right && right_stick_centered, input.timestamp);
|
||||
|
||||
if (_param_man_arm_gesture.get() && !previous_stick_arm_hysteresis && _stick_arm_hysteresis.get_state()) {
|
||||
sendActionRequest(action_request_s::ACTION_ARM, action_request_s::SOURCE_MANUAL_CONTROL_GESTURE);
|
||||
sendActionRequest(action_request_s::ACTION_ARM, action_request_s::SOURCE_STICK_GESTURE);
|
||||
}
|
||||
|
||||
// Disarm gesture
|
||||
@ -366,7 +366,7 @@ void ManualControl::processStickArming(const manual_control_setpoint_s &input)
|
||||
_stick_disarm_hysteresis.set_state_and_update(left_stick_lower_left && right_stick_centered, input.timestamp);
|
||||
|
||||
if (_param_man_arm_gesture.get() && !previous_stick_disarm_hysteresis && _stick_disarm_hysteresis.get_state()) {
|
||||
sendActionRequest(action_request_s::ACTION_DISARM, action_request_s::SOURCE_MANUAL_CONTROL_GESTURE);
|
||||
sendActionRequest(action_request_s::ACTION_DISARM, action_request_s::SOURCE_STICK_GESTURE);
|
||||
}
|
||||
|
||||
// Kill gesture
|
||||
@ -377,7 +377,7 @@ void ManualControl::processStickArming(const manual_control_setpoint_s &input)
|
||||
_stick_kill_hysteresis.set_state_and_update(left_stick_lower_left && right_stick_lower_right, input.timestamp);
|
||||
|
||||
if (!previous_stick_kill_hysteresis && _stick_kill_hysteresis.get_state()) {
|
||||
sendActionRequest(action_request_s::ACTION_KILL, action_request_s::SOURCE_MANUAL_CONTROL_GESTURE);
|
||||
sendActionRequest(action_request_s::ACTION_KILL, action_request_s::SOURCE_STICK_GESTURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user