From b7dff9578205c2795818f367f17837d3cdfdcdbf Mon Sep 17 00:00:00 2001 From: Nicolas de Palezieux Date: Wed, 24 Jan 2018 18:15:52 +0100 Subject: [PATCH] landing target estimator: check validity of the correct data before computing acceleration --- .../landing_target_estimator/LandingTargetEstimator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/landing_target_estimator/LandingTargetEstimator.cpp b/src/modules/landing_target_estimator/LandingTargetEstimator.cpp index 3ce4aa38bd..8c33ab91ae 100644 --- a/src/modules/landing_target_estimator/LandingTargetEstimator.cpp +++ b/src/modules/landing_target_estimator/LandingTargetEstimator.cpp @@ -94,14 +94,13 @@ void LandingTargetEstimator::update() PX4_WARN("Timeout"); _estimator_initialized = false; - } else if (_vehicleLocalPosition_valid - && _vehicleLocalPosition.v_xy_valid) { + } else { float dt = (hrt_absolute_time() - _last_predict) / SEC2USEC; // predict target position with the help of accel data matrix::Vector3f a; - if (_sensorBias_valid) { + if (_vehicleAttitude_valid && _sensorBias_valid) { matrix::Quaternion q_att(&_vehicleAttitude.q[0]); _R_att = matrix::Dcm(q_att); a(0) = _sensorBias.accel_x; @@ -272,7 +271,6 @@ void LandingTargetEstimator::_check_params(const bool force) void LandingTargetEstimator::_initialize_topics() { - // subscribe to position, attitude, arming and velocity changes _vehicleLocalPositionSub = orb_subscribe(ORB_ID(vehicle_local_position)); _attitudeSub = orb_subscribe(ORB_ID(vehicle_attitude)); _sensorBiasSub = orb_subscribe(ORB_ID(sensor_bias));