setting QAccelerometer rate has no effect

Bug #1388654 reported by Lorn Potter
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
platform-api
New
Undecided
Unassigned
qtubuntu-sensors
New
Undecided
Unassigned

Bug Description

First example here tries to set it to 100 Hz, second to 5Hz

(the timestamp issue may effect this issue)

phablet@ubuntu-phablet:~/sensors-examples$ show_acceleration/show_acceleration -r 100
 (check::checkRate:49) - data rate set for sensor 100
 (main:134) - choosing "core.accelerometer"
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975702653225608 (-1703654 ms since last, -0.0 Hz)
Acceleration: -1.6 x 6.4 y 7.5 z m/s^21414975702658230491 (5004 ms since last, 0.2 Hz)
Acceleration: -1.5 x 6.3 y 7.5 z m/s^21414975702663265892 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.4 y 7.5 z m/s^21414975702668301292 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.4 y 7.5 z m/s^21414975702673336692 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975702678372093 (5035 ms since last, 0.2 Hz)

phablet@ubuntu-phablet:~/sensors-examples$ show_acceleration/show_acceleration -r 5
 (check::checkRate:49) - data rate set for sensor 5
 (main:134) - choosing "core.accelerometer"
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975695656999702 (-109946 ms since last, -0.0 Hz)
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975695663591499 (6591 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975695668596382 (5004 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975695673631782 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975695678667183 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.4 y 7.5 z m/s^21414975695683702583 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.3 y 7.5 z m/s^21414975695688737984 (5035 ms since last, 0.2 Hz)
Acceleration: -1.6 x 6.3 y 7.6 z m/s^21414975695693773384 (5035 ms since last, 0.2 Hz)

Revision history for this message
Lorn Potter (lorn-potter) wrote :

Looking at the code, there are a few things that need fixing to fix this.

1) qtubuntu-sensors backend does not check what the data rate has been set before starting the sensor.
2) platform-api does not arbitrate fastest data rate request and down sample to other slower data rate requests.

If it is platform policy that sensor data rates are not guaranteed (this is allowed by QtSensors API docs) then #2 does not need fixing. But fixing #1 without fixing #2 is problematic, as clients can change the rate of all clients sensors of a particular type when they do.

Revision history for this message
Lorn Potter (lorn-potter) wrote :

I supposed a third option would be to move to sensorfw which already does both #1 and #2

Revision history for this message
Lorn Potter (lorn-potter) wrote :

Attached is a patch I did a few months ago. Other sensors would need something like this as well.

One problem is that with this patch applied, the rate would be applied across all other clients reading accel (or other sensors with this).

I seem to remember when I was looking into it, having multiple reader with each their own rate would require some bigger change to allow.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.