mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 11:59:58 +03:00
feedforward transition moved to feedforward.c
This commit is contained in:
parent
86aa5cc84e
commit
28d9d778a6
6 changed files with 33 additions and 20 deletions
|
@ -256,12 +256,12 @@ void pidStabilisationState(pidStabilisationState_e pidControllerState)
|
|||
|
||||
const angle_index_t rcAliasToAngleIndexMap[] = { AI_ROLL, AI_PITCH };
|
||||
|
||||
float pidGetFeedforwardBoostFactor()
|
||||
#ifdef USE_FEEDFORWARD
|
||||
float pidGetFeedforwardTransitionFactor()
|
||||
{
|
||||
return pidRuntime.feedforwardBoostFactor;
|
||||
return pidRuntime.feedforwardTransitionFactor;
|
||||
}
|
||||
|
||||
#ifdef USE_FEEDFORWARD
|
||||
float pidGetFeedforwardSmoothFactor()
|
||||
{
|
||||
return pidRuntime.feedforwardSmoothFactor;
|
||||
|
@ -271,6 +271,11 @@ float pidGetFeedforwardJitterFactor()
|
|||
{
|
||||
return pidRuntime.feedforwardJitterFactor;
|
||||
}
|
||||
|
||||
float pidGetFeedforwardBoostFactor()
|
||||
{
|
||||
return pidRuntime.feedforwardBoostFactor;
|
||||
}
|
||||
#endif
|
||||
|
||||
void pidResetIterm(void)
|
||||
|
@ -1105,9 +1110,8 @@ void FAST_CODE pidController(const pidProfile_t *pidProfile, timeUs_t currentTim
|
|||
if (feedforwardGain > 0) {
|
||||
// halve feedforward in Level mode since stick sensitivity is weaker by about half
|
||||
feedforwardGain *= FLIGHT_MODE(ANGLE_MODE) ? 0.5f : 1.0f;
|
||||
// no transition if feedforwardTransition == 0
|
||||
float transition = pidRuntime.feedforwardTransition > 0 ? MIN(1.f, getRcDeflectionAbs(axis) * pidRuntime.feedforwardTransition) : 1;
|
||||
float feedForward = feedforwardGain * transition * pidSetpointDelta * pidRuntime.pidFrequency;
|
||||
// transition now calculated in feedforward.c when new RC data arrives
|
||||
float feedForward = feedforwardGain * pidSetpointDelta * pidRuntime.pidFrequency;
|
||||
|
||||
#ifdef USE_FEEDFORWARD
|
||||
pidData[axis].F = shouldApplyFeedforwardLimits(axis) ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue