New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 541607 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug


Participants' hotlists:
Sensors


Sign in to add a comment

devicemotion: rotationRate not implemented according to spec

Reported by i...@soaa.me, Oct 9 2015

Issue description

Steps to reproduce the problem:
1. On Chrome Mobile, go to https://jsfiddle.net/SrxtE/61/embedded/result/
2. Rotate the device around the axis perpendicular to the screen (Z axis)
3. See that 'gamma' is changing
4. Rotate the device around its shorter side to side axis (X axis)
5. See that 'alpha' is changing
6. Rotate the device around its longer top to bottom axis (Y axis)
7. See that 'beta' is changing
8. Notice that in all three cases, the numbers reported are fairly small (around -10..10)

What is the expected behavior?
According to the W3C spec (http://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion) the rotation axes should be the following:

Z axis: alpha
X axis: beta
Y axis: gamma

Furthermore, the rotation rate should be reported in deg/s, whereas in the current version of Chrome, the value is in rad/s.

What went wrong?
- The axes are not assigned correctly.
- The values are not scaled correctly.

Did this work before? No 

Chrome version: 47.0.2526.6  Channel: dev
OS Version: 5.1.1; SM-N910W8 Build/LMY47X
Flash Version:
 

Comment 1 by i...@soaa.me, Oct 9 2015

Woops. The arch here is arm-v7.
Cc: timvolod...@chromium.org klo...@chromium.org
Status: Available

Comment 3 by Deleted ...@, Oct 9 2015

Yeh questions prapt nahi kar Sakta isliye maine download kiya

Comment 4 by tkent@chromium.org, Oct 12 2015

Labels: -Cr-Blink-JavaScript Cr-Blink
Cc: smus@chromium.org

Comment 6 by yosin@chromium.org, Apr 20 2016

Owner: lafo...@chromium.org
Status: Assigned (was: Available)
laforge@, please create component:Blink>DeviceOrientation like Blink>Bluetooth
Status: Fixed (was: Assigned)
IO>DeviceOrientation created, IO>Bluetooth existed.
Cc: -timvolod...@chromium.org lafo...@chromium.org
Owner: timvolod...@chromium.org
Status: Assigned (was: Fixed)
thanks laforge@
looks like the rotation rate comment could still apply will need to double-check, assigning to myself
Components: IO>DeviceOrientation
Components: -Blink
Components: -IO>DeviceOrientation Blink>Sensor
Components: -Blink>Sensor Blink>Sensor>DeviceOrientation
Owner: juncai@chromium.org
Jun and I recently rediscovered this issue. It is an easy fix however we should do a survey of other implementations to be sure that this behavior has not become the de facto standard given that this has been wrong since this feature was first implemented 4.5 years ago.
I did some testing on Chrome on Android, Firefox browser on Android, and Safari browser on iPhone, they all use:
X axis: alpha
Y axis: beta
Z axis: gamma

The difference is that Firefox browser and Safari browser use degrees, and Chrome uses radians.

Status: Started (was: Assigned)
Cc: timvolod...@chromium.org
Some updates:
1. For the rotation axes issue, I filed a DeviceOrientation Event spec issue to update the spec and created a pull request:
https://github.com/w3c/deviceorientation/issues/44
https://github.com/w3c/deviceorientation/pull/43

2. For the rotation rate issue, I posted an "Intent to Change" to change Chrome implementation to use deg/s instead of rad/s at:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ple1o7bFqEs

Project Member

Comment 18 by bugdroid1@chromium.org, Jan 19 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b86cf40509d59742d8917fde6d03fe195a7432d8

commit b86cf40509d59742d8917fde6d03fe195a7432d8
Author: Jun Cai <juncai@chromium.org>
Date: Fri Jan 19 17:29:02 2018

Change DeviceMotionEvent's DeviceRotationRate to use degrees

The DeviceMotionEvent spec:
https://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion
says the DeviceMotionEvent's DeviceRotationRate "must be expressed in
degrees per second (deg/s)". This CL changes the implementation to be
the same as the spec.

Related post and discussion at blink-dev:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/ple1o7bFqEs

Bug:  541607 
Change-Id: I8cd5a8fadeebf49deb1126685d267495da7b4c3c
Reviewed-on: https://chromium-review.googlesource.com/658330
Commit-Queue: Jun Cai <juncai@chromium.org>
Reviewed-by: Tim Volodine <timvolodine@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#530549}
[modify] https://crrev.com/b86cf40509d59742d8917fde6d03fe195a7432d8/content/renderer/device_sensors/device_motion_event_pump.cc
[modify] https://crrev.com/b86cf40509d59742d8917fde6d03fe195a7432d8/content/renderer/device_sensors/device_motion_event_pump_unittest.cc
[modify] https://crrev.com/b86cf40509d59742d8917fde6d03fe195a7432d8/content/test/data/device_sensors/device_motion_only_some_sensors_are_available_test.html
[modify] https://crrev.com/b86cf40509d59742d8917fde6d03fe195a7432d8/content/test/data/device_sensors/device_motion_test.html

Status: Fixed (was: Started)

Sign in to add a comment