Added kiss rates (#8251)

Added kiss rates
This commit is contained in:
Michael Keller 2019-05-19 13:52:47 +12:00 committed by GitHub
commit b1d1fba775
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View File

@ -325,7 +325,7 @@ static const char * const lookupTableGyroOverflowCheck[] = {
#endif
static const char * const lookupTableRatesType[] = {
"BETAFLIGHT", "RACEFLIGHT"
"BETAFLIGHT", "RACEFLIGHT", "KISS"
};
#ifdef USE_OVERCLOCK

View File

@ -27,6 +27,7 @@
typedef enum {
RATES_TYPE_BETAFLIGHT = 0,
RATES_TYPE_RACEFLIGHT,
RATES_TYPE_KISS,
} ratesType_e;
typedef enum {

View File

@ -148,6 +148,17 @@ float applyRaceFlightRates(const int axis, float rcCommandf, const float rcComma
return angleRate;
}
float applyKissRates(const int axis, float rcCommandf, const float rcCommandfAbs)
{
const float rcCurvef = currentControlRateProfile->rcExpo[axis] / 100.0f;
float kissRpyUseRates = 1.0f / (constrainf(1.0f - (rcCommandfAbs * (currentControlRateProfile->rates[axis] / 100.0f)), 0.01f, 1.00f));
float kissRcCommandf = (power3(rcCommandf) * rcCurvef + rcCommandf * (1 - rcCurvef)) * (currentControlRateProfile->rcRates[axis] / 1000.0f);
float kissAngle = constrainf(((2000.0f * kissRpyUseRates) * kissRcCommandf), -SETPOINT_RATE_LIMIT, SETPOINT_RATE_LIMIT);
return kissAngle;
}
static void calculateSetpointRate(int axis)
{
float angleRate;
@ -711,6 +722,10 @@ void initRcProcessing(void)
case RATES_TYPE_RACEFLIGHT:
applyRates = applyRaceFlightRates;
break;
case RATES_TYPE_KISS:
applyRates = applyKissRates;
break;
}