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/ArduSub/terrain.cpp
Views: 1798
1
#include "Sub.h"
2
3
// update terrain data
4
void Sub::terrain_update()
5
{
6
#if AP_TERRAIN_AVAILABLE
7
terrain.update();
8
9
// tell the rangefinder our height, so it can go into power saving
10
// mode if available
11
#if AP_RANGEFINDER_ENABLED
12
float height;
13
if (terrain.height_above_terrain(height, true)) {
14
rangefinder.set_estimated_terrain_height(height);
15
}
16
#endif
17
#endif
18
}
19
20
#if HAL_LOGGING_ENABLED
21
// log terrain data - should be called at 1hz
22
void Sub::terrain_logging()
23
{
24
#if AP_TERRAIN_AVAILABLE
25
if (should_log(MASK_LOG_GPS)) {
26
terrain.log_terrain_data();
27
}
28
#endif
29
}
30
#endif // HAL_LOGGING_ENABLED
31
32
33