mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-19 04:52:12 +01:00
Merge remote-tracking branch 'origin/rodney/OP-1834_disable_piro_comp_in_self_level_modes' into next
This commit is contained in:
commit
9103b4de92
@ -244,6 +244,10 @@ static void stabilizationInnerloopTask()
|
||||
float dT;
|
||||
dT = PIOS_DELTATIME_GetAverageSeconds(&timeval);
|
||||
|
||||
StabilizationStatusOuterLoopData outerLoop;
|
||||
StabilizationStatusOuterLoopGet(&outerLoop);
|
||||
bool allowPiroComp = true;
|
||||
|
||||
for (t = 0; t < AXES; t++) {
|
||||
bool reinit = (StabilizationStatusInnerLoopToArray(enabled)[t] != previous_mode[t]);
|
||||
previous_mode[t] = StabilizationStatusInnerLoopToArray(enabled)[t];
|
||||
@ -257,6 +261,10 @@ static void stabilizationInnerloopTask()
|
||||
axis_lock_accum[t] = 0;
|
||||
}
|
||||
}
|
||||
// Any self leveling on roll or pitch must prevent pirouette compensation
|
||||
if (t < STABILIZATIONSTATUS_INNERLOOP_YAW && StabilizationStatusOuterLoopToArray(outerLoop)[t] != STABILIZATIONSTATUS_OUTERLOOP_DIRECT) {
|
||||
allowPiroComp = false;
|
||||
}
|
||||
switch (StabilizationStatusInnerLoopToArray(enabled)[t]) {
|
||||
case STABILIZATIONSTATUS_INNERLOOP_VIRTUALFLYBAR:
|
||||
stabilization_virtual_flybar(gyro_filtered[t], rate[t], &actuatorDesiredAxis[t], dT, reinit, t, &stabSettings.settings);
|
||||
@ -330,7 +338,7 @@ static void stabilizationInnerloopTask()
|
||||
}
|
||||
}
|
||||
|
||||
if (stabSettings.stabBank.EnablePiroComp == STABILIZATIONBANK_ENABLEPIROCOMP_TRUE && stabSettings.innerPids[0].iLim > 1e-3f && stabSettings.innerPids[1].iLim > 1e-3f) {
|
||||
if (allowPiroComp && stabSettings.stabBank.EnablePiroComp == STABILIZATIONBANK_ENABLEPIROCOMP_TRUE && stabSettings.innerPids[0].iLim > 1e-3f && stabSettings.innerPids[1].iLim > 1e-3f) {
|
||||
// attempted piro compensation - rotate pitch and yaw integrals (experimental)
|
||||
float angleYaw = DEG2RAD(gyro_filtered[2] * dT);
|
||||
float sinYaw = sinf(angleYaw);
|
||||
|
Loading…
x
Reference in New Issue
Block a user