Currently, I am just recording a bunch of motion data and saving it to a file. However, when I plot the data, I am having a hard time believing I am getting the right readings. Here is my watch code:
- (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);
}];
}
}
The parent application just writes all the data to a file. I recorded the watch rotating back and forth on all three axes (pitch, then roll, then yaw):
And then when I plotted the data, this is what I got:
The yaw is so noisy that you can't see a signal at all in there. I also have a similar problem when plotting the acceleration after jerking the watch in three different directions. I can see spikes of acceleration, but they don't seem to be direction dependent. Any ideas on how to improve this? Am I missing something? Could I just have a bad sensor in my watch?