From bd843284408afa53059c13563be4935b510d675f Mon Sep 17 00:00:00 2001 From: Jonathan Challinger Date: Sat, 21 Mar 2015 13:30:16 -0700 Subject: [PATCH] AP_InertialSensor: hack to "reset" the accel filter before taking a cal sample --- libraries/AP_InertialSensor/AP_InertialSensor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index d65cf9fa94..53f82e5c6b 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -508,8 +508,12 @@ bool AP_InertialSensor::calibrate_accel(AP_InertialSensor_UserInteract* interact goto failed; } - // clear out any existing samples from ins - update(); + // wait 100ms for ins filter to rise + for (uint8_t k=0; k<10; k++) { + wait_for_sample(); + update(); + hal.scheduler->delay(10); + } uint8_t num_samples = 0; while (num_samples < 32) {