-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
FINALLY fix mag rotation issues. #7366
Conversation
@matanhavi @Tubme please test this PR thoroughly with all the problem cases you found. @LorenzMeier I also realise that we can cut our loop times for voted_sensors_update in half (because I made small optimisations over the last few PRs which remove bad assumptions preventing this previously). We are currently super-wasteful with nested loops in the code. Something to remember after this fix goes in. |
@bresch please test this :) |
I tested with the same configuration, and the PR fixes the issue. |
@@ -66,7 +66,7 @@ VotedSensorsUpdate::VotedSensorsUpdate(const Parameters ¶meters, bool hil_en | |||
// initialise the corrections | |||
memset(&_corrections, 0, sizeof(_corrections)); | |||
|
|||
for (unsigned i = 0; i < 3; i++) { | |||
for (unsigned i = 0; i < math::max(ACCEL_COUNT_MAX, GYRO_COUNT_MAX); i++) { |
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 wrong: i
stands for the axis index, not sensor index.
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.
Fixed.
* sensors : second cut at fixing mag calibration - remove old problematic code * sensors : use more intuitive naming for loop variables
This does not fix our issue. On the X2.1 the external mag0 was 180 degrees offset (the GPS + Mag physically are oriented toward the front). Even more, The CAL_MAG0_ROT was at Internal Mag (-1) and I could not change it! I tried a couple of times to give Yaw 180 degrees without success. I tried forcefully to change it with param 4 but again it did not store my choice. It seems like the QGC accepts the change but then it stays back to Internal Mag. I know there are 3 internal mags in X2.1 and 1 external. I don't see a MAG3 in Parameters... Forgot to mention we flashed yesterdays master... |
Fixes #7358.