I'm working with a Samsung Galaxy sii phone which has a gyroscope, magnometer, and accelerometer. Everything is using NDK.
I am using the toadlet library to abstract out a lot of the phone interface, but within that library there is function to set the sampling rate which calls the expected NDK function:
void AndroidSensorDevice::setSampleTime(int dt){
if(mSensor!=NULL){
ASensorEventQueue_setEventRate(mEventQueue,mSensor,dt*1000);
}
}
When I change the sampling rates of the accelerometer and magnometer I see, roughly, the expected change in actual sampling rates. For the gyroscope, though, it always updates at only the fastest rate, i.e. no matter what I set the sample rate to I get time differences similar to this:
I/toadlet (10266): dt= 0.619000
I/toadlet (10266): dt= 4.423000
I/toadlet (10266): dt= 0.511000
I/toadlet (10266): dt= 4.335000
I/toadlet (10266): dt= 0.586000
I/toadlet (10266): dt= 4.371000
I/toadlet (10266): dt= 0.586000
I/toadlet (10266): dt= 4.559000
I/toadlet (10266): dt= 0.340000
I/toadlet (10266): dt= 3.827000
I/toadlet (10266): dt= 0.617000
I/toadlet (10266): dt= 5.337000
I/toadlet (10266): dt= 0.154000
I/toadlet (10266): dt= 3.538000
I/toadlet (10266): dt= 0.556000
I/toadlet (10266): dt= 4.547000
Even trying ridiculously large sample rates has no effect. Has anyone else seen this?
The phone is running Android 2.3.5 and I've tried using both android-9 and android-14 targets with no noticeable difference.