@wemap/providers 6.1.5 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Vector3 } from '@wemap/maths';
|
|
2
|
+
|
|
1
3
|
class StepDetectionMinMaxPeaks2 {
|
|
2
4
|
|
|
3
5
|
// in seconds
|
|
@@ -14,6 +16,11 @@ class StepDetectionMinMaxPeaks2 {
|
|
|
14
16
|
static VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD = 0.75;
|
|
15
17
|
static VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD = -0.3;
|
|
16
18
|
|
|
19
|
+
// in rad.s-1
|
|
20
|
+
static HIGH_ROTATION_THRESHOLD = 1.35
|
|
21
|
+
// in seconds
|
|
22
|
+
static HIGH_ROTATION_DURATION = 0.3
|
|
23
|
+
|
|
17
24
|
|
|
18
25
|
constructor() {
|
|
19
26
|
this.slidingWindow = [];
|
|
@@ -23,14 +30,22 @@ class StepDetectionMinMaxPeaks2 {
|
|
|
23
30
|
this.influence = 0.2;
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
_parseGyroscope(values, timestamp) {
|
|
34
|
+
const rotationSpeed = Vector3.norm(values);
|
|
35
|
+
if (rotationSpeed > StepDetectionMinMaxPeaks2.HIGH_ROTATION_THRESHOLD) {
|
|
36
|
+
this.lastHighRotation = timestamp;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
26
39
|
|
|
27
40
|
compute(timestamp, linearAcc, angularRate) {
|
|
28
41
|
|
|
42
|
+
this._parseGyroscope(angularRate, timestamp);
|
|
43
|
+
|
|
29
44
|
const verticalAcc = this.influence * (linearAcc[2] * 2) + (1 - this.influence) * this.previousVerticalAcc;
|
|
30
45
|
this.previousVerticalAcc = verticalAcc;
|
|
31
46
|
|
|
32
47
|
|
|
33
|
-
if (
|
|
48
|
+
if (timestamp - this.lastHighRotation < StepDetectionMinMaxPeaks2.HIGH_ROTATION_DURATION) {
|
|
34
49
|
return false;
|
|
35
50
|
}
|
|
36
51
|
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema#",
|
|
3
|
+
"title": "JSON SCHEMA for Visual Positioning Service (VPS)",
|
|
4
|
+
"$comment": "Helped from https://github.com/OpenArCloud/oscp-geopose-protocol",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["imageBytes", "size"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"imageBytes": {
|
|
9
|
+
"$comment": "base64 image",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"pattern": "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
|
|
12
|
+
},
|
|
13
|
+
"cameraParams": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"intrinsic": {
|
|
17
|
+
"$comment": "[fx, s, cx, 0, fy, cy, 0, 0, 1] (row-major)",
|
|
18
|
+
"type": "array",
|
|
19
|
+
"minLength": 9,
|
|
20
|
+
"maxLength": 9
|
|
21
|
+
},
|
|
22
|
+
"distortions": {
|
|
23
|
+
"$comment": "[k1, k2, p1, p2, k3]",
|
|
24
|
+
"type": "array",
|
|
25
|
+
"minLength": 5,
|
|
26
|
+
"maxLength": 5
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"imageFormat": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"enum": [
|
|
33
|
+
"RGBA32",
|
|
34
|
+
"GRAY8"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"size": {
|
|
38
|
+
"$comment": "[width, height] (in pixels)",
|
|
39
|
+
"type": "array",
|
|
40
|
+
"minLength": 2,
|
|
41
|
+
"maxLength": 2
|
|
42
|
+
},
|
|
43
|
+
"coarseLocation": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["latitude", "longitude"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"latitude": {
|
|
48
|
+
"type": "number"
|
|
49
|
+
},
|
|
50
|
+
"longitude": {
|
|
51
|
+
"type": "number"
|
|
52
|
+
},
|
|
53
|
+
"altitude": {
|
|
54
|
+
"type": "number"
|
|
55
|
+
},
|
|
56
|
+
"level": {
|
|
57
|
+
"$comment": "OpenStreetMap level",
|
|
58
|
+
"type": "number",
|
|
59
|
+
"multipleOf": 1
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"coarseAttitude": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"required": ["w", "x", "y", "z"],
|
|
66
|
+
"properties": {
|
|
67
|
+
"w": {
|
|
68
|
+
"type": "number",
|
|
69
|
+
"minimum": -1,
|
|
70
|
+
"maximum": 1
|
|
71
|
+
},
|
|
72
|
+
"x": {
|
|
73
|
+
"type": "number",
|
|
74
|
+
"minimum": -1,
|
|
75
|
+
"maximum": 1
|
|
76
|
+
},
|
|
77
|
+
"y": {
|
|
78
|
+
"type": "number",
|
|
79
|
+
"minimum": -1,
|
|
80
|
+
"maximum": 1
|
|
81
|
+
},
|
|
82
|
+
"z": {
|
|
83
|
+
"type": "number",
|
|
84
|
+
"minimum": -1,
|
|
85
|
+
"maximum": 1
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|