Line data Source code
1 : #include "Plane.h" 2 : 3 : 4 : /* 5 : call parachute library update 6 : */ 7 547089 : void Plane::parachute_check() 8 : { 9 : #if HAL_PARACHUTE_ENABLED 10 547089 : parachute.update(); 11 547089 : parachute.check_sink_rate(); 12 : #endif 13 547089 : } 14 : 15 : #if HAL_PARACHUTE_ENABLED 16 : 17 : /* 18 : parachute_release - trigger the release of the parachute 19 : */ 20 3 : void Plane::parachute_release() 21 : { 22 3 : if (parachute.release_in_progress()) { 23 0 : return; 24 : } 25 3 : if (parachute.released()) { 26 0 : gcs().send_text(MAV_SEVERITY_CRITICAL,"Parachute: Released again"); 27 : } else { 28 3 : gcs().send_text(MAV_SEVERITY_CRITICAL,"Parachute: Released"); 29 : } 30 : 31 : // release parachute 32 3 : parachute.release(); 33 : 34 : #if AP_LANDINGGEAR_ENABLED 35 : // deploy landing gear 36 3 : g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy); 37 : #endif 38 : } 39 : 40 : /* 41 : parachute_manual_release - trigger the release of the parachute, 42 : after performing some checks for pilot error checks if the vehicle 43 : is landed 44 : */ 45 2 : bool Plane::parachute_manual_release() 46 : { 47 : // exit immediately if parachute is not enabled 48 2 : if (!parachute.enabled() || parachute.released()) { 49 0 : return false; 50 : } 51 : 52 4 : if (parachute.alt_min() > 0 && relative_ground_altitude(RangeFinderUse::NONE) < parachute.alt_min() && 53 2 : auto_state.last_flying_ms > 0) { 54 : // Allow manual ground tests by only checking if flying too low if we've taken off 55 0 : gcs().send_text(MAV_SEVERITY_WARNING, "Parachute: Too low"); 56 0 : return false; 57 : } 58 : 59 : // if we get this far release parachute 60 2 : parachute_release(); 61 : 62 : #if AP_LANDINGGEAR_ENABLED 63 : // deploy landing gear 64 2 : g2.landing_gear.set_position(AP_LandingGear::LandingGear_Deploy); 65 : #endif 66 2 : return true; 67 : } 68 : #endif