ardupilot/ArduCopter/precision_landing.cpp
Randy Mackay 3e7fb66a77 Copter: precision landing does not use terrain database
precision landing was always only using the range finder, there was no use of the provided alt unless the rangefinder was good
2019-12-17 20:02:01 +09:00

26 lines
503 B
C++

//
// functions to support precision landing
//
#include "Copter.h"
#if PRECISION_LANDING == ENABLED
void Copter::init_precland()
{
copter.precland.init(400);
}
void Copter::update_precland()
{
int32_t height_above_ground_cm = current_loc.alt;
// use range finder altitude if it is valid, otherwise use home alt
if (rangefinder_alt_ok()) {
height_above_ground_cm = rangefinder_state.alt_cm;
}
precland.update(height_above_ground_cm, rangefinder_alt_ok());
}
#endif