iphone - Coremotion acceleration always zero!
<p>I am trying to grab the device acceleration using CoreMotion. I have this code:</p>

<p>for setting</p>

<pre><code>if (motionManager == nil) 
        motionManager = [[CMMotionManager alloc] init];

motionManager.deviceMotionUpdateInterval = framesPorKeyframes / 60.0; //60 Hz
motionManager.accelerometerUpdateInterval =  framesPorKeyframes / 60.0; //60 Hz

[motionManager startDeviceMotionUpdates];
referenceAttitude = nil;
</code></pre>

<p>for reading</p>

<pre><code>vec3f_t translation = {0.0f, 0.0f, 0.0f};
CMRotationMatrix rotation;
CMAcceleration userAcceleration;


CMDeviceMotion *deviceMotion = motionManager.deviceMotion;      
attitude = deviceMotion.attitude;

rotation = attitude.rotationMatrix;

userAcceleration = deviceMotion.userAcceleration;
[userAccelerationLpf addAcceleration:userAcceleration withTimestamp:deviceMotion.timestamp];

// The user acceleration we want to use is the one computed by userAccelerationLpf
userAcceleration.x = userAccelerationLpf.x;
userAcceleration.y = userAccelerationLpf.y;
userAcceleration.z = userAccelerationLpf.z; 

NSLog(@"acc = %f, %f, %f", userAcceleration.x, userAcceleration.y, userAcceleration.z);
</code></pre>

<p>All I have here are zeros!!!!!!!!</p>

<p>The reading method repeats at 30 Hz.</p>

<p>this is taken from Apple sample and should not be giving me zeros!
any clues?</p>

<p>thanks.</p>
