CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/ArduCopter/avoidance.cpp
Views: 1798
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
int32_t alt_cm;
8
if (!get_rangefinder_height_interpolated_cm(alt_cm)) {
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_cm < avoid.get_min_alt() * 100.0f) {
16
enable_avoidance = false;
17
}
18
avoid.proximity_alt_avoidance_enable(enable_avoidance);
19
#endif
20
}
21
22