Skip to content
Snippets Groups Projects
Commit 269d077f authored by Matthias Grob's avatar Matthias Grob Committed by Roman Bapst
Browse files

ekf2: only check ground effect if it's configured

parent f034d2da
No related branches found
No related tags found
No related merge requests found
...@@ -1419,7 +1419,8 @@ void Ekf2::run() ...@@ -1419,7 +1419,8 @@ void Ekf2::run()
_had_valid_terrain = lpos.dist_bottom_valid; _had_valid_terrain = lpos.dist_bottom_valid;
} }
if (vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED) { // only consider ground effect if compensation is configured and the vehicle is armed (props spinning)
if (_param_ekf2_gnd_eff_dz.get() > 0.0f && vehicle_status.arming_state == vehicle_status_s::ARMING_STATE_ARMED) {
// set ground effect flag if vehicle is closer than a specified distance to the ground // set ground effect flag if vehicle is closer than a specified distance to the ground
if (lpos.dist_bottom_valid) { if (lpos.dist_bottom_valid) {
_ekf.set_gnd_effect_flag(lpos.dist_bottom < _param_ekf2_gnd_max_hgt.get()); _ekf.set_gnd_effect_flag(lpos.dist_bottom < _param_ekf2_gnd_max_hgt.get());
...@@ -1428,7 +1429,7 @@ void Ekf2::run() ...@@ -1428,7 +1429,7 @@ void Ekf2::run()
// _had_valid_terrain is used to make sure that we don't fall back to using this option // _had_valid_terrain is used to make sure that we don't fall back to using this option
// if we temporarily lose terrain data due to the distance sensor getting out of range // if we temporarily lose terrain data due to the distance sensor getting out of range
} else if (vehicle_land_detected_updated && _param_ekf2_gnd_eff_dz.get() > 0.0f && !_had_valid_terrain) { } else if (vehicle_land_detected_updated && !_had_valid_terrain) {
// update ground effect flag based on land detector state // update ground effect flag based on land detector state
_ekf.set_gnd_effect_flag(vehicle_land_detected.in_ground_effect); _ekf.set_gnd_effect_flag(vehicle_land_detected.in_ground_effect);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment