You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.6 KiB
67 lines
1.6 KiB
#include "Plane.h" |
|
|
|
|
|
/* |
|
call parachute library update |
|
*/ |
|
void Plane::parachute_check() |
|
{ |
|
#if PARACHUTE == ENABLED |
|
parachute.update(); |
|
#endif |
|
} |
|
|
|
#if PARACHUTE == ENABLED |
|
|
|
/* |
|
parachute_release - trigger the release of the parachute |
|
*/ |
|
void Plane::parachute_release() |
|
{ |
|
if (parachute.release_in_progress()) { |
|
return; |
|
} |
|
if (parachute.released()) { |
|
gcs().send_text(MAV_SEVERITY_CRITICAL,"Parachute: Released again"); |
|
} else { |
|
gcs().send_text(MAV_SEVERITY_CRITICAL,"Parachute: Released"); |
|
} |
|
|
|
// release parachute |
|
parachute.release(); |
|
|
|
#if LANDING_GEAR_ENABLED == ENABLED |
|
// deploy landing gear |
|
g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy); |
|
#endif |
|
} |
|
|
|
/* |
|
parachute_manual_release - trigger the release of the parachute, |
|
after performing some checks for pilot error checks if the vehicle |
|
is landed |
|
*/ |
|
bool Plane::parachute_manual_release() |
|
{ |
|
// exit immediately if parachute is not enabled |
|
if (!parachute.enabled() || parachute.released()) { |
|
return false; |
|
} |
|
|
|
if (parachute.alt_min() > 0 && relative_ground_altitude(false) < parachute.alt_min() && |
|
auto_state.last_flying_ms > 0) { |
|
// Allow manual ground tests by only checking if flying too low if we've taken off |
|
gcs().send_text(MAV_SEVERITY_WARNING, "Parachute: Too low"); |
|
return false; |
|
} |
|
|
|
// if we get this far release parachute |
|
parachute_release(); |
|
|
|
#if LANDING_GEAR_ENABLED == ENABLED |
|
// deploy landing gear |
|
g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy); |
|
#endif |
|
return true; |
|
} |
|
#endif |