mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-03 16:30:35 +08:00
Use action_request to command RC VTOL transitions
This commit is contained in:
@@ -232,10 +232,10 @@ void ManualControl::Run()
|
||||
|
||||
if (switches.transition_switch != _previous_switches.transition_switch) {
|
||||
if (switches.transition_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
send_vtol_transition_command(vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW);
|
||||
sendActionRequest(action_request_s::ACTION_VTOL_TRANSITION_TO_FIXEDWING, action_request_s::SOURCE_RC_SWITCH);
|
||||
|
||||
} else if (switches.transition_switch == manual_control_switches_s::SWITCH_POS_OFF) {
|
||||
send_vtol_transition_command(vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC);
|
||||
sendActionRequest(action_request_s::ACTION_VTOL_TRANSITION_TO_MULTICOPTER, action_request_s::SOURCE_RC_SWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,19 +342,6 @@ void ManualControl::publish_landing_gear(int8_t action)
|
||||
landing_gear_pub.publish(landing_gear);
|
||||
}
|
||||
|
||||
void ManualControl::send_vtol_transition_command(uint8_t action)
|
||||
{
|
||||
vehicle_command_s command{};
|
||||
command.command = vehicle_command_s::VEHICLE_CMD_DO_VTOL_TRANSITION;
|
||||
command.param1 = action;
|
||||
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);
|
||||
}
|
||||
|
||||
int ManualControl::task_spawn(int argc, char *argv[])
|
||||
{
|
||||
ManualControl *instance = new ManualControl();
|
||||
|
||||
Reference in New Issue
Block a user