I am testing Core Motion and using the gyroscope. Right now I am getting values that I am not understanding. My assumption was that with each x, y and z I would get a value between 0-360 which would be a full rotation, but this isn't the case.
[self.motionManager startGyroUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMGyroData *gyroData, NSError *error) {
NSString *x = [NSString stringWithFormat:@"%.02f",gyroData.rotationRate.x];
NSLog(@"X: %@", x);
NSString *y = [NSString stringWithFormat:@"%.02f",gyroData.rotationRate.y];
NSLog(@"Y: %@", y);
NSString *z = [NSString stringWithFormat:@"%.02f",gyroData.rotationRate.z];
NSLog(@"Z: %@", z);
frequency = gyroData.rotationRate.y*500;
float rate = gyroData.rotationRate.z;
if (fabs(rate) > .2) {
float direction = rate > 0 ? 1 : -1;
rotation += (direction * M_PI/90.0)*1000;
NSLog(@"Rotation: %f", rotation);
}
}];
It is possible to get more human readable rotation values? Is my assumption that I should be getting values between 0-360 wrong?
The values are in radians, not degrees, so they should be between 0 and 2Pi. Also, they are a rate, not an angle. They are radians per second.