Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 2 FirstFirst 1 2
Results 26 to 32 of 32

Thread: Prop Shield - large drift

  1. #26
    Junior Member
    Join Date
    Aug 2017
    Posts
    7
    Thanks @mjs513. I'm now running into a problem with AP_Filter. The error I see is " LowPassFilter.h:26:29: fatal error: AP_Math_freeimu.h: No such file or directory". Any tips?

  2. #27
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    1,941
    Sorry - was another missing library. Added now.

  3. #28
    Junior Member
    Join Date
    Dec 2018
    Posts
    3
    Loaded your sketch with dependencies then calibrated with your complete and compiled python exe. I got a good sphere using the routine as suggested https://github.com/mjs513/FreeIMU-Up...MU-Calibration.
    Saved calibration.h to /Arduino/libraries/FreeIMU/
    Arduino Rebuilt loaded and rebooted Teensy


    WARNINGS (not errors)
    psIMU_serial: In function 'float invSqrt(float)':
    psIMU_serial:370: warning: dereferencing type-punned pointer will break strict-aliasing rules
    uint32_t i = 0x5F1F1412 - (*(uint32_t*)&x >> 1);

    ^

    psIMU_serial:371: warning: dereferencing type-punned pointer will break strict-aliasing rules
    float tmp = *(float*)&i;

    ^

    MadgwickQuantFileter: In function 'void MadgwickQuaternionUpdate(float, float, float, float, float, float, float, float, float)':
    MadgwickQuantFileter:15: warning: variable '_2q0q2' set but not used
    float _2q0mx, _2q0my, _2q0mz, _2q1mx, _2bx, _2bz, _4bx, _4bz, _2q0, _2q1, _2q2, _2q3, _2q0q2, _2q2q3, q0q0, q0q1, q0q2, q0q3, q1q1, q1q2, q1q3, q2q2, q2q3, q3q3;

    ^

    MadgwickQuantFileter:15: warning: variable '_2q2q3' set but not used
    float _2q0mx, _2q0my, _2q0mz, _2q1mx, _2bx, _2bz, _4bx, _4bz, _2q0, _2q1, _2q2, _2q3, _2q0q2, _2q2q3, q0q0, q0q1, q0q2, q0q3, q1q1, q1q2, q1q3, q2q2, q2q3, q3q3;

    ^

    MahoneyQuantFilter: In function 'void MahonyQuaternionUpdate(float, float, float, float, float, float, float, float, float)':
    MahoneyQuantFilter:48: warning: 'halfex' may be used uninitialized in this function
    halfex += (my * halfwz - mz * halfwy);

    ^

    MahoneyQuantFilter:49: warning: 'halfey' may be used uninitialized in this function
    halfey += (mz * halfwx - mx * halfwz);

    ^

    MahoneyQuantFilter:50: warning: 'halfez' may be used uninitialized in this function
    halfez += (mx * halfwy - my * halfwx);

    ^

    Press y in serial output to get Quaternion values for XYZ and all I get is
    NANNANNAN
    NANNANNAN

    SOOOO?

    C for calibration data reads normal (installed) values.

    r 20 records reads values with no nan. Everything looks normal.

    z for MultiWii data shows hex values. MultiWii interface shows all data EXCEPT for xyz quaternion, NAN.

    How do I fix it so it spits out quaternion values for me (with your fix for the yaw drift?)

    Thanks!

  4. #29
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    1,941
    Are u using the Freeimu sketches or the PSImu sketch?

    EDIT: If you are using the PSImu sketch I just noticed an error in the calibration file while debugging the example. If you look at the calibration.h file it probably reads:
    Code:
    mag_scale[0] = 459.630087;
    mag_scale[0] = 475.958118;
    mag_scale[0] = 461.666950;
    It should read:
    Code:
    mag_scale[0] = 459.630087;
    mag_scale[1] = 475.958118;
    mag_scale[1] = 461.666950;
    That will get rid of your "NaN" issues.
    Last edited by mjs513; 12-06-2018 at 02:25 PM.

  5. #30
    Junior Member
    Join Date
    Dec 2018
    Posts
    3

    Cool

    I was using the PSImu from /PSImu/examples from your github.

    Did another rough calibration, compared the calibration.h file, and made the necessary corrections. No more NaN. Yaw drifts a few degrees and it stops! It works! Now I can tinker with the settings but its more than good enough for me.

    Thank you so much!

  6. #31
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    2,821
    Quote Originally Posted by mjs513 View Post
    It should read:
    Code:
    mag_scale[0] = 459.630087;
    mag_scale[1] = 475.958118;
    mag_scale[1] = 461.666950;
    That will get rid of your "NaN" issues.
    Ummm, shouldn't that be?

    Code:
    mag_scale[0] = 459.630087;
    mag_scale[1] = 475.958118;
    mag_scale[2] = 461.666950;

  7. #32
    Senior Member
    Join Date
    Jul 2014
    Location
    New York
    Posts
    1,941
    Yes it should. Thanks MichaelM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •