From 4d7cc41921101cf9ee91793cf12e21c3d94a7c19 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 14 Oct 2015 12:12:58 +0200 Subject: [PATCH 1/2] EKF: Retain minimum Kalman update rate --- .../ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h | 1 + .../ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h b/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h index 57df913069..421e109eb3 100644 --- a/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h +++ b/src/modules/ekf_att_pos_estimator/AttitudePositionEstimatorEKF.h @@ -177,6 +177,7 @@ private: hrt_abstime _last_accel; hrt_abstime _last_mag; unsigned _prediction_steps; + uint64_t _prediction_last; struct sensor_combined_s _sensor_combined; diff --git a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp index 587d22bac4..afb7cfbac5 100644 --- a/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp +++ b/src/modules/ekf_att_pos_estimator/ekf_att_pos_estimator_main.cpp @@ -157,6 +157,7 @@ AttitudePositionEstimatorEKF::AttitudePositionEstimatorEKF() : _last_accel(0), _last_mag(0), _prediction_steps(0), + _prediction_last(0), _sensor_combined{}, @@ -997,11 +998,12 @@ void AttitudePositionEstimatorEKF::updateSensorFusion(const bool fuseGPS, const _covariancePredictionDt += _ekf->dtIMU; // only fuse every few steps - if (_prediction_steps < MAX_PREDICITION_STEPS) { + if (_prediction_steps < MAX_PREDICITION_STEPS && ((hrt_absolute_time() - _prediction_last) < 20 * 1000)) { _prediction_steps++; return; } else { _prediction_steps = 0; + _prediction_last = hrt_absolute_time(); } // perform a covariance prediction if the total delta angle has exceeded the limit From 51707245bb643a79bec6a75e3a151549ad1093c1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Wed, 14 Oct 2015 12:13:20 +0200 Subject: [PATCH 2/2] Makefile: Use blunt force to ensure uavcan submodule is up to date --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a507be0826..2b9a34553f 100644 --- a/Makefile +++ b/Makefile @@ -104,13 +104,13 @@ endef # -------------------------------------------------------------------- # Do not put any spaces between function arguments. -px4fmu-v1_default: +px4fmu-v1_default: git-init $(call cmake-build,nuttx_px4fmu-v1_default) -px4fmu-v2_default: +px4fmu-v2_default: git-init $(call cmake-build,nuttx_px4fmu-v2_default) -px4fmu-v2_simple: +px4fmu-v2_simple: git-init $(call cmake-build,nuttx_px4fmu-v2_simple) nuttx_sim_simple: @@ -181,6 +181,11 @@ distclean: clean @git clean -d -f -x @cd ../../../.. +# XXX this is not the right way to fix it, but we need a temporary solution +# for average joe +git-init: + @git submodule update --init --recursive + # targets handled by cmake cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak libuavcan $(foreach targ,$(cmake_targets),$(eval $(call cmake-targ,$(targ))))