-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automation: integrate with Device Orientation API's Automation section #83
Conversation
@reillyeon PTAL. w3c/deviceorientation#124 (comment) has more context. |
index.bs
Outdated
The [=parse orientation data reading=] algorithm given a JSON {{Object}} |parameters| is modified as follows: | ||
|
||
* Prepend the following steps to the beginning of the algorithm: | ||
1. If ! [$HasOwnProperty$](|parameters|, "`quaternion`") is true: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced we need to support this given this is the only reason we need to specify how to convert from a quaternion back to Euler angles, which is the most complex conversion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason I've thought of doing this is ease of use for end users: people wanting to use WebDriver with the Orientation Sensor API should only need to deal with quaternions.
If the spec doesn't add this bit, users would need to implement the Euler angles to quaternions conversion code themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My intuition has been that tests are mostly written by humans and Euler angles are more intuitive to choose "by hand" while quaternions are better for computation and so are what an application actually wants to work with internally. This makes me think that test authors are unlikely to provide quaternion values or if they do they would generate them on-the-fly from hand-picked Euler angles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is difficult to argue with intuition, but I trust your judgment about this matter. I've pushed a new commit that removes the quaternion->Euler bits and will rebase and squash some commits once it's time to land this PR.
The discussion in #83 (comment) has favored only taking Euler angles as input from WebDriver and having users convert quaternions to Euler angles on their own when necessary (under the assumption that this is not a very common use case).
This adapts to w3c/deviceorientation#124 -- the Device Orientation and Orientation Sensor specifications are supposed to share the same virtual sensor types since they provide similar data (although with different units of measurement). Since the Device Orientation API has broader adoption, the definition of these sensor types have been moved there so that implementations do not need to depend on this spec to implement WebDriver integration.
…operation This will make it easier to invoke from the Automation section in an upcoming commit. The "convert a quaternion to rotation matrix" algorithm performs the same steps that were part of `OrientationSensor.populateMatrix()` and returns the matrix as a 16-element list that is used by the latter. There are no changes to the algorithm itself. Drive-by improvements to populateMatrix(): - Stop checking `targetMatrix`'s type, this is already done by Web IDL. - Refer to `this` with the right notation.
Related to w3c/deviceorientation#124. Both the Device Orientation API and the Orientation Sensor specifications provide orientation data. Among other differences, the former provides the data as a set of intrinsic Tait-Bryant Euler angles, whereas the latter uses quaternions. From an automation perspective, though, it makes sense to use the same virtual sensor types for both APIs and take care of the conversions internally. The Device Orientation spec's Automation section defines steps for parsing a user-provided reading as alpha, beta, gamma numbers that adhere to the requirements laid out by the same spec. This commit augments the same "parse orientation data reading" algorithm by also setting a "quaternion" entry in the reading map that is derived from the user-provider Euler angles. The Euler angles to quaternion algorithm has been copied from Chromium.
ea02c72
to
59e1a7f
Compare
…egration SHA: 7cb6cae Reason: push, by rakuco Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287}
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287}
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287}
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287}
Since w3c/deviceorientation#124 and w3c/orientation-sensor#83, there are no specifications using this algorithm anymore.
Since w3c/deviceorientation#124 and w3c/orientation-sensor#83, there are no specifications using this algorithm anymore.
…aternions from WebDriver, a=testonly Automatic update from web-platform-tests sensors: Read Euler angles instead of quaternions from WebDriver As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287} -- wpt-commits: 95e6ad02194b81f525bdaa089f4574796a68d52d wpt-pr: 44145
…aternions from WebDriver, a=testonly Automatic update from web-platform-tests sensors: Read Euler angles instead of quaternions from WebDriver As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287} -- wpt-commits: 95e6ad02194b81f525bdaa089f4574796a68d52d wpt-pr: 44145
…aternions from WebDriver, a=testonly Automatic update from web-platform-tests sensors: Read Euler angles instead of quaternions from WebDriver As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainiointel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costaintel.com> Reviewed-by: danakj <danakjchromium.org> Reviewed-by: Vladimir Nechaev <nechaevchromium.org> Reviewed-by: Reilly Grant <reillygchromium.org> Cr-Commit-Position: refs/heads/main{#1251287} -- wpt-commits: 95e6ad02194b81f525bdaa089f4574796a68d52d wpt-pr: 44145 UltraBlame original commit: e959950e3a8cc09ccf196193adee5cc688066080
…aternions from WebDriver, a=testonly Automatic update from web-platform-tests sensors: Read Euler angles instead of quaternions from WebDriver As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainiointel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costaintel.com> Reviewed-by: danakj <danakjchromium.org> Reviewed-by: Vladimir Nechaev <nechaevchromium.org> Reviewed-by: Reilly Grant <reillygchromium.org> Cr-Commit-Position: refs/heads/main{#1251287} -- wpt-commits: 95e6ad02194b81f525bdaa089f4574796a68d52d wpt-pr: 44145 UltraBlame original commit: e959950e3a8cc09ccf196193adee5cc688066080
As a result of w3c/deviceorientation#124 and w3c/orientation-sensor#83. The reading format is alpha-beta-gamma as described in the spec. They are measured in degrees and must fall within certain ranges. Internally, however, we always perform the Euler angles to quaternions conversion at the edges (i.e. in ChromeDriver and the Internals implementation used by content_shell), so that the the CDP and //services layers remain unchanged and continue to support only quaternions and the {ABSOLUTE,RELATIVE}_ORIENTATION_QUATERNION types for simplicity. The code to convert Euler angles to quaternions was copied from SensorInspectorAgent in Blink and is available for use by any callers that need to validate Euler angles and convert them. The original code remains in place because the entirety of the SensorInspectorAgent will be removed soon due to the work on bug 1506995. The test values for the orientation-sensor web tests had to be adapted: we now provide the inputs as Euler angles. The expected values have changed slightly as we had to find Euler _and_ quaternion values that were easy enough to read. Written in collaboration with Juha Vainio <juha.j.vainio@intel.com> Bug: 1506995, 1520912, 1520919 Validate-Test-Flakiness: skip Change-Id: I047f41f172f0bbcf30c7462926cec7ae0a66d4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5229177 Commit-Queue: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Vladimir Nechaev <nechaev@chromium.org> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1251287}
This PR builds upon w3c/deviceorientation#124 by augmenting the "parse orientation data reading" algorithm and making it also support quaternions in addition to Euler angles.
From the third and biggest commit:
Both the Device Orientation API and the Orientation Sensor specifications
provide orientation data. Among other differences, the former provides the
data as a set of intrinsic Tait-Bryant Euler angles, whereas the latter uses
quaternions.
From an automation perspective, though, it makes sense to use the same
virtual sensor types for both APIs and take care of the conversions
internally.
The Device Orientation spec's Automation section defines steps for parsing a
user-provided reading as alpha, beta, gamma numbers that adhere to the
requirements laid out by the same spec. This commit augments the same "parse
orientation data reading" algorithm by also setting a "quaternion" entry in
the reading map that is derived from the user-provider Euler angles.
The Euler angles to quaternion algorithm has been copied from Chromium.
Preview | Diff