Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/ArduCopter/avoidance.cpp
9362 views
1
#include "Copter.h"
2
3
// check if proximity type Simple Avoidance should be enabled based on alt
4
void Copter::low_alt_avoidance()
5
{
6
#if AP_AVOIDANCE_ENABLED
7
float alt_m;
8
if (!get_rangefinder_height_interpolated_m(alt_m)) {
9
// enable avoidance if we don't have a valid rangefinder reading
10
avoid.proximity_alt_avoidance_enable(true);
11
return;
12
}
13
14
bool enable_avoidance = true;
15
if (alt_m < avoid.get_min_alt()) {
16
enable_avoidance = false;
17
}
18
avoid.proximity_alt_avoidance_enable(enable_avoidance);
19
#endif
20
}
21
22