Delay in yaw, pitch and roll values

前端 未结 1 1505
轻奢々
轻奢々 2021-01-26 17:14

I am developing an application in windows phone 7.1 which I require the current degree rotation of the phone in x and y axis. I tried using the motion API and use the appropriat

相关标签:
1条回答
  • 2021-01-26 18:07

    I've got similar problems with WP8 Motion API. The delay is not the only problem. It seems Motion API is also very sensitive to compass (or magnetometer) errors of all kinds. And worse, these don't affect the yaw only. Motion class AHRS algorithm seems to couple the pitch and roll with yaw. As a result, when compass delays or goes other ways crazy, so do pitch and roll.

    I doubt you can do without gyroscope. In theory, you could get Euler angles (yaw, pitch and roll) from accelerometer only, but ONLY IF the phone is standing still. A slightest movement causes linear/centripetal accelerations that will ruin your orientation calculations. I'd say any attempts to do that with a hand held device such as phone are doomed to fail. Moreover, Motion API in itself requires both compass and gyro hardware in addition to accelerometer.

    Anyways, all is not lost. I got rid of Motion class all together and implemented "my own" IMU a la Sebastian Madgwick's IMU algorithm. The IMU / AHRS report with C-code here:

    http://www.x-io.co.uk/res/doc/madgwick_internal_report.pdf

    C source code can be found here:

    http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/

    With proper beta gain Madgwick's IMU works like charm on Windows Phone. IMU doesn't provide yaw, just pitch and roll. And it uses only gyro and accelerometer hardware. If you need yaw too, you can implement the full AHRS algorithm included in both the above sources. That of course needs compass too.

    The Madgwick algorithms do not include Euler angle calculations (just a quaternion describing rotation between earth and sensor frames), but you'll find the equations from the Madgwick's report.

    I do not have experience with the full AHRS (or MARG, as Madgwick calls it). However, the algorithm decouples compass yaw from pitch and roll calculations, so one could expect to have sane pitch/roll readings even there's magnetic disturbances.

    Please, note that coordinate systems are different. In WP, X=pitch axis, Y=roll axis and Z=yaw axis. In above algorithms, Y=pitch, X=roll and Z=yaw. So, you'll need to swap the X and Y as well as invert the direction of Z acceleration. You need to reverse the gyroscope rates as well (and swap the X and Y rates).

    Hope this helps :)

    0 讨论(0)
提交回复
热议问题