2019-06-18 15:29:05 -03:00
|
|
|
#include "Copter.h"
|
|
|
|
|
|
|
|
// update terrain data
|
|
|
|
void Copter::terrain_update()
|
|
|
|
{
|
2021-02-12 23:40:10 -04:00
|
|
|
#if AP_TERRAIN_AVAILABLE
|
2019-06-18 15:29:05 -03:00
|
|
|
terrain.update();
|
|
|
|
|
|
|
|
// tell the rangefinder our height, so it can go into power saving
|
|
|
|
// mode if available
|
|
|
|
#if RANGEFINDER_ENABLED == ENABLED
|
|
|
|
float height;
|
|
|
|
if (terrain.height_above_terrain(height, true)) {
|
|
|
|
rangefinder.set_estimated_terrain_height(height);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
// log terrain data - should be called at 1hz
|
|
|
|
void Copter::terrain_logging()
|
|
|
|
{
|
2021-02-12 23:40:10 -04:00
|
|
|
#if AP_TERRAIN_AVAILABLE
|
2019-06-18 15:29:05 -03:00
|
|
|
if (should_log(MASK_LOG_GPS)) {
|
|
|
|
terrain.log_terrain_data();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|