forked from Blendman974/faceclaw
Simplify glanceboard-trigger angle setting; fix incorrectly-rotated accelerometer readings on G1
The glanceboard head-tilt option was more complicated than necessary, because it wanted the user to take two angle measurements, a baseline angle and a tilt angle. That was a workaround to not knowing the accelerometer's orientation/calibration, but actually, we do know those. (Except, as it turns out, on the G1, the accelerometer orientation is different than it is on the G2, and there was a bug where EvenHub apps got their accelerometer readings in the wrong orientation. So for example the EvenHub Level app didn't work correctly.)
This commit is contained in:
1 parent
37d81d0308
commit
e09f8eae96
17 files changed
+255
-281
No files matched your search
@@ -1,7 +1,23 @@
|
||||
/** Platform-neutral IMU types, shared by imu.ts and imu.ios.ts. */
|
||||
|
||||
/**
|
||||
* An accelerometer sample in g, in Faceclaw's frame for every glasses model
|
||||
* (the G2's own; the session rotates other models' samples into it, see
|
||||
* ImuOrientation.kt): +x forward, +y to the wearer's left, +z up through the
|
||||
* top of the head. At rest it is the "up" direction: head level reads
|
||||
* (0, 0, 1), looking 45° up (0.71, 0, 0.71), the head tilted 45° to the right
|
||||
* (0, 0.71, 0.71).
|
||||
*/
|
||||
export type ImuReading = { x: number; y: number; z: number; source: number };
|
||||
|
||||
/**
|
||||
* How far the head is tilted up from level, in degrees (negative: down), from
|
||||
* a reading taken at rest. Rolling the head to the side does not change it.
|
||||
*/
|
||||
export function imuPitchDegrees(reading: { x: number; y: number; z: number }): number {
|
||||
return (Math.atan2(reading.x, Math.hypot(reading.y, reading.z)) * 180) / Math.PI;
|
||||
}
|
||||
|
||||
/** Map an IMU sample's EventSource to a short label. */
|
||||
export function imuSourceLabel(source: number): string {
|
||||
switch (source) {
|
||||
|
||||
Reference in new issue
Block a user