add constraint to ground distance to avoid values below rng_gnd_clearance (#7662)

This commit is contained in:
ChristophTobler
2017-07-21 23:49:00 +02:00
committed by Paul Riseborough
parent a6c682ce50
commit bc951f6f15
+6
View File
@@ -942,6 +942,12 @@ void Ekf2::run()
lpos.dist_bottom_valid = _ekf.get_terrain_valid();
_ekf.get_terrain_vert_pos(&terrain_vpos);
lpos.dist_bottom = terrain_vpos - pos[2]; // Distance to bottom surface (ground) in meters
// constrain the distance to ground to _params->rng_gnd_clearance
if (lpos.dist_bottom < _params->rng_gnd_clearance) {
lpos.dist_bottom = _params->rng_gnd_clearance;
}
lpos.dist_bottom_rate = -velocity[2]; // Distance to bottom surface (ground) change rate
lpos.surface_bottom_timestamp = now; // Time when new bottom surface found