iPhone的捕捉动作的滚动,俯仰和偏转的最大值和最小值

Joe*_*Joe 3 iphone xcode motion

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

请问我想知道Roll,Pitch和Yaw的最大值和最小值是多少.(陀螺仪的价值)


初始化:

[[UIAccelerometer sharedAccelerometer] setUpdateInterval:0.2f];

[[UIAccelerometer sharedAccelerometer] setDelegate:self];

motionManager = [[CMMotionManager alloc] init];

motionManager.accelerometerUpdateInterval = 0.01; // 100Hz

motionManager.deviceMotionUpdateInterval = 0.01; // 100Hz

[motionManager startDeviceMotionUpdates];


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

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

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

以及如何传递给价值观 - >度?

谢谢

Joe*_*Joe 6

这是解决方案:

如果你放

#define degrees(x) (180 * x / M_PI)
Run Code Online (Sandbox Code Playgroud)

然后是Degree中的值:

Vroll = degrees(motionManager.deviceMotion.attitude.roll);
Vyaw  = degrees(motionManager.deviceMotion.attitude.yaw);
Vpitch= degrees(motionManager.deviceMotion.attitude.pitch);
Run Code Online (Sandbox Code Playgroud)

所以:

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

Vyaw Min:-180°,最大值:180°

Vpitch最小值:-90°,最大值:90°

谢谢stackoverflow :)