Skip to content

Commit

Permalink
use Qplane option to allow autoland and fix auto-flaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Dec 21, 2024
1 parent f1fe400 commit e252174
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions ArduPlane/ArduPlane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,6 @@ void Plane::update_flight_stage(void)
// This prevents TECS from being stuck in the wrong stage if you switch from
// AUTO to, say, FBWB during a landing, an aborted landing or takeoff.
set_flight_stage(AP_FixedWing::FlightStage::NORMAL);
} else if (control_mode == &mode_autoland) {
set_flight_stage(AP_FixedWing::FlightStage::LAND);
}
return;
}
Expand Down
7 changes: 4 additions & 3 deletions ArduPlane/mode_autoland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ModeAutoLand::ModeAutoLand() :
}

bool ModeAutoLand::_enter()
{
{
//must be flying to enter
if (!plane.is_flying()) {
gcs().send_text(MAV_SEVERITY_WARNING, "Must already be flying!");
Expand All @@ -52,8 +52,8 @@ bool ModeAutoLand::_enter()

//takeoff direction must be set and must not be a quadplane, otherwise since flying switch to RTL so this can be used as FS action
#if HAL_QUADPLANE_ENABLED
if (quadplane.available()) {
gcs().send_text(MAV_SEVERITY_WARNING, "AutoLand is fixed wing only mode");
if (quadplane.available() && !quadplane.option_is_set(QuadPlane::OPTION::ALLOW_FW_LAND)) {
gcs().send_text(MAV_SEVERITY_WARNING, "Option not set to allow fixed wing autoland");
return false;
}
#endif
Expand Down Expand Up @@ -105,6 +105,7 @@ void ModeAutoLand::navigate()
plane.prev_WP_loc = plane.current_loc;
plane.next_WP_loc = home_loc;
plane.start_command(cmd);
plane.set_flight_stage(AP_FixedWing::FlightStage::LAND);
}
return;
//otherwise keep flying the current command
Expand Down
1 change: 1 addition & 0 deletions ArduPlane/quadplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class QuadPlane
friend class ModeQAutotune;
friend class ModeQAcro;
friend class ModeLoiterAltQLand;
friend class ModeAutoLand;

QuadPlane(AP_AHRS &_ahrs);

Expand Down
1 change: 1 addition & 0 deletions ArduPlane/servos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ void Plane::set_servos_flaps(void)
better than speed based flaps as it leads to less
possibility of oscillation
*/

switch (flight_stage) {
case AP_FixedWing::FlightStage::TAKEOFF:
case AP_FixedWing::FlightStage::ABORT_LANDING:
Expand Down

0 comments on commit e252174

Please sign in to comment.