@@ -32,6 +32,9 @@ urlPrefix: https://w3c.github.io/sensors; spec: GENERIC-SENSOR
32
32
text: latest reading
33
33
text: sensor
34
34
text: sensor-fusion
35
+ urlPrefix: https://w3c.github.io/accelerometer; spec: ACCELEROMETER
36
+ type: dfn
37
+ text: acceleration
35
38
</pre>
36
39
37
40
<pre class="link-defaults">
@@ -92,10 +95,11 @@ Low-level Sensors {#low-level-sensors}
92
95
A raw <dfn>accelerometer</dfn> sensor measures changes in acceleration in 3 different
93
96
directions, but is affected by <i> gravity</i> .
94
97
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.
99
103
100
104
Accelerometers are less useful by themselves and often take part in other fusion sensors,
101
105
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.
160
164
## Magnetometer ## {#magnetometer}
161
165
162
166
<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
164
168
of north, but not true north.
165
169
166
170
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
180
184
if more precise readings are needed. This is called tilt compensation.
181
185
182
186
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
184
188
former with corrections to the declination depending on geolocation position, such that it points
185
189
to the true north.
186
190
@@ -343,7 +347,7 @@ with [=gyroscope=] readings.
343
347
344
348
As mentioned before, the <dfn>Orientation Sensor</dfn> , is one of the common use-cases of a
345
349
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.
347
351
348
352
An orientation sensor can be useful for game controls such as a ball-in-a-maze puzzle, or
349
353
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.
356
360
357
361
The orientation vector of the [=Orientation Sensor=] , can be calculated the following way:
358
362
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.
362
366
363
367
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.
365
375
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.
368
381
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.">
371
383
372
384
Thus an [=Orientation Sensor=] is a fusion sensor of the [=Magnetometer=] and the
373
385
[=Accelerometer=] , and potentially the [=Gyroscope=] for better isolated gravity
0 commit comments