mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-06 19:00:27 +08:00
Plane: auto-deploy landing gear on fixed wing landing
if LGR_OPTIONS is set to auto-deploy then deploy
This commit is contained in:
+17
-1
@@ -558,7 +558,23 @@ void Plane::set_flight_stage(AP_FixedWing::FlightStage fs)
|
||||
return;
|
||||
}
|
||||
|
||||
landing.handle_flight_stage_change(fs == AP_FixedWing::FlightStage::LAND);
|
||||
const bool is_landing = (fs == AP_FixedWing::FlightStage::LAND);
|
||||
|
||||
landing.handle_flight_stage_change(is_landing);
|
||||
|
||||
#if AP_LANDINGGEAR_ENABLED
|
||||
if (is_landing) {
|
||||
plane.g2.landing_gear.deploy_for_landing();
|
||||
}
|
||||
|
||||
const bool is_takeoff_complete = (flight_stage == AP_FixedWing::FlightStage::TAKEOFF &&
|
||||
fs == AP_FixedWing::FlightStage::NORMAL);
|
||||
if (is_takeoff_complete &&
|
||||
arming.is_armed_and_safety_off() &&
|
||||
is_flying()) {
|
||||
g2.landing_gear.retract_after_takeoff();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fs == AP_FixedWing::FlightStage::ABORT_LANDING) {
|
||||
gcs().send_text(MAV_SEVERITY_NOTICE, "Landing aborted, climbing to %dm",
|
||||
|
||||
@@ -1157,7 +1157,6 @@ private:
|
||||
void set_throttle(void);
|
||||
void set_takeoff_expected(void);
|
||||
void set_servos_flaps(void);
|
||||
void set_landing_gear(void);
|
||||
void dspoiler_update(void);
|
||||
void airbrake_update(void);
|
||||
void landing_neutral_control_surface_servos(void);
|
||||
|
||||
@@ -747,29 +747,6 @@ void Plane::set_servos_flaps(void)
|
||||
flaperon_update();
|
||||
}
|
||||
|
||||
#if AP_LANDINGGEAR_ENABLED
|
||||
/*
|
||||
setup landing gear state
|
||||
*/
|
||||
void Plane::set_landing_gear(void)
|
||||
{
|
||||
if (control_mode == &mode_auto && arming.is_armed_and_safety_off() && is_flying() && gear.last_flight_stage != flight_stage) {
|
||||
switch (flight_stage) {
|
||||
case AP_FixedWing::FlightStage::LAND:
|
||||
g2.landing_gear.deploy_for_landing();
|
||||
break;
|
||||
case AP_FixedWing::FlightStage::NORMAL:
|
||||
g2.landing_gear.retract_after_takeoff();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
gear.last_flight_stage = flight_stage;
|
||||
}
|
||||
#endif // AP_LANDINGGEAR_ENABLED
|
||||
|
||||
|
||||
/*
|
||||
support for twin-engine planes
|
||||
*/
|
||||
@@ -919,11 +896,6 @@ void Plane::set_servos(void)
|
||||
// setup flap outputs
|
||||
set_servos_flaps();
|
||||
|
||||
#if AP_LANDINGGEAR_ENABLED
|
||||
// setup landing gear output
|
||||
set_landing_gear();
|
||||
#endif
|
||||
|
||||
// set airbrake outputs
|
||||
airbrake_update();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user