View Single Post
Posts: 13 | Thanked: 12 times | Joined on Oct 2011
#1
I am not perfectly sure I am writing this on the right forum, so apologies if the forum is not correct.

So, I decided to try and give a look on the data the sensors deliver in my N9, but hit a wall.

I thought that it would be relatively easy to just create a python script that prints out accelerometer and/or compass data. So, I installed python and some bindings as instructed in

http://wiki.meego.com/Python/Harmattan/Getting_started

(Note: python-modules-all was not found)

Then, found some example codes:

http://qt.gitorious.org/pyside/pysid...bility/sensors

and

http://wiki.meego.com/User:Mdengler

Both get stuck somewhere before getting to the output generating part. Typical output, after which the process must be killed manually:

Code:
~/python $ python ac.py 
Using the meego graphics system
loaded the Generic plugin 
loaded the grue plugin 
Loaded the MeeGo sensor plugin 
Setting data rate 0 Hz (interval 0 ms) for "meego.accelerometer" 
Setting data rate 0 Hz (interval 0 ms) for "meego.magnetometer"
Finally, I tried to generate as simple script as I could:

Code:
import sys
from PySide.QtCore import *
from QtMobility.Sensors import *
                                
app = QCoreApplication(sys.argv)
sensor = QAccelerometer()       
sensor.start()                  
reading = sensor.reading()      
print reading.x(), reading.y(), reading.z()
Which gives following output:

Code:
~/python $ python acc.py  
loaded the Generic plugin 
loaded the grue plugin 
Loaded the MeeGo sensor plugin 
Setting data rate 0 Hz (interval 0 ms) for "meego.accelerometer" 
0.0 0.0 0.0
~/python $
Now, I would expect one of those to be slightly below 10 if the phone is lying still. I tried similar script for the compass sensor, and I got a bearing of 0 regardless which direction the phone was turned.

So, what have I missed?

Thanks,

Gybe