Sampling frequency : Swift on MAC OSX
I am using Swift to read the sensor data, as follows:
device.accelerometer?.sampleFrequency = 100;
device.gyro?.sampleFrequency = 100;
device.accelerometer?.dataReadyEvent.startNotificationsAsync(handler: { (obj, error) in
if let obj = obj {
let toWrite = "\(obj.x)," + "\(obj.y)," + "\(obj.z),";
print(toWrite);
}
});
device.gyro?.dataReadyEvent.startNotificationsAsync(handler: { (obj, error) in
if let obj = obj {
let toWrite = "\(obj.x)," + "\(obj.y)," + "\(obj.z),";
print(toWrite);
}
})
The problem that I am facing is that never am I getting a sample rate of 100Hz on either medium. When logging both the gyro and the accelero, I get 5~Hz on each . When choosing one vs the other, I can get 17Hz. ( Seems that the sampling frequency I set has no effect on the outcome.
Thoughts?
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #4f8187; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}
span.s1 {color: #000000}
span.s2 {color: #272ad8}
span.s3 {color: #4f8187}
span.s4 {color: #31595d}
span.s5 {color: #ba2da2}
span.s6 {color: #d12f1b}
span.s7 {color: #3e1e81}
span.s8 {color: #703daa}
This discussion has been closed.
Comments