Line data Source code
1 : #include "Copter.h" 2 : 3 : // check if proximity type Simple Avoidance should be enabled based on alt 4 228158 : void Copter::low_alt_avoidance() 5 : { 6 : #if AP_AVOIDANCE_ENABLED 7 : float alt_m; 8 228158 : if (!get_rangefinder_height_interpolated_m(alt_m)) { 9 : // enable avoidance if we don't have a valid rangefinder reading 10 216680 : avoid.proximity_alt_avoidance_enable(true); 11 216680 : return; 12 : } 13 : 14 11478 : bool enable_avoidance = true; 15 11478 : if (alt_m < avoid.get_min_alt()) { 16 364 : enable_avoidance = false; 17 : } 18 11478 : avoid.proximity_alt_avoidance_enable(enable_avoidance); 19 : #endif 20 : }