maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Qt mobility or Maemo bug (regarding accelerometer) (https://talk.maemo.org/showthread.php?t=65492)

Blaizzen 2010-11-12 00:43

Qt mobility or Maemo bug (regarding accelerometer)
 
1 Attachment(s)
Hi!
Not sure if this is a bug relating to Qt mobility or Maemo 5

With reading sensor values through mobility and values through "/sys/class/i2c-adapter/i2c-3/3-001d/coord" I've found the Y and Z values to be inverse (apart from other things). Lying the phone face up, it gives me

Through Qt Mobility: 0.35, 0.35, 9.5
through reading file: 36, -36, -954

Would this be a maemo bug since according to this page, face up should give a positive z value (http://doc.qt.nokia.com/qtmobility-1.0/sensors-api.html).

Additionally why are the values all have different ranges. Qt Mobility on the simulator has -50 to +50, on maemo -10 to +10 while reading the values from that file gives -1000 to +1000. Would other phone models behave similarly (eg would the N8 or N9 have the same ranges as maemo or closer to the simulator)?


I've attached the project i used to test it.

tswindell 2010-11-12 00:52

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Qt is an abstraction layer between the hardware and you app, the file is basically the raw data. So you'd expect them to be different. Qt Mobility is supposed to provide you with a unified interface to the accel data no matter what platform (symbian, maemo, etc). The ranges are as they are, becuase sysfs is generally full of integers, I'm guessing those are 100th/s of a G, where as Qt mobility is probably scaling it to a real value with a bit more friendly meaning for app devs (which should be unified across platforms).

anwar71839 2010-11-12 01:00

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Quote:

Originally Posted by Blaizzen (Post 870955)
Hi!
Not sure if this is a bug relating to Qt mobility or Maemo 5

With reading sensor values through mobility and values through "/sys/class/i2c-adapter/i2c-3/3-001d/coord" I've found the Y and Z values to be inverse (apart from other things). Lying the phone face up, it gives me

Through Qt Mobility: 0.35, 0.35, 9.5
through reading file: 36, -36, -954

Would this be a maemo bug since according to this page, face up should give a positive z value (http://doc.qt.nokia.com/qtmobility-1.0/sensors-api.html).

Additionally why are the values all have different ranges. Qt Mobility on the simulator has -50 to +50, on maemo -10 to +10 while reading the values from that file gives -1000 to +1000. Would other phone models behave similarly (eg would the N8 or N9 have the same ranges as maemo or closer to the simulator)?


I've attached the project i used to test it.

This thing is definitely a bug. My accelerometer is acting weird after updating to PR 1.3. Anyway to solve this issue?

tswindell 2010-11-12 01:03

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Quote:

Originally Posted by anwar71839 (Post 870966)
This thing is definitely a bug. My accelerometer is acting weird after updating to PR 1.3. Anyway to solve this issue?

How do you mean weird? And he's not reporting a bug, he was enquiring over why the values differ and what he can expect from Qt Mobility APIs across platform. If you have a problem with the accel, can you file a bug report.

Blaizzen 2010-11-12 01:04

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Makes sense. I just would have assumed it would try to make it more uniform across platforms to ease in development. Guess to port to another platform you'd have to change the maths slightly.

I guess it also answers why the values are inverse, as Qt would probably try to make all phones face up have positive Z values no matter how their accelerometer is placed inside.

thanks :D

tswindell 2010-11-12 01:07

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Quote:

Originally Posted by Blaizzen (Post 870973)
Makes sense. I just would have assumed it would try to make it more uniform across platforms to ease in development. Guess to port to another platform you'd have to change the maths slightly.

I guess it also answers why the values are inverse, as Qt would probably try to make all phones face up have positive Z values no matter how their accelerometer is placed inside.

thanks :D

Well, this is the whole reason of Qt Mobility Sensors API, it means you don't have to worry about talking to the hardware directly and can write code once that will work the same on all platforms/devices.

Blaizzen 2010-11-12 01:11

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Quote:

Originally Posted by tswindell (Post 870974)
Well, this is the whole reason of Qt Mobility Sensors API, it means you don't have to worry about talking to the hardware directly and can write code once that will work the same on all platforms/devices.

So it might still be a bug, only if other devices behave differently.

Also I guess the simulator would need to have the limits changed.

tswindell 2010-11-12 01:13

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Quote:

Originally Posted by Blaizzen (Post 870976)
So it might still be a bug, only if other devices behave differently.

Also I guess the simulator would need to have the limits changed.

All you need to worry about is the values matching those in the qt docs when using the qt apis, stop thinking about the sysfs interface. :P

The simulator is fine, I'm sure it's possible that some accels can measure 5G

Blaizzen 2010-11-12 01:20

Re: Qt mobility or Maemo bug (regarding accelerometer)
 
Quote:

Originally Posted by tswindell (Post 870978)
All you need to worry about is the values matching those in the qt docs when using the qt apis, stop thinking about the sysfs interface. :P

The simulator is fine, I'm sure it's possible that some accels can measure 5G

lol, fair enough. Thanks for your help.


All times are GMT. The time now is 16:38.

vBulletin® Version 3.8.8