Rename kill switch to emergency stop

This commit is contained in:
sluvd 2025-06-23 03:58:44 +02:00 committed by Claudio Chies
parent f7269c9c22
commit af439dc630
31 changed files with 63 additions and 63 deletions

View File

@ -24,7 +24,7 @@ Most users should set the following modes and functions, as these make the vehic
It is also common to map switches to:
- **Mission mode** — This mode runs a pre-programmed mission sent by the ground control station.
- <a id="kill_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
- <a id="emergency_stop_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
## Flight Mode Selection
@ -49,7 +49,7 @@ To configure single-channel flight mode selection:
* Select the flight mode that you want triggered for each switch position.
1. Specify *Switch Settings*:
* Select the channels that you want to map to specific actions - e.g.: *Return* mode, *Kill switch*, *offboard* mode, etc. (if you have spare switches and channels on your transmitter).
1. Test that the modes are mapped to the right transmitter switches:
* Check the *Channel Monitor* to confirm that the expected channel is changed by each switch.
* Select each mode switch on your transmitter in turn, and check that the desired flight mode is activated (the text turns yellow on *QGroundControl* for the active mode).

View File

@ -27,7 +27,7 @@ uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
uint8 kill_switch # throttle kill: _NORMAL_, KILL
uint8 emergency_stop_switch # throttle kill: _NORMAL_, KILL
uint8 termination_switch # trigger termination which cannot be undone
uint8 gear_switch # landing gear switch: _DOWN_, UP
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT

View File

@ -27,7 +27,7 @@ uint8 ARM_DISARM_REASON_COMMAND_EXTERNAL = 4
uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_LANDING = 6
uint8 ARM_DISARM_REASON_PREFLIGHT_INACTION = 7
uint8 ARM_DISARM_REASON_KILL_SWITCH = 8
uint8 ARM_DISARM_REASON_emergency_stop_switch = 8
uint8 ARM_DISARM_REASON_RC_BUTTON = 13
uint8 ARM_DISARM_REASON_FAILSAFE = 14

View File

@ -29,7 +29,7 @@ uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_SAFETY_BUTTON = 6
uint8 ARM_DISARM_REASON_AUTO_DISARM_LAND = 7
uint8 ARM_DISARM_REASON_AUTO_DISARM_PREFLIGHT = 8
uint8 ARM_DISARM_REASON_KILL_SWITCH = 9
uint8 ARM_DISARM_REASON_emergency_stop_switch = 9
uint8 ARM_DISARM_REASON_LOCKDOWN = 10
uint8 ARM_DISARM_REASON_FAILURE_DETECTOR = 11
uint8 ARM_DISARM_REASON_SHUTDOWN = 12

View File

@ -25,7 +25,7 @@ You can set any (or none) of the flight modes [available to your vehicle](../fli
It is also common to map switches to:
- **Mission mode** — This mode runs a pre-programmed mission sent by the ground control station.
- <a id="kill_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
- <a id="emergency_stop_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
## 비행 모드 선택

View File

@ -27,7 +27,7 @@ uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
uint8 kill_switch # throttle kill: _NORMAL_, KILL
uint8 emergency_stop_switch # throttle kill: _NORMAL_, KILL
uint8 termination_switch # trigger termination which cannot be undone
uint8 gear_switch # landing gear switch: _DOWN_, UP
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT

View File

@ -27,7 +27,7 @@ uint8 ARM_DISARM_REASON_COMMAND_EXTERNAL = 4
uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_LANDING = 6
uint8 ARM_DISARM_REASON_PREFLIGHT_INACTION = 7
uint8 ARM_DISARM_REASON_KILL_SWITCH = 8
uint8 ARM_DISARM_REASON_emergency_stop_switch = 8
uint8 ARM_DISARM_REASON_RC_BUTTON = 13
uint8 ARM_DISARM_REASON_FAILSAFE = 14

View File

@ -29,7 +29,7 @@ uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_SAFETY_BUTTON = 6
uint8 ARM_DISARM_REASON_AUTO_DISARM_LAND = 7
uint8 ARM_DISARM_REASON_AUTO_DISARM_PREFLIGHT = 8
uint8 ARM_DISARM_REASON_KILL_SWITCH = 9
uint8 ARM_DISARM_REASON_emergency_stop_switch = 9
uint8 ARM_DISARM_REASON_LOCKDOWN = 10
uint8 ARM_DISARM_REASON_FAILURE_DETECTOR = 11
uint8 ARM_DISARM_REASON_SHUTDOWN = 12

View File

@ -25,7 +25,7 @@ You can set any (or none) of the flight modes [available to your vehicle](../fli
Також звичайно відображати перемикачі на:
- **Mission mode** — This mode runs a pre-programmed mission sent by the ground control station.
- <a id="kill_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
- <a id="emergency_stop_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
## Вибір режиму польоту

View File

@ -27,7 +27,7 @@ uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
uint8 kill_switch # throttle kill: _NORMAL_, KILL
uint8 emergency_stop_switch # throttle kill: _NORMAL_, KILL
uint8 termination_switch # trigger termination which cannot be undone
uint8 gear_switch # landing gear switch: _DOWN_, UP
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT

View File

@ -27,7 +27,7 @@ uint8 ARM_DISARM_REASON_COMMAND_EXTERNAL = 4
uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_LANDING = 6
uint8 ARM_DISARM_REASON_PREFLIGHT_INACTION = 7
uint8 ARM_DISARM_REASON_KILL_SWITCH = 8
uint8 ARM_DISARM_REASON_emergency_stop_switch = 8
uint8 ARM_DISARM_REASON_RC_BUTTON = 13
uint8 ARM_DISARM_REASON_FAILSAFE = 14

View File

@ -29,7 +29,7 @@ uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_SAFETY_BUTTON = 6
uint8 ARM_DISARM_REASON_AUTO_DISARM_LAND = 7
uint8 ARM_DISARM_REASON_AUTO_DISARM_PREFLIGHT = 8
uint8 ARM_DISARM_REASON_KILL_SWITCH = 9
uint8 ARM_DISARM_REASON_emergency_stop_switch = 9
uint8 ARM_DISARM_REASON_LOCKDOWN = 10
uint8 ARM_DISARM_REASON_FAILURE_DETECTOR = 11
uint8 ARM_DISARM_REASON_SHUTDOWN = 12

View File

@ -25,7 +25,7 @@ Most users should set the following modes and functions, as these make the vehic
It is also common to map switches to:
- **Mission mode** — This mode runs a pre-programmed mission sent by the ground control station.
- <a id="kill_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
- <a id="emergency_stop_switch"></a> [Kill Switch](../config/safety.md#kill-switch) - Immediately stops all motor outputs (the vehicle will crash, which may in some circumstances be more desirable than allowing it to continue flying).
## Flight Mode Selection

View File

@ -27,7 +27,7 @@ uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
uint8 kill_switch # throttle kill: _NORMAL_, KILL
uint8 emergency_stop_switch # throttle kill: _NORMAL_, KILL
uint8 termination_switch # trigger termination which cannot be undone
uint8 gear_switch # landing gear switch: _DOWN_, UP
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT

View File

@ -27,7 +27,7 @@ uint8 ARM_DISARM_REASON_COMMAND_EXTERNAL = 4
uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_LANDING = 6
uint8 ARM_DISARM_REASON_PREFLIGHT_INACTION = 7
uint8 ARM_DISARM_REASON_KILL_SWITCH = 8
uint8 ARM_DISARM_REASON_emergency_stop_switch = 8
uint8 ARM_DISARM_REASON_RC_BUTTON = 13
uint8 ARM_DISARM_REASON_FAILSAFE = 14

View File

@ -29,7 +29,7 @@ uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_SAFETY_BUTTON = 6
uint8 ARM_DISARM_REASON_AUTO_DISARM_LAND = 7
uint8 ARM_DISARM_REASON_AUTO_DISARM_PREFLIGHT = 8
uint8 ARM_DISARM_REASON_KILL_SWITCH = 9
uint8 ARM_DISARM_REASON_emergency_stop_switch = 9
uint8 ARM_DISARM_REASON_LOCKDOWN = 10
uint8 ARM_DISARM_REASON_FAILURE_DETECTOR = 11
uint8 ARM_DISARM_REASON_SHUTDOWN = 12

View File

@ -10,8 +10,8 @@ uint8 action # [@enum ACTION] Requested acti
uint8 ACTION_DISARM = 0 # Disarm vehicle
uint8 ACTION_ARM = 1 # Arm vehicle
uint8 ACTION_TOGGLE_ARMING = 2 # Toggle arming
uint8 ACTION_UNKILL = 3 # Revert a kill action
uint8 ACTION_KILL = 4 # Kill vehicle (instantly stop the motors)
uint8 ACTION_REVERT_EMERGENGY_STOP = 3 # Revert a emergency stop action
uint8 ACTION_EMERGENGY_STOP = 4 # emergency stop the vehicle
uint8 ACTION_SWITCH_MODE = 5 # Switch mode. The target mode is set in the `mode` field.
uint8 ACTION_VTOL_TRANSITION_TO_MULTICOPTER = 6 # Transition to hover flight
uint8 ACTION_VTOL_TRANSITION_TO_FIXEDWING = 7 # Transition to fast forward flight

View File

@ -22,7 +22,7 @@ uint8 arm_switch # arm/disarm switch: _DISARMED_, ARMED
uint8 return_switch # return to launch 2 position switch (mandatory): _NORMAL_, RTL
uint8 loiter_switch # loiter 2 position switch (optional): _MISSION_, LOITER
uint8 offboard_switch # offboard 2 position switch (optional): _NORMAL_, OFFBOARD
uint8 kill_switch # throttle kill: _NORMAL_, KILL
uint8 emergency_stop_switch # throttle kill: _NORMAL_, KILL
uint8 termination_switch # trigger termination which cannot be undone
uint8 gear_switch # landing gear switch: _DOWN_, UP
uint8 transition_switch # VTOL transition switch: _HOVER, FORWARD_FLIGHT

View File

@ -17,7 +17,7 @@ uint8 FUNCTION_AUX_6 = 13
uint8 FUNCTION_PARAM_1 = 14
uint8 FUNCTION_PARAM_2 = 15
uint8 FUNCTION_PARAM_3_5 = 16
uint8 FUNCTION_KILLSWITCH = 17
uint8 FUNCTION_EMERGENCYSTOPSWITCH = 17
uint8 FUNCTION_TRANSITION = 18
uint8 FUNCTION_GEAR = 19
uint8 FUNCTION_ARMSWITCH = 20

View File

@ -22,7 +22,7 @@ uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_SAFETY_BUTTON = 6
uint8 ARM_DISARM_REASON_AUTO_DISARM_LAND = 7
uint8 ARM_DISARM_REASON_AUTO_DISARM_PREFLIGHT = 8
uint8 ARM_DISARM_REASON_KILL_SWITCH = 9
uint8 ARM_DISARM_REASON_emergency_stop_switch = 9
uint8 ARM_DISARM_REASON_LOCKDOWN = 10
uint8 ARM_DISARM_REASON_FAILURE_DETECTOR = 11
uint8 ARM_DISARM_REASON_SHUTDOWN = 12

View File

@ -20,7 +20,7 @@ uint8 ARM_DISARM_REASON_COMMAND_EXTERNAL = 4
uint8 ARM_DISARM_REASON_MISSION_START = 5
uint8 ARM_DISARM_REASON_LANDING = 6
uint8 ARM_DISARM_REASON_PREFLIGHT_INACTION = 7
uint8 ARM_DISARM_REASON_KILL_SWITCH = 8
uint8 ARM_DISARM_REASON_emergency_stop_switch = 8
uint8 ARM_DISARM_REASON_RC_BUTTON = 13
uint8 ARM_DISARM_REASON_FAILSAFE = 14

View File

@ -360,7 +360,7 @@ struct msp_rendor_rssi_t {
// MSP_ARMING_CONFIG reply
struct msp_arming_config_t {
uint8_t auto_disarm_delay;
uint8_t disarm_kill_switch;
uint8_t disarm_emergency_stop_switch;
} __attribute__((packed));

View File

@ -471,8 +471,8 @@
"description": "preflight inaction"
},
"8": {
"name": "kill_switch",
"description": "kill switch"
"name": "emergency_stop_switch",
"description": "emergency stop"
},
"13": {
"name": "rc_button",

View File

@ -526,7 +526,7 @@ static constexpr const char *arm_disarm_reason_str(arm_disarm_reason_t calling_r
static_assert(
(uint8_t)arm_disarm_reason_t::preflight_inaction == vehicle_status_s::ARM_DISARM_REASON_PREFLIGHT_INACTION,
"(dis)arm enum mismatch");
static_assert((uint8_t)arm_disarm_reason_t::kill_switch == vehicle_status_s::ARM_DISARM_REASON_KILL_SWITCH,
static_assert((uint8_t)arm_disarm_reason_t::emergency_stop_switch == vehicle_status_s::ARM_DISARM_REASON_emergency_stop_switch,
"(dis)arm enum mismatch");
static_assert((uint8_t)arm_disarm_reason_t::rc_button == vehicle_status_s::ARM_DISARM_REASON_RC_BUTTON,
"(dis)arm enum mismatch");
@ -548,7 +548,7 @@ static constexpr const char *arm_disarm_reason_str(arm_disarm_reason_t calling_r
case arm_disarm_reason_t::preflight_inaction: return "auto preflight disarming";
case arm_disarm_reason_t::kill_switch: return "kill-switch";
case arm_disarm_reason_t::emergency_stop_switch: return "emergency-stop";
case arm_disarm_reason_t::rc_button: return "RC button";
@ -1696,30 +1696,30 @@ void Commander::executeActionRequest(const action_request_s &action_request)
break;
case action_request_s::ACTION_UNKILL:
case action_request_s::ACTION_REVERT_EMERGENGY_STOP:
if (_actuator_armed.kill) {
mavlink_log_info(&_mavlink_log_pub, "Kill disengaged\t");
events::send(events::ID("commander_kill_sw_disengaged"), events::Log::Info, "Kill disengaged");
mavlink_log_info(&_mavlink_log_pub, "Emergency Stop Disengaged\t");
events::send(events::ID("commander_emergency_stop_disengaged"), events::Log::Info, "Emergency Stop Disengaged");
_status_changed = true;
_actuator_armed.kill = false;
}
break;
case action_request_s::ACTION_KILL:
case action_request_s::ACTION_EMERGENGY_STOP:
if (!_actuator_armed.kill) {
const char kill_switch_string[] = "Kill engaged\t";
const char emergency_stop_switch_string[] = "Emergency Stop Engaged\t";
events::LogLevels log_levels{events::Log::Info};
if (_vehicle_land_detected.landed) {
mavlink_log_info(&_mavlink_log_pub, kill_switch_string);
mavlink_log_info(&_mavlink_log_pub, emergency_stop_switch_string);
} else {
mavlink_log_critical(&_mavlink_log_pub, kill_switch_string);
mavlink_log_critical(&_mavlink_log_pub, emergency_stop_switch_string);
log_levels.external = events::Log::Critical;
}
events::send(events::ID("commander_kill_sw_engaged"), log_levels, "Kill engaged");
events::send(events::ID("commander_emergency_stop_engaged"), log_levels, "Emergency Stop Engaged");
_status_changed = true;
_actuator_armed.kill = true;
@ -1931,7 +1931,7 @@ void Commander::run()
_actuator_armed.prearmed = getPrearmState();
_actuator_armed.ready_to_arm = _vehicle_status.pre_flight_checks_pass || isArmed();
_actuator_armed.lockdown = _multicopter_throw_launch.isThrowLaunchInProgress();
// _actuator_armed.kill // action_request_s::ACTION_KILL
// _actuator_armed.kill // action_request_s::ACTION_EMERGENGY_STOP
_actuator_armed.termination = (_vehicle_status.nav_state == _vehicle_status.NAVIGATION_STATE_TERMINATION);
// _actuator_armed.in_esc_calibration_mode // VEHICLE_CMD_PREFLIGHT_CALIBRATION
@ -2309,7 +2309,7 @@ void Commander::handleAutoDisarm()
_auto_disarm_killed.set_state_and_update(_actuator_armed.kill, hrt_absolute_time());
if (_auto_disarm_killed.get_state()) {
disarm(arm_disarm_reason_t::kill_switch, true);
disarm(arm_disarm_reason_t::emergency_stop_switch, true);
}
} else {

View File

@ -58,15 +58,15 @@ void ManualControlChecks::checkAndReport(const Context &context, Report &reporte
}
}
if (manual_control_switches.kill_switch == manual_control_switches_s::SWITCH_POS_ON) {
if (manual_control_switches.emergency_stop_switch == manual_control_switches_s::SWITCH_POS_ON) {
/* EVENT
*/
reporter.armingCheckFailure(NavModes::All, health_component_t::remote_control,
events::ID("check_man_control_kill_engaged"),
events::Log::Error, "Kill switch engaged");
events::ID("check_man_control_emergency_stop_engaged"),
events::Log::Error, "Emergency Stop Engaged");
if (reporter.mavlink_log_pub()) {
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Kill switch engaged");
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Emergency Stop Engaged");
}
}

View File

@ -734,9 +734,9 @@ PARAM_DEFINE_INT32(COM_FORCE_SAFETY, 0);
PARAM_DEFINE_INT32(COM_MOT_TEST_EN, 1);
/**
* Timeout value for disarming when kill switch is engaged
* Timeout value for disarming when emergency stop switch is engaged
*
* Use RC_MAP_KILL_SW to map a kill switch.
* Use RC_MAP_KILL_SW to map a emergency stop switch.
*
* @group Commander
* @unit s

View File

@ -228,12 +228,12 @@ void ManualControl::processSwitches(hrt_abstime &now)
}
}
if (switches.kill_switch != _previous_switches.kill_switch) {
if (switches.kill_switch == manual_control_switches_s::SWITCH_POS_ON) {
sendActionRequest(action_request_s::ACTION_KILL, action_request_s::SOURCE_RC_SWITCH);
if (switches.emergency_stop_switch != _previous_switches.emergency_stop_switch) {
if (switches.emergency_stop_switch == manual_control_switches_s::SWITCH_POS_ON) {
sendActionRequest(action_request_s::ACTION_EMERGENGY_STOP, action_request_s::SOURCE_RC_SWITCH);
} else if (switches.kill_switch == manual_control_switches_s::SWITCH_POS_OFF) {
sendActionRequest(action_request_s::ACTION_UNKILL, action_request_s::SOURCE_RC_SWITCH);
} else if (switches.emergency_stop_switch == manual_control_switches_s::SWITCH_POS_OFF) {
sendActionRequest(action_request_s::ACTION_REVERT_EMERGENGY_STOP, action_request_s::SOURCE_RC_SWITCH);
}
}
@ -396,7 +396,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_STICK_GESTURE);
sendActionRequest(action_request_s::ACTION_EMERGENGY_STOP, action_request_s::SOURCE_STICK_GESTURE);
}
}
}

View File

@ -36,8 +36,8 @@
static constexpr uint64_t SOME_TIME = 12345678;
static constexpr uint8_t ACTION_KILL = action_request_s::ACTION_KILL;
static constexpr uint8_t ACTION_UNKILL = action_request_s::ACTION_UNKILL;
static constexpr uint8_t ACTION_EMERGENGY_STOP = action_request_s::ACTION_EMERGENGY_STOP;
static constexpr uint8_t ACTION_REVERT_EMERGENGY_STOP = action_request_s::ACTION_REVERT_EMERGENGY_STOP;
static constexpr uint8_t ACTION_VTOL_TRANSITION_TO_FIXEDWING = action_request_s::ACTION_VTOL_TRANSITION_TO_FIXEDWING;
static constexpr uint8_t ACTION_VTOL_TRANSITION_TO_MULTICOPTER =
action_request_s::ACTION_VTOL_TRANSITION_TO_MULTICOPTER;
@ -93,12 +93,12 @@ public:
};
TEST_F(SwitchTest, KillSwitch)
TEST_F(SwitchTest, EmergencyStopSwitch)
{
// GIVEN: valid stick input from RC
_manual_control_input_pub.publish({.timestamp_sample = _timestamp, .valid = true, .data_source = manual_control_setpoint_s::SOURCE_RC});
// and kill switch in off position
_manual_control_switches_pub.publish({.timestamp_sample = _timestamp, .kill_switch = manual_control_switches_s::SWITCH_POS_ON});
_manual_control_switches_pub.publish({.timestamp_sample = _timestamp, .emergency_stop_switch = manual_control_switches_s::SWITCH_POS_ON});
_manual_control.processInput(_timestamp += 100_ms);
// THEN: the stick input is published for use
@ -108,20 +108,20 @@ TEST_F(SwitchTest, KillSwitch)
EXPECT_FALSE(_action_request_sub.update());
// WHEN: the kill switch is switched on
_manual_control_switches_pub.publish({.timestamp_sample = _timestamp, .kill_switch = manual_control_switches_s::SWITCH_POS_OFF});
_manual_control_switches_pub.publish({.timestamp_sample = _timestamp, .emergency_stop_switch = manual_control_switches_s::SWITCH_POS_OFF});
_manual_control.processInput(_timestamp += 100_ms);
// THEN: a kill action request is published
EXPECT_TRUE(_action_request_sub.update());
EXPECT_EQ(_action_request_sub.get().action, ACTION_UNKILL);
EXPECT_EQ(_action_request_sub.get().action, ACTION_REVERT_EMERGENGY_STOP);
// WHEN: the kill switch is switched off again
_manual_control_switches_pub.publish({.timestamp_sample = _timestamp, .kill_switch = manual_control_switches_s::SWITCH_POS_ON});
_manual_control_switches_pub.publish({.timestamp_sample = _timestamp, .emergency_stop_switch = manual_control_switches_s::SWITCH_POS_ON});
_manual_control.processInput(_timestamp += 100_ms);
// THEN: an unkill action request is published
EXPECT_TRUE(_action_request_sub.update());
EXPECT_EQ(_action_request_sub.get().action, ACTION_KILL);
EXPECT_EQ(_action_request_sub.get().action, ACTION_EMERGENGY_STOP);
}
TEST_F(SwitchTest, TransitionSwitch)

View File

@ -83,7 +83,7 @@ private:
msg.buttons |= (manual_control_switches.return_switch << (shift * 1));
msg.buttons |= (manual_control_switches.loiter_switch << (shift * 3));
msg.buttons |= (manual_control_switches.offboard_switch << (shift * 5));
msg.buttons |= (manual_control_switches.kill_switch << (shift * 6));
msg.buttons |= (manual_control_switches.emergency_stop_switch << (shift * 6));
}
if (PX4_ISFINITE(manual_control_setpoint.aux1)) {

View File

@ -1212,7 +1212,7 @@ PARAM_DEFINE_INT32(RC_MAP_LOITER_SW, 0);
PARAM_DEFINE_INT32(RC_MAP_OFFB_SW, 0);
/**
* Emergency Kill switch channel
* Emergency stop switch channel
*
* This channel immediately sets all outputs to their disarmed values, parachutes are NOT deployed.
* Unlike termination this can be undone. Quickly flipping the switch back restores control.

View File

@ -51,7 +51,7 @@ static bool operator ==(const manual_control_switches_s &a, const manual_control
a.return_switch == b.return_switch &&
a.loiter_switch == b.loiter_switch &&
a.offboard_switch == b.offboard_switch &&
a.kill_switch == b.kill_switch &&
a.emergency_stop_switch == b.emergency_stop_switch &&
a.arm_switch == b.arm_switch &&
a.transition_switch == b.transition_switch &&
a.gear_switch == b.gear_switch &&
@ -198,7 +198,7 @@ void RCUpdate::update_rc_functions()
_rc.function[rc_channels_s::FUNCTION_RETURN] = _param_rc_map_return_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_LOITER] = _param_rc_map_loiter_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_OFFBOARD] = _param_rc_map_offb_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_KILLSWITCH] = _param_rc_map_kill_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_EMERGENCYSTOPSWITCH] = _param_rc_map_kill_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_TERMINATION] = _param_rc_map_term_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_ARMSWITCH] = _param_rc_map_arm_sw.get() - 1;
_rc.function[rc_channels_s::FUNCTION_TRANSITION] = _param_rc_map_trans_sw.get() - 1;
@ -620,7 +620,7 @@ void RCUpdate::UpdateManualSwitches(const hrt_abstime &timestamp_sample)
switches.return_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_RETURN, _param_rc_return_th.get());
switches.loiter_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_LOITER, _param_rc_loiter_th.get());
switches.offboard_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_OFFBOARD, _param_rc_offb_th.get());
switches.kill_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_KILLSWITCH, _param_rc_killswitch_th.get());
switches.emergency_stop_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_EMERGENCYSTOPSWITCH, _param_rc_killswitch_th.get());
switches.termination_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_TERMINATION, .75f);
switches.arm_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_ARMSWITCH, _param_rc_armswitch_th.get());
switches.transition_switch = getRCSwitchOnOffPosition(rc_channels_s::FUNCTION_TRANSITION, _param_rc_trans_th.get());