2015-06-18 07:45:33 -03:00
|
|
|
#include "Plane.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
call parachute library update
|
|
|
|
*/
|
|
|
|
void Plane::parachute_check()
|
|
|
|
{
|
2017-01-02 23:58:07 -04:00
|
|
|
#if PARACHUTE == ENABLED
|
2015-06-18 07:45:33 -03:00
|
|
|
parachute.update();
|
2020-09-16 03:25:58 -03:00
|
|
|
parachute.check_sink_rate();
|
2017-01-02 23:58:07 -04:00
|
|
|
#endif
|
2015-06-18 07:45:33 -03:00
|
|
|
}
|
|
|
|
|
2017-01-02 23:58:07 -04:00
|
|
|
#if PARACHUTE == ENABLED
|
|
|
|
|
2015-06-18 07:45:33 -03:00
|
|
|
/*
|
|
|
|
parachute_release - trigger the release of the parachute
|
|
|
|
*/
|
|
|
|
void Plane::parachute_release()
|
|
|
|
{
|
2017-07-26 09:29:42 -03:00
|
|
|
if (parachute.release_in_progress()) {
|
2015-06-18 07:45:33 -03:00
|
|
|
return;
|
|
|
|
}
|
2017-07-26 09:29:42 -03:00
|
|
|
if (parachute.released()) {
|
|
|
|
gcs().send_text(MAV_SEVERITY_CRITICAL,"Parachute: Released again");
|
|
|
|
} else {
|
|
|
|
gcs().send_text(MAV_SEVERITY_CRITICAL,"Parachute: Released");
|
|
|
|
}
|
2015-06-18 07:45:33 -03:00
|
|
|
|
|
|
|
// release parachute
|
|
|
|
parachute.release();
|
2018-06-10 03:33:06 -03:00
|
|
|
|
|
|
|
#if LANDING_GEAR_ENABLED == ENABLED
|
|
|
|
// deploy landing gear
|
|
|
|
g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy);
|
|
|
|
#endif
|
2015-06-18 07:45:33 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
parachute_manual_release - trigger the release of the parachute,
|
|
|
|
after performing some checks for pilot error checks if the vehicle
|
|
|
|
is landed
|
|
|
|
*/
|
2015-10-27 01:17:13 -03:00
|
|
|
bool Plane::parachute_manual_release()
|
2015-06-18 07:45:33 -03:00
|
|
|
{
|
|
|
|
// exit immediately if parachute is not enabled
|
|
|
|
if (!parachute.enabled() || parachute.released()) {
|
2015-10-27 01:17:13 -03:00
|
|
|
return false;
|
2015-06-18 07:45:33 -03:00
|
|
|
}
|
|
|
|
|
2016-06-07 13:02:09 -03:00
|
|
|
if (parachute.alt_min() > 0 && relative_ground_altitude(false) < parachute.alt_min() &&
|
2016-06-08 12:14:38 -03:00
|
|
|
auto_state.last_flying_ms > 0) {
|
2016-06-07 13:02:09 -03:00
|
|
|
// Allow manual ground tests by only checking if flying too low if we've taken off
|
2017-07-08 22:15:58 -03:00
|
|
|
gcs().send_text(MAV_SEVERITY_WARNING, "Parachute: Too low");
|
2015-10-27 01:17:13 -03:00
|
|
|
return false;
|
2015-06-18 07:45:33 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
// if we get this far release parachute
|
|
|
|
parachute_release();
|
2015-10-27 01:17:13 -03:00
|
|
|
|
2018-06-10 03:33:06 -03:00
|
|
|
#if LANDING_GEAR_ENABLED == ENABLED
|
|
|
|
// deploy landing gear
|
|
|
|
g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy);
|
|
|
|
#endif
|
|
|
|
return true;
|
2015-06-18 07:45:33 -03:00
|
|
|
}
|
2019-02-11 10:20:38 -04:00
|
|
|
#endif
|