1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-25 17:25:20 +03:00

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 #endif
static const char * const lookupTableRatesType[] = { static const char * const lookupTableRatesType[] = {
"BETAFLIGHT", "RACEFLIGHT" "BETAFLIGHT", "RACEFLIGHT", "KISS"
}; };
#ifdef USE_OVERCLOCK #ifdef USE_OVERCLOCK

View file

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

View file

@ -148,6 +148,17 @@ float applyRaceFlightRates(const int axis, float rcCommandf, const float rcComma
return angleRate; 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) static void calculateSetpointRate(int axis)
{ {
float angleRate; float angleRate;
@ -711,6 +722,10 @@ void initRcProcessing(void)
case RATES_TYPE_RACEFLIGHT: case RATES_TYPE_RACEFLIGHT:
applyRates = applyRaceFlightRates; applyRates = applyRaceFlightRates;
break;
case RATES_TYPE_KISS:
applyRates = applyKissRates;
break; break;
} }