Intent to Prototype: GravitySensor API

180 views
Skip to first unread message

Mandy, Arnaud

unread,
Jan 26, 2021, 12:32:00 PM1/26/21
to Abridged recipients
Contact emails


Specification


API spec
Yes

Summary
Expose the GravitySensor API, which provides a 3-axis reading of the gravity force, to users. Together with the readings from a LinearAccelerometer, its values form the readings obtained from an Accelerometer object.

Blink component

Motivation
A gravity sensor is used to measure the force of gravity around the x, y, z axes.

As https://crbug.com/1163993 states, it is already possible for users to manually derive readings close to a GravitySensor’s by manually inspecting an Accelerometer and a LinearAccelerometer’s readings, but this can be cumbersome and depend on the accuracy of the values provided by those sensors.

Platforms such as Android can provide gravity readings as part of the platform, which should be cheaper in terms of computation, provide more accurate values depending on the user’s hardware and easier to use in terms of API ergonomics.

Search tags

TAG review

TAG review status
Issues addressed

Risks
 
Interoperability and Compatibility
Generic Sensor APIs, as well as other hardware-related APIs, can be controversial when it comes to interoperability because other browser engine developers have voiced privacy-related concerns.

We believe the Chromium implementation addresses those concerns. Additionally, all the data exposed by this API can already be read by users in JavaScript by calculating gravity from the Accelerometer and LinearAccelerometer readings we already provide.
Gecko: Negative Mozilla has not been asked about this specific API, but have raised concerns about the Generic Sensor APIs, including Accelerometer.
WebKit: Negative (https://webkit.org/tracking-prevention/) Although Apple has not been specifically asked about this API, they are not part of the Devices & Sensors WG, and have generally been contrary to the Generic Sensor APIs.
Web developers: Positive (https://crbug.com/1163993)

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes, except for Mac. The readings are obtained directly from the platform on Android when possible, and implemented as a fusion sensor on top of the Accelerometer implementation otherwise (and in other OSes except for macOS). There is support for gravity sensors in the Linux kernel as well, but we need to write some extra logic to handle falling back to a fusion sensor if they are not present".

Per this discussion, only older Mac laptops seem to ship with accelerometers. We currently only ship the Accelerometer interface on Macs, but not LinearAccelerometer, in order to support the older Device Orientation/Motion APIs. As such, there does not seem to make much sense to ship this API on Macs either. 



Is this feature fully tested by web-platform-tests?

Tracking bug

Link to entry on the Chrome Platform Status

 
This intent message was generated by Chrome Platform Status.

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Thomas Steiner

unread,
Feb 5, 2021, 8:51:24 AM2/5/21
to Mandy, Arnaud, Abridged recipients
Hi all,

FYI, I have covered the new GravitySensor in the updated and migrated Generic Sensor API article (staging link, the final link will be web.dev/generic-sensor/) that was initially written by two of your colleagues from Intel. 

Cheers,
Tom


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/DM5PR11MB2057E69BD2266D242E6F884B93BD9%40DM5PR11MB2057.namprd11.prod.outlook.com.


--
Thomas Steiner, PhD—Developer Advocate (https://blog.tomayac.com, https://twitter.com/tomayac)

Google Germany GmbH, ABC-Str. 19, 20354 Hamburg, Germany
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.1.23 (GNU/Linux)

iFy0uwAntT0bE3xtRa5AfeCheCkthAtTh3reSabiGbl0ck0fjumBl3DCharaCTersAttH3b0ttom.hTtPs://xKcd.cOm/1181/
-----END PGP SIGNATURE-----

Mandy, Arnaud

unread,
Feb 8, 2021, 3:56:51 AM2/8/21
to Thomas Steiner, Abridged recipients
Hi,

Thanks for the update!

Br
Arno

From: Thomas Steiner <to...@google.com>
Sent: Friday, February 5, 2021 15:51
To: Mandy, Arnaud <arnaud...@intel.com>
Cc: Abridged recipients <blin...@chromium.org>
Subject: Re: [blink-dev] Intent to Prototype: GravitySensor API
 

Balazs Engedy

unread,
Feb 9, 2021, 10:17:02 AM2/9/21
to blink-dev, arnaud...@intel.com, Abridged recipients, Thomas Steiner
What is the accuracy of the sensor readings here? I am seeing rounding for other types of accelerometers, but not this one:

Thomas Steiner

unread,
Feb 9, 2021, 11:47:58 AM2/9/21
to Balazs Engedy, Kubo Da Costa, Raphael, arnaud...@intel.com, Abridged recipients, Thomas Steiner
Hi Balazs,

On Tue, Feb 9, 2021 at 4:16 PM Balazs Engedy <eng...@chromium.org> wrote:
What is the accuracy of the sensor readings here? I am seeing rounding for other types of accelerometers, but not this one:

It was mentioned by @Kubo Da Costa, Raphael in #c15 that this new interface would add rounding, too (based on #c14, which, coming from the requester of this feature, makes me happy! More of this!). 

Cheers,
Tom

Balazs Engedy

unread,
Feb 23, 2021, 9:54:19 AM2/23/21
to blink-dev, Thomas Steiner, arnaud...@intel.com, Abridged recipients, Balazs Engedy, Raphael Kubo Da Costa
Thanks, Thomas! To close the loop on this, in the meantime https://crrev.com/c/2684575 was landed which addresses my concern.
Reply all
Reply to author
Forward
0 new messages