该程序用于检测陀螺仪的值(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 //最大和最小值?
如何传递给价值观 - >学位?
由于
答案 0 :(得分:6)
这是解决方案:
如果你把
#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 Min:-180°,Max:180°
Vyaw Min:-180°,Max:180°
Vpitch最小值:-90°,最大值:90°
感谢stackoverflow:)