4

该程序用于检测陀螺仪的值(Roll、Pitch 和 Yaw)。

请我想知道 Roll、Pitch 和 Yaw 的最大值和最小值是多少。(陀螺仪的值)


初始化:

[[UIAccelerometer sharedAccelerometer] setUpdateInterval:0.2f];

[[UIAccelerometer sharedAccelerometer] setDelegate:self];

motionManager = [[CMMotionManager alloc] init];

motionManager.accelerometerUpdateInterval = 0.01; // 100赫兹

motionManager.deviceMotionUpdateInterval = 0.01; // 100赫兹

[motionManager startDeviceMotionUpdates];


motionManager.deviceMotion.attitude.roll // 最大值和最小值?

motionManager.deviceMotion.attitude.yaw // 最大值和最小值?

motionManager.deviceMotion.attitude.Pitch // 最大值和最小值 ?

以及如何传递给 Values -> Degree ?

谢谢

4

1 回答 1

7

这是解决方案:

如果你把

#define degrees(x) (180 * x / M_PI)

然后是 Degree 中的值:

Vroll = degrees(motionManager.deviceMotion.attitude.roll);
Vyaw  = degrees(motionManager.deviceMotion.attitude.yaw);
Vpitch= degrees(motionManager.deviceMotion.attitude.pitch);

所以 :

Vroll 最小值:-180°,最大值:180°

Vyaw 最小:-180°,最大:180°

Vpitch Min : -90°, Max : 90°

谢谢stackoverflow :)

于 2012-02-08T05:09:07.473 回答