tags:

views:

84

answers:

1

Hey, guys! I am working on a project using HTC magic which requires the data from the electronic compass, including both the accelerometer and magnetic sensor. But I find that there is a significant latency between the move of the phone and the trigger of the sensorChanged event. In other word, the acceleration and magnetic data obtained from sensor are updated about half of a second after my motion. And I have several questions about the problem as follow.

  1. Are the orientation data computed by the acceleration and magnetic data? Or are there a physical sensor for orientation?

  2. Does the latency result from the android API (using the event) or the physical limitation of the electronic compass?

  3. It is said that the model of the electronic compass is AK8976A from Asahi Kasei. Does anybody have the datasheet or know the frequency of the sampling?

  4. Any idea to improve the real-time experience?

Thank you in advance!

A: 

When you register the SensorEventListener what rate are you using? You should be using SENSOR_DELAY_GAME to get the best balance between frequent updates and not overdriving the update queue which can actually cause updated to be slower if SENSOR_DELAY_FASTEST.

As to your other questions I think they're kind of moot. Whether the update delay you're seeing is due to the API, or the actual compass itself you can't change it.

CaseyB
Thank you very much! I use the SENSOR_DELAY_GAME now. It seems much better!By the way, what is the default value of the rate of SensorEventListener? SENSOR_DELAY_FASTEST? SENSOR_DELAY_GAME? SENSOR_DELAY_NORMAL? SENSOR_DELAY_UI? :P
cat
I don't know but if I had to hazard a guess I'd say SENSOR_DELAY_NORMAL, since it's called normal.
CaseyB