mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Fixed tests.
This commit is contained in:
parent
1d998ea404
commit
03dc1a1aee
1 changed files with 5 additions and 5 deletions
|
@ -129,7 +129,7 @@ void setDefaultTestSettings(void) {
|
||||||
pidProfile->iterm_rotation = false;
|
pidProfile->iterm_rotation = false;
|
||||||
pidProfile->smart_feedforward = false,
|
pidProfile->smart_feedforward = false,
|
||||||
pidProfile->iterm_relax = ITERM_RELAX_OFF,
|
pidProfile->iterm_relax = ITERM_RELAX_OFF,
|
||||||
pidProfile->iterm_relax_cutoff = 20,
|
pidProfile->iterm_relax_cutoff = 11,
|
||||||
pidProfile->iterm_relax_type = ITERM_RELAX_SETPOINT,
|
pidProfile->iterm_relax_type = ITERM_RELAX_SETPOINT,
|
||||||
pidProfile->abs_control_gain = 0,
|
pidProfile->abs_control_gain = 0,
|
||||||
pidProfile->launchControlMode = LAUNCH_CONTROL_MODE_NORMAL,
|
pidProfile->launchControlMode = LAUNCH_CONTROL_MODE_NORMAL,
|
||||||
|
@ -529,12 +529,12 @@ TEST(pidControllerTest, testItermRelax) {
|
||||||
|
|
||||||
applyItermRelax(FD_PITCH, pidData[FD_PITCH].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
applyItermRelax(FD_PITCH, pidData[FD_PITCH].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
||||||
|
|
||||||
ASSERT_NEAR(-6.66, itermErrorRate, calculateTolerance(-6.66));
|
ASSERT_NEAR(-8.16, itermErrorRate, calculateTolerance(-6.66));
|
||||||
currentPidSetpoint += ITERM_RELAX_SETPOINT_THRESHOLD;
|
currentPidSetpoint += ITERM_RELAX_SETPOINT_THRESHOLD;
|
||||||
applyItermRelax(FD_PITCH, pidData[FD_PITCH].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
applyItermRelax(FD_PITCH, pidData[FD_PITCH].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
||||||
EXPECT_FLOAT_EQ(itermErrorRate, 0);
|
ASSERT_NEAR(-2.17, itermErrorRate, calculateTolerance(-2.17));
|
||||||
applyItermRelax(FD_PITCH, pidData[FD_PITCH].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
applyItermRelax(FD_PITCH, pidData[FD_PITCH].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
||||||
EXPECT_FLOAT_EQ(itermErrorRate, 0);
|
ASSERT_NEAR(-0.58, itermErrorRate, calculateTolerance(-0.58));
|
||||||
|
|
||||||
pidProfile->iterm_relax_type = ITERM_RELAX_GYRO;
|
pidProfile->iterm_relax_type = ITERM_RELAX_GYRO;
|
||||||
pidInit(pidProfile);
|
pidInit(pidProfile);
|
||||||
|
@ -578,7 +578,7 @@ TEST(pidControllerTest, testItermRelax) {
|
||||||
pidProfile->iterm_relax = ITERM_RELAX_RPY;
|
pidProfile->iterm_relax = ITERM_RELAX_RPY;
|
||||||
pidInit(pidProfile);
|
pidInit(pidProfile);
|
||||||
applyItermRelax(FD_YAW, pidData[FD_YAW].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
applyItermRelax(FD_YAW, pidData[FD_YAW].I, gyroRate, &itermErrorRate, ¤tPidSetpoint);
|
||||||
ASSERT_NEAR(-3.6, itermErrorRate, calculateTolerance(-3.6));
|
ASSERT_NEAR(-6.46, itermErrorRate, calculateTolerance(-3.6));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - Add more tests
|
// TODO - Add more tests
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue