From defe800745f31c29f198c11f207d8a31aff29845 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 17 May 2022 08:10:29 +1000 Subject: [PATCH] Copter: allow VTOL_TAKEOFF and VTOL_LAND as synonyms this allows is_takeoff_next() to be in common, and reduces confusion if user selects VTOL_TAKEOFF in a GCS mission editor --- ArduCopter/GCS_Mavlink.cpp | 2 ++ ArduCopter/mode_auto.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/ArduCopter/GCS_Mavlink.cpp b/ArduCopter/GCS_Mavlink.cpp index aebfc4d55b..0cdfea1785 100644 --- a/ArduCopter/GCS_Mavlink.cpp +++ b/ArduCopter/GCS_Mavlink.cpp @@ -743,6 +743,7 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_long_packet(const mavlink_command_ { switch(packet.command) { + case MAV_CMD_NAV_VTOL_TAKEOFF: case MAV_CMD_NAV_TAKEOFF: { // param3 : horizontal navigation by pilot acceptable // param4 : yaw angle (not supported) @@ -778,6 +779,7 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_long_packet(const mavlink_command_ } return MAV_RESULT_ACCEPTED; + case MAV_CMD_NAV_VTOL_LAND: case MAV_CMD_NAV_LAND: if (!copter.set_mode(Mode::Number::LAND, ModeReason::GCS_COMMAND)) { return MAV_RESULT_FAILED; diff --git a/ArduCopter/mode_auto.cpp b/ArduCopter/mode_auto.cpp index 437e38b600..fab0ba8b58 100644 --- a/ArduCopter/mode_auto.cpp +++ b/ArduCopter/mode_auto.cpp @@ -528,6 +528,7 @@ bool ModeAuto::start_command(const AP_Mission::Mission_Command& cmd) /// /// navigation commands /// + case MAV_CMD_NAV_VTOL_TAKEOFF: case MAV_CMD_NAV_TAKEOFF: // 22 do_takeoff(cmd); break; @@ -536,6 +537,7 @@ bool ModeAuto::start_command(const AP_Mission::Mission_Command& cmd) do_nav_wp(cmd); break; + case MAV_CMD_NAV_VTOL_LAND: case MAV_CMD_NAV_LAND: // 21 LAND to Waypoint do_land(cmd); break; @@ -764,6 +766,7 @@ bool ModeAuto::verify_command(const AP_Mission::Mission_Command& cmd) // // navigation commands // + case MAV_CMD_NAV_VTOL_TAKEOFF: case MAV_CMD_NAV_TAKEOFF: cmd_complete = verify_takeoff(); break; @@ -772,6 +775,7 @@ bool ModeAuto::verify_command(const AP_Mission::Mission_Command& cmd) cmd_complete = verify_nav_wp(cmd); break; + case MAV_CMD_NAV_VTOL_LAND: case MAV_CMD_NAV_LAND: cmd_complete = verify_land(); break; @@ -1286,10 +1290,12 @@ bool ModeAuto::set_next_wp(const AP_Mission::Mission_Command& current_cmd, const get_spline_from_cmd(next_cmd, default_loc, next_dest_loc, next_next_dest_loc, next_next_dest_loc_is_spline); return wp_nav->set_spline_destination_next_loc(next_dest_loc, next_next_dest_loc, next_next_dest_loc_is_spline); } + case MAV_CMD_NAV_VTOL_LAND: case MAV_CMD_NAV_LAND: // stop because we may change between rel,abs and terrain alt types case MAV_CMD_NAV_LOITER_TURNS: case MAV_CMD_NAV_RETURN_TO_LAUNCH: + case MAV_CMD_NAV_VTOL_TAKEOFF: case MAV_CMD_NAV_TAKEOFF: // always stop for RTL and takeoff commands default: