@wemap/providers 10.0.0-alpha.11 → 10.0.0-alpha.13
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 +2 -2
- package/src/errors/MissingNativeInterfaceError.js +2 -1
- package/src/events/AvailabilityHelper.js +26 -0
- package/src/events/AvailabilityHelper.spec.js +30 -0
- package/src/mapmatching/MapMatchingHandler.js +7 -0
- package/src/providers/FakeProvider.spec.js +1 -1
- package/src/providers/Provider.js +6 -6
- package/src/providers/Provider.spec.js +5 -5
- package/src/providers/attitude/absolute/AbsoluteAttitude.js +2 -2
- package/src/providers/attitude/absolute/AbsoluteAttitudeFromBrowser.js +1 -1
- package/src/providers/attitude/relative/RelativeAttitudeFromBrowser.js +1 -1
- package/src/providers/attitude/relative/RelativeAttitudeFromEkf.js +2 -1
- package/src/providers/attitude/relative/RelativeAttitudeFromInertial.js +6 -7
- package/src/providers/imu/Imu.js +1 -1
- package/src/providers/inclination/Inclination.js +2 -3
- package/src/providers/others/CameraNative.js +5 -4
- package/src/providers/position/absolute/AbsolutePosition.js +11 -10
- package/src/providers/position/absolute/GnssWifi.js +1 -1
- package/src/providers/position/absolute/PoleStar.js +5 -3
- package/src/providers/position/relative/GeoRelativePosition.js +4 -6
- package/src/providers/position/relative/GeoRelativePositionFromArCore.js +5 -1
- package/src/providers/position/relative/Pdr.js +2 -1
- package/src/providers/steps/StepDetector.js +2 -1
- package/src/providers/steps/StepDetectorLadetto.js +2 -1
- package/src/providers/steps/StepDetectorMinMaxPeaks.js +2 -1
- package/src/providers/steps/StepDetectorMinMaxPeaks2.js +2 -1
- package/src/providers/steps/StepDetectorMinMaxPeaks3.js +2 -1
- package/src/providers/steps/StraightLineDetector.js +11 -0
- package/src/providers/vision/ArCore.js +2 -2
package/package.json
CHANGED
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"url": "git+https://github.com/wemap/wemap-modules-js.git"
|
|
43
43
|
},
|
|
44
44
|
"type": "module",
|
|
45
|
-
"version": "10.0.0-alpha.
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"version": "10.0.0-alpha.13",
|
|
46
|
+
"gitHead": "3923469dae09f868af8c0ccb18b82db6282235cc"
|
|
47
47
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
class MissingNativeInterfaceError extends Error {
|
|
2
2
|
|
|
3
|
-
static DEFAULT_MESSAGE = 'Native interface is missing'
|
|
3
|
+
static DEFAULT_MESSAGE = 'Native interface is missing. You are maybe trying to '
|
|
4
|
+
+ 'execute a code which is not available in a web browser';
|
|
4
5
|
|
|
5
6
|
constructor(message) {
|
|
6
7
|
super(message || MissingNativeInterfaceError.DEFAULT_MESSAGE);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default class AvailabilityHelper {
|
|
2
|
+
|
|
3
|
+
static async every(availabilityPromises) {
|
|
4
|
+
for (const aPr of availabilityPromises) {
|
|
5
|
+
const error = await aPr;
|
|
6
|
+
if (error) {
|
|
7
|
+
return error;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static async some(availabilityPromises) {
|
|
14
|
+
let firstError;
|
|
15
|
+
for (const aPr of availabilityPromises) {
|
|
16
|
+
const error = await aPr;
|
|
17
|
+
if (!error) {
|
|
18
|
+
return null;
|
|
19
|
+
} else if (!firstError) {
|
|
20
|
+
firstError = error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return firstError || null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import chai from 'chai';
|
|
2
|
+
import chaiAsPromised from 'chai-as-promised';
|
|
3
|
+
|
|
4
|
+
import AvailabilityHelper from './AvailabilityHelper.js';
|
|
5
|
+
|
|
6
|
+
chai.use(chaiAsPromised);
|
|
7
|
+
const { expect } = chai;
|
|
8
|
+
|
|
9
|
+
const availabilityOk = Promise.resolve();
|
|
10
|
+
const availabilityFail1 = Promise.resolve('Reason 1.');
|
|
11
|
+
const availabilityFail2 = Promise.resolve('Reason 2.');
|
|
12
|
+
|
|
13
|
+
describe('AvailabilityHelper', () => {
|
|
14
|
+
|
|
15
|
+
it('every', async () => {
|
|
16
|
+
expect(await AvailabilityHelper.every([availabilityOk, availabilityOk])).is.equal(null);
|
|
17
|
+
expect(await AvailabilityHelper.every([availabilityOk, availabilityFail1])).is.equal('Reason 1.');
|
|
18
|
+
expect(await AvailabilityHelper.every([availabilityFail1, availabilityOk])).is.equal('Reason 1.');
|
|
19
|
+
expect(await AvailabilityHelper.every([availabilityFail1, availabilityFail2])).is.equal('Reason 1.');
|
|
20
|
+
expect(await AvailabilityHelper.every([availabilityFail2, availabilityFail1])).is.equal('Reason 2.');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('some', async () => {
|
|
24
|
+
expect(await AvailabilityHelper.some([availabilityOk, availabilityOk])).is.equal(null);
|
|
25
|
+
expect(await AvailabilityHelper.some([availabilityOk, availabilityFail1])).is.equal(null);
|
|
26
|
+
expect(await AvailabilityHelper.some([availabilityFail1, availabilityOk])).is.equal(null);
|
|
27
|
+
expect(await AvailabilityHelper.some([availabilityFail1, availabilityFail2])).is.equal('Reason 1.');
|
|
28
|
+
expect(await AvailabilityHelper.some([availabilityFail2, availabilityFail1])).is.equal('Reason 2.');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -115,6 +115,13 @@ class MapMatchingHandler extends Provider {
|
|
|
115
115
|
this._mapMatching.maxAngleBearing = MapMatchingHandler.DEFAULT_MM_MAX_ANGLE;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @override
|
|
120
|
+
*/
|
|
121
|
+
static get pname() {
|
|
122
|
+
return 'MapMatchingHandler';
|
|
123
|
+
}
|
|
124
|
+
|
|
118
125
|
/**
|
|
119
126
|
* @override
|
|
120
127
|
*/
|
|
@@ -69,11 +69,12 @@ class Provider {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
* @type {Promise} returns an availability promise
|
|
72
|
+
* @type {Promise<Error?>} returns an availability promise
|
|
73
|
+
* Resolve with an error if the provider is not available
|
|
73
74
|
*/
|
|
74
75
|
get availability() {
|
|
75
76
|
if (ProvidersOptions.ignoreProviders.includes(this.pname)) {
|
|
76
|
-
return Promise.
|
|
77
|
+
return Promise.resolve(new ContainsIgnoredProviderError());
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
return this._availability;
|
|
@@ -182,11 +183,10 @@ class Provider {
|
|
|
182
183
|
}
|
|
183
184
|
|
|
184
185
|
(async () => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
} catch (e) {
|
|
186
|
+
const error = await availabilityPromise;
|
|
187
|
+
if (error) {
|
|
188
188
|
this.state = ProviderState.STOPPED;
|
|
189
|
-
this.notifyError(
|
|
189
|
+
this.notifyError(error);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -37,15 +37,15 @@ describe('Provider', () => {
|
|
|
37
37
|
|
|
38
38
|
it('availability', async () => {
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
expect(FakeProvider1.availability).to.be.fulfilled;
|
|
41
41
|
ProvidersOptions.ignoreProviders.push(FakeProvider1.pname);
|
|
42
|
-
await
|
|
42
|
+
expect(await FakeProvider1.availability).is.instanceOf(ContainsIgnoredProviderError);
|
|
43
43
|
ProvidersOptions.ignoreProviders = [];
|
|
44
44
|
|
|
45
|
-
await
|
|
45
|
+
expect(await FakeProvider2.availability).is.instanceOf(Error);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
expect(FakeProvider3.availability).to.be.fulfilled;
|
|
48
|
+
expect(FakeProvider4.availability).to.be.fulfilled;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
it('checkAvailability on start', async () => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-statements */
|
|
2
2
|
import { AbsoluteHeading, Attitude } from '@wemap/geo';
|
|
3
3
|
import { deg2rad, diffAngle, Quaternion } from '@wemap/maths';
|
|
4
|
-
import { PromiseUtils } from '@wemap/utils';
|
|
5
4
|
|
|
6
5
|
import Provider from '../../Provider.js';
|
|
7
6
|
import EventType from '../../../events/EventType.js';
|
|
@@ -12,6 +11,7 @@ import ProviderEvent from '../../../events/ProviderEvent.js';
|
|
|
12
11
|
import HighRotationsDetector from '../../imu/HighRotationsDetector.js';
|
|
13
12
|
import ProvidersOptions from '../../../ProvidersOptions.js';
|
|
14
13
|
import Vps from '../../vision/vps/Vps.js';
|
|
14
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Absolute attitude provider gives the device attitude in East-North-Up (ENU) frame
|
|
@@ -81,7 +81,7 @@ class AbsoluteAttitude extends Provider {
|
|
|
81
81
|
* @override
|
|
82
82
|
*/
|
|
83
83
|
get _availability() {
|
|
84
|
-
return
|
|
84
|
+
return AvailabilityHelper.some([
|
|
85
85
|
AbsoluteAttitudeFromBrowser.availability,
|
|
86
86
|
RelativeAttitude.availability
|
|
87
87
|
]);
|
|
@@ -7,6 +7,7 @@ import RelativeAttitudeFromInertial from './RelativeAttitudeFromInertial.js';
|
|
|
7
7
|
|
|
8
8
|
import Accelerometer from '../../imu/Accelerometer.js';
|
|
9
9
|
import Gyroscope from '../../imu/Gyroscope.js';
|
|
10
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -44,7 +45,7 @@ class RelativeAttitudeFromEkf extends Provider {
|
|
|
44
45
|
* @override
|
|
45
46
|
*/
|
|
46
47
|
get _availability() {
|
|
47
|
-
return
|
|
48
|
+
return AvailabilityHelper.every([
|
|
48
49
|
Accelerometer.availability,
|
|
49
50
|
Gyroscope.availability
|
|
50
51
|
]);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Attitude } from '@wemap/geo';
|
|
2
2
|
import { deg2rad } from '@wemap/maths';
|
|
3
|
-
import { PromiseUtils } from '@wemap/utils';
|
|
4
3
|
|
|
5
4
|
import Provider from '../../Provider.js';
|
|
6
5
|
import ProviderEvent from '../../../events/ProviderEvent.js';
|
|
@@ -8,6 +7,7 @@ import EventType from '../../../events/EventType.js';
|
|
|
8
7
|
import RelativeAttitudeFromEkf from './RelativeAttitudeFromEkf.js';
|
|
9
8
|
import RelativeAttitudeFromBrowser from './RelativeAttitudeFromBrowser.js';
|
|
10
9
|
import HighRotationsDetector from '../../imu/HighRotationsDetector.js';
|
|
10
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class RelativeAttitudeFromInertial extends Provider {
|
|
@@ -36,10 +36,9 @@ class RelativeAttitudeFromInertial extends Provider {
|
|
|
36
36
|
* @override
|
|
37
37
|
*/
|
|
38
38
|
get _availability() {
|
|
39
|
-
return
|
|
39
|
+
return AvailabilityHelper.some([
|
|
40
40
|
RelativeAttitudeFromEkf.availability,
|
|
41
|
-
RelativeAttitudeFromBrowser.availability
|
|
42
|
-
HighRotationsDetector.availability
|
|
41
|
+
RelativeAttitudeFromBrowser.availability
|
|
43
42
|
]);
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -49,9 +48,9 @@ class RelativeAttitudeFromInertial extends Provider {
|
|
|
49
48
|
start() {
|
|
50
49
|
|
|
51
50
|
RelativeAttitudeFromEkf.availability
|
|
52
|
-
.then(
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
.then(availabilityError => {
|
|
52
|
+
this.provider = !availabilityError ? RelativeAttitudeFromEkf : RelativeAttitudeFromBrowser;
|
|
53
|
+
|
|
55
54
|
this.listenerId = this.provider.addEventListener(
|
|
56
55
|
events => this._parseEvent(events[0]),
|
|
57
56
|
error => this.notifyError(error)
|
package/src/providers/imu/Imu.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { PromiseUtils } from '@wemap/utils';
|
|
2
|
-
|
|
3
1
|
import Provider from '../Provider.js';
|
|
4
2
|
import EventType from '../../events/EventType.js';
|
|
5
3
|
import InclinationFromAcc from './InclinationFromAcc.js';
|
|
6
4
|
import InclinationFromRelativeAttitude from './InclinationFromRelativeAttitude.js';
|
|
5
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Inclination provider gives the inclination of the device using Imu Sensor
|
|
@@ -31,7 +30,7 @@ class Inclination extends Provider {
|
|
|
31
30
|
* @override
|
|
32
31
|
*/
|
|
33
32
|
get _availability() {
|
|
34
|
-
return
|
|
33
|
+
return AvailabilityHelper.some([
|
|
35
34
|
InclinationFromAcc.availability,
|
|
36
35
|
InclinationFromRelativeAttitude.availability
|
|
37
36
|
]);
|
|
@@ -23,10 +23,11 @@ class CameraNative extends Provider {
|
|
|
23
23
|
* @override
|
|
24
24
|
*/
|
|
25
25
|
get _availability() {
|
|
26
|
-
return new Promise(
|
|
27
|
-
ArCore.availability
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
return new Promise(async resolve => {
|
|
27
|
+
resolve(await ArCore.availability
|
|
28
|
+
? new Error('Providers will not use the camera.')
|
|
29
|
+
: null
|
|
30
|
+
);
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UserPosition, GeoRelativePosition, Level } from '@wemap/geo';
|
|
2
|
-
import {
|
|
2
|
+
import { TimeUtils } from '@wemap/utils';
|
|
3
3
|
|
|
4
4
|
import Provider from '../../Provider.js';
|
|
5
5
|
import EventType from '../../../events/EventType.js';
|
|
@@ -11,6 +11,7 @@ import ProvidersOptions from '../../../ProvidersOptions.js';
|
|
|
11
11
|
import ProviderState from '../../ProviderState.js';
|
|
12
12
|
import Vps from '../../vision/vps/Vps.js';
|
|
13
13
|
import PoleStar from './PoleStar.js';
|
|
14
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
14
15
|
|
|
15
16
|
class AbsolutePosition extends Provider {
|
|
16
17
|
|
|
@@ -64,7 +65,7 @@ class AbsolutePosition extends Provider {
|
|
|
64
65
|
if (ProvidersOptions.hasVps) {
|
|
65
66
|
providersToCheck.push(Vps.availability);
|
|
66
67
|
}
|
|
67
|
-
return
|
|
68
|
+
return AvailabilityHelper.some(providersToCheck);
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
|
|
@@ -73,16 +74,16 @@ class AbsolutePosition extends Provider {
|
|
|
73
74
|
*/
|
|
74
75
|
start() {
|
|
75
76
|
GeoRelativePositionProvider.availability
|
|
76
|
-
.then(() => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
.then((error) => {
|
|
78
|
+
if (!error) {
|
|
79
|
+
this._relativePositionProviderId = GeoRelativePositionProvider.addEventListener(
|
|
80
|
+
events => this._onRelativePosition(events[0])
|
|
81
|
+
);
|
|
82
|
+
} else {
|
|
83
|
+
// do nothing
|
|
84
|
+
}
|
|
83
85
|
});
|
|
84
86
|
|
|
85
|
-
|
|
86
87
|
// GnssWifi
|
|
87
88
|
this._gnssWifiProviderId = GnssWifi.addEventListener(
|
|
88
89
|
events => {
|
|
@@ -45,7 +45,7 @@ class GnssWifi extends Provider {
|
|
|
45
45
|
get _availability() {
|
|
46
46
|
return typeof (navigator) === 'object' && navigator.geolocation
|
|
47
47
|
? Promise.resolve()
|
|
48
|
-
: Promise.
|
|
48
|
+
: Promise.resolve(new GeolocationApiMissingError());
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -71,10 +71,12 @@ class PoleStar extends Provider {
|
|
|
71
71
|
* @override
|
|
72
72
|
*/
|
|
73
73
|
get _availability() {
|
|
74
|
-
|
|
74
|
+
try {
|
|
75
75
|
this.nativeProvider.checkAvailability();
|
|
76
|
-
resolve();
|
|
77
|
-
})
|
|
76
|
+
return Promise.resolve();
|
|
77
|
+
} catch (e) {
|
|
78
|
+
return Promise.resolve(e);
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
addMethodsToNativeJsProvider() {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { PromiseUtils } from '@wemap/utils';
|
|
2
|
-
|
|
3
1
|
import Provider from '../../Provider.js';
|
|
4
2
|
import EventType from '../../../events/EventType.js';
|
|
5
3
|
import GeoRelativePositionFromArCore from './GeoRelativePositionFromArCore.js';
|
|
6
4
|
import Pdr from './Pdr.js';
|
|
5
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class GeoRelativePosition extends Provider {
|
|
@@ -26,7 +25,7 @@ class GeoRelativePosition extends Provider {
|
|
|
26
25
|
* @override
|
|
27
26
|
*/
|
|
28
27
|
get _availability() {
|
|
29
|
-
return
|
|
28
|
+
return AvailabilityHelper.some([
|
|
30
29
|
Pdr.availability,
|
|
31
30
|
GeoRelativePositionFromArCore.availability
|
|
32
31
|
]);
|
|
@@ -39,9 +38,8 @@ class GeoRelativePosition extends Provider {
|
|
|
39
38
|
start() {
|
|
40
39
|
|
|
41
40
|
GeoRelativePositionFromArCore.availability
|
|
42
|
-
.then(
|
|
43
|
-
|
|
44
|
-
.finally(() => {
|
|
41
|
+
.then(availabilityError => {
|
|
42
|
+
this.geoRelativeProvider = availabilityError ? Pdr : GeoRelativePositionFromArCore;
|
|
45
43
|
this.providerId = this.geoRelativeProvider.addEventListener(
|
|
46
44
|
events => {
|
|
47
45
|
const event = events.find(_event => _event.dataType === EventType.GeoRelativePosition);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GeoRelativePosition } from '@wemap/geo';
|
|
2
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
2
3
|
|
|
3
4
|
import EventType from '../../../events/EventType.js';
|
|
4
5
|
import AbsoluteAttitude from '../../attitude/absolute/AbsoluteAttitude.js';
|
|
@@ -18,7 +19,10 @@ class GeoRelativePositionFromArCore extends Provider {
|
|
|
18
19
|
* @override
|
|
19
20
|
*/
|
|
20
21
|
get _availability() {
|
|
21
|
-
return
|
|
22
|
+
return AvailabilityHelper.every([
|
|
23
|
+
ArCore.availability,
|
|
24
|
+
AbsoluteAttitude.availability
|
|
25
|
+
]);
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
/**
|
|
@@ -5,6 +5,7 @@ import Provider from '../../Provider.js';
|
|
|
5
5
|
import EventType from '../../../events/EventType.js';
|
|
6
6
|
import StepDetector from '../../steps/StepDetector.js';
|
|
7
7
|
import AbsoluteAttitude from '../../attitude/absolute/AbsoluteAttitude.js';
|
|
8
|
+
import AvailabilityHelper from '../../../events/AvailabilityHelper.js';
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class Pdr extends Provider {
|
|
@@ -31,7 +32,7 @@ class Pdr extends Provider {
|
|
|
31
32
|
* @override
|
|
32
33
|
*/
|
|
33
34
|
get _availability() {
|
|
34
|
-
return
|
|
35
|
+
return AvailabilityHelper.every([
|
|
35
36
|
StepDetector.availability,
|
|
36
37
|
AbsoluteAttitude.availability
|
|
37
38
|
]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Constants as GeoConstants } from '@wemap/geo';
|
|
2
2
|
import { Quaternion } from '@wemap/maths';
|
|
3
3
|
|
|
4
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
4
5
|
import EventType from '../../events/EventType.js';
|
|
5
6
|
import RelativeAttitudeFromInertial from '../attitude/relative/RelativeAttitudeFromInertial.js';
|
|
6
7
|
import Accelerometer from '../imu/Accelerometer.js';
|
|
@@ -43,7 +44,7 @@ class StepDetector extends Provider {
|
|
|
43
44
|
* @override
|
|
44
45
|
*/
|
|
45
46
|
get _availability() {
|
|
46
|
-
return
|
|
47
|
+
return AvailabilityHelper.every([
|
|
47
48
|
Accelerometer.availability,
|
|
48
49
|
Gyroscope.availability,
|
|
49
50
|
RelativeAttitudeFromInertial.availability
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Constants as GeoConstants } from '@wemap/geo';
|
|
2
2
|
import { Quaternion } from '@wemap/maths';
|
|
3
3
|
|
|
4
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
4
5
|
import EventType from '../../events/EventType.js';
|
|
5
6
|
import RelativeAttitudeFromInertial from '../attitude/relative/RelativeAttitudeFromInertial.js';
|
|
6
7
|
import Accelerometer from '../imu/Accelerometer.js';
|
|
@@ -27,7 +28,7 @@ class StepDetectorLadetto extends Provider {
|
|
|
27
28
|
* @override
|
|
28
29
|
*/
|
|
29
30
|
get _availability() {
|
|
30
|
-
return
|
|
31
|
+
return AvailabilityHelper.every([
|
|
31
32
|
Accelerometer.availability,
|
|
32
33
|
Gyroscope.availability,
|
|
33
34
|
RelativeAttitudeFromInertial.availability
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Constants as GeoConstants } from '@wemap/geo';
|
|
2
2
|
import { Quaternion } from '@wemap/maths';
|
|
3
3
|
|
|
4
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
4
5
|
import EventType from '../../events/EventType.js';
|
|
5
6
|
import RelativeAttitudeFromInertial from '../attitude/relative/RelativeAttitudeFromInertial.js';
|
|
6
7
|
import Accelerometer from '../imu/Accelerometer.js';
|
|
@@ -27,7 +28,7 @@ class StepDetectorMinMaxPeaks extends Provider {
|
|
|
27
28
|
* @override
|
|
28
29
|
*/
|
|
29
30
|
get _availability() {
|
|
30
|
-
return
|
|
31
|
+
return AvailabilityHelper.every([
|
|
31
32
|
Accelerometer.availability,
|
|
32
33
|
Gyroscope.availability,
|
|
33
34
|
RelativeAttitudeFromInertial.availability
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Constants as GeoConstants } from '@wemap/geo';
|
|
2
2
|
import { Quaternion } from '@wemap/maths';
|
|
3
3
|
|
|
4
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
4
5
|
import EventType from '../../events/EventType.js';
|
|
5
6
|
import RelativeAttitudeFromInertial from '../attitude/relative/RelativeAttitudeFromInertial.js';
|
|
6
7
|
import Accelerometer from '../imu/Accelerometer.js';
|
|
@@ -27,7 +28,7 @@ class StepDetectorMinMaxPeaks2 extends Provider {
|
|
|
27
28
|
* @override
|
|
28
29
|
*/
|
|
29
30
|
get _availability() {
|
|
30
|
-
return
|
|
31
|
+
return AvailabilityHelper.every([
|
|
31
32
|
Accelerometer.availability,
|
|
32
33
|
Gyroscope.availability,
|
|
33
34
|
RelativeAttitudeFromInertial.availability
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Constants as GeoConstants } from '@wemap/geo';
|
|
2
2
|
import { Quaternion } from '@wemap/maths';
|
|
3
3
|
|
|
4
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
4
5
|
import EventType from '../../events/EventType.js';
|
|
5
6
|
import RelativeAttitudeFromInertial from '../attitude/relative/RelativeAttitudeFromInertial.js';
|
|
6
7
|
import Accelerometer from '../imu/Accelerometer.js';
|
|
@@ -27,7 +28,7 @@ class StepDetectorMinMaxPeaks3 extends Provider {
|
|
|
27
28
|
* @override
|
|
28
29
|
*/
|
|
29
30
|
get _availability() {
|
|
30
|
-
return
|
|
31
|
+
return AvailabilityHelper.every([
|
|
31
32
|
Accelerometer.availability,
|
|
32
33
|
Gyroscope.availability,
|
|
33
34
|
RelativeAttitudeFromInertial.availability
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AvailabilityHelper from '../../events/AvailabilityHelper.js';
|
|
1
2
|
import Provider from '../Provider.js';
|
|
2
3
|
import StepDetector from './StepDetector.js';
|
|
3
4
|
import TurnDectector from '../attitude/TurnDectector.js';
|
|
@@ -27,6 +28,16 @@ class StraightLineDetector extends Provider {
|
|
|
27
28
|
return 'StraightLineDetector';
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @override
|
|
33
|
+
*/
|
|
34
|
+
get _availability() {
|
|
35
|
+
return AvailabilityHelper.every([
|
|
36
|
+
TurnDectector.availability,
|
|
37
|
+
StepDetector.availability
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
/**
|
|
31
42
|
* @override
|
|
32
43
|
*/
|
|
@@ -162,11 +162,11 @@ class ArCore extends Provider {
|
|
|
162
162
|
const nativeProvider = this.nativeProvider;
|
|
163
163
|
|
|
164
164
|
if (!nativeProvider.checkAvailability()) {
|
|
165
|
-
return Promise.
|
|
165
|
+
return Promise.resolve(new MissingArCoreError());
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
} catch (e) {
|
|
169
|
-
return Promise.
|
|
169
|
+
return Promise.resolve(e);
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
return Promise.resolve();
|