mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Merge pull request #9495 from ctzsnooze/Actual-Rates
New Actual Rates model : set rates in deg/s, independently of each other
This commit is contained in:
commit
f33dd32c33
3 changed files with 18 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -28,6 +28,7 @@ typedef enum {
|
|||
RATES_TYPE_BETAFLIGHT = 0,
|
||||
RATES_TYPE_RACEFLIGHT,
|
||||
RATES_TYPE_KISS,
|
||||
RATES_TYPE_ACTUAL,
|
||||
} ratesType_e;
|
||||
|
||||
typedef enum {
|
||||
|
|
|
@ -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] * 10.0f;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue