Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gyro Kalman filter from EmuFlight #5519

Merged
merged 18 commits into from Jun 11, 2020
Merged

Gyro Kalman filter from EmuFlight #5519

merged 18 commits into from Jun 11, 2020

Conversation

DzikuVx
Copy link
Member

@DzikuVx DzikuVx commented Mar 21, 2020

No description provided.

// kalmanState->e = 1.0f;
// }

kalmanState->e = ABS((target - input) * 3) + ABS(input/4);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm your testing this version of the kalman prediction. In the end we decided against this version of it and went with the above commented out code. I've since updated this version a bit more to allow it to handle its little issues. You should rebase off of what i've currently changed. But i'm excited to see this getting at least tested in iNav :)

@Quick-Flash
Copy link

If you would like any help with this i'd be happy to oblige :)

@DzikuVx DzikuVx added this to the 2.6 milestone May 29, 2020
varStruct.yMean = varStruct.ySumMean * varStruct.inverseN;
varStruct.zMean = varStruct.zSumMean * varStruct.inverseN;

varStruct.xVar = fabsf(varStruct.xSumVar * varStruct.inverseN - (varStruct.xMean * varStruct.xMean));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct.
Variance is average((x - mean)^2)
However this algorithm computes average(x)^2 - average(mean)^2

@digitalentity digitalentity changed the base branch from development to master June 8, 2020 10:17
@DzikuVx DzikuVx merged commit 706da4a into master Jun 11, 2020
@DzikuVx DzikuVx deleted the dzikuvx-gyro-kalman branch June 11, 2020 11:46
@digitalentity
Copy link
Member

@DzikuVx this must be disabled by default. It makes the horizon drift much worse as it changes the integral of angular rate because of making a "prediction".

We could still use the "filtered" output for PID control where the error will be marginal, but AHRS must be fed unfiltered gyro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants