From b61d641bfc743e3cc58da05b50c869c0e7f59c7c Mon Sep 17 00:00:00 2001 From: ctzsnooze Date: Tue, 18 Feb 2020 10:04:25 +1100 Subject: [PATCH 1/2] Set actual rates in deg/s, independently of each other Each parameter is independent. Set actual centre sensitivity and actual max rates. For: Centre sensitivity of 200 = rcRate of 1.0; enter as 2.0 in Config, 200 CLI Max Rate of 800, enter sRate as 0.8 in Config, 80 in CLI Expo enter as usual, 0.5 approximates no expo, 0 is flatter, 1 is about the same as 0.5 expo usually, but won't change centre sensitivity. --- src/main/cli/settings.c | 2 +- src/main/fc/controlrate_profile.h | 1 + src/main/fc/rc.c | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/cli/settings.c b/src/main/cli/settings.c index d178d2f856..80b5aae0c2 100644 --- a/src/main/cli/settings.c +++ b/src/main/cli/settings.c @@ -336,7 +336,7 @@ static const char * const lookupTableGyroOverflowCheck[] = { #endif static const char * const lookupTableRatesType[] = { - "BETAFLIGHT", "RACEFLIGHT", "KISS" + "BETAFLIGHT", "RACEFLIGHT", "KISS", "ACTUAL" }; #ifdef USE_OVERCLOCK diff --git a/src/main/fc/controlrate_profile.h b/src/main/fc/controlrate_profile.h index 08fd20119b..16ad114392 100644 --- a/src/main/fc/controlrate_profile.h +++ b/src/main/fc/controlrate_profile.h @@ -28,6 +28,7 @@ typedef enum { RATES_TYPE_BETAFLIGHT = 0, RATES_TYPE_RACEFLIGHT, RATES_TYPE_KISS, + RATES_TYPE_ACTUAL, } ratesType_e; typedef enum { diff --git a/src/main/fc/rc.c b/src/main/fc/rc.c index d45729c818..74b2e8ae6c 100644 --- a/src/main/fc/rc.c +++ b/src/main/fc/rc.c @@ -193,6 +193,18 @@ float applyKissRates(const int axis, float rcCommandf, const float rcCommandfAbs return kissAngle; } +float applyActualRates(const int axis, float rcCommandf, const float rcCommandfAbs) +{ + float expof = currentControlRateProfile->rcExpo[axis] / 100.0f; + expof = rcCommandfAbs * (powerf(rcCommandf, 5) * expof + rcCommandf * (1 - expof)); + + const float centerSensitivity = currentControlRateProfile->rcRates[axis]; + const float stickMovement = MAX(0, currentControlRateProfile->rates[axis] * 10.0f - centerSensitivity); + const float angleRate = rcCommandf * centerSensitivity + stickMovement * expof; + + return angleRate; +} + float applyCurve(int axis, float deflection) { return applyRates(axis, deflection, fabsf(deflection)); @@ -816,6 +828,10 @@ void initRcProcessing(void) case RATES_TYPE_KISS: applyRates = applyKissRates; + break; + case RATES_TYPE_ACTUAL: + applyRates = applyActualRates; + break; } From 19694902fec7197a2d1e14c73a19e70c611a8314 Mon Sep 17 00:00:00 2001 From: ctzsnooze Date: Tue, 25 Feb 2020 12:45:09 +1100 Subject: [PATCH 2/2] SEnsitivity to 10 deg/s on both --- src/main/fc/rc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/fc/rc.c b/src/main/fc/rc.c index 74b2e8ae6c..cc77a5e268 100644 --- a/src/main/fc/rc.c +++ b/src/main/fc/rc.c @@ -198,7 +198,7 @@ float applyActualRates(const int axis, float rcCommandf, const float rcCommandfA float expof = currentControlRateProfile->rcExpo[axis] / 100.0f; expof = rcCommandfAbs * (powerf(rcCommandf, 5) * expof + rcCommandf * (1 - expof)); - const float centerSensitivity = currentControlRateProfile->rcRates[axis]; + const float centerSensitivity = currentControlRateProfile->rcRates[axis] * 10.0f; const float stickMovement = MAX(0, currentControlRateProfile->rates[axis] * 10.0f - centerSensitivity); const float angleRate = rcCommandf * centerSensitivity + stickMovement * expof;