8000 Add illustration for orientation sensor · w3c/motion-sensors@d61ec99 · GitHub
[go: up one dir, main page]

Skip to content

Commit d61ec99

Browse files
author
Alexander Shalamov
committed
Add illustration for orientation sensor
1 parent 2e3dbaa commit d61ec99

File tree

4 files changed

+100
-60
lines changed
8000

4 files changed

+100
-60
lines changed

index.bs

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ urlPrefix: https://w3c.github.io/sensors; spec: GENERIC-SENSOR
3232
text: latest reading
3333
text: sensor
3434
text: sensor-fusion
35+
urlPrefix: https://w3c.github.io/accelerometer; spec: ACCELEROMETER
36+
type: dfn
37+
text: acceleration
3538
</pre>
3639

3740
<pre class="link-defaults">
@@ -92,10 +95,11 @@ Low-level Sensors {#low-level-sensors}
9295
A raw <dfn>accelerometer</dfn> sensor measures changes in acceleration in 3 different
9396
directions, but is affected by <i>gravity</i>.
9497

95-
This means that when the device is in free fall, the acceleration will be 0 m/s<sup>2</sup>
96-
in the falling direction, and when a device is laying flat on a table, the acceleration in
97-
upwards direction will be equal to the earth gravity, i.e. g := +9.8 m/s<sup>2</sup> as it is
98-
measuring the force of the table holding up the device.
98+
The [=Accelerometer=] sensor is an <dfn>inertial-frame sensor</dfn>, this means that when the device
99+
is in free fall, the acceleration is 0 m/s<sup>2</sup> in the falling direction, and
100+
when a device is laying flat on a table, the acceleration in upwards direction will be equal
101+
to the Earth gravity, i.e. g ≡ 9.8 m/s<sup>2</sup> as it is measuring the force of the table
102+
pushing the device upwards.
99103

100104
Accelerometers are less useful by themselves and often take part in other fusion sensors,
101105
but they do have some purposes like registering shakes, steps and the like.
@@ -160,7 +164,7 @@ frequency caused by adjacent hardware on the device.
160164
## Magnetometer ## {#magnetometer}
161165

162166
<dfn for="magnetometer">Magnetometers</dfn> are <i>magnetic field sensors</i>, which means that without any strong magnetic influence
163-
close by, it will sense the earth's magnetic field, which more or less points in the direction
167+
close by, it will sense the Earth's magnetic field, which more or less points in the direction
164168
of north, but not true north.
165169

166170
As said, magnetometers are very sensitive to outside influence, like anything on a table that
@@ -180,7 +184,7 @@ minimum requires an accelerometer, in the case of low pass filtering, and additi
180184
if more precise readings are needed. This is called tilt compensation.
181185

182186
The most common use-case for magnetometers are as part of sensor fusion, in order to generate an
183-
Orientation Sensor which is stationary to the earth plane, or a compass, which is basically the
187+
Orientation Sensor which is stationary to the Earth plane, or a compass, which is basically the
184188
former with corrections to the declination depending on geolocation position, such that it points
185189
to the true north.
186190

@@ -343,7 +347,7 @@ with [=gyroscope=] readings.
343347

344348
As mentioned before, the <dfn>Orientation Sensor</dfn>, is one of the common use-cases of a
345349
magnetometer, and it a sensor representing an orientation stationary (fixed to the magnetic
346-
field vector and gravity vector) to the earth plane.
350+
field vector and gravity vector) to the Earth plane.
347351

348352
An orientation sensor can be useful for game controls such as a ball-in-a-maze puzzle, or
349353
for a head-mounted display where you want to be able to rotate the display and look in all
@@ -356,18 +360,26 @@ even slightly or slowly, without affecting your driving direction.
356360

357361
The orientation vector of the [=Orientation Sensor=], can be calculated the following way:
358362

359-
The gravity vector points towards the earth's core when mostly stationary and as long as the
360-
device is not in free fall, there is enough vector length to project the magnetic field vector
361-
onto the ground plane.
363+
As the [=Accelerometer=] is an <a>inertial-frame sensor</a>, the gravity vector will point
364+
towards the sky when the device is mostly stationary, and as long as the device is not in free fall,
365+
there is enough vector length to project the magnetic field vector onto the ground plane.
362366

363367
Note, this will fail at the magnetic poles as the magnetic field vector will point mostly in
364-
the same direction as the gravity vector and generally be very unreliable.
368+
the opposite direction as the gravity vector and generally be very unreliable.
369+
370+
By taking the cross product between the the magnetic field vector and gravity vector
371+
(see [=Gravity Sensor=]), we get a vector which points East on the ground plane, using the right hand rule.
372+
373+
Now if we take the cross product the gravity vector and the newly found East vector, then resulting
374+
vector will point in the northern direction towards the Earth's magnetic field.
365375

366-
By taking the cross product between the gravity vector (see [=Gravity Sensor=]) and the magnetic
367-
field vector, we get a vector which points East on the ground plane, using the right hand rule.
376+
The illustration below represents the case when device is at rest and y-axis points towards the
377+
North. The reading from the [=Magnetometer=] is {x: 0, y: 11, z: -16} and [=Accelerometer=] reports
378+
{x: 0.11, y: 0.07, z: 9.81} <a>acceleration</a>. The uG is a unit vector representing the gravity,
379+
uB represents magnetic field vector, uE = uB x uG and points East. The uN = uG x uE that points to
380+
the northern direction.
368381

369-
Now if we take the cross product of the gravity vector with the newly found East vector, then
370-
it will point in the northern direction towards the earth's magnetic field.
382+
<img src="orientation_fusion.png" srcset="orientation_fusion.svg" style="display: block;margin: auto;" alt="OrientationSensor fusion.">
371383

372384
Thus an [=Orientation Sensor=] is a fusion sensor of the [=Magnetometer=] and the
373385
[=Accelerometer=], and potentially the [=Gyroscope=] for better isolated gravity

0 commit comments

Comments
 (0)
0