mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Add test for anti-windup affecting Anti Gravity gain
This commit is contained in:
parent
c61efe1e2e
commit
2bdb660d56
1 changed files with 23 additions and 0 deletions
|
@ -498,6 +498,29 @@ TEST(pidControllerTest, testMixerSaturation)
|
|||
EXPECT_LT(pidData[FD_ROLL].I, rollTestIterm);
|
||||
EXPECT_GE(pidData[FD_PITCH].I, pitchTestIterm);
|
||||
EXPECT_LT(pidData[FD_YAW].I, yawTestIterm);
|
||||
|
||||
// Test that the added i term gain from Anti Gravity
|
||||
// is also affected by itermWindup
|
||||
resetTest();
|
||||
ENABLE_ARMING_FLAG(ARMED);
|
||||
pidStabilisationState(PID_STABILISATION_ON);
|
||||
|
||||
setStickPosition(FD_ROLL, 1.0f);
|
||||
setStickPosition(FD_PITCH, -1.0f);
|
||||
setStickPosition(FD_YAW, 1.0f);
|
||||
simulatedMotorMixRange = 2.0f;
|
||||
const bool prevAgState = pidRuntime.antiGravityEnabled;
|
||||
const float prevAgTrhottleD = pidRuntime.antiGravityThrottleD;
|
||||
pidRuntime.antiGravityEnabled = true;
|
||||
pidRuntime.antiGravityThrottleD = 1.0;
|
||||
pidController(pidProfile, currentTestTime());
|
||||
pidRuntime.antiGravityEnabled = prevAgState;
|
||||
pidRuntime.antiGravityThrottleD = prevAgTrhottleD;
|
||||
|
||||
// Expect no iterm accumulation for all axes
|
||||
EXPECT_FLOAT_EQ(0, pidData[FD_ROLL].I);
|
||||
EXPECT_FLOAT_EQ(0, pidData[FD_PITCH].I);
|
||||
EXPECT_FLOAT_EQ(0, pidData[FD_YAW].I);
|
||||
}
|
||||
|
||||
// TODO - Add more scenarios
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue