land_detector: don't estimate freefall on 0 data

This commit is contained in:
Julian Oes
2016-06-05 14:36:43 +02:00
committed by Lorenz Meier
parent b2719cf439
commit f56e951f00
@@ -135,6 +135,11 @@ bool MulticopterLandDetector::get_freefall_state()
const uint64_t now = hrt_absolute_time();
if (_ctrl_state.timestamp == 0) {
// _ctrl_state is not valid yet, we have to assume we're not falling.
return false;
}
float acc_norm = _ctrl_state.x_acc * _ctrl_state.x_acc
+ _ctrl_state.y_acc * _ctrl_state.y_acc
+ _ctrl_state.z_acc * _ctrl_state.z_acc;