apple watch CMDeviceMotion 没有给我很好的读数
apple watch CMDeviceMotion is not giving me good readings
目前,我正在记录一堆运动数据并将其保存到文件中。然而,当我绘制数据时,我很难相信我得到了正确的读数。这是我的手表代码:
- (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);
}];
}
}
父应用程序只是将所有数据写入一个文件。我记录了手表在所有三个轴上来回旋转(俯仰,然后滚动,然后偏航):
然后当我绘制数据时,这就是我得到的:
偏航噪音太大,根本看不到信号。在向三个不同方向猛拉手表后绘制加速度时,我也遇到了类似的问题。我可以看到加速度尖峰,但它们似乎与方向无关。关于如何改进这个的任何想法?我错过了什么吗?我的手表传感器会不会坏了?
原因是因为我实际上并没有从手表中提取数据。它正在从 phone 中提取数据。为了提取数据(目前只能从手表获取 acc 数据),您需要安装 watchOS2(目前处于测试阶段)。否则手表只会从 phone.
获取传递的数据
目前,我正在记录一堆运动数据并将其保存到文件中。然而,当我绘制数据时,我很难相信我得到了正确的读数。这是我的手表代码:
- (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);
}];
}
}
父应用程序只是将所有数据写入一个文件。我记录了手表在所有三个轴上来回旋转(俯仰,然后滚动,然后偏航):
然后当我绘制数据时,这就是我得到的:
偏航噪音太大,根本看不到信号。在向三个不同方向猛拉手表后绘制加速度时,我也遇到了类似的问题。我可以看到加速度尖峰,但它们似乎与方向无关。关于如何改进这个的任何想法?我错过了什么吗?我的手表传感器会不会坏了?
原因是因为我实际上并没有从手表中提取数据。它正在从 phone 中提取数据。为了提取数据(目前只能从手表获取 acc 数据),您需要安装 watchOS2(目前处于测试阶段)。否则手表只会从 phone.
获取传递的数据