'Recording IMU data in watchOS at 60hz or greater frequency stops randomly for sometime in between of recording IMU data
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.
Solution 1:[1]
I work with Abhishek on this and so to give a little more context, here is an extract where this has stoppped working.
In the below you see that its generally recording at 100hz, denoted by the Diff column which is based on the difference between a timeinterval in column A, but then it has a gap of 5 seconds of 123 seconds. We are gathering imu data as you can see.

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | James Oliver |
