We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ecb843b commit f67843eCopy full SHA for f67843e
ArduCopter/precision_landing.cpp
@@ -15,13 +15,15 @@ void Copter::init_precland()
15
16
void Copter::update_precland()
17
{
18
- float final_alt = current_loc.alt;
+ int32_t height_above_ground_cm = current_loc.alt;
19
20
- // use range finder altitude if it is valid
+ // use range finder altitude if it is valid, else try to get terrain alt
21
if (rangefinder_alt_ok()) {
22
- final_alt = rangefinder_state.alt_cm;
+ height_above_ground_cm = rangefinder_state.alt_cm;
23
+ } else if (terrain_use()) {
24
+ current_loc.get_alt_cm(Location_Class::ALT_FRAME_ABOVE_TERRAIN, height_above_ground_cm);
25
}
26
- copter.precland.update(final_alt);
27
+ copter.precland.update(height_above_ground_cm);
28
29
#endif
0 commit comments