From 9e80c4da9c2f895f0de74490639b86b2ed3894b4 Mon Sep 17 00:00:00 2001 From: Andres <> Date: Fri, 23 May 2014 11:55:06 +0200 Subject: [PATCH] OP-1317 Low-pass filter parameters added to airpeedSettings: IMUBasedEstimationLowPassPeriod1 pre-filter period in seconds, IMUBasedEstimationLowPassPeriod2 filter period in seconds. Oscillations with shorter periods than these, are filtered. If airspeed has too much noise increase IMUBasedEstimationLowPassPeriod2, else if it is too smooth descrease it. --- flight/modules/Airspeed/imu_airspeed.c | 9 +++------ shared/uavobjectdefinition/airspeedsettings.xml | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/flight/modules/Airspeed/imu_airspeed.c b/flight/modules/Airspeed/imu_airspeed.c index baf2c6a52..65158fbb2 100644 --- a/flight/modules/Airspeed/imu_airspeed.c +++ b/flight/modules/Airspeed/imu_airspeed.c @@ -181,12 +181,9 @@ void imu_airspeedInitialize() void imu_airspeedGet(AirspeedSensorData *airspeedData, AirspeedSettingsData *airspeedSettings) { // pre-filter frequency rate - // corresponds to a cut-off frequency of 0.04 Hz or a period of 25 sec - const float ff = 0.04f * airspeedSettings->SamplePeriod / 1000.0f; - // good values for turbulent situation: cut-off 0.01 Hz or a period of 100 sec - const float ffV = 0.01f * airspeedSettings->SamplePeriod / 1000.0f; - // good values for steady situation: cut-off 0.05 Hz or a period of 20 sec -// const float ffV=0.05 * 1000.0f/airspeedSettings->SamplePeriod; + const float ff = (float)(airspeedSettings->SamplePeriod) / 1000.0f / airspeedSettings->IMUBasedEstimationLowPassPeriod1; + // filter frequency rate + const float ffV = (float)(airspeedSettings->SamplePeriod) / 1000.0f / airspeedSettings->IMUBasedEstimationLowPassPeriod2; float normVel2; float normDiffAttitude2; diff --git a/shared/uavobjectdefinition/airspeedsettings.xml b/shared/uavobjectdefinition/airspeedsettings.xml index 0c438afa5..00cd56241 100644 --- a/shared/uavobjectdefinition/airspeedsettings.xml +++ b/shared/uavobjectdefinition/airspeedsettings.xml @@ -5,7 +5,8 @@ - + +