Questions tagged [core-motion]

Core Motion is a framework within Apple's iOS SDK used to access all kind of motion sensor data. Introduced in version 4.0 it is the recommended way of accessing gyroscope or accelerometer data, and since version 5.0 magnetometer (compass) data as well.

Citing from Event Handling Guide for iOS:

Core Motion is a system framework that obtains motion data from sensors on a device and presents that data to applications for processing. The handling of the sensor data and the application of related algorithms occurs on Core Motion’s own thread. The items of hardware that detect and originate these motion events are the accelerometer and the gyroscope. (The gyroscope is currently available only on iPhone 4.) Core Motion publishes an Objective-C programmatic interface that enables applications to receive device-motion data of various types, which they can then process in appropriate ways.

Core Motion is replacing the older UIAccelerometer framework wich is still available but deprecated in version 5.x.

705 questions
0
votes
1 answer

Receive DeviceMotion updates while phone in background

I have a navigation app that uses core motion to receive CMDeviceMotion updates. How can I continue to receive and process these updates if the phone has been put to sleep or is running in the background?
Geoff
  • 197
  • 1
  • 13
0
votes
3 answers

How to update x and y position from the amount of tilt?

How can I update x and y position of an object from the amount of tilt? I'm trying to update the x and y position of my _bg object, based on the amount of a tilt movement. Also, if the device is put down on a table, the position should go back to…
nmdias
  • 3,628
  • 4
  • 31
  • 59
0
votes
1 answer

Change frame in startDeviceMotionUpdatesToQueue

I'm trying to change my UIView's frame with value I get from CMMotionManager and its method - startDeviceMotionUpdatesToQueue:withHandler I wrote a draft like this : [_motionManager startDeviceMotionUpdatesToQueue:theQueue…
Pierre
  • 6,557
  • 5
  • 48
  • 78
0
votes
1 answer

Moving UIView plane in 2D along with accelerometer and gyro data

Question in one line is i want to apply effect like deepEnd jailbreak app. Details: I have a UIImageView for the background. Above that i have added Gold coin image. What i need to do is when user tilt the ipad the background should move either x or…
Abhigyan
  • 621
  • 10
  • 24
0
votes
3 answers

Stop gyro updates

I cant work out to stop the Gyro updates in my Cocos2D game, I have got the following code in my init: ` //gyro motionManager = [[CMMotionManager alloc] init]; referenceAttitude = nil; [motionManager startGyroUpdates]; timer…
Andrew Ho
  • 618
  • 8
  • 20
0
votes
1 answer

CoreMotion wont give me roll, pitch and yaw

sBefore UIAccelerometer was deprecated from iOS I used the data from x, y and z from this class to calculate pitch, roll and yaw. I also had to do some filtering, but now I see that with the CoreMotion library I can get these data from the…
chwi
  • 2,663
  • 2
  • 34
  • 62
0
votes
2 answers

Accelerometer didAccelerate delegate method not getting called in iOS sdk 6.0

I am developing application to get threshold how forcefully user shook iOS device. I am using iOS sdk 6.0. I tried UIResponder delegate method motionEnded:: It get called when device is shaken but do not give enough data that how forcefully some one…
abdus.me
  • 1,819
  • 21
  • 34
0
votes
1 answer

Need assistance regarding Core Motion

Using core motion I get 3 values of yaw, pitch, roll, Now using these values I need to create a custom loader, when user moves device right, forward, left, backward this loader will fill. So I draw a circle using this core graphics method void…
S.J
  • 2,979
  • 3
  • 30
  • 63
0
votes
0 answers

Inaccurate accelerometer update interval

I'm using the CoreMotion API and I would like to save the accelerometer's values every 10ms (100hz). The update intervals I obtained so far aren't accurate. Here's an example of update intervals I got (in…
Simo
  • 1
  • 2
0
votes
2 answers

Do I need to use NSTimer to get data from gyroscope iOS?

Right now I'm using the following code to get Euler values from the device's gyroscope. Is this how it's supposed to be used? Or is there a better way without using NSTimer? - (void)viewDidLoad { [super viewDidLoad]; CMMotionManager *motionManger =…
thisiscrazy4
  • 1,767
  • 8
  • 33
  • 55
0
votes
1 answer

iOS CoreMotion Gryoscope Update Interval

I am writing an application that uses the Gryoscope in iOS-compatible devices. I only want the gyroscope to update my application with new Coordinates about every second. I've tried to set: motionManager.gryoUpdateInterval=1 However, it seems that…
El Guapo
  • 5,253
  • 7
  • 51
  • 78
0
votes
2 answers

Detect verticality of iPhone

Possible Duplicate: Get pitch, roll and yaw relative to geographic north on iOS? Is there a way to detect that iPhone is vertical? Gyroscope gives us absolute angle relative to a position. But how can I know if this relative position corresponds…
Jakikiller
  • 149
  • 1
  • 9
0
votes
4 answers

Create a single button which can trigger two actions and changes it's title?

CGRect buttonFrame = CGRectMake( 10, 80, 100, 30 ); UIButton *button = [[UIButton alloc] initWithFrame: buttonFrame]; [button setTitle: @"Start" forState: UIControlStateNormal]; [button addTarget:self action:@selector(start_Accel)…
sam
  • 239
  • 1
  • 5
  • 22
-1
votes
1 answer

Swift await for async request to complete

I have the following function by which I want to return a Int private func queryPedometerSteps(currentStartDate: Date, currentLastDate: Date) -> Int { var stepsGiven = 0 pedometer.queryPedometerData(from: currentStartDate, to:…
Johny Boy
  • 45
  • 4
-1
votes
1 answer

Build a basic Altimeter with SwiftUi for Apple Watch

I am trying to build a MVP with SwiftUI that simply shows me the changes in altitude on my Apple Watch. From there I will figure out where to go next (I want to use it for paragliding and other aviation things). I have previous experience in python,…
1 2 3
46
47