mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 14:53:33 +08:00
Use arm_request for manual killing
This commit is contained in:
@@ -165,7 +165,7 @@ void ManualControl::Run()
|
||||
_button_hysteresis.set_state_and_update(switches.arm_switch == manual_control_switches_s::SWITCH_POS_ON, now);
|
||||
|
||||
if (!previous_button_hysteresis && _button_hysteresis.get_state()) {
|
||||
sendArmRequest(arm_request_s::ACTION_TOGGLE, arm_request_s::SOURCE_RC_BUTTON);
|
||||
sendArmRequest(arm_request_s::ACTION_TOGGLE_ARMING, arm_request_s::SOURCE_RC_BUTTON);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -209,10 +209,10 @@ void ManualControl::Run()
|
||||
|
||||
if (switches.kill_switch != _previous_switches.kill_switch) {
|
||||
if (switches.kill_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
send_termination_command(true);
|
||||
sendArmRequest(arm_request_s::ACTION_KILL, arm_request_s::SOURCE_RC_SWITCH);
|
||||
|
||||
} else if (switches.kill_switch == manual_control_switches_s::SWITCH_POS_OFF) {
|
||||
send_termination_command(false);
|
||||
sendArmRequest(arm_request_s::ACTION_UNKILL, arm_request_s::SOURCE_RC_SWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,19 +469,6 @@ void ManualControl::send_offboard_command()
|
||||
command_pub.publish(command);
|
||||
}
|
||||
|
||||
void ManualControl::send_termination_command(bool should_terminate)
|
||||
{
|
||||
vehicle_command_s command{};
|
||||
command.command = vehicle_command_s::VEHICLE_CMD_DO_FLIGHTTERMINATION;
|
||||
command.param1 = should_terminate ? 1.0f : 0.0f;
|
||||
command.target_system = _param_mav_sys_id.get();
|
||||
command.target_component = _param_mav_comp_id.get();
|
||||
|
||||
uORB::Publication<vehicle_command_s> command_pub{ORB_ID(vehicle_command)};
|
||||
command.timestamp = hrt_absolute_time();
|
||||
command_pub.publish(command);
|
||||
}
|
||||
|
||||
void ManualControl::publish_landing_gear(int8_t action)
|
||||
{
|
||||
landing_gear_s landing_gear{};
|
||||
|
||||
@@ -125,7 +125,6 @@ private:
|
||||
void send_rtl_command();
|
||||
void send_loiter_command();
|
||||
void send_offboard_command();
|
||||
void send_termination_command(bool should_terminate);
|
||||
void publish_landing_gear(int8_t action);
|
||||
void send_vtol_transition_command(uint8_t action);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user