w3c / accelerometer

Accelerometer
https://www.w3.org/TR/accelerometer/
Other
18 stars 25 forks source link

Explain how the implementation separates gravity from linear acceleration #58

Closed jyasskin closed 3 years ago

jyasskin commented 3 years ago

In the interest of helping someone in the future produce a greenfield implementation, it would be good if this specification explained or linked to an explanation of how raw sensor values are combined or split into separate linear acceleration vs gravity values. General relativity would seem to imply that such a separation is impossible, but clearly it's been done. 🙃

anssiko commented 3 years ago

That's a good point, we somehow missed a reference to an explainer. Do you think an informative note linking to https://w3c.github.io/motion-sensors/#gravity-and-linear-acceleration would be adequate?

reillyeon commented 3 years ago

The existing definition of gravity could use a note that it assumes that the device is not in free fall for more than a short period of time. It is that assumption which allows the separation of the two components of the force applied to the accelerometer to be separated without violating General Relativity.

jyasskin commented 3 years ago

Yes, informatively linking to the information in https://www.w3.org/TR/motion-sensors/#gravity-and-linear-acceleration would solve the problem, along with some fix to the normative definition of gravity along the lines Reilly suggests. Reilly also mentioned that the normative definition could say something about it being the component of acceleration that doesn't cause a change in velocity-relative-to-your-reference-frame ... but I defer to the WG on which change both helps the theoretical problem and accurately describes the output of real implementations.