@wemap/providers 11.6.0 → 11.6.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/dist/index.js +261 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +246 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
6
|
return value;
|
|
7
7
|
};
|
|
8
|
-
Object.
|
|
8
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
9
9
|
const geo = require("@wemap/geo");
|
|
10
10
|
const maths = require("@wemap/maths");
|
|
11
11
|
const routers = require("@wemap/routers");
|
|
@@ -13,10 +13,7 @@ const utils = require("@wemap/utils");
|
|
|
13
13
|
const Logger = require("@wemap/logger");
|
|
14
14
|
const geomag = require("geomag");
|
|
15
15
|
const camera = require("@wemap/camera");
|
|
16
|
-
|
|
17
|
-
function _interopNamespace(e) {
|
|
18
|
-
if (e && e.__esModule)
|
|
19
|
-
return e;
|
|
16
|
+
function _interopNamespaceDefault(e) {
|
|
20
17
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
21
18
|
if (e) {
|
|
22
19
|
for (const k in e) {
|
|
@@ -32,8 +29,7 @@ function _interopNamespace(e) {
|
|
|
32
29
|
n.default = e;
|
|
33
30
|
return Object.freeze(n);
|
|
34
31
|
}
|
|
35
|
-
const
|
|
36
|
-
const geomag__namespace = /* @__PURE__ */ _interopNamespace(geomag);
|
|
32
|
+
const geomag__namespace = /* @__PURE__ */ _interopNamespaceDefault(geomag);
|
|
37
33
|
class RelativeAttitude extends geo.Attitude {
|
|
38
34
|
}
|
|
39
35
|
class AbsoluteAttitude extends geo.Attitude {
|
|
@@ -41,8 +37,21 @@ class AbsoluteAttitude extends geo.Attitude {
|
|
|
41
37
|
class AbsolutePosition extends geo.UserPosition {
|
|
42
38
|
}
|
|
43
39
|
const ProvidersOptions = {
|
|
40
|
+
/**
|
|
41
|
+
* Does provider will use map to
|
|
42
|
+
*/
|
|
44
43
|
useMapMatching: true,
|
|
44
|
+
/**
|
|
45
|
+
* Providers listed here will not be used by the system
|
|
46
|
+
* List of {@link Provider#pname}
|
|
47
|
+
*/
|
|
45
48
|
ignoreProviders: [],
|
|
49
|
+
/**
|
|
50
|
+
* Some providers are not used by default (i.e. PoleStar) because they
|
|
51
|
+
* require data from an optional external service or because they drain more
|
|
52
|
+
* battery. They can be added to this list to be used
|
|
53
|
+
* List of {@link Provider#pname}
|
|
54
|
+
*/
|
|
46
55
|
optionalProviders: [],
|
|
47
56
|
stopOnError: true,
|
|
48
57
|
checkAvailabilityOnStart: true,
|
|
@@ -72,7 +81,7 @@ class ProvidersLoggerOld {
|
|
|
72
81
|
}
|
|
73
82
|
this.interval = window.setInterval(() => {
|
|
74
83
|
for (const [key, value] of Object.entries(this.pushEvents)) {
|
|
75
|
-
|
|
84
|
+
Logger.debug("Received " + value + " notifications from " + this.pushEventsRef[Number(key)].getName() + " last second");
|
|
76
85
|
}
|
|
77
86
|
this.pushEvents = {};
|
|
78
87
|
this.pushEventsRef = {};
|
|
@@ -94,7 +103,7 @@ class ProvidersLoggerOld {
|
|
|
94
103
|
this.initializeInterval();
|
|
95
104
|
const objectId = this.getObjectId(object);
|
|
96
105
|
const objectClassName = object.getName();
|
|
97
|
-
|
|
106
|
+
Logger.debug(objectClassName + "[" + objectId + "]." + method);
|
|
98
107
|
}
|
|
99
108
|
incrementNotifications(object) {
|
|
100
109
|
if (!this.enabled) {
|
|
@@ -110,20 +119,26 @@ class ProvidersLoggerOld {
|
|
|
110
119
|
}
|
|
111
120
|
}
|
|
112
121
|
const ProvidersLoggerOld$1 = new ProvidersLoggerOld();
|
|
113
|
-
const _ContainsIgnoredProviderError = class extends Error {
|
|
122
|
+
const _ContainsIgnoredProviderError = class _ContainsIgnoredProviderError extends Error {
|
|
114
123
|
constructor(message) {
|
|
115
124
|
super(message || _ContainsIgnoredProviderError.DEFAULT_MESSAGE);
|
|
116
125
|
}
|
|
117
126
|
};
|
|
127
|
+
__publicField(_ContainsIgnoredProviderError, "DEFAULT_MESSAGE", "Contains ignored provider");
|
|
118
128
|
let ContainsIgnoredProviderError = _ContainsIgnoredProviderError;
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
const _Provider = class _Provider {
|
|
130
|
+
/**
|
|
131
|
+
* Provider constructor
|
|
132
|
+
*/
|
|
121
133
|
constructor() {
|
|
122
134
|
__publicField(this, "id");
|
|
123
135
|
__publicField(this, "state", "stopped");
|
|
124
136
|
__publicField(this, "_lastEvent", null);
|
|
125
137
|
__publicField(this, "_eventsCallbacks", []);
|
|
126
138
|
__publicField(this, "_monitoringCallbacks", []);
|
|
139
|
+
/**
|
|
140
|
+
* Notify the subscriber defined in {@link addEventListener}
|
|
141
|
+
*/
|
|
127
142
|
__publicField(this, "notify", (event) => {
|
|
128
143
|
ProvidersLoggerOld$1.incrementNotifications(this);
|
|
129
144
|
this._eventsCallbacks.forEach((cb) => {
|
|
@@ -132,6 +147,9 @@ const _Provider = class {
|
|
|
132
147
|
});
|
|
133
148
|
this._lastEvent = event;
|
|
134
149
|
});
|
|
150
|
+
/**
|
|
151
|
+
* Notify the subscriber defined in {@link addEventListener}
|
|
152
|
+
*/
|
|
135
153
|
__publicField(this, "notifyError", (error) => {
|
|
136
154
|
this._eventsCallbacks.forEach(({
|
|
137
155
|
id,
|
|
@@ -146,6 +164,9 @@ const _Provider = class {
|
|
|
146
164
|
this.id = _Provider._uniqueId++;
|
|
147
165
|
ProvidersLoggerOld$1.addEvent(this, "constructor");
|
|
148
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Resolve with an error if the provider is not available
|
|
169
|
+
*/
|
|
149
170
|
getAvailability() {
|
|
150
171
|
if (ProvidersOptions.ignoreProviders.includes(this.getName())) {
|
|
151
172
|
return Promise.resolve(new ContainsIgnoredProviderError());
|
|
@@ -249,9 +270,9 @@ const _Provider = class {
|
|
|
249
270
|
return this._lastEvent;
|
|
250
271
|
}
|
|
251
272
|
};
|
|
273
|
+
__publicField(_Provider, "_callbackUniqueId", 0);
|
|
274
|
+
__publicField(_Provider, "_uniqueId", 1);
|
|
252
275
|
let Provider = _Provider;
|
|
253
|
-
__publicField(Provider, "_callbackUniqueId", 0);
|
|
254
|
-
__publicField(Provider, "_uniqueId", 1);
|
|
255
276
|
class AvailabilityHelper {
|
|
256
277
|
static async every(availabilityPromises) {
|
|
257
278
|
for (const aPr of availabilityPromises) {
|
|
@@ -275,14 +296,14 @@ class AvailabilityHelper {
|
|
|
275
296
|
return firstError || null;
|
|
276
297
|
}
|
|
277
298
|
}
|
|
278
|
-
const _AskImuOnDesktopError = class extends Error {
|
|
299
|
+
const _AskImuOnDesktopError = class _AskImuOnDesktopError extends Error {
|
|
279
300
|
constructor(message) {
|
|
280
301
|
super(message || _AskImuOnDesktopError.DEFAULT_MESSAGE);
|
|
281
302
|
}
|
|
282
303
|
};
|
|
304
|
+
__publicField(_AskImuOnDesktopError, "DEFAULT_MESSAGE", "It seems that you ask for IMU events on a desktop browser");
|
|
283
305
|
let AskImuOnDesktopError = _AskImuOnDesktopError;
|
|
284
|
-
|
|
285
|
-
const _MissingSensorError = class extends Error {
|
|
306
|
+
const _MissingSensorError = class _MissingSensorError extends Error {
|
|
286
307
|
constructor(message) {
|
|
287
308
|
super(message || _MissingSensorError.DEFAULT_MESSAGE);
|
|
288
309
|
}
|
|
@@ -291,38 +312,38 @@ const _MissingSensorError = class extends Error {
|
|
|
291
312
|
return this;
|
|
292
313
|
}
|
|
293
314
|
};
|
|
315
|
+
__publicField(_MissingSensorError, "DEFAULT_MESSAGE", "Impossible to retrieve events, a sensor is missing");
|
|
294
316
|
let MissingSensorError = _MissingSensorError;
|
|
295
|
-
__publicField(MissingSensorError, "DEFAULT_MESSAGE", "Impossible to retrieve events, a sensor is missing");
|
|
296
317
|
class MissingMagnetometerError extends MissingSensorError {
|
|
297
318
|
constructor(message) {
|
|
298
319
|
super(message);
|
|
299
320
|
}
|
|
300
321
|
}
|
|
301
|
-
const _GeolocationApiMissingError = class extends Error {
|
|
322
|
+
const _GeolocationApiMissingError = class _GeolocationApiMissingError extends Error {
|
|
302
323
|
constructor(message) {
|
|
303
324
|
super(message || _GeolocationApiMissingError.DEFAULT_MESSAGE);
|
|
304
325
|
}
|
|
305
326
|
};
|
|
327
|
+
__publicField(_GeolocationApiMissingError, "DEFAULT_MESSAGE", "Geolocation api is missing");
|
|
306
328
|
let GeolocationApiMissingError = _GeolocationApiMissingError;
|
|
307
|
-
|
|
308
|
-
const _GeolocationPermissionDeniedError = class extends Error {
|
|
329
|
+
const _GeolocationPermissionDeniedError = class _GeolocationPermissionDeniedError extends Error {
|
|
309
330
|
constructor(message) {
|
|
310
331
|
super(message || _GeolocationPermissionDeniedError.DEFAULT_MESSAGE);
|
|
311
332
|
}
|
|
312
333
|
};
|
|
334
|
+
__publicField(_GeolocationPermissionDeniedError, "DEFAULT_MESSAGE", "Geolocation permission denied");
|
|
313
335
|
let GeolocationPermissionDeniedError = _GeolocationPermissionDeniedError;
|
|
314
|
-
|
|
315
|
-
const _GeolocationPositionUnavailableError = class extends Error {
|
|
336
|
+
const _GeolocationPositionUnavailableError = class _GeolocationPositionUnavailableError extends Error {
|
|
316
337
|
constructor(message) {
|
|
317
338
|
super(message || _GeolocationPositionUnavailableError.DEFAULT_MESSAGE);
|
|
318
339
|
}
|
|
319
340
|
};
|
|
341
|
+
__publicField(_GeolocationPositionUnavailableError, "DEFAULT_MESSAGE", "Geolocation position unavailable");
|
|
320
342
|
let GeolocationPositionUnavailableError = _GeolocationPositionUnavailableError;
|
|
321
|
-
__publicField(GeolocationPositionUnavailableError, "DEFAULT_MESSAGE", "Geolocation position unavailable");
|
|
322
343
|
const Constants = {
|
|
323
344
|
DEFAULT_ALTITUDE: 1.6
|
|
324
345
|
};
|
|
325
|
-
const _GnssWifiProvider = class extends Provider {
|
|
346
|
+
const _GnssWifiProvider = class _GnssWifiProvider extends Provider {
|
|
326
347
|
constructor() {
|
|
327
348
|
super(...arguments);
|
|
328
349
|
__publicField(this, "discardPositionsAbove", _GnssWifiProvider.DEFAULT_DISCARD_POSITIONS_ABOVE);
|
|
@@ -353,7 +374,7 @@ const _GnssWifiProvider = class extends Provider {
|
|
|
353
374
|
this.notify(position);
|
|
354
375
|
});
|
|
355
376
|
__publicField(this, "onPositionError", (error) => {
|
|
356
|
-
|
|
377
|
+
Logger.warn(`[Providers] watchPosition error: [${error.code}] ${error.message}`);
|
|
357
378
|
let customError;
|
|
358
379
|
switch (error.code) {
|
|
359
380
|
case 1:
|
|
@@ -386,29 +407,29 @@ const _GnssWifiProvider = class extends Provider {
|
|
|
386
407
|
}
|
|
387
408
|
}
|
|
388
409
|
};
|
|
389
|
-
|
|
390
|
-
__publicField(GnssWifiProvider, "POSITION_OPTIONS", {
|
|
410
|
+
__publicField(_GnssWifiProvider, "POSITION_OPTIONS", {
|
|
391
411
|
enableHighAccuracy: true,
|
|
392
412
|
timeout: Infinity,
|
|
393
413
|
maximumAge: 0
|
|
394
414
|
});
|
|
395
|
-
__publicField(
|
|
415
|
+
__publicField(_GnssWifiProvider, "DEFAULT_DISCARD_POSITIONS_ABOVE", 50);
|
|
416
|
+
let GnssWifiProvider = _GnssWifiProvider;
|
|
396
417
|
const GnssWifiProvider$1 = new GnssWifiProvider();
|
|
397
|
-
const _MissingArCoreError = class extends Error {
|
|
418
|
+
const _MissingArCoreError = class _MissingArCoreError extends Error {
|
|
398
419
|
constructor(message) {
|
|
399
420
|
super(message || _MissingArCoreError.DEFAULT_MESSAGE);
|
|
400
421
|
}
|
|
401
422
|
};
|
|
423
|
+
__publicField(_MissingArCoreError, "DEFAULT_MESSAGE", "ARCore is missing");
|
|
402
424
|
let MissingArCoreError = _MissingArCoreError;
|
|
403
|
-
|
|
404
|
-
const _MissingNativeInterfaceError = class extends Error {
|
|
425
|
+
const _MissingNativeInterfaceError = class _MissingNativeInterfaceError extends Error {
|
|
405
426
|
constructor(message) {
|
|
406
427
|
super(message || _MissingNativeInterfaceError.DEFAULT_MESSAGE);
|
|
407
428
|
}
|
|
408
429
|
};
|
|
430
|
+
__publicField(_MissingNativeInterfaceError, "DEFAULT_MESSAGE", "Native interface is missing. You are maybe trying to execute a code which is not available in a web browser");
|
|
409
431
|
let MissingNativeInterfaceError = _MissingNativeInterfaceError;
|
|
410
|
-
|
|
411
|
-
const _ArCoreProvider = class extends Provider {
|
|
432
|
+
const _ArCoreProvider = class _ArCoreProvider extends Provider {
|
|
412
433
|
constructor() {
|
|
413
434
|
super(...arguments);
|
|
414
435
|
__publicField(this, "_nativeProvider");
|
|
@@ -516,8 +537,7 @@ const _ArCoreProvider = class extends Provider {
|
|
|
516
537
|
return true;
|
|
517
538
|
}
|
|
518
539
|
};
|
|
519
|
-
|
|
520
|
-
__publicField(ArCoreProvider, "Payload", {
|
|
540
|
+
__publicField(_ArCoreProvider, "Payload", {
|
|
521
541
|
Pose: {
|
|
522
542
|
ref: 2 ** 0,
|
|
523
543
|
size: 7
|
|
@@ -535,7 +555,11 @@ __publicField(ArCoreProvider, "Payload", {
|
|
|
535
555
|
size: 1
|
|
536
556
|
}
|
|
537
557
|
});
|
|
538
|
-
|
|
558
|
+
/**
|
|
559
|
+
* default relative attitude drift in rad.second-1
|
|
560
|
+
*/
|
|
561
|
+
__publicField(_ArCoreProvider, "RELATIVE_ATTITUDE_DRIFT", maths.deg2rad(3) / 60);
|
|
562
|
+
let ArCoreProvider = _ArCoreProvider;
|
|
539
563
|
const ArCoreProvider$1 = new ArCoreProvider();
|
|
540
564
|
class GeoRelativePositionFromArCoreProvider extends Provider {
|
|
541
565
|
constructor() {
|
|
@@ -626,6 +650,10 @@ class EkfAttitude {
|
|
|
626
650
|
yc: maths.Matrix3.diag(Array(3).fill(absoluteNoises.yc ** 2))
|
|
627
651
|
};
|
|
628
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* Try to initialize filter.
|
|
655
|
+
* To initialize, we need at least current acceleration (acc)
|
|
656
|
+
*/
|
|
629
657
|
tryInitialize(acc, mag) {
|
|
630
658
|
const accNormalized = maths.Vector3.normalize(acc);
|
|
631
659
|
if (mag) {
|
|
@@ -756,6 +784,9 @@ class ImuProvider extends Provider {
|
|
|
756
784
|
constructor() {
|
|
757
785
|
super(...arguments);
|
|
758
786
|
__publicField(this, "getName", () => "IMU");
|
|
787
|
+
/**
|
|
788
|
+
* devicemotion callback
|
|
789
|
+
*/
|
|
759
790
|
__publicField(this, "parseDeviceMotionEvent", (e) => {
|
|
760
791
|
const timestamp = e.timeStamp / 1e3;
|
|
761
792
|
let acc;
|
|
@@ -815,13 +846,13 @@ class ImuProvider extends Provider {
|
|
|
815
846
|
}
|
|
816
847
|
}
|
|
817
848
|
const ImuProvider$1 = new ImuProvider();
|
|
818
|
-
const _MissingAccelerometerError = class extends MissingSensorError {
|
|
849
|
+
const _MissingAccelerometerError = class _MissingAccelerometerError extends MissingSensorError {
|
|
819
850
|
constructor(message) {
|
|
820
851
|
super(message || _MissingAccelerometerError.DEFAULT_MESSAGE);
|
|
821
852
|
}
|
|
822
853
|
};
|
|
854
|
+
__publicField(_MissingAccelerometerError, "DEFAULT_MESSAGE", "Impossible to retrieve Acceleration data");
|
|
823
855
|
let MissingAccelerometerError = _MissingAccelerometerError;
|
|
824
|
-
__publicField(MissingAccelerometerError, "DEFAULT_MESSAGE", "Impossible to retrieve Acceleration data");
|
|
825
856
|
class AccelerometerProvider extends Provider {
|
|
826
857
|
constructor() {
|
|
827
858
|
super(...arguments);
|
|
@@ -862,7 +893,7 @@ class GyroscopeProvider extends Provider {
|
|
|
862
893
|
}
|
|
863
894
|
}
|
|
864
895
|
const GyroscopeProvider$1 = new GyroscopeProvider();
|
|
865
|
-
const _RelativeAttitudeFromEkf = class extends Provider {
|
|
896
|
+
const _RelativeAttitudeFromEkf = class _RelativeAttitudeFromEkf extends Provider {
|
|
866
897
|
constructor() {
|
|
867
898
|
super(...arguments);
|
|
868
899
|
__publicField(this, "accelerometerProviderId");
|
|
@@ -921,10 +952,13 @@ const _RelativeAttitudeFromEkf = class extends Provider {
|
|
|
921
952
|
GyroscopeProvider$1.removeEventListener(this.gyroscopeProviderId);
|
|
922
953
|
}
|
|
923
954
|
};
|
|
955
|
+
/**
|
|
956
|
+
* default relative attitude drift in rad.second-1
|
|
957
|
+
*/
|
|
958
|
+
__publicField(_RelativeAttitudeFromEkf, "DEFAULT_DRIFT", maths.deg2rad(5) / 60);
|
|
924
959
|
let RelativeAttitudeFromEkf = _RelativeAttitudeFromEkf;
|
|
925
|
-
__publicField(RelativeAttitudeFromEkf, "DEFAULT_DRIFT", maths.deg2rad(5) / 60);
|
|
926
960
|
const RelativeAttitudeFromEkfProvider = new RelativeAttitudeFromEkf();
|
|
927
|
-
const _RelativeAttitudeFromBrowser = class extends Provider {
|
|
961
|
+
const _RelativeAttitudeFromBrowser = class _RelativeAttitudeFromBrowser extends Provider {
|
|
928
962
|
constructor() {
|
|
929
963
|
super(...arguments);
|
|
930
964
|
__publicField(this, "getName", () => "RelativeAttitudeFromBrowser");
|
|
@@ -963,12 +997,16 @@ const _RelativeAttitudeFromBrowser = class extends Provider {
|
|
|
963
997
|
window.removeEventListener("deviceorientation", this.onDeviceOrientationEvent, true);
|
|
964
998
|
}
|
|
965
999
|
};
|
|
1000
|
+
/**
|
|
1001
|
+
* default relative attitude drift in rad.second-1
|
|
1002
|
+
*/
|
|
1003
|
+
__publicField(_RelativeAttitudeFromBrowser, "DEFAULT_DRIFT", maths.deg2rad(5) / 60);
|
|
966
1004
|
let RelativeAttitudeFromBrowser = _RelativeAttitudeFromBrowser;
|
|
967
|
-
__publicField(RelativeAttitudeFromBrowser, "DEFAULT_DRIFT", maths.deg2rad(5) / 60);
|
|
968
1005
|
const RelativeAttitudeFromBrowser$1 = new RelativeAttitudeFromBrowser();
|
|
969
|
-
const _HighRotationsProvider = class extends Provider {
|
|
1006
|
+
const _HighRotationsProvider = class _HighRotationsProvider extends Provider {
|
|
970
1007
|
constructor() {
|
|
971
1008
|
super(...arguments);
|
|
1009
|
+
// in seconds
|
|
972
1010
|
__publicField(this, "gyroscopeProviderId");
|
|
973
1011
|
__publicField(this, "getName", () => "HighRotationsProvider");
|
|
974
1012
|
__publicField(this, "availability", () => GyroscopeProvider$1.getAvailability());
|
|
@@ -997,11 +1035,12 @@ const _HighRotationsProvider = class extends Provider {
|
|
|
997
1035
|
return diffTime < _HighRotationsProvider.DELAY_CONSIDERATION;
|
|
998
1036
|
}
|
|
999
1037
|
};
|
|
1038
|
+
__publicField(_HighRotationsProvider, "THRESHOLD", 10);
|
|
1039
|
+
// in radians by second
|
|
1040
|
+
__publicField(_HighRotationsProvider, "DELAY_CONSIDERATION", 3);
|
|
1000
1041
|
let HighRotationsProvider = _HighRotationsProvider;
|
|
1001
|
-
__publicField(HighRotationsProvider, "THRESHOLD", 10);
|
|
1002
|
-
__publicField(HighRotationsProvider, "DELAY_CONSIDERATION", 3);
|
|
1003
1042
|
const HighRotationsProvider$1 = new HighRotationsProvider();
|
|
1004
|
-
const _RelativeAttitudeFromInertial = class extends Provider {
|
|
1043
|
+
const _RelativeAttitudeFromInertial = class _RelativeAttitudeFromInertial extends Provider {
|
|
1005
1044
|
constructor() {
|
|
1006
1045
|
super(...arguments);
|
|
1007
1046
|
__publicField(this, "_highRotationsProviderId");
|
|
@@ -1045,11 +1084,15 @@ const _RelativeAttitudeFromInertial = class extends Provider {
|
|
|
1045
1084
|
HighRotationsProvider$1.removeEventListener(this._highRotationsProviderId);
|
|
1046
1085
|
}
|
|
1047
1086
|
};
|
|
1087
|
+
/**
|
|
1088
|
+
* default relative attitude drift in rad.second-1
|
|
1089
|
+
*/
|
|
1090
|
+
__publicField(_RelativeAttitudeFromInertial, "DEFAULT_DRIFT", maths.deg2rad(5) / 60);
|
|
1048
1091
|
let RelativeAttitudeFromInertial = _RelativeAttitudeFromInertial;
|
|
1049
|
-
__publicField(RelativeAttitudeFromInertial, "DEFAULT_DRIFT", maths.deg2rad(5) / 60);
|
|
1050
1092
|
const RelativeAttitudeFromInertialProvider = new RelativeAttitudeFromInertial();
|
|
1051
|
-
const _StepDetectionLadetto = class {
|
|
1093
|
+
const _StepDetectionLadetto = class _StepDetectionLadetto {
|
|
1052
1094
|
constructor() {
|
|
1095
|
+
// in m.s-2
|
|
1053
1096
|
__publicField(this, "frequency", 0);
|
|
1054
1097
|
__publicField(this, "lastVerticalAcc", 0);
|
|
1055
1098
|
__publicField(this, "maxAcceleration", 0);
|
|
@@ -1088,13 +1131,17 @@ const _StepDetectionLadetto = class {
|
|
|
1088
1131
|
return this.lastStepTimestamp ? this.lastStepSize * this.frequency : 0;
|
|
1089
1132
|
}
|
|
1090
1133
|
};
|
|
1134
|
+
__publicField(_StepDetectionLadetto, "MIN_TIME_BETWEEN_STEPS", 0.4);
|
|
1135
|
+
// in seconds
|
|
1136
|
+
__publicField(_StepDetectionLadetto, "MAX_FRENQUENCY", 4);
|
|
1137
|
+
// in Hz
|
|
1138
|
+
__publicField(_StepDetectionLadetto, "MIN_FRENQUENCY", 1);
|
|
1139
|
+
// in Hz
|
|
1140
|
+
__publicField(_StepDetectionLadetto, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 1);
|
|
1091
1141
|
let StepDetectionLadetto = _StepDetectionLadetto;
|
|
1092
|
-
|
|
1093
|
-
__publicField(StepDetectionLadetto, "MAX_FRENQUENCY", 4);
|
|
1094
|
-
__publicField(StepDetectionLadetto, "MIN_FRENQUENCY", 1);
|
|
1095
|
-
__publicField(StepDetectionLadetto, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 1);
|
|
1096
|
-
const _StepDetectionMinMaxPeaks = class {
|
|
1142
|
+
const _StepDetectionMinMaxPeaks = class _StepDetectionMinMaxPeaks {
|
|
1097
1143
|
constructor() {
|
|
1144
|
+
// in m.s-2
|
|
1098
1145
|
__publicField(this, "frequency", 0);
|
|
1099
1146
|
__publicField(this, "lastStepTimestamp", -_StepDetectionMinMaxPeaks.MIN_TIME_BETWEEN_STEPS);
|
|
1100
1147
|
__publicField(this, "slidingWindow", []);
|
|
@@ -1138,15 +1185,21 @@ const _StepDetectionMinMaxPeaks = class {
|
|
|
1138
1185
|
return this.lastStepTimestamp ? this.lastStepSize * this.frequency : 0;
|
|
1139
1186
|
}
|
|
1140
1187
|
};
|
|
1188
|
+
__publicField(_StepDetectionMinMaxPeaks, "WINDOW_TIME", 0.3);
|
|
1189
|
+
// in seconds
|
|
1190
|
+
__publicField(_StepDetectionMinMaxPeaks, "MIN_TIME_BETWEEN_STEPS", 0.4);
|
|
1191
|
+
// in seconds
|
|
1192
|
+
__publicField(_StepDetectionMinMaxPeaks, "MAX_FRENQUENCY", 4);
|
|
1193
|
+
// in Hz
|
|
1194
|
+
__publicField(_StepDetectionMinMaxPeaks, "MIN_FRENQUENCY", 1);
|
|
1195
|
+
// in Hz
|
|
1196
|
+
__publicField(_StepDetectionMinMaxPeaks, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 1.5);
|
|
1197
|
+
// in m.s-2
|
|
1198
|
+
__publicField(_StepDetectionMinMaxPeaks, "VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD", -1);
|
|
1141
1199
|
let StepDetectionMinMaxPeaks = _StepDetectionMinMaxPeaks;
|
|
1142
|
-
|
|
1143
|
-
__publicField(StepDetectionMinMaxPeaks, "MIN_TIME_BETWEEN_STEPS", 0.4);
|
|
1144
|
-
__publicField(StepDetectionMinMaxPeaks, "MAX_FRENQUENCY", 4);
|
|
1145
|
-
__publicField(StepDetectionMinMaxPeaks, "MIN_FRENQUENCY", 1);
|
|
1146
|
-
__publicField(StepDetectionMinMaxPeaks, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 1.5);
|
|
1147
|
-
__publicField(StepDetectionMinMaxPeaks, "VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD", -1);
|
|
1148
|
-
const _StepDetectionMinMaxPeaks2 = class {
|
|
1200
|
+
const _StepDetectionMinMaxPeaks2 = class _StepDetectionMinMaxPeaks2 {
|
|
1149
1201
|
constructor() {
|
|
1202
|
+
// in m.s-2
|
|
1150
1203
|
__publicField(this, "frequency", 0);
|
|
1151
1204
|
__publicField(this, "influence", 0.2);
|
|
1152
1205
|
__publicField(this, "slidingWindow", []);
|
|
@@ -1212,15 +1265,21 @@ const _StepDetectionMinMaxPeaks2 = class {
|
|
|
1212
1265
|
return Math.sqrt(standardDeviation / data.length);
|
|
1213
1266
|
}
|
|
1214
1267
|
};
|
|
1268
|
+
__publicField(_StepDetectionMinMaxPeaks2, "WINDOW_TIME", 0.3);
|
|
1269
|
+
// in seconds
|
|
1270
|
+
__publicField(_StepDetectionMinMaxPeaks2, "MIN_TIME_BETWEEN_STEPS", 0.4);
|
|
1271
|
+
// in seconds
|
|
1272
|
+
__publicField(_StepDetectionMinMaxPeaks2, "MAX_FRENQUENCY", 4);
|
|
1273
|
+
// in Hz
|
|
1274
|
+
__publicField(_StepDetectionMinMaxPeaks2, "MIN_FRENQUENCY", 1);
|
|
1275
|
+
// in Hz
|
|
1276
|
+
__publicField(_StepDetectionMinMaxPeaks2, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 0.75);
|
|
1277
|
+
// in m.s-2
|
|
1278
|
+
__publicField(_StepDetectionMinMaxPeaks2, "VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD", -0.3);
|
|
1215
1279
|
let StepDetectionMinMaxPeaks2 = _StepDetectionMinMaxPeaks2;
|
|
1216
|
-
|
|
1217
|
-
__publicField(StepDetectionMinMaxPeaks2, "MIN_TIME_BETWEEN_STEPS", 0.4);
|
|
1218
|
-
__publicField(StepDetectionMinMaxPeaks2, "MAX_FRENQUENCY", 4);
|
|
1219
|
-
__publicField(StepDetectionMinMaxPeaks2, "MIN_FRENQUENCY", 1);
|
|
1220
|
-
__publicField(StepDetectionMinMaxPeaks2, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 0.75);
|
|
1221
|
-
__publicField(StepDetectionMinMaxPeaks2, "VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD", -0.3);
|
|
1222
|
-
const _StepDetectionMinMaxPeaks3 = class {
|
|
1280
|
+
const _StepDetectionMinMaxPeaks3 = class _StepDetectionMinMaxPeaks3 {
|
|
1223
1281
|
constructor() {
|
|
1282
|
+
// in m.s-2
|
|
1224
1283
|
__publicField(this, "frequency", 0);
|
|
1225
1284
|
__publicField(this, "influence", 0.05);
|
|
1226
1285
|
__publicField(this, "slidingWindow", []);
|
|
@@ -1310,14 +1369,19 @@ const _StepDetectionMinMaxPeaks3 = class {
|
|
|
1310
1369
|
return Math.sqrt(standardDeviation / data.length);
|
|
1311
1370
|
}
|
|
1312
1371
|
};
|
|
1372
|
+
__publicField(_StepDetectionMinMaxPeaks3, "WINDOW_TIME", 0.6);
|
|
1373
|
+
// in seconds
|
|
1374
|
+
__publicField(_StepDetectionMinMaxPeaks3, "MIN_TIME_BETWEEN_STEPS", 0.6);
|
|
1375
|
+
// in seconds
|
|
1376
|
+
__publicField(_StepDetectionMinMaxPeaks3, "MAX_FRENQUENCY", 4);
|
|
1377
|
+
// in Hz
|
|
1378
|
+
__publicField(_StepDetectionMinMaxPeaks3, "MIN_FRENQUENCY", 1);
|
|
1379
|
+
// in Hz
|
|
1380
|
+
__publicField(_StepDetectionMinMaxPeaks3, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 0.2);
|
|
1381
|
+
// in m.s-2
|
|
1382
|
+
__publicField(_StepDetectionMinMaxPeaks3, "VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD", -0.1);
|
|
1313
1383
|
let StepDetectionMinMaxPeaks3 = _StepDetectionMinMaxPeaks3;
|
|
1314
|
-
|
|
1315
|
-
__publicField(StepDetectionMinMaxPeaks3, "MIN_TIME_BETWEEN_STEPS", 0.6);
|
|
1316
|
-
__publicField(StepDetectionMinMaxPeaks3, "MAX_FRENQUENCY", 4);
|
|
1317
|
-
__publicField(StepDetectionMinMaxPeaks3, "MIN_FRENQUENCY", 1);
|
|
1318
|
-
__publicField(StepDetectionMinMaxPeaks3, "VERTICAL_ACC_POSITIVE_PEAK_THRESHOLD", 0.2);
|
|
1319
|
-
__publicField(StepDetectionMinMaxPeaks3, "VERTICAL_ACC_NEGATIVE_PEAK_THRESHOLD", -0.1);
|
|
1320
|
-
const _StepProvider = class extends Provider {
|
|
1384
|
+
const _StepProvider = class _StepProvider extends Provider {
|
|
1321
1385
|
constructor() {
|
|
1322
1386
|
super();
|
|
1323
1387
|
__publicField(this, "accelerometerProviderId");
|
|
@@ -1379,6 +1443,7 @@ const _StepProvider = class extends Provider {
|
|
|
1379
1443
|
GyroscopeProvider$1.removeEventListener(this.gyroscopeProviderId);
|
|
1380
1444
|
RelativeAttitudeFromInertialProvider.removeEventListener(this.attitudeProviderId);
|
|
1381
1445
|
}
|
|
1446
|
+
// Linear acceleration in ENU
|
|
1382
1447
|
static computeLinearAcceleration(quaternion, acc) {
|
|
1383
1448
|
const linearAcc = maths.Quaternion.rotateMatlab(maths.Quaternion.inverse(quaternion), acc);
|
|
1384
1449
|
linearAcc[2] -= geo.Constants.EARTH_GRAVITY;
|
|
@@ -1413,9 +1478,9 @@ const _StepProvider = class extends Provider {
|
|
|
1413
1478
|
return this._algorithm;
|
|
1414
1479
|
}
|
|
1415
1480
|
};
|
|
1481
|
+
__publicField(_StepProvider, "DEFAULT_STEP_SIZE_MULTIPLIER", 1);
|
|
1482
|
+
__publicField(_StepProvider, "DEFAULT_ALGORITHM", "minMaxPeaks3");
|
|
1416
1483
|
let StepProvider = _StepProvider;
|
|
1417
|
-
__publicField(StepProvider, "DEFAULT_STEP_SIZE_MULTIPLIER", 1);
|
|
1418
|
-
__publicField(StepProvider, "DEFAULT_ALGORITHM", "minMaxPeaks3");
|
|
1419
1484
|
const StepProvider$1 = new StepProvider();
|
|
1420
1485
|
class PdrProvider extends Provider {
|
|
1421
1486
|
constructor() {
|
|
@@ -1423,6 +1488,8 @@ class PdrProvider extends Provider {
|
|
|
1423
1488
|
__publicField(this, "absoluteAttitudeProviderId");
|
|
1424
1489
|
__publicField(this, "stepDetectionProviderId");
|
|
1425
1490
|
__publicField(this, "attitudeEvent");
|
|
1491
|
+
// https://ieeexplore.ieee.org/document/7346766
|
|
1492
|
+
// private misalignment = [1, 0, 0, 0];
|
|
1426
1493
|
__publicField(this, "misalignmentError", maths.deg2rad(3));
|
|
1427
1494
|
__publicField(this, "getName", () => "Pdr");
|
|
1428
1495
|
__publicField(this, "onStepEvent", (stepEvent) => {
|
|
@@ -1705,7 +1772,7 @@ class ImageRelocalization {
|
|
|
1705
1772
|
let serverResponse;
|
|
1706
1773
|
try {
|
|
1707
1774
|
const body = JSON.stringify(vpsRequest.toJson());
|
|
1708
|
-
|
|
1775
|
+
Logger.debug(`[VPS] Request (${(body.length / 1024).toFixed(0)} kB) sent to server ${endpointUrl}`);
|
|
1709
1776
|
serverResponse = await fetch(endpointUrl, {
|
|
1710
1777
|
method: "POST",
|
|
1711
1778
|
body,
|
|
@@ -1715,16 +1782,16 @@ class ImageRelocalization {
|
|
|
1715
1782
|
)
|
|
1716
1783
|
});
|
|
1717
1784
|
} catch (e) {
|
|
1718
|
-
|
|
1785
|
+
Logger.debug("[VPS] Server respond error");
|
|
1719
1786
|
return null;
|
|
1720
1787
|
}
|
|
1721
1788
|
if (serverResponse.status !== 200) {
|
|
1722
|
-
|
|
1789
|
+
Logger.debug("[VPS] Server respond error");
|
|
1723
1790
|
return null;
|
|
1724
1791
|
}
|
|
1725
1792
|
const json = await serverResponse.json();
|
|
1726
1793
|
const res = VpsResponse.fromJson(json, timeBeforeRequest);
|
|
1727
|
-
|
|
1794
|
+
Logger.debug(`[VPS] Server respond ${res.success ? "success" : "not found"}`);
|
|
1728
1795
|
return res;
|
|
1729
1796
|
}
|
|
1730
1797
|
static getHeadingFromQuaternion(quaternion) {
|
|
@@ -1754,12 +1821,12 @@ class RelativeRotationCalc {
|
|
|
1754
1821
|
}
|
|
1755
1822
|
tickEnd() {
|
|
1756
1823
|
if (!this._isRunning) {
|
|
1757
|
-
|
|
1824
|
+
Logger.warn("You have to call tickStart before tickEnd");
|
|
1758
1825
|
return null;
|
|
1759
1826
|
}
|
|
1760
1827
|
this._internalStop();
|
|
1761
1828
|
if (!this._dataOnStart) {
|
|
1762
|
-
|
|
1829
|
+
Logger.warn("Delay was too short between tickStart and tickEnd or RelativeAttitudeProvider cannot be retrieved.");
|
|
1763
1830
|
return null;
|
|
1764
1831
|
}
|
|
1765
1832
|
const dataOnEnd = RelativeAttitudeFromBrowser$1.lastEvent;
|
|
@@ -1776,13 +1843,13 @@ class RelativeRotationCalc {
|
|
|
1776
1843
|
}
|
|
1777
1844
|
}
|
|
1778
1845
|
}
|
|
1779
|
-
const _MissingPoleStarError = class extends Error {
|
|
1846
|
+
const _MissingPoleStarError = class _MissingPoleStarError extends Error {
|
|
1780
1847
|
constructor(message) {
|
|
1781
1848
|
super(message || _MissingPoleStarError.DEFAULT_MESSAGE);
|
|
1782
1849
|
}
|
|
1783
1850
|
};
|
|
1851
|
+
__publicField(_MissingPoleStarError, "DEFAULT_MESSAGE", "PoleStar is missing");
|
|
1784
1852
|
let MissingPoleStarError = _MissingPoleStarError;
|
|
1785
|
-
__publicField(MissingPoleStarError, "DEFAULT_MESSAGE", "PoleStar is missing");
|
|
1786
1853
|
class PoleStarProvider extends Provider {
|
|
1787
1854
|
constructor() {
|
|
1788
1855
|
super();
|
|
@@ -1840,7 +1907,7 @@ class PoleStarProvider extends Provider {
|
|
|
1840
1907
|
}
|
|
1841
1908
|
}
|
|
1842
1909
|
const PoleStarProvider$1 = new PoleStarProvider();
|
|
1843
|
-
const _VpsProvider = class extends Provider {
|
|
1910
|
+
const _VpsProvider = class _VpsProvider extends Provider {
|
|
1844
1911
|
constructor() {
|
|
1845
1912
|
super(...arguments);
|
|
1846
1913
|
__publicField(this, "_relativeRotationCalc");
|
|
@@ -1856,7 +1923,7 @@ const _VpsProvider = class extends Provider {
|
|
|
1856
1923
|
__publicField(this, "availability", () => camera.Camera.checkAvailability());
|
|
1857
1924
|
__publicField(this, "_onCameraDetected", ({ camera: camera2 }) => {
|
|
1858
1925
|
if (this._camera) {
|
|
1859
|
-
|
|
1926
|
+
Logger.warn("It seems that more than 1 camera has been detected for VPS. Taking the first...");
|
|
1860
1927
|
}
|
|
1861
1928
|
this._useCamera(camera2);
|
|
1862
1929
|
});
|
|
@@ -1865,7 +1932,7 @@ const _VpsProvider = class extends Provider {
|
|
|
1865
1932
|
this._camera.off("started", this._internalStart);
|
|
1866
1933
|
this._camera.off("stopped", this._internalStop);
|
|
1867
1934
|
} else {
|
|
1868
|
-
|
|
1935
|
+
Logger.warn("There is no previously detected camera but once has stopped");
|
|
1869
1936
|
}
|
|
1870
1937
|
this._camera = null;
|
|
1871
1938
|
});
|
|
@@ -1951,7 +2018,7 @@ const _VpsProvider = class extends Provider {
|
|
|
1951
2018
|
camera.SharedCameras.on("removed", this._onCameraRemoved);
|
|
1952
2019
|
if (camera.SharedCameras.list.length) {
|
|
1953
2020
|
if (camera.SharedCameras.list.length > 1) {
|
|
1954
|
-
|
|
2021
|
+
Logger.warn("It seems that more than 1 camera has been detected for VPS. Taking the first...");
|
|
1955
2022
|
}
|
|
1956
2023
|
this._useCamera(camera.SharedCameras.list[0].camera);
|
|
1957
2024
|
}
|
|
@@ -1997,14 +2064,17 @@ const _VpsProvider = class extends Provider {
|
|
|
1997
2064
|
this._useCoarsePose = useCoarsePose;
|
|
1998
2065
|
}
|
|
1999
2066
|
};
|
|
2067
|
+
__publicField(_VpsProvider, "MIN_TIME_BETWEEN_TWO_REQUESTS", 1e3);
|
|
2068
|
+
// in ms
|
|
2069
|
+
__publicField(_VpsProvider, "DEFAULT_MIN_INCLINATION_FOR_REQUEST", maths.deg2rad(60));
|
|
2070
|
+
// in radians
|
|
2071
|
+
__publicField(_VpsProvider, "DEFAULT_WAIT_TIME_MIN_INCLINATION_FOR_REQUEST", 200);
|
|
2072
|
+
// in ms
|
|
2073
|
+
__publicField(_VpsProvider, "DEFAULT_USE_COARSE_POSE", true);
|
|
2074
|
+
__publicField(_VpsProvider, "CAMERA_TO_SMARTPHONE_ROT", maths.Quaternion.fromAxisAngle([1, 0, 0], Math.PI));
|
|
2000
2075
|
let VpsProvider = _VpsProvider;
|
|
2001
|
-
__publicField(VpsProvider, "MIN_TIME_BETWEEN_TWO_REQUESTS", 1e3);
|
|
2002
|
-
__publicField(VpsProvider, "DEFAULT_MIN_INCLINATION_FOR_REQUEST", maths.deg2rad(60));
|
|
2003
|
-
__publicField(VpsProvider, "DEFAULT_WAIT_TIME_MIN_INCLINATION_FOR_REQUEST", 200);
|
|
2004
|
-
__publicField(VpsProvider, "DEFAULT_USE_COARSE_POSE", true);
|
|
2005
|
-
__publicField(VpsProvider, "CAMERA_TO_SMARTPHONE_ROT", maths.Quaternion.fromAxisAngle([1, 0, 0], Math.PI));
|
|
2006
2076
|
const VpsProvider$1 = new VpsProvider();
|
|
2007
|
-
const _AbsolutePositionProvider = class extends Provider {
|
|
2077
|
+
const _AbsolutePositionProvider = class _AbsolutePositionProvider extends Provider {
|
|
2008
2078
|
constructor() {
|
|
2009
2079
|
super(...arguments);
|
|
2010
2080
|
__publicField(this, "_polestarProviderId");
|
|
@@ -2059,6 +2129,9 @@ const _AbsolutePositionProvider = class extends Provider {
|
|
|
2059
2129
|
}
|
|
2060
2130
|
this._mapMatchingHandlerId = MapMatchingHandler$1.addEventListener();
|
|
2061
2131
|
}
|
|
2132
|
+
/**
|
|
2133
|
+
* @override
|
|
2134
|
+
*/
|
|
2062
2135
|
stop() {
|
|
2063
2136
|
if (this._relativePositionProviderId) {
|
|
2064
2137
|
GeoRelativePositionProvider$1.removeEventListener(this._relativePositionProviderId);
|
|
@@ -2102,6 +2175,9 @@ const _AbsolutePositionProvider = class extends Provider {
|
|
|
2102
2175
|
}
|
|
2103
2176
|
return false;
|
|
2104
2177
|
}
|
|
2178
|
+
/**
|
|
2179
|
+
* @returns if input position is used by the system (true = used, false = discarded)
|
|
2180
|
+
*/
|
|
2105
2181
|
_onAbsolutePosition(positionEvent, canContainLevel = true) {
|
|
2106
2182
|
if (!this._shouldTakeIntoAccountNewAbsolutePosition(positionEvent, canContainLevel) && !this.useAllAbsolutePositions) {
|
|
2107
2183
|
return false;
|
|
@@ -2122,6 +2198,9 @@ const _AbsolutePositionProvider = class extends Provider {
|
|
|
2122
2198
|
}
|
|
2123
2199
|
return MapMatchingHandler$1.notifyPositionFromAbsolute(newPosition);
|
|
2124
2200
|
}
|
|
2201
|
+
/**
|
|
2202
|
+
* @returns if input position is used by the system (true = used, false = discarded)
|
|
2203
|
+
*/
|
|
2125
2204
|
_onRelativePosition(relativeEvent) {
|
|
2126
2205
|
if (!this.lastEvent || this._waitUntilNextVpsPosition) {
|
|
2127
2206
|
return false;
|
|
@@ -2174,13 +2253,16 @@ const _AbsolutePositionProvider = class extends Provider {
|
|
|
2174
2253
|
}, null);
|
|
2175
2254
|
}
|
|
2176
2255
|
};
|
|
2256
|
+
// Use the new absolute position if its accuracy is at least x times better than the last one.
|
|
2257
|
+
__publicField(_AbsolutePositionProvider, "ACCURACY_RELOC_RATIO", 1);
|
|
2258
|
+
// or 1.5
|
|
2259
|
+
__publicField(_AbsolutePositionProvider, "USE_MM_FOR_FEED", true);
|
|
2177
2260
|
let AbsolutePositionProvider = _AbsolutePositionProvider;
|
|
2178
|
-
__publicField(AbsolutePositionProvider, "ACCURACY_RELOC_RATIO", 1);
|
|
2179
|
-
__publicField(AbsolutePositionProvider, "USE_MM_FOR_FEED", true);
|
|
2180
2261
|
const AbsolutePositionProvider$1 = new AbsolutePositionProvider();
|
|
2181
2262
|
class AbsoluteAttitudeFromBrowser extends Provider {
|
|
2182
2263
|
constructor() {
|
|
2183
2264
|
super(...arguments);
|
|
2265
|
+
// from http://tyrex.inria.fr/mobile/benchmarks-attitude/
|
|
2184
2266
|
__publicField(this, "DEFAULT_ACCURACY", maths.deg2rad(15));
|
|
2185
2267
|
__publicField(this, "absolutePositionProviderId");
|
|
2186
2268
|
__publicField(this, "absolutePositionEvent");
|
|
@@ -2239,6 +2321,11 @@ class AbsoluteAttitudeFromBrowser extends Provider {
|
|
|
2239
2321
|
this.magQuaternion = maths.Rotations.eulerToQuaternionZXYDegrees([alpha, e.beta, e.gamma]);
|
|
2240
2322
|
this.compute();
|
|
2241
2323
|
});
|
|
2324
|
+
/**
|
|
2325
|
+
* Initialized declination quaternion using current position.
|
|
2326
|
+
* This method should be theoretically called every time the user moves.
|
|
2327
|
+
* But in reality declination does not change as much.
|
|
2328
|
+
*/
|
|
2242
2329
|
__publicField(this, "onAbsolutePositionEvent", (position) => {
|
|
2243
2330
|
this.absolutePositionEvent = position;
|
|
2244
2331
|
const wmmResult = geomag__namespace.field(position.lat, position.lng);
|
|
@@ -2382,6 +2469,9 @@ class RelativeAttitudeProvider extends Provider {
|
|
|
2382
2469
|
this.listenInertial();
|
|
2383
2470
|
}
|
|
2384
2471
|
}
|
|
2472
|
+
/**
|
|
2473
|
+
* @override
|
|
2474
|
+
*/
|
|
2385
2475
|
stop() {
|
|
2386
2476
|
ArCoreProvider$1.removeMonitoringListener(this.arCoreMonitoringId);
|
|
2387
2477
|
this.unlistenArCore();
|
|
@@ -2389,9 +2479,10 @@ class RelativeAttitudeProvider extends Provider {
|
|
|
2389
2479
|
}
|
|
2390
2480
|
}
|
|
2391
2481
|
const RelativeAttitudeProvider$1 = new RelativeAttitudeProvider();
|
|
2392
|
-
const _AbsoluteAttitudeProvider = class extends Provider {
|
|
2482
|
+
const _AbsoluteAttitudeProvider = class _AbsoluteAttitudeProvider extends Provider {
|
|
2393
2483
|
constructor() {
|
|
2394
2484
|
super(...arguments);
|
|
2485
|
+
// in radians;
|
|
2395
2486
|
__publicField(this, "_absAttitudeFromBrowser");
|
|
2396
2487
|
__publicField(this, "_vpsProviderId");
|
|
2397
2488
|
__publicField(this, "fromBrowserProviderId");
|
|
@@ -2400,8 +2491,12 @@ const _AbsoluteAttitudeProvider = class extends Provider {
|
|
|
2400
2491
|
__publicField(this, "relativeAttitudeProviderId");
|
|
2401
2492
|
__publicField(this, "_attitudeFromBrowserErrored", false);
|
|
2402
2493
|
__publicField(this, "_attitudeFromRelativeErrored", false);
|
|
2494
|
+
/*
|
|
2495
|
+
* RELATIVE
|
|
2496
|
+
*/
|
|
2403
2497
|
__publicField(this, "_relativeAttitude", null);
|
|
2404
2498
|
__publicField(this, "_relativeAccuracy", 0);
|
|
2499
|
+
// in radians/s
|
|
2405
2500
|
__publicField(this, "_lastForcedHeadingEvent");
|
|
2406
2501
|
__publicField(this, "_relAbsQuat");
|
|
2407
2502
|
__publicField(this, "_wasHighRotationInProgress", false);
|
|
@@ -2557,14 +2652,17 @@ const _AbsoluteAttitudeProvider = class extends Provider {
|
|
|
2557
2652
|
}
|
|
2558
2653
|
}
|
|
2559
2654
|
};
|
|
2655
|
+
__publicField(_AbsoluteAttitudeProvider, "REL_ABS_DIVERGENCE_ANGLE_THRESHOLD", maths.deg2rad(25));
|
|
2656
|
+
// in radians;
|
|
2657
|
+
__publicField(_AbsoluteAttitudeProvider, "REL_ABS_DIVERGENCE_TIME_THRESHOLD", 2.5);
|
|
2658
|
+
// in seconds
|
|
2659
|
+
__publicField(_AbsoluteAttitudeProvider, "REL_ABS_DIVERGENCE_INCLINATION_THRESHOLD", maths.deg2rad(15));
|
|
2560
2660
|
let AbsoluteAttitudeProvider = _AbsoluteAttitudeProvider;
|
|
2561
|
-
__publicField(AbsoluteAttitudeProvider, "REL_ABS_DIVERGENCE_ANGLE_THRESHOLD", maths.deg2rad(25));
|
|
2562
|
-
__publicField(AbsoluteAttitudeProvider, "REL_ABS_DIVERGENCE_TIME_THRESHOLD", 2.5);
|
|
2563
|
-
__publicField(AbsoluteAttitudeProvider, "REL_ABS_DIVERGENCE_INCLINATION_THRESHOLD", maths.deg2rad(15));
|
|
2564
2661
|
const AbsoluteAttitudeProvider$1 = new AbsoluteAttitudeProvider();
|
|
2565
|
-
const _TurnProvider = class extends Provider {
|
|
2662
|
+
const _TurnProvider = class _TurnProvider extends Provider {
|
|
2566
2663
|
constructor() {
|
|
2567
2664
|
super(...arguments);
|
|
2665
|
+
// in seconds
|
|
2568
2666
|
__publicField(this, "providerId");
|
|
2569
2667
|
__publicField(this, "slidingWindow", []);
|
|
2570
2668
|
__publicField(this, "getName", () => "Turn");
|
|
@@ -2597,12 +2695,13 @@ const _TurnProvider = class extends Provider {
|
|
|
2597
2695
|
return diffTime < _TurnProvider.CONSIDER_TURN_UNTIL;
|
|
2598
2696
|
}
|
|
2599
2697
|
};
|
|
2698
|
+
__publicField(_TurnProvider, "SLIDING_WINDOW_TIME", 0.3);
|
|
2699
|
+
// in seconds
|
|
2700
|
+
__publicField(_TurnProvider, "STD_THRESHOLD", 0.075);
|
|
2701
|
+
__publicField(_TurnProvider, "CONSIDER_TURN_UNTIL", 1);
|
|
2600
2702
|
let TurnProvider = _TurnProvider;
|
|
2601
|
-
__publicField(TurnProvider, "SLIDING_WINDOW_TIME", 0.3);
|
|
2602
|
-
__publicField(TurnProvider, "STD_THRESHOLD", 0.075);
|
|
2603
|
-
__publicField(TurnProvider, "CONSIDER_TURN_UNTIL", 1);
|
|
2604
2703
|
const TurnProvider$1 = new TurnProvider();
|
|
2605
|
-
const _StraightLineProvider = class extends Provider {
|
|
2704
|
+
const _StraightLineProvider = class _StraightLineProvider extends Provider {
|
|
2606
2705
|
constructor() {
|
|
2607
2706
|
super(...arguments);
|
|
2608
2707
|
__publicField(this, "_turnProviderId");
|
|
@@ -2650,12 +2749,13 @@ const _StraightLineProvider = class extends Provider {
|
|
|
2650
2749
|
this._stepsConsideredForStraightLine = stepsConsideredForStraightLine;
|
|
2651
2750
|
}
|
|
2652
2751
|
};
|
|
2752
|
+
__publicField(_StraightLineProvider, "DEFAULT_STEPS_CONSIDERED_FOR_STRAIGHT_LINE", 2);
|
|
2653
2753
|
let StraightLineProvider = _StraightLineProvider;
|
|
2654
|
-
__publicField(StraightLineProvider, "DEFAULT_STEPS_CONSIDERED_FOR_STRAIGHT_LINE", 2);
|
|
2655
2754
|
const StraightLineProvider$1 = new StraightLineProvider();
|
|
2656
|
-
const _MapMatchingHandler = class extends Provider {
|
|
2755
|
+
const _MapMatchingHandler = class _MapMatchingHandler extends Provider {
|
|
2657
2756
|
constructor() {
|
|
2658
2757
|
super();
|
|
2758
|
+
// radians
|
|
2659
2759
|
__publicField(this, "_mapMatchingMinDistance", _MapMatchingHandler.DEFAULT_MM_MIN_DIST);
|
|
2660
2760
|
__publicField(this, "_useItineraryStartAsPosition", _MapMatchingHandler.DEFAULT_USE_ITINERARY_START_AS_POSITION);
|
|
2661
2761
|
__publicField(this, "_useOrientationMatching", _MapMatchingHandler.DEFAULT_USE_ORIENTATION_MATCHING);
|
|
@@ -2774,6 +2874,9 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2774
2874
|
}
|
|
2775
2875
|
AbsolutePositionProvider$1.notify(projection.coords);
|
|
2776
2876
|
}
|
|
2877
|
+
/**
|
|
2878
|
+
* @returns if input position is used by the system (true = used, false = discarded)
|
|
2879
|
+
*/
|
|
2777
2880
|
notifyPositionFromAbsolute(newPosition) {
|
|
2778
2881
|
let projectionWithBearing = null;
|
|
2779
2882
|
if (newPosition.bearing !== null) {
|
|
@@ -2794,6 +2897,9 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2794
2897
|
this.tryOrientationMatching(projectionWithBearing);
|
|
2795
2898
|
return true;
|
|
2796
2899
|
}
|
|
2900
|
+
/**
|
|
2901
|
+
* @returns if input position is used by the system (true = used, false = discarded)
|
|
2902
|
+
*/
|
|
2797
2903
|
notifyPositionFromRelative(newPosition) {
|
|
2798
2904
|
var _a;
|
|
2799
2905
|
if (TurnProvider$1.isTurning()) {
|
|
@@ -2921,6 +3027,7 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2921
3027
|
matchingDirection,
|
|
2922
3028
|
origin.time,
|
|
2923
3029
|
0
|
|
3030
|
+
// Math.min(Math.abs(matchingDirectionAngle1), Math.abs(matchingDirectionAngle2))
|
|
2924
3031
|
);
|
|
2925
3032
|
AbsoluteAttitudeProvider$1._forceHeadingForRelative(matchedHeading);
|
|
2926
3033
|
this._countStepsFromLastMatching = 0;
|
|
@@ -2995,20 +3102,29 @@ const _MapMatchingHandler = class extends Provider {
|
|
|
2995
3102
|
this._lastProjectionsEdgeAngleThreshold = lastProjectionsEdgeAngleThreshold;
|
|
2996
3103
|
}
|
|
2997
3104
|
};
|
|
3105
|
+
__publicField(_MapMatchingHandler, "DEFAULT_MM_MAX_ANGLE", maths.deg2rad(30));
|
|
3106
|
+
// radians
|
|
3107
|
+
__publicField(_MapMatchingHandler, "DEFAULT_MM_MAX_DIST", 30);
|
|
3108
|
+
// meters
|
|
3109
|
+
__publicField(_MapMatchingHandler, "DEFAULT_MM_MIN_DIST", 0);
|
|
3110
|
+
// meters
|
|
3111
|
+
__publicField(_MapMatchingHandler, "DEFAULT_USE_ITINERARY_START_AS_POSITION", false);
|
|
3112
|
+
__publicField(_MapMatchingHandler, "DEFAULT_USE_ORIENTATION_MATCHING", true);
|
|
3113
|
+
__publicField(_MapMatchingHandler, "DEFAULT_MM_HUGE_JUMP_DISTANCE", 3);
|
|
3114
|
+
// meters
|
|
3115
|
+
__publicField(_MapMatchingHandler, "DEFAULT_DISABLE_MM_CLOSE_TO_A_TURN_DISTANCE", 2);
|
|
3116
|
+
// meters
|
|
3117
|
+
__publicField(_MapMatchingHandler, "DEFAULT_MIN_STEPS_BETWEEN_ORIENTATION_MATCHING", 3);
|
|
3118
|
+
__publicField(_MapMatchingHandler, "DEFAULT_MIN_STEPS_FOR_ORIENTATION_MATCHING", 5);
|
|
3119
|
+
__publicField(_MapMatchingHandler, "DEFAULT_LAST_PROJECTIONS_WINDOW_SIZE", 3);
|
|
3120
|
+
__publicField(_MapMatchingHandler, "DEFAULT_LAST_PROJECTIONS_EDGE_ANGLE_THRESHOLD", maths.deg2rad(3));
|
|
2998
3121
|
let MapMatchingHandler = _MapMatchingHandler;
|
|
2999
|
-
__publicField(MapMatchingHandler, "DEFAULT_MM_MAX_ANGLE", maths.deg2rad(30));
|
|
3000
|
-
__publicField(MapMatchingHandler, "DEFAULT_MM_MAX_DIST", 30);
|
|
3001
|
-
__publicField(MapMatchingHandler, "DEFAULT_MM_MIN_DIST", 0);
|
|
3002
|
-
__publicField(MapMatchingHandler, "DEFAULT_USE_ITINERARY_START_AS_POSITION", false);
|
|
3003
|
-
__publicField(MapMatchingHandler, "DEFAULT_USE_ORIENTATION_MATCHING", true);
|
|
3004
|
-
__publicField(MapMatchingHandler, "DEFAULT_MM_HUGE_JUMP_DISTANCE", 3);
|
|
3005
|
-
__publicField(MapMatchingHandler, "DEFAULT_DISABLE_MM_CLOSE_TO_A_TURN_DISTANCE", 2);
|
|
3006
|
-
__publicField(MapMatchingHandler, "DEFAULT_MIN_STEPS_BETWEEN_ORIENTATION_MATCHING", 3);
|
|
3007
|
-
__publicField(MapMatchingHandler, "DEFAULT_MIN_STEPS_FOR_ORIENTATION_MATCHING", 5);
|
|
3008
|
-
__publicField(MapMatchingHandler, "DEFAULT_LAST_PROJECTIONS_WINDOW_SIZE", 3);
|
|
3009
|
-
__publicField(MapMatchingHandler, "DEFAULT_LAST_PROJECTIONS_EDGE_ANGLE_THRESHOLD", maths.deg2rad(3));
|
|
3010
3122
|
const MapMatchingHandler$1 = new MapMatchingHandler();
|
|
3011
|
-
const _PositionSmoother = class {
|
|
3123
|
+
const _PositionSmoother = class _PositionSmoother {
|
|
3124
|
+
// can be number if web or NodeJS.Timer
|
|
3125
|
+
/**
|
|
3126
|
+
* @param frequency in Hz
|
|
3127
|
+
*/
|
|
3012
3128
|
constructor(callback, frequency = _PositionSmoother.DEFAULT_FREQUENCY) {
|
|
3013
3129
|
__publicField(this, "positionsQueue", []);
|
|
3014
3130
|
__publicField(this, "previousPosition", null);
|
|
@@ -3027,6 +3143,9 @@ const _PositionSmoother = class {
|
|
|
3027
3143
|
this.callback = callback;
|
|
3028
3144
|
this.frequency = frequency;
|
|
3029
3145
|
}
|
|
3146
|
+
/**
|
|
3147
|
+
* @param flybyTime in seconds
|
|
3148
|
+
*/
|
|
3030
3149
|
feed(newPosition, flybyTime = _PositionSmoother.DEFAULT_FLYBY_TIME) {
|
|
3031
3150
|
if (!(newPosition instanceof geo.UserPosition)) {
|
|
3032
3151
|
throw new TypeError("newPosition is not instance of UserPosition");
|
|
@@ -3075,11 +3194,14 @@ const _PositionSmoother = class {
|
|
|
3075
3194
|
this.positionsQueue = [];
|
|
3076
3195
|
}
|
|
3077
3196
|
};
|
|
3197
|
+
// Generated positions by second
|
|
3198
|
+
__publicField(_PositionSmoother, "DEFAULT_FREQUENCY", 60);
|
|
3199
|
+
// flyby (in second)
|
|
3200
|
+
__publicField(_PositionSmoother, "DEFAULT_FLYBY_TIME", 1);
|
|
3078
3201
|
let PositionSmoother = _PositionSmoother;
|
|
3079
|
-
|
|
3080
|
-
__publicField(PositionSmoother, "DEFAULT_FLYBY_TIME", 1);
|
|
3081
|
-
const _AttitudeSmoother = class {
|
|
3202
|
+
const _AttitudeSmoother = class _AttitudeSmoother {
|
|
3082
3203
|
constructor(callback) {
|
|
3204
|
+
// in radians/s
|
|
3083
3205
|
__publicField(this, "_previousAttitude");
|
|
3084
3206
|
__publicField(this, "_smoothing", null);
|
|
3085
3207
|
this.callback = callback;
|
|
@@ -3126,6 +3248,11 @@ const _AttitudeSmoother = class {
|
|
|
3126
3248
|
}
|
|
3127
3249
|
this.callback(newAttitude);
|
|
3128
3250
|
}
|
|
3251
|
+
/**
|
|
3252
|
+
* @param {Attitude} previousAttitude
|
|
3253
|
+
* @param {Attitude} newAttitude
|
|
3254
|
+
* @returns {boolean}
|
|
3255
|
+
*/
|
|
3129
3256
|
static isJump(previousAttitude, newAttitude) {
|
|
3130
3257
|
const fromHeading = previousAttitude.heading;
|
|
3131
3258
|
const toHeading = newAttitude.heading;
|
|
@@ -3139,12 +3266,16 @@ const _AttitudeSmoother = class {
|
|
|
3139
3266
|
return Math.abs(diffAngleHeading) > _AttitudeSmoother.ROTATION_SPEED_JUMP_THRESHOLD * diffTime;
|
|
3140
3267
|
}
|
|
3141
3268
|
};
|
|
3269
|
+
__publicField(_AttitudeSmoother, "ROTATION_SPEED_JUMP_THRESHOLD", maths.deg2rad(180));
|
|
3270
|
+
// in radians/s
|
|
3271
|
+
__publicField(_AttitudeSmoother, "ROTATION_SPEED_CONVERGENCE", maths.deg2rad(10));
|
|
3272
|
+
// in radians/s
|
|
3273
|
+
__publicField(_AttitudeSmoother, "HIGH_JUMP_THRESHOLD", maths.deg2rad(20));
|
|
3274
|
+
// in radians/s
|
|
3275
|
+
__publicField(_AttitudeSmoother, "ROTATION_SPEED_HIGH_JUMP_CONVERGENCE", maths.deg2rad(100));
|
|
3276
|
+
// in radians/s
|
|
3277
|
+
__publicField(_AttitudeSmoother, "PITCH_UNCERTAINITY_HEADING_THRESHOLD", maths.deg2rad(5));
|
|
3142
3278
|
let AttitudeSmoother = _AttitudeSmoother;
|
|
3143
|
-
__publicField(AttitudeSmoother, "ROTATION_SPEED_JUMP_THRESHOLD", maths.deg2rad(180));
|
|
3144
|
-
__publicField(AttitudeSmoother, "ROTATION_SPEED_CONVERGENCE", maths.deg2rad(10));
|
|
3145
|
-
__publicField(AttitudeSmoother, "HIGH_JUMP_THRESHOLD", maths.deg2rad(20));
|
|
3146
|
-
__publicField(AttitudeSmoother, "ROTATION_SPEED_HIGH_JUMP_CONVERGENCE", maths.deg2rad(100));
|
|
3147
|
-
__publicField(AttitudeSmoother, "PITCH_UNCERTAINITY_HEADING_THRESHOLD", maths.deg2rad(5));
|
|
3148
3279
|
class MagnetometerCalibrationProvider extends Provider {
|
|
3149
3280
|
constructor() {
|
|
3150
3281
|
super();
|
|
@@ -3158,13 +3289,13 @@ class MagnetometerCalibrationProvider extends Provider {
|
|
|
3158
3289
|
}
|
|
3159
3290
|
}
|
|
3160
3291
|
const MagnetometerCalibrationProvider$1 = new MagnetometerCalibrationProvider();
|
|
3161
|
-
const _IpResolveServerError = class extends Error {
|
|
3292
|
+
const _IpResolveServerError = class _IpResolveServerError extends Error {
|
|
3162
3293
|
constructor(message) {
|
|
3163
3294
|
super(message || _IpResolveServerError.DEFAULT_MESSAGE);
|
|
3164
3295
|
}
|
|
3165
3296
|
};
|
|
3297
|
+
__publicField(_IpResolveServerError, "DEFAULT_MESSAGE", "IP Resolver failed");
|
|
3166
3298
|
let IpResolveServerError = _IpResolveServerError;
|
|
3167
|
-
__publicField(IpResolveServerError, "DEFAULT_MESSAGE", "IP Resolver failed");
|
|
3168
3299
|
class IpProvider extends Provider {
|
|
3169
3300
|
constructor() {
|
|
3170
3301
|
super(...arguments);
|