core-motion

Live Updates with CMPedometer (CoreMotion)

て烟熏妆下的殇ゞ 提交于 2019-12-29 07:52:27
问题 I've found very limited resources on this topic (CMPedometer). I was wondering if anyone here has managed to get this to work properly. My code is fairly simple, and has more than what I'm trying to do. Basically, the step counter does not increment EVERY step a user takes. It actually is tracking every step the user takes but it updates so slowly and I can't figure out why. I even tried using NSTimer to make a request to update the labels every half a second. I want to try to get the step

Actual frequency of device motion updates lower than expected, but scales up with setting

こ雲淡風輕ζ 提交于 2019-12-29 05:58:09
问题 I am porting an app that I originally wrote using the accelerometer for IOS 3, to incorporate the new IOS 4 motion capabilities. While capturing motion, the application does little else - no graphics updates for example. I'm doing the following to set up motion updates, as a replacement for my previous use of the accelerometer. I do realize that I could rebuild to do my own polling using NSTimer or something, and may pursue that yet. [motionManager setDeviceMotionUpdateInterval:updateInterval

CoreMotion updates in background state

南笙酒味 提交于 2019-12-28 03:20:30
问题 With the M7 chip in the latest iOS devices one can get programmatically notified as the user goes from stationary to running, walking, etc using CMMotionActivityManager. Stava and Runkeeper have both used this to auto-pause GPS polling (shut off the GPS antenna) when it detects the user isn't moving via the M7, and then re-enable GPS updates once they are moving again. It is able to do this while the app is in the background state, which is the key here. The issue I run into while duplicating

Accelerometer Low Pass Filter Smoothing

天大地大妈咪最大 提交于 2019-12-24 06:38:01
问题 I am using the device accelerometer and try to smooth the Accelerometer Data CMAcceleration . I am doing this with help of this code: -(void)proccessAccelerometerData:(CMAcceleration)accelData { currentAccelX = (kUpdateInterval * accelData.x) + ((1.0 - kUpdateInterval) * currentAccelX); currentAccelY = (kUpdateInterval * accelData.y) + ((1.0 - kUpdateInterval) * currentAccelY); } Which currentAccelX and currentAccelY is the last accelerometer x and y data. Now, I have the smooth x and y

iPhone orientation — how do I figure out which way is up?

拟墨画扇 提交于 2019-12-24 04:16:07
问题 I'm trying to draw a 2D image on the screen that is always facing "up". If the user is rotating their phone, I want to ensure my 2D object does not rotate with the device; it should always "stand vertical". I want to compensate for the user tilting left or right, but not tilting away or towards themselves. I'm using CoreMotion to get Pitch, Roll and Yaw from the device, but I don't understand how to translate the points into the direction up, especially as the user rotates the device. Ideally

CMCalibratedMagneticField doesn't update

我的梦境 提交于 2019-12-24 02:14:37
问题 CMCalibratedMagneticField returns 0 all the time. CMAcceleration returns values, CMMagnetometerData returns values too. Only CMCalibratedMagneticField doesn't, I need it because it is the magneticfield without bias. I'm testing on iPhone 4S. [MotionManager startDeviceMotionUpdatesToQueue:deviceQueue withHandler:^(CMDeviceMotion *motion, NSError *error) { CMCalibratedMagneticField f = motion.magneticField; //CMMagneticField t = motion.; //CMAcceleration s = motion.gravity; Works! //_xlabelnew

iOS device screen magnetic direction based on maximum inclination?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 02:13:50
问题 OK I don't think this question has been asked and its time either I get an answer quicker or I will add the answer once I have it as I must be close. Let me explain: Considering iOS device pitch and roll (forget yaw) we have the angles being as this * r+ * ------------ * | | * p- ° |p+ * | | * ------------ * r- So based on the body reference frame. We know that when either pitch or roll is 0 the other is the max inclination of the device. But when the device has inclination in both roll and

Irregular timestamp in CMMotionManager

风格不统一 提交于 2019-12-24 01:59:31
问题 Researched this a lot for the past week but could not find a similar issue. I am collecting accelerometer data on the Apple Watch and looking at the timestamp outputted by the the DeviceMotion class which presents an issue. The timestamps do not always go in chronoligcal order. For example, if I collect a few minutes of motion data at 100Hz, I get the following timestamps from a CSV file I generate in the same app (these are UTC timestamps): 1531099702.768570 1531099702.778460 1531099702

CMMotionActivityManager startActivityUpdates keep detects user activity after calling stopActivityUpdates()

こ雲淡風輕ζ 提交于 2019-12-24 01:37:28
问题 Am developing an app to get the user activity using CMMotionActivity. It is working fine. I also get the user activities in the following method. CMMotionActivityManager *activityManager = [[CMMotionActivityManager alloc] init]; [activityManager startActivityUpdatesToQueue:[[NSOperationQueue alloc] init] withHandler: ^(CMMotionActivity *activity) { dispatch_async(dispatch_get_main_queue(), ^{ }); } ]; But the issue is that, when i call the following method [activityManager stopActivityUpdates

CMAltimeter callback never fires

♀尐吖头ヾ 提交于 2019-12-23 22:47:49
问题 Using my 6+ I've been trying to read the relative altitude and pressure using CoreMotion's new CMAltimeter. However the callback is never firing. I have a very similar setup which instead uses the accelerometers, gyros, and magnetometers. They all seem to work fine. Was wondering if anyone out there has managed to get a reading? - (void)viewDidLoad { [super viewDidLoad]; if([CMAltimeter isRelativeAltitudeAvailable]){ CMAltimeter *altimeterManager = [[CMAltimeter alloc]init]; [altimeterManager