Core Motion

RSS for tag

Process accelerometer, gyroscope, pedometer, and environment-related events using Core Motion.

Core Motion Documentation

Posts under Core Motion tag

35 Posts
Sort by:
Post not yet marked as solved
0 Replies
264 Views
Hi Everyone, I am developing an app which for sustainability purposes, needs to track when a person is driving in the same vehicle as another person. This way, the app can reward citizens that share their trip and reduce their carbon footprint. I have been doing research about ways to make this technically posible but there are some limitations I can't seem to understand. The idea is to make it very easy for the user so that the app could even work in a passive way without the user having to interact in any way. I have thought of using MotionActivity and BLE advertising and scanning so that the app can execute code either when another phone with my app is found nearby (BLE advertising and scanning would need to be continuously running) or when the user starts an automobile activity. It would then check that both conditions are met (at least there is one other user with the app installed nearby and the user is on an automobile). If these conditions are met, the app would start recording an activity, which uses GPS to track the distance and route taken by the user, all this in the background. I have read cases of developers building apps with similar functionalities but I can't seem to find answers as to the viability of this scenario. If this wasn't posible, I would appreciate advice as to other ways to accomplish this with minimal (or none) user interaction. Thanks in advance
Posted
by
Post not yet marked as solved
0 Replies
278 Views
Is anyone able to answer any of these questions? There's very little information on them on Apple's website and I am struggling to find information about them online in relation to the Apple Watch. What exactly are gravity and quaternion? How are they being calculated (I'm assuming some kind of sensor fusion between the accelerometer and gyroscope)? What are the units of gravity and quaternion?
Posted
by
Post not yet marked as solved
0 Replies
274 Views
For the development of a sleep app, we want to constantly monitor a user’s heart rate (HR), accelerometer and blood oxygen data and based on that define in which sleep stage a user is. Reaching certain sleep stages should then trigger certain actions on the iPhone, e.g. playing music. Is it possible to stream HR, accelerometer and blood oxygen data directly from the watch? I read older articles mentioning that it is only possible via AppleHealthKit? Can we define how often the watch should measure the data (i.e. every 10 or 30 seconds)? From what I understand, AppleWatch only measures the HR constantly when users are doing workouts, but not when resting/sleeping. Thus, we would need to adjust the frequency, probably to every 30 seconds. Thanks for any advice!
Posted
by
Post not yet marked as solved
1 Replies
243 Views
I would like to integrate a function into my iOS app, that allows the user to use his or her device as a virtual camera, meaning they hit record, then the motion of the iPhone or iPad is captured and then when done, saved as an fbx or similar file format virtual camera movement. Is there a more of less easy way to do this? thanks in advance!
Posted
by
Post marked as solved
1 Replies
240 Views
Hi, How to call the CoreMotion Manager to fill the CMAmbientPressureData class in iOS? I couldn't find any methods for this. In the header of CoreMotion, I can see methods like startAmbientPressureUpdates, but I cannot use those in Xcode? Any advise?
Posted
by
Post not yet marked as solved
1 Replies
479 Views
Hello, I am currently hoping to use Accelerometer and Gyroscope in the healthcare application.  I have confirmed that safari, web browser, and web app need to request permission to access the sensors mentioned above, especially from iOS 13. However, I have not found any information about whether the permission is required when accessing through the iOS application.  Also, when I tried to use any application (using mentioned two sensors) in the App Store, I couldn't check the procedure for requesting permission.  I would like to clarify this. If anyone knows whether the iOS application have to ask the permission to access Accelerometer and Gyroscope, please reply. (or, if anyone gives me the URLs, I'd like to check and learn about it.) Thank you for reading.
Posted
by
Post not yet marked as solved
0 Replies
227 Views
Hi All, I am writing a small App for Apple Watch 7 where I am interested in using the accelerometer, gyro and magnetometer. But it seems as we can only sample the accelerometer as I am not receiving any data from the others sensors. When running a similar code on an Apple iPhone, I can read raw data from all the sensors. Does anyone know how we can read the gyro and magnetometer? In the Apple Watch 7 Specifications there seems the part of the watch hardware. I would appreciate any help.
Posted
by
Post not yet marked as solved
0 Replies
210 Views
I'm using the following code to get CMMotionActivity updates on iPhone and apple watch, RESPECTIVELY. It works great on iPhone, i.e. motionActivityString keeps getting updated immediately and infinitely. However, when running the same code on apple watch, the string is only updated once rather than continuously. So my question is how to get continuous update on apple watch, just like the iphone does? Thanks! class MyMotionManager { @Published var motionActivityString: String = "" private let activityManager = CMMotionActivityManager() func checkMotionActivityInForeground() { if CMMotionActivityManager.isActivityAvailable() { activityManager.startActivityUpdates(to: OperationQueue.main) { (motionActivity) in guard let activity = motionActivity else {return} print(activity) // The string is updated (almost) immediately and continuously when running on iPhone. // However, it's only updated once when running on watch. if activity.stationary { self.motionActivityString = "Stationary" } else { self.motionActivityString = "Moving" } } } }
Posted
by
Post not yet marked as solved
0 Replies
177 Views
I am recording IMU data from watch sensors using Core Motion Framework device motion updates at 60hz using watch workout sessions most of the time it works fine but sometimes 3/10 there is a large gap in data captured from the sensor e.g. for 10 minutes it did not record anything also data recorded does not always record at 60hz frequency, Following is code for same any suggestions? let motion = CMMotionManager() motion.deviceMotionUpdateInterval = 1/60 motion.startDeviceMotionUpdates(to: queue) { (deviceMotion: CMDeviceMotion?, error: Error?) in if error != nil { print("Encountered error: \(error!)") } if let deviceMotion = deviceMotion { self.saveIMUReading(deviceMotion: deviceMotion) } } FYI as readings are generated at near 60hz I save a chunk of every 1000 entries in the JSON file, Your knowledge or assistance on this subject would be of great help Thanks.
Posted
by
Post not yet marked as solved
0 Replies
161 Views
Hello Is there any way to access Motion Sensors (CMMotionActivityManager) when the application is in a Suspended state I am able to access sensor updates when I use from Location Service With startUpdateLocation, but this solution comes with bad battery performance Is there any way to access it with the startMonitoringSignificantLocation() service, this location service is not consuming more battery Or is there any other way to access the sensor update while application in suspended state Thank you
Posted
by
Post not yet marked as solved
0 Replies
131 Views
when my app asks for motion and fitness permission to the user and the user denied that. If they go to setting and turn on that setting then my app forcefully restarts again. my question is why app restart again when we change motion and fitness settings?
Posted
by
Post not yet marked as solved
0 Replies
134 Views
I wanted to get the gyroscope, accelerometer, etc., and now I can get it, but when I set the time interval, I can't set it to 4 milliseconds. If you look at the debug output, the minimum value is around 10 milliseconds. What is the minimum deviceMotionUpdateInterval? Check the website. Apple doesn't provide this figure
Posted
by
Post not yet marked as solved
0 Replies
149 Views
When I run my iPhone-portrait-only app on iPadOS15 and turn the iPad to landscape, the iPad screen rotates and the portrait iPhone app appears inside the landscape iPad screen. This causes the orientation of the device and the app to be misaligned, resulting in a 90-degree shift in the orientation of the acceleration acquired by CMDeviceMotion. Tested on iPad6/iPadOS15.5. Is there a way to obtain the correct acceleration for the iPhone-only app on iPad? (other than locking the iPad screen rotation by user)
Posted
by
Post not yet marked as solved
0 Replies
113 Views
CoreMotion running on background? It ends in the background. i want check CMPedometer state in background
Posted
by