From bb4d2717999d3826edfcdbecb6dd43c98bb4b989 Mon Sep 17 00:00:00 2001 From: m_thread Date: Fri, 10 Oct 2014 12:26:22 +0200 Subject: [PATCH] OP-1525 Made the Expo magic number a constant and changed it to 1.00695f. Changed n the firmware code to match the GCS side. --- flight/modules/ManualControl/stabilizedhandler.c | 4 ++-- .../src/plugins/config/configstabilizationwidget.cpp | 2 +- .../src/plugins/config/configstabilizationwidget.h | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/flight/modules/ManualControl/stabilizedhandler.c b/flight/modules/ManualControl/stabilizedhandler.c index 06a598f3f..c6b1c58ce 100644 --- a/flight/modules/ManualControl/stabilizedhandler.c +++ b/flight/modules/ManualControl/stabilizedhandler.c @@ -46,14 +46,14 @@ static float applyExpo(float value, float expo); static float applyExpo(float value, float expo) { // note: fastPow makes a small error, therefore result needs to be bound - float exp = boundf(fastPow(1.023293f, expo), 0.1f, 10.0f); + float exp = boundf(fastPow(1.00695f, expo), 0.1f, 10.0f); // magic number scales expo // so that // expo=100 yields value**10 // expo=0 yields value**1 // expo=-100 yields value**(1/10) - // (pow(10,1/100)~=1.023293) + // (pow(10,1/100)~=1.00695) if (value > 0.0f) { return boundf(fastPow(value, exp), 0.0f, 1.0f); } else if (value < -0.0f) { diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp index bcb6f7e76..7c9fb0eae 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp @@ -315,7 +315,7 @@ void ConfigStabilizationWidget::replotExpo(int value, QwtPlotCurve &curve) { double x[EXPO_CURVE_POINTS_COUNT] = { 0 }; double y[EXPO_CURVE_POINTS_COUNT] = { 0 }; - double factor = pow(1.03293, value); + double factor = pow(EXPO_CURVE_CONSTANT, value); double step = 1.0 / (EXPO_CURVE_POINTS_COUNT - 1); for (int i = 0; i < EXPO_CURVE_POINTS_COUNT; i++) { diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h index 980a2fca5..180700112 100644 --- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h @@ -56,6 +56,7 @@ private: static const int AUTOMATIC_UPDATE_RATE = 500; static const int EXPO_CURVE_POINTS_COUNT = 100; + static const double EXPO_CURVE_CONSTANT = 1.00695; int boardModel; int m_pidBankCount;