ardupilot/ArduSub/terrain.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
646 B
C++
Raw Normal View History

2016-05-03 22:57:47 -03:00
#include "Sub.h"
// update terrain data
void Sub::terrain_update()
{
#if AP_TERRAIN_AVAILABLE
2016-05-03 22:57:47 -03:00
terrain.update();
// tell the rangefinder our height, so it can go into power saving
// mode if available
#if RANGEFINDER_ENABLED == ENABLED
2016-05-03 22:57:47 -03:00
float height;
if (terrain.height_above_terrain(height, true)) {
rangefinder.set_estimated_terrain_height(height);
2016-05-03 22:57:47 -03:00
}
#endif
#endif
}
#if HAL_LOGGING_ENABLED
2016-05-03 22:57:47 -03:00
// log terrain data - should be called at 1hz
void Sub::terrain_logging()
{
#if AP_TERRAIN_AVAILABLE
2016-05-03 22:57:47 -03:00
if (should_log(MASK_LOG_GPS)) {
terrain.log_terrain_data();
2016-05-03 22:57:47 -03:00
}
#endif
}
#endif // HAL_LOGGING_ENABLED
2016-05-03 22:57:47 -03:00