mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
major rc changes ctzsnooze 2021
This commit is contained in:
parent
2a5e457603
commit
636d563abe
26 changed files with 377 additions and 546 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
bool simulatedAirmodeEnabled = true;
|
||||
float simulatedSetpointRate[3] = { 0,0,0 };
|
||||
float simulatedPrevSetpointRate[3] = { 0,0,0 };
|
||||
float simulatedRcDeflection[3] = { 0,0,0 };
|
||||
float simulatedThrottlePIDAttenuation = 1.0f;
|
||||
float simulatedMotorMixRange = 0.0f;
|
||||
|
@ -88,12 +89,26 @@ extern "C" {
|
|||
void beeperConfirmationBeeps(uint8_t) { }
|
||||
bool isLaunchControlActive(void) {return unitLaunchControlActive; }
|
||||
void disarm(flightLogDisarmReason_e) { }
|
||||
float applyFFLimit(int axis, float value, float Kp, float currentPidSetpoint) {
|
||||
float applyFeedforwardLimit(int axis, float value, float Kp, float currentPidSetpoint)
|
||||
{
|
||||
UNUSED(axis);
|
||||
UNUSED(Kp);
|
||||
UNUSED(currentPidSetpoint);
|
||||
return value;
|
||||
}
|
||||
void feedforwardInit(const pidProfile_t) { }
|
||||
float feedforwardApply(int axis, bool newRcFrame, feedforwardAveraging_t feedforwardAveraging)
|
||||
{
|
||||
UNUSED(newRcFrame);
|
||||
UNUSED(feedforwardAveraging);
|
||||
return simulatedSetpointRate[axis] - simulatedPrevSetpointRate[axis];
|
||||
}
|
||||
bool shouldApplyFeedforwardLimits(int axis)
|
||||
{
|
||||
UNUSED(axis);
|
||||
return true;
|
||||
}
|
||||
bool getShouldUpdateFeedforward() { return true; }
|
||||
void initRcProcessing(void) { }
|
||||
}
|
||||
|
||||
|
@ -124,7 +139,7 @@ void setDefaultTestSettings(void) {
|
|||
pidProfile->itermWindupPointPercent = 50;
|
||||
pidProfile->pidAtMinThrottle = PID_STABILISATION_ON;
|
||||
pidProfile->levelAngleLimit = 55;
|
||||
pidProfile->feedForwardTransition = 100;
|
||||
pidProfile->feedforwardTransition = 100;
|
||||
pidProfile->yawRateAccelLimit = 100;
|
||||
pidProfile->rateAccelLimit = 0;
|
||||
pidProfile->antiGravityMode = ANTI_GRAVITY_SMOOTH;
|
||||
|
@ -199,6 +214,7 @@ void resetTest(void) {
|
|||
}
|
||||
|
||||
void setStickPosition(int axis, float stickRatio) {
|
||||
simulatedPrevSetpointRate[axis] = simulatedSetpointRate[axis];
|
||||
simulatedSetpointRate[axis] = 1998.0f * stickRatio;
|
||||
simulatedRcDeflection[axis] = stickRatio;
|
||||
}
|
||||
|
@ -519,7 +535,7 @@ TEST(pidControllerTest, testFeedForward) {
|
|||
|
||||
EXPECT_NEAR(2232.78, pidData[FD_ROLL].F, calculateTolerance(2232.78));
|
||||
EXPECT_NEAR(-2061.03, pidData[FD_PITCH].F, calculateTolerance(-2061.03));
|
||||
EXPECT_NEAR(-82.52, pidData[FD_YAW].F, calculateTolerance(-82.5));
|
||||
EXPECT_NEAR(-2061.03, pidData[FD_YAW].F, calculateTolerance(-2061.03));
|
||||
|
||||
// Match the stick to gyro to stop error
|
||||
setStickPosition(FD_ROLL, 0.5f);
|
||||
|
@ -530,9 +546,13 @@ TEST(pidControllerTest, testFeedForward) {
|
|||
|
||||
EXPECT_NEAR(-558.20, pidData[FD_ROLL].F, calculateTolerance(-558.20));
|
||||
EXPECT_NEAR(515.26, pidData[FD_PITCH].F, calculateTolerance(515.26));
|
||||
EXPECT_NEAR(-41.26, pidData[FD_YAW].F, calculateTolerance(-41.26));
|
||||
EXPECT_NEAR(515.26, pidData[FD_YAW].F, calculateTolerance(515.26));
|
||||
|
||||
for (int loop =0; loop <= 15; loop++) {
|
||||
setStickPosition(FD_ROLL, 0.0f);
|
||||
setStickPosition(FD_PITCH, 0.0f);
|
||||
setStickPosition(FD_YAW, 0.0f);
|
||||
|
||||
for (int loop = 0; loop <= 15; loop++) {
|
||||
gyro.gyroADCf[FD_ROLL] += gyro.gyroADCf[FD_ROLL];
|
||||
pidController(pidProfile, currentTestTime());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue