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
Conversation
src/main/flight/kalman.c
Outdated
// kalmanState->e = 1.0f; | ||
// } | ||
|
||
kalmanState->e = ABS((target - input) * 3) + ABS(input/4); |
There was a problem hiding this comment.
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 :)
If you would like any help with this i'd be happy to oblige :) |
src/main/flight/kalman.c
Outdated
varStruct.yMean = varStruct.ySumMean * varStruct.inverseN; | ||
varStruct.zMean = varStruct.zSumMean * varStruct.inverseN; | ||
|
||
varStruct.xVar = fabsf(varStruct.xSumVar * varStruct.inverseN - (varStruct.xMean * varStruct.xMean)); |
There was a problem hiding this comment.
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
…ss-axis Compute real variance
@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. |
No description provided.