延迟偏航,俯仰和横滚值 [英] Delay in yaw, pitch and roll values

查看:233
本文介绍了延迟偏航,俯仰和横滚值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows Phone 7.1中开发一个应用程序,我需要手机在x和y轴上的当前角度旋转。我尝试使用运动API,并使用其提供的偏航角和侧倾来使用适当的值。但是从某种意义上说,它提供的值会延迟,因为如果我将手机移动得太快并将其旋转到90度,则对应的值将花费一些时间才能到达该位置,这无法达到我的目的。

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 appropriate values from yaw pitch and roll it provides. But the values it provide are delayed in the sense that if I move the phone too fast and rotate it to 90 degrees the corresponding value takes a little time to reach there, which defeats my purpose.

我在Android中做了同样的事情,我可以使用类似的方法来计算手机的即时旋转。

I have done the same thing in Android where I am able to use something similar to calculate the immediate rotation of phone.

可以在wp7上使用陀螺仪来完成此操作,但是我想使用加速度计,以便可以满足更多设备的需求。

This thing can be done using gyroscope on wp7 but I want to use accelerometer so that I can cater to more devices.

对实现目标的任何帮助将不胜感激

Any help on how to achieve the goal would be appreciated

推荐答案

WP8 Motion API也有类似问题。延迟不是唯一的问题。看来Motion API对各种罗盘(或磁力计)错误也非常敏感。更糟糕的是,这些不仅仅影响偏航。运动类AHRS算法似乎将俯仰和横滚与偏航耦合在一起。结果,当指南针延迟或以其他方式发疯时,俯仰和俯仰也是如此。

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.

我怀疑您是否可以不使用陀螺仪。从理论上讲,您只能从加速度计获得欧拉角(偏航角,俯仰角和横滚角),但前提是手机必须保持静止。轻微的运动会导致线性/向心加速度,这会破坏您的方向计算。我想说用手机之类的手持设备进行任何尝试都注定会失败。此外,Motion API本身除了加速度计外还需要罗盘和陀螺仪硬件。

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.

无论如何,一切都不会丢失。我一起摆脱了Motion类,并实现了塞巴斯蒂安·麦格威克(Sebastian Madgwick)的IMU算法我自己的 IMU。此处带有C代码的IMU / AHRS报告:

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源代码可以在这里找到:

C source code can be found here:

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

通过适当的beta增益,麦格威克的IMU在Windows Phone上就像魅力一样工作。 IMU不提供偏航功能,仅提供俯仰和滚动功能。而且它仅使用陀螺仪和加速度计硬件。如果还需要偏航,则可以实现上述两个资源中都包含的完整AHRS算法。当然,这也需要罗盘。

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.

Madgwick算法不包括欧拉角计算(只是描述地球和传感器框架之间旋转的四元数),但是您会发现方程式来自Madgwick的报告。

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.

我没有完整的AHRS经验(或Madgwick所说的MARG)。但是,该算法将指南针偏航与俯仰和横滚计算解耦,因此即使存在电磁干扰,人们也可以期望获得理智的俯仰/横滚读数。

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.

请注意,坐标系是不同的。在WP中,X =俯仰轴,Y =横滚轴,Z =偏航轴。在以上算法中,Y =俯仰,X =滚动,Z =偏航。因此,您需要交换X和Y以及反转Z加速度的方向。您还需要反转陀螺仪的速率(并交换X和Y速率)。

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).

希望这会有所帮助:)

这篇关于延迟偏航,俯仰和横滚值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆