苹果手表CMDeviceMotion不给我很好的阅读

目前,我只是logging一堆运动数据并将其保存到文件中。 但是,当我绘制数据时,我很难相信我正在读取正确的数据。 这是我的手表代码:

- (IBAction)startStopRecording { if (!recording){ NSLog(@"starting to record"); recording = YES; data = [[NSMutableArray alloc] init]; [self.startRecording setTitle:@"Stop Recording"]; if (self.motionManager.deviceMotionAvailable) { [self.motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue currentQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) { [data addObject:[NSString stringWithFormat:@"%f, %f, %f, %f, %f, %f, %f, %f, %f", motion.attitude.pitch, motion.attitude.roll, motion.attitude.yaw, motion.userAcceleration.x, motion.userAcceleration.y, motion.userAcceleration.z, motion.rotationRate.x, motion.rotationRate.y, motion.rotationRate.z]]; NSLog(@"."); }]; } }else{ recording = NO; NSLog(@"stopping recording"); [self.motionManager stopDeviceMotionUpdates]; [self.startRecording setTitle:@"Start Recording"]; [InterfaceController openParentApplication:@{ @"data": data } reply:^(NSDictionary *replyInfo, NSError *error) { NSLog(@"Data has been saved."); NSLog(@"replyInfo %@", replyInfo); }]; } } 

父应用程序只是将所有数据写入文件。 我logging了手表在三个轴上来回转动(俯仰,然后转动,然后偏转):

在这里输入图像说明

然后当我绘制数据,这是我得到的:

间距情节 滚动情节 偏航的情节

偏航太吵了,你根本看不到一个信号。 在将手表向三个不同方向拉动之后绘制加速度时,我也有类似的问题。 我可以看到加速度的峰值,但是它们似乎并不依赖于方向。 任何想法如何改善这一点? 我错过了什么吗? 我的手表只能有一个不好的传感器吗?

原因是因为我实际上并没有从手表中提取数据。 这是从手机拉数据。 为了提取数据(目前只有acc数据可以从手表中获得),你需要有watchOS2(目前处于testing阶段)。 否则,手表只会从手机取得数据。