Skip to content

Commit

Permalink
Copter: precision landing does not use terrain database
Browse files Browse the repository at this point in the history
precision landing was always only using the range finder, there was no use of the provided alt unless the rangefinder was good
  • Loading branch information
rmackay9 committed Dec 17, 2019
1 parent ea22e88 commit 3e7fb66
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 16 deletions.
1 change: 0 additions & 1 deletion ArduCopter/Copter.h
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,6 @@ class Copter : public AP_Vehicle {
// terrain.cpp
void terrain_update();
void terrain_logging();
bool terrain_use();

// tuning.cpp
void tuning();
Expand Down
6 changes: 1 addition & 5 deletions ArduCopter/precision_landing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@ void Copter::update_precland()
{
int32_t height_above_ground_cm = current_loc.alt;

// use range finder altitude if it is valid, else try to get terrain 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;
} else if (terrain_use() && !current_loc.is_zero()) {
if (!current_loc.get_alt_cm(Location::AltFrame::ABOVE_TERRAIN, height_above_ground_cm)) {
height_above_ground_cm = current_loc.alt;
}
}

precland.update(height_above_ground_cm, rangefinder_alt_ok());
Expand Down
10 changes: 0 additions & 10 deletions ArduCopter/terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,3 @@ void Copter::terrain_logging()
}
#endif
}

// should we use terrain data for things including the home altitude
bool Copter::terrain_use()
{
#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
return (g.terrain_follow > 0);
#else
return false;
#endif
}

0 comments on commit 3e7fb66

Please sign in to comment.