sinkuri256 / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

Sensor event time stamp errors #522

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Sensor events entered into the event queue have a time stamp which 'sticks' for 
between 4 and 6 entries before updating. Run the following script:

import android, time
droid = android.Android()
t = time.time()
droid.startSensing()
time.sleep(2)
e = droid.eventPoll(60).result
for i in range(17,55):
  print e[i]['data']['time'] - t
droid.stopSensing()

You will get someting like:

0.763589143753
0.763589143753
0.764589071274
0.765588998795
0.765588998795
0.979588985443
0.980589151382
0.980589151382
0.983589172363
0.984589099884
0.986589193344
1.19458913803
1.19658899307
1.19658899307
1.19758915901
1.41658902168
1.41758918762
1.41758918762
1.41858911514
1.41958904266
1.42158913612
1.63858914375
1.63858914375
1.63858914375
1.63958907127
1.86158919334
1.86258912086
1.86258912086
1.86358904839
1.86458921432
1.86558914185
2.08958911896
2.09158921242
2.09158921242
2.09158921242
2.31058907509
2.31158900261
2.31258916855

This makes it impossible to relate readings to given points in time.

Original issue reported on code.google.com by joka...@gmail.com on 22 Feb 2011 at 10:36

GoogleCodeExporter commented 9 years ago
Reminder to Damon who suggested:

However, if the only concern here is adjusting the sensor delay, I 
think we could provide an API for that easily enough. 
I suggest: 
sensorsStartSensingFast() 
sensorsStartSensingSlow() 
sensorsStartSensing(int rateInEventsPerSecond) 

Original comment by joka...@gmail.com on 9 Mar 2011 at 8:28