[英]How to get Acceleration Time & Acceleration Magnitude in iPhone
Currently I'm trying to use CMAcceleration to get accelerometer values for x,y& z axis is it possible to get Acceleration Time & Acceleration Magnitude with this x,y & z values.When i checked the developer forum i can't find any delegates / methods to get this two.Guide me to find the values. 目前,我正在尝试使用CMAcceleration来获取x,y&z轴的加速度计值,是否可以使用此x,y&z值获得Acceleration Time&Acceleration Magnitude。当我检查开发人员论坛时,我找不到任何代表/方法来获取这两个。指导我查找值。 Using the following code:
使用以下代码:
int updatesensorFrequencyInterval = [sensorFrequencySliderTxt.text intValue];
self.motionManager.accelerometerUpdateInterval = updatesensorFrequencyInterval;
self.motionManager.gyroUpdateInterval = updatesensorFrequencyInterval;
[self.motionManager startAccelerometerUpdatesToQueue:[NSOperationQueue currentQueue]
withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) {
[self outputAccelertionData:accelerometerData.acceleration];
if(error){
NSLog(@"%@", error);
}
}];
The x,y,z values of CMAccelerometerData
acceleration struct are magnitudes in m/s^2. CMAccelerometerData
加速度结构的x,y,z值CMAccelerometerData
m / s ^ 2为单位的大小。
CMAccelerometerData
is a subclass of CMLogItem
, so it inherits the timestamp
property which provides the NSTimeInterval
since the phone was booted. CMAccelerometerData
是的子类CMLogItem
,所以它继承了timestamp
属性,它提供了NSTimeInterval
因为手机被启动。 This can be used to measure elapsed time between any pair of samples. 这可用于测量任何一对样本之间的经过时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.