ardupilot/ArduPlane/parachute.cpp

69 lines
1.6 KiB
C++
Raw Normal View History

#include "Plane.h"
/*
call parachute library update
*/
void Plane::parachute_check()
{
#if PARACHUTE == ENABLED
parachute.update();
parachute.check_sink_rate();
#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();
2018-06-10 03:33:06 -03:00
#if AP_LANDINGGEAR_ENABLED
2018-06-10 03:33:06 -03:00
// 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 AP_LANDINGGEAR_ENABLED
2018-06-10 03:33:06 -03:00
// deploy landing gear
g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy);
#endif
return true;
}
#endif