@wemap/providers 3.0.1 → 3.1.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/.env +2 -0
- package/debug/components/InclinationComponent.jsx +4 -4
- package/debug/components/index.js +0 -2
- package/package.json +3 -3
- package/src/Providers.js +15 -7
- package/src/ProvidersInterface.js +7 -1
- package/src/events/EventType.js +1 -1
- package/src/providers/attitude/absolute/AbsoluteAttitudeFromRelAttProvider.js +1 -2
- package/src/providers/attitude/relative/RelativeAttitudeFromBrowserProvider.js +2 -2
- package/src/providers/attitude/relative/RelativeAttitudeFromEkfProvider.js +2 -2
- package/src/providers/attitude/relative/RelativeAttitudeFromInertialProvider.js +64 -0
- package/src/providers/attitude/relative/RelativeAttitudeProvider.js +25 -30
- package/src/providers/inclination/{InclinationFromAttitudeProvider.js → InclinationFromRelativeAttitudeProvider.js} +6 -6
- package/src/providers/inclination/InclinationProvider.js +5 -5
- package/src/providers/others/BarcodeProvider.js +47 -0
- package/src/providers/others/CameraProjectionMatrixProvider.js +44 -0
- package/src/providers/position/relative/ArCoreProvider.js +1 -1
- package/src/providers/steps/StepDetectionProvider.js +4 -4
- package/src/smoothers/PositionSmoother.js +1 -1
- package/debug/components/AttitudeComponent.jsx +0 -40
- package/debug/components/old/PositioningComponent.jsx +0 -29
- package/debug/components/old/PositioningInclinationComponent.jsx +0 -82
- package/debug/components/old/PositioningPoseComponent.jsx +0 -117
- package/dist/attitude.html +0 -16
- package/src/providers/attitude/AttitudeProvider.js +0 -63
package/.env
ADDED
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import Utils from './Utils';
|
|
4
4
|
import ProvidersLogger from '../../src/events/ProvidersLogger';
|
|
5
5
|
import {
|
|
6
|
-
InclinationFromAcc,
|
|
6
|
+
InclinationFromAcc, InclinationFromRelativeAttitude, Inclination
|
|
7
7
|
} from '../../src/Providers';
|
|
8
8
|
|
|
9
9
|
|
|
@@ -29,7 +29,7 @@ class InclinationComponent extends React.Component {
|
|
|
29
29
|
this.name
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
this.providerAttId =
|
|
32
|
+
this.providerAttId = InclinationFromRelativeAttitude.addEventListener(
|
|
33
33
|
events => this.setState({ inclinationFromAtt: events[0] }),
|
|
34
34
|
error => this.setState({ inclinationFromAtt: error }),
|
|
35
35
|
this.name
|
|
@@ -45,7 +45,7 @@ class InclinationComponent extends React.Component {
|
|
|
45
45
|
|
|
46
46
|
componentWillUnmount() {
|
|
47
47
|
InclinationFromAcc.removeEventListener(this.providerAccId);
|
|
48
|
-
|
|
48
|
+
InclinationFromRelativeAttitude.removeEventListener(this.providerAttId);
|
|
49
49
|
Inclination.removeEventListener(this.providerId);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -55,7 +55,7 @@ class InclinationComponent extends React.Component {
|
|
|
55
55
|
<div>
|
|
56
56
|
<h3>Inclination from accelerometer</h3>
|
|
57
57
|
{Utils.renderInclinationEvent(this.state.inclinationFromAcc)}
|
|
58
|
-
<h3>Inclination from attitude</h3>
|
|
58
|
+
<h3>Inclination from relative attitude</h3>
|
|
59
59
|
{Utils.renderInclinationEvent(this.state.inclinationFromAtt)}
|
|
60
60
|
<h3>Inclination</h3>
|
|
61
61
|
{Utils.renderInclinationEvent(this.state.inclination)}
|
|
@@ -3,7 +3,6 @@ import ReactDOM from 'react-dom';
|
|
|
3
3
|
|
|
4
4
|
import AbsoluteAttitudeComponent from './AbsoluteAttitudeComponent';
|
|
5
5
|
import AbsolutePositionComponent from './AbsolutePositionComponent';
|
|
6
|
-
import AttitudeComponent from './AttitudeComponent';
|
|
7
6
|
import GnssWifiComponent from './GnssWifiComponent';
|
|
8
7
|
import ImuComponent from './ImuComponent';
|
|
9
8
|
import InclinationComponent from './InclinationComponent';
|
|
@@ -19,7 +18,6 @@ const createReactElement = (component, container) => ReactDOM.render(
|
|
|
19
18
|
export {
|
|
20
19
|
AbsoluteAttitudeComponent,
|
|
21
20
|
AbsolutePositionComponent,
|
|
22
|
-
AttitudeComponent,
|
|
23
21
|
ImuComponent,
|
|
24
22
|
InclinationComponent,
|
|
25
23
|
GnssWifiComponent,
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@wemap/graph": "^3.0.0",
|
|
13
13
|
"@wemap/logger": "^3.0.0",
|
|
14
14
|
"@wemap/maths": "^3.0.0",
|
|
15
|
-
"@wemap/osm": "^3.
|
|
15
|
+
"@wemap/osm": "^3.1.0",
|
|
16
16
|
"@wemap/utils": "^3.0.0",
|
|
17
17
|
"geomagnetism": "^0.1.0",
|
|
18
18
|
"lodash.isempty": "^4.4.0",
|
|
@@ -63,6 +63,6 @@
|
|
|
63
63
|
"lint": "eslint --ext .js,.jsx --quiet src",
|
|
64
64
|
"test": "mocha -r esm \"src/**/*.spec.js\""
|
|
65
65
|
},
|
|
66
|
-
"version": "3.
|
|
67
|
-
"gitHead": "
|
|
66
|
+
"version": "3.1.1",
|
|
67
|
+
"gitHead": "34b7d9d3c18db38ee6c5f8de470fcc8abfdf3327"
|
|
68
68
|
}
|
package/src/Providers.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/* eslint-disable id-length */
|
|
3
|
+
|
|
1
4
|
import ImuProvider from './providers/imu/ImuProvider';
|
|
2
5
|
import AccelerometerProvider from './providers/imu/AccelerometerProvider';
|
|
3
6
|
import GyroscopeProvider from './providers/imu/GyroscopeProvider';
|
|
@@ -7,9 +10,11 @@ const Gyroscope = GyroscopeProvider.instance;
|
|
|
7
10
|
|
|
8
11
|
import RelativeAttitudeFromBrowserProvider from './providers/attitude/relative/RelativeAttitudeFromBrowserProvider';
|
|
9
12
|
import RelativeAttitudeFromEkfProvider from './providers/attitude/relative/RelativeAttitudeFromEkfProvider';
|
|
13
|
+
import RelativeAttitudeFromInertialProvider from './providers/attitude/relative/RelativeAttitudeFromInertialProvider';
|
|
10
14
|
import RelativeAttitudeProvider from './providers/attitude/relative/RelativeAttitudeProvider';
|
|
11
15
|
const RelativeAttitudeFromBrowser = RelativeAttitudeFromBrowserProvider.instance;
|
|
12
16
|
const RelativeAttitudeFromEkf = RelativeAttitudeFromEkfProvider.instance;
|
|
17
|
+
const RelativeAttitudeFromInertial = RelativeAttitudeFromInertialProvider.instance;
|
|
13
18
|
const RelativeAttitude = RelativeAttitudeProvider.instance;
|
|
14
19
|
|
|
15
20
|
import AbsoluteAttitudeFromBrowserProvider from './providers/attitude/absolute/AbsoluteAttitudeFromBrowserProvider';
|
|
@@ -19,14 +24,11 @@ const AbsoluteAttitudeFromBrowser = AbsoluteAttitudeFromBrowserProvider.instance
|
|
|
19
24
|
const AbsoluteAttitudeFromRelAtt = AbsoluteAttitudeFromRelAttProvider.instance;
|
|
20
25
|
const AbsoluteAttitude = AbsoluteAttitudeProvider.instance;
|
|
21
26
|
|
|
22
|
-
import AttitudeProvider from './providers/attitude/AttitudeProvider';
|
|
23
|
-
const Attitude = AttitudeProvider.instance;
|
|
24
|
-
|
|
25
27
|
import InclinationFromAccProvider from './providers/inclination/InclinationFromAccProvider';
|
|
26
|
-
import
|
|
28
|
+
import InclinationFromRelativeAttitudeProvider from './providers/inclination/InclinationFromRelativeAttitudeProvider';
|
|
27
29
|
import InclinationProvider from './providers/inclination/InclinationProvider';
|
|
28
30
|
const InclinationFromAcc = InclinationFromAccProvider.instance;
|
|
29
|
-
const
|
|
31
|
+
const InclinationFromRelativeAttitude = InclinationFromRelativeAttitudeProvider.instance;
|
|
30
32
|
const Inclination = InclinationProvider.instance;
|
|
31
33
|
|
|
32
34
|
import StepDetectionProvider from './providers/steps/StepDetectionProvider';
|
|
@@ -50,8 +52,12 @@ const GnssWifi = GnssWifiProvider.instance;
|
|
|
50
52
|
const Ip = IpProvider.instance;
|
|
51
53
|
const AbsolutePosition = AbsolutePositionProvider.instance;
|
|
52
54
|
|
|
55
|
+
import BarcodeProvider from './providers/others/BarcodeProvider';
|
|
53
56
|
import CameraNativeProvider from './providers/others/CameraNativeProvider';
|
|
57
|
+
import CameraProjectionMatrixProvider from './providers/others/CameraProjectionMatrixProvider';
|
|
58
|
+
const Barcode = BarcodeProvider.instance;
|
|
54
59
|
const CameraNative = CameraNativeProvider.instance;
|
|
60
|
+
const CameraProjectionMatrix = CameraProjectionMatrixProvider.instance;
|
|
55
61
|
|
|
56
62
|
export {
|
|
57
63
|
AbsoluteAttitude,
|
|
@@ -61,8 +67,9 @@ export {
|
|
|
61
67
|
AbsolutePositionFromRel,
|
|
62
68
|
Accelerometer,
|
|
63
69
|
ArCore,
|
|
64
|
-
|
|
70
|
+
Barcode,
|
|
65
71
|
CameraNative,
|
|
72
|
+
CameraProjectionMatrix,
|
|
66
73
|
GeoRelativePosition,
|
|
67
74
|
GeoRelativePositionFromArCore,
|
|
68
75
|
GnssWifi,
|
|
@@ -70,11 +77,12 @@ export {
|
|
|
70
77
|
Imu,
|
|
71
78
|
Inclination,
|
|
72
79
|
InclinationFromAcc,
|
|
73
|
-
|
|
80
|
+
InclinationFromRelativeAttitude,
|
|
74
81
|
Ip,
|
|
75
82
|
Pdr,
|
|
76
83
|
RelativeAttitude,
|
|
77
84
|
RelativeAttitudeFromBrowser,
|
|
78
85
|
RelativeAttitudeFromEkf,
|
|
86
|
+
RelativeAttitudeFromInertial,
|
|
79
87
|
StepDetection
|
|
80
88
|
};
|
|
@@ -7,7 +7,7 @@ import { Network } from '@wemap/graph';
|
|
|
7
7
|
import EventType from './events/EventType';
|
|
8
8
|
import MetaProvider from './providers/MetaProvider';
|
|
9
9
|
import {
|
|
10
|
-
AbsoluteAttitude, AbsolutePosition, CameraNative, Inclination
|
|
10
|
+
AbsoluteAttitude, AbsolutePosition, Barcode, CameraNative, CameraProjectionMatrix, Inclination
|
|
11
11
|
} from './Providers';
|
|
12
12
|
import ProvidersLogger from './events/ProvidersLogger';
|
|
13
13
|
|
|
@@ -79,6 +79,12 @@ class ProvidersInterface {
|
|
|
79
79
|
case EventType.CameraNative:
|
|
80
80
|
return CameraNative;
|
|
81
81
|
|
|
82
|
+
case EventType.Barcode:
|
|
83
|
+
return Barcode;
|
|
84
|
+
|
|
85
|
+
case EventType.CameraProjectionMatrix:
|
|
86
|
+
return CameraProjectionMatrix;
|
|
87
|
+
|
|
82
88
|
default:
|
|
83
89
|
throw new Error(`Unable to deal with this event type: ${eventType}`);
|
|
84
90
|
}
|
package/src/events/EventType.js
CHANGED
|
@@ -100,8 +100,6 @@ class AbsoluteAttitudeFromRelAttProvider extends Provider {
|
|
|
100
100
|
// preprocess zOffset for "compute" function
|
|
101
101
|
const currentHeading = this.relativeAttitudeEvent ? this.relativeAttitudeEvent.data.heading : 0;
|
|
102
102
|
this.zOffset = Quaternion.fromAxisAngle([0, 0, 1], -absoluteAttitudeEvent.data.heading + currentHeading);
|
|
103
|
-
|
|
104
|
-
this.compute();
|
|
105
103
|
};
|
|
106
104
|
|
|
107
105
|
|
|
@@ -120,6 +118,7 @@ class AbsoluteAttitudeFromRelAttProvider extends Provider {
|
|
|
120
118
|
const newAccuracy = absoluteAttitudeAccuracy + this.accuracy;
|
|
121
119
|
const attitude = new Attitude(absoluteQuat, time, newAccuracy, this.name);
|
|
122
120
|
|
|
121
|
+
console.log('AbsoluteAttitudeFromRelAttProvider notify', attitude.accuracy);
|
|
123
122
|
this.notify(this.createEvent(
|
|
124
123
|
EventType.AbsoluteAttitude,
|
|
125
124
|
attitude,
|
|
@@ -9,7 +9,7 @@ import EventType from '../../../events/EventType';
|
|
|
9
9
|
import AskImuOnDesktopError from '../../../errors/AskImuOnDesktopError';
|
|
10
10
|
import MissingSensorError from '../../../errors/MissingSensorError';
|
|
11
11
|
import Availability from '../../../events/Availability';
|
|
12
|
-
import
|
|
12
|
+
import RelativeAttitudeFromInertialProvider from './RelativeAttitudeFromInertialProvider';
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -93,7 +93,7 @@ class RelativeAttitudeFromBrowserProvider extends Provider {
|
|
|
93
93
|
const quaternion = Rotations.eulerToQuaternionZXYDegrees([e.alpha, e.beta, e.gamma]);
|
|
94
94
|
const attitude = new Attitude(quaternion,
|
|
95
95
|
timestamp,
|
|
96
|
-
|
|
96
|
+
RelativeAttitudeFromInertialProvider.DEFAULT_DRIFT,
|
|
97
97
|
this.name
|
|
98
98
|
);
|
|
99
99
|
this.notify(this.createEvent(EventType.RelativeAttitude, attitude, timestamp));
|
|
@@ -4,7 +4,7 @@ import Provider from '../../Provider';
|
|
|
4
4
|
import Availability from '../../../events/Availability';
|
|
5
5
|
import EventType from '../../../events/EventType';
|
|
6
6
|
import EkfAttitude from '../EkfAttitude';
|
|
7
|
-
import
|
|
7
|
+
import RelativeAttitudeFromInertialProvider from './RelativeAttitudeFromInertialProvider';
|
|
8
8
|
import {
|
|
9
9
|
Accelerometer, Gyroscope
|
|
10
10
|
} from '../../../Providers';
|
|
@@ -99,7 +99,7 @@ class RelativeAttitudeFromEkfProvider extends Provider {
|
|
|
99
99
|
if (quaternion) {
|
|
100
100
|
const attitude = new Attitude(quaternion,
|
|
101
101
|
timestamp,
|
|
102
|
-
|
|
102
|
+
RelativeAttitudeFromInertialProvider.DEFAULT_DRIFT,
|
|
103
103
|
this.name
|
|
104
104
|
);
|
|
105
105
|
this.notify(this.createEvent(
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { deg2rad } from '@wemap/maths';
|
|
2
|
+
|
|
3
|
+
import Provider from '../../Provider';
|
|
4
|
+
import EventType from '../../../events/EventType';
|
|
5
|
+
import Availability from '../../../events/Availability';
|
|
6
|
+
import {
|
|
7
|
+
RelativeAttitudeFromEkf, RelativeAttitudeFromBrowser
|
|
8
|
+
} from '../../../Providers';
|
|
9
|
+
|
|
10
|
+
class RelativeAttitudeFromInertialProvider extends Provider {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* default relative attitude drift in rad.second-1
|
|
14
|
+
*/
|
|
15
|
+
static DEFAULT_DRIFT = deg2rad(15) / 60;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @override
|
|
20
|
+
*/
|
|
21
|
+
static get displayName() {
|
|
22
|
+
return 'Relative Attitude from Inertial';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @override
|
|
27
|
+
*/
|
|
28
|
+
static get eventsType() {
|
|
29
|
+
return [EventType.RelativeAttitude];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @override
|
|
34
|
+
*/
|
|
35
|
+
get _availability() {
|
|
36
|
+
return Availability.union(
|
|
37
|
+
RelativeAttitudeFromEkf.availability,
|
|
38
|
+
RelativeAttitudeFromBrowser.availability
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @override
|
|
44
|
+
*/
|
|
45
|
+
start() {
|
|
46
|
+
this.provider = RelativeAttitudeFromEkf.availability.isSupported
|
|
47
|
+
? RelativeAttitudeFromEkf
|
|
48
|
+
: RelativeAttitudeFromBrowser;
|
|
49
|
+
|
|
50
|
+
this.listenerId = this.provider.addEventListener(
|
|
51
|
+
events => this.notify(events[0].clone()),
|
|
52
|
+
error => this.notifyError(error),
|
|
53
|
+
this.name);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @override
|
|
58
|
+
*/
|
|
59
|
+
stop() {
|
|
60
|
+
this.provider.removeEventListener(this.listenerId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default RelativeAttitudeFromInertialProvider;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { deg2rad } from '@wemap/maths';
|
|
2
|
-
|
|
3
1
|
import Provider from '../../Provider';
|
|
4
2
|
import EventType from '../../../events/EventType';
|
|
5
|
-
import Availability from '../../../events/Availability';
|
|
6
3
|
import noop from 'lodash.noop';
|
|
7
4
|
import ProviderState from '../../ProviderState';
|
|
8
5
|
import {
|
|
9
|
-
|
|
6
|
+
RelativeAttitudeFromInertial, ArCore
|
|
10
7
|
} from '../../../Providers';
|
|
11
8
|
|
|
12
9
|
|
|
@@ -16,13 +13,6 @@ import {
|
|
|
16
13
|
* The provider does not work until an offset is given.
|
|
17
14
|
*/
|
|
18
15
|
class RelativeAttitudeProvider extends Provider {
|
|
19
|
-
/**
|
|
20
|
-
* default relative attitude drift in rad.second-1
|
|
21
|
-
*/
|
|
22
|
-
static DEFAULT_DRIFT = deg2rad(15) / 60;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
lastTimestamp = 0;
|
|
26
16
|
|
|
27
17
|
/**
|
|
28
18
|
* @override
|
|
@@ -42,33 +32,26 @@ class RelativeAttitudeProvider extends Provider {
|
|
|
42
32
|
* @override
|
|
43
33
|
*/
|
|
44
34
|
get _availability() {
|
|
45
|
-
return
|
|
46
|
-
RelativeAttitudeFromEkf.availability,
|
|
47
|
-
RelativeAttitudeFromBrowser.availability
|
|
48
|
-
);
|
|
35
|
+
return RelativeAttitudeFromInertial.availability;
|
|
49
36
|
}
|
|
50
37
|
|
|
51
38
|
/**
|
|
52
39
|
* @override
|
|
53
40
|
*/
|
|
54
41
|
start() {
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
error => this.notifyError(error),
|
|
66
|
-
this.name);
|
|
67
|
-
|
|
42
|
+
this.arCoreMonitoringId = ArCore.addMonitoringListener(
|
|
43
|
+
() => {
|
|
44
|
+
this.listenArCore();
|
|
45
|
+
this.unlistenInertial();
|
|
46
|
+
}, () => {
|
|
47
|
+
this.unlistenArCore();
|
|
48
|
+
this.listenInertial();
|
|
49
|
+
});
|
|
68
50
|
|
|
69
|
-
this.arCoreMonitoringId = ArCore.addMonitoringListener(this.listenArCore, this.unlistenArCore);
|
|
70
51
|
if (ArCore.state === ProviderState.STARTED) {
|
|
71
52
|
this.listenArCore();
|
|
53
|
+
} else {
|
|
54
|
+
this.listenInertial();
|
|
72
55
|
}
|
|
73
56
|
}
|
|
74
57
|
|
|
@@ -76,9 +59,21 @@ class RelativeAttitudeProvider extends Provider {
|
|
|
76
59
|
* @override
|
|
77
60
|
*/
|
|
78
61
|
stop() {
|
|
79
|
-
this.provider.removeEventListener(this.listenerId);
|
|
80
62
|
ArCore.removeMonitoringListener(this.arCoreMonitoringId);
|
|
81
63
|
this.unlistenArCore();
|
|
64
|
+
this.unlistenInertial();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
listenInertial = () => {
|
|
69
|
+
this.inertialProviderId = RelativeAttitudeFromInertial.addEventListener(
|
|
70
|
+
events => this.notify(events[0].clone()),
|
|
71
|
+
error => this.notifyError(error),
|
|
72
|
+
this.name);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
unlistenInertial = () => {
|
|
76
|
+
RelativeAttitudeFromInertial.removeEventListener(this.inertialProviderId);
|
|
82
77
|
}
|
|
83
78
|
|
|
84
79
|
listenArCore = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Provider from '../Provider';
|
|
2
2
|
import EventType from '../../events/EventType';
|
|
3
|
-
import {
|
|
3
|
+
import { RelativeAttitudeFromInertial } from '../../Providers';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Inclination provider gives the inclination of the device using Relative Attitude
|
|
@@ -8,7 +8,7 @@ import { Attitude } from '../../Providers';
|
|
|
8
8
|
* when the device is layed on a table, inclination = 0
|
|
9
9
|
* This provider use window.orientation to return a result in function of screen orientation
|
|
10
10
|
*/
|
|
11
|
-
class
|
|
11
|
+
class InclinationFromRelativeAttitudeProvider extends Provider {
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @override
|
|
@@ -28,14 +28,14 @@ class InclinationFromAttitudeProvider extends Provider {
|
|
|
28
28
|
* @override
|
|
29
29
|
*/
|
|
30
30
|
get _availability() {
|
|
31
|
-
return
|
|
31
|
+
return RelativeAttitudeFromInertial.availability;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* @override
|
|
36
36
|
*/
|
|
37
37
|
start() {
|
|
38
|
-
this.providerId =
|
|
38
|
+
this.providerId = RelativeAttitudeFromInertial.addEventListener(
|
|
39
39
|
events => {
|
|
40
40
|
const attitudeEvent = events[0];
|
|
41
41
|
const inclination = this.constructor.enuQuatToInclination(
|
|
@@ -56,7 +56,7 @@ class InclinationFromAttitudeProvider extends Provider {
|
|
|
56
56
|
* @override
|
|
57
57
|
*/
|
|
58
58
|
stop() {
|
|
59
|
-
|
|
59
|
+
RelativeAttitudeFromInertial.removeEventListener(this.providerId);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
static enuQuatToInclination(q) {
|
|
@@ -74,4 +74,4 @@ class InclinationFromAttitudeProvider extends Provider {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
export default
|
|
77
|
+
export default InclinationFromRelativeAttitudeProvider;
|
|
@@ -2,7 +2,7 @@ import MetaProvider from '../MetaProvider';
|
|
|
2
2
|
import EventType from '../../events/EventType';
|
|
3
3
|
import Availability from '../../events/Availability';
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
InclinationFromRelativeAttitude, InclinationFromAcc
|
|
6
6
|
} from '../../Providers';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -26,7 +26,7 @@ class InclinationProvider extends MetaProvider {
|
|
|
26
26
|
get _availability() {
|
|
27
27
|
return Availability.union(
|
|
28
28
|
InclinationFromAcc.availability,
|
|
29
|
-
|
|
29
|
+
InclinationFromRelativeAttitude.availability
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -44,12 +44,12 @@ class InclinationProvider extends MetaProvider {
|
|
|
44
44
|
);
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
if (
|
|
48
|
-
this.provider =
|
|
47
|
+
if (InclinationFromRelativeAttitude.availability) {
|
|
48
|
+
this.provider = InclinationFromRelativeAttitude;
|
|
49
49
|
this.providerId = this.provider.addEventListener(
|
|
50
50
|
events => this.notify(events[0].clone()),
|
|
51
51
|
() => {
|
|
52
|
-
|
|
52
|
+
InclinationFromRelativeAttitude.removeEventListener(this.providerId);
|
|
53
53
|
startInclinationFromAcc();
|
|
54
54
|
},
|
|
55
55
|
this.name);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Provider from '../Provider';
|
|
2
|
+
import EventType from '../../events/EventType';
|
|
3
|
+
import { ArCore } from '../../Providers';
|
|
4
|
+
|
|
5
|
+
class BarcodeProvider extends Provider {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @override
|
|
9
|
+
*/
|
|
10
|
+
static get eventsType() {
|
|
11
|
+
return [EventType.Barcode];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @override
|
|
16
|
+
*/
|
|
17
|
+
get _availability() {
|
|
18
|
+
return ArCore.availability;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
24
|
+
start() {
|
|
25
|
+
ArCore.enableBarcodeScanner();
|
|
26
|
+
|
|
27
|
+
this.providerId = ArCore.addEventListener(
|
|
28
|
+
events => {
|
|
29
|
+
const barcodeEvent = events.find(event => event.dataType === EventType.Barcode);
|
|
30
|
+
if (barcodeEvent) {
|
|
31
|
+
this.notify(barcodeEvent);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
error => this.notifyError(error)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @override
|
|
40
|
+
*/
|
|
41
|
+
stop() {
|
|
42
|
+
ArCore.disableBarcodeScanner();
|
|
43
|
+
ArCore.removeEventListener(this.providerId);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default BarcodeProvider;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import MetaProvider from '../MetaProvider';
|
|
2
|
+
import EventType from '../../events/EventType';
|
|
3
|
+
import { ArCore } from '../../Providers';
|
|
4
|
+
|
|
5
|
+
class CameraProjectionMatrixProvider extends MetaProvider {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @override
|
|
9
|
+
*/
|
|
10
|
+
static get eventsType() {
|
|
11
|
+
return [EventType.CameraProjectionMatrix];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @override
|
|
16
|
+
*/
|
|
17
|
+
get _availability() {
|
|
18
|
+
return ArCore.availability;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @override
|
|
23
|
+
*/
|
|
24
|
+
start() {
|
|
25
|
+
this.providerId = ArCore.addEventListener(
|
|
26
|
+
events => {
|
|
27
|
+
const projMatrixEvent = events.find(event => event.dataType === EventType.CameraProjectionMatrix);
|
|
28
|
+
if (projMatrixEvent) {
|
|
29
|
+
this.notify(projMatrixEvent);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
error => this.notifyError(error)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @override
|
|
38
|
+
*/
|
|
39
|
+
stop() {
|
|
40
|
+
ArCore.removeEventListener(this.providerId);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default CameraProjectionMatrixProvider;
|
|
@@ -128,7 +128,7 @@ class ArCoreProvider extends Provider {
|
|
|
128
128
|
|
|
129
129
|
if (ref & Payload.ProjMat.ref) {
|
|
130
130
|
const projMatrix = payload.slice(bufferIndex, bufferIndex + Payload.ProjMat.size);
|
|
131
|
-
events.push(this.createEvent(EventType.
|
|
131
|
+
events.push(this.createEvent(EventType.CameraProjectionMatrix, projMatrix));
|
|
132
132
|
bufferIndex += Payload.ProjMat.size;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -6,7 +6,7 @@ import EventType from '../../events/EventType';
|
|
|
6
6
|
import Provider from '../Provider';
|
|
7
7
|
import StepDetectionMinMaxPeaks2 from './StepDetectionMinMaxPeaks2';
|
|
8
8
|
import {
|
|
9
|
-
Accelerometer,
|
|
9
|
+
Accelerometer, Gyroscope, RelativeAttitudeFromInertial
|
|
10
10
|
} from '../../Providers';
|
|
11
11
|
|
|
12
12
|
class StepDetectionProvider extends Provider {
|
|
@@ -23,7 +23,7 @@ class StepDetectionProvider extends Provider {
|
|
|
23
23
|
return Availability.merge(
|
|
24
24
|
Accelerometer.availability,
|
|
25
25
|
Gyroscope.availability,
|
|
26
|
-
|
|
26
|
+
RelativeAttitudeFromInertial.availability
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -44,7 +44,7 @@ class StepDetectionProvider extends Provider {
|
|
|
44
44
|
error => this.notifyError(error),
|
|
45
45
|
this.name);
|
|
46
46
|
|
|
47
|
-
this.attitudeProviderId =
|
|
47
|
+
this.attitudeProviderId = RelativeAttitudeFromInertial.addEventListener(
|
|
48
48
|
events => (this.attitudeEvent = events[0]),
|
|
49
49
|
error => this.notifyError(error),
|
|
50
50
|
this.name);
|
|
@@ -56,7 +56,7 @@ class StepDetectionProvider extends Provider {
|
|
|
56
56
|
stop() {
|
|
57
57
|
Accelerometer.removeEventListener(this.accelerometerProviderId);
|
|
58
58
|
Gyroscope.removeEventListener(this.gyroscopeProviderId);
|
|
59
|
-
|
|
59
|
+
RelativeAttitudeFromInertial.removeEventListener(this.attitudeProviderId);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
onAccelerometerEvent(accelerationEvent) {
|
|
@@ -63,7 +63,7 @@ class PositionSmoother {
|
|
|
63
63
|
smoothedPosition.time = refTimestamp + (i - 1) / this.frequency;
|
|
64
64
|
smoothedPosition.level = newPositionLevel;
|
|
65
65
|
smoothedPosition.bearing = newPosition.bearing;
|
|
66
|
-
smoothedPosition.accuracy += (newPosition.accuracy - smoothedPosition.accuracy) * i / nSamples;
|
|
66
|
+
smoothedPosition.accuracy += Math.max((newPosition.accuracy - smoothedPosition.accuracy) * i / nSamples, 0);
|
|
67
67
|
this.positionsQueue.push(smoothedPosition);
|
|
68
68
|
i++;
|
|
69
69
|
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Utils from './Utils';
|
|
4
|
-
import ProvidersLogger from '../../src/events/ProvidersLogger';
|
|
5
|
-
import { Attitude } from '../../src/Providers';
|
|
6
|
-
|
|
7
|
-
ProvidersLogger.enabled = true;
|
|
8
|
-
|
|
9
|
-
class AttitudeComponent extends React.Component {
|
|
10
|
-
|
|
11
|
-
constructor(props, context) {
|
|
12
|
-
super(props, context);
|
|
13
|
-
|
|
14
|
-
this.state = { attitude: null };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
componentDidMount() {
|
|
18
|
-
this.providerId = Attitude.addEventListener(
|
|
19
|
-
events => this.setState({ attitude: events[0] }),
|
|
20
|
-
error => this.setState({ attitude: error })
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
componentWillUnmount() {
|
|
25
|
-
Attitude.removeEventListener(this.providerId);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
render() {
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div>
|
|
32
|
-
<h3>Attitude:</h3>
|
|
33
|
-
{Utils.renderAttitudeEvent(this.state.attitude)}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default AttitudeComponent;
|
|
40
|
-
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PositioningPoseComponent from './PositioningPoseComponent';
|
|
3
|
-
import PositioningHandler from '../../src/PositioningHandler';
|
|
4
|
-
import PositioningInclinationComponent from './PositioningInclinationComponent';
|
|
5
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
6
|
-
|
|
7
|
-
ProvidersLogger.enabled = true;
|
|
8
|
-
|
|
9
|
-
class PositioningComponent extends React.Component {
|
|
10
|
-
|
|
11
|
-
constructor(props, context) {
|
|
12
|
-
super(props, context);
|
|
13
|
-
this.positioningHandler = new PositioningHandler();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
render() {
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<h2>Pose</h2>
|
|
21
|
-
<div><PositioningPoseComponent positioningHandler={this.positioningHandler} /></div>
|
|
22
|
-
<h2>Inclination</h2>
|
|
23
|
-
<div><PositioningInclinationComponent positioningHandler={this.positioningHandler} /></div>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default PositioningComponent;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEmpty from 'lodash.isempty';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import EventType from '../../src/events/EventType';
|
|
6
|
-
import Utils from './Utils';
|
|
7
|
-
import PositioningHandler from '../../src/PositioningHandler';
|
|
8
|
-
import StartStopComponent from './StartStopComponent';
|
|
9
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
10
|
-
|
|
11
|
-
ProvidersLogger.enabled = true;
|
|
12
|
-
|
|
13
|
-
class PositioningInclinationComponent extends React.Component {
|
|
14
|
-
|
|
15
|
-
static propTypes = { positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired };
|
|
16
|
-
|
|
17
|
-
constructor(props, context) {
|
|
18
|
-
super(props, context);
|
|
19
|
-
this.state = {
|
|
20
|
-
inclination: null,
|
|
21
|
-
errored: false
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
start() {
|
|
27
|
-
const output = this.props.positioningHandler.start(
|
|
28
|
-
[EventType.Inclination],
|
|
29
|
-
this.onEvents,
|
|
30
|
-
this.onError
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
if (!output) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
this.id = output.id;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
stop() {
|
|
42
|
-
this.props.positioningHandler.stop(this.id);
|
|
43
|
-
this.setState({
|
|
44
|
-
inclination: null,
|
|
45
|
-
errored: false
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
onEvents = (events) => {
|
|
50
|
-
const newState = {};
|
|
51
|
-
events.forEach(event => {
|
|
52
|
-
if (event.dataType === EventType.Inclination) {
|
|
53
|
-
newState.inclination = event.data;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
if (!isEmpty(newState)) {
|
|
57
|
-
this.setState(newState);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
onError = error => {
|
|
62
|
-
this.setState({
|
|
63
|
-
errored: true,
|
|
64
|
-
inclination: error
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
render() {
|
|
69
|
-
return (
|
|
70
|
-
<div>
|
|
71
|
-
<StartStopComponent
|
|
72
|
-
onStart={() => this.start()}
|
|
73
|
-
onStop={() => this.stop()}
|
|
74
|
-
errored={this.state.errored} />
|
|
75
|
-
|
|
76
|
-
<p>{Utils.renderInclination(this.state.inclination)}</p>
|
|
77
|
-
</div>
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default PositioningInclinationComponent;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import isEmpty from 'lodash.isempty';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import EventType from '../../src/events/EventType';
|
|
6
|
-
import NavigationConfig from './NavigationConfig';
|
|
7
|
-
import Utils from './Utils';
|
|
8
|
-
import PositioningHandler from '../../src/PositioningHandler';
|
|
9
|
-
import StartStopComponent from './StartStopComponent';
|
|
10
|
-
import MapComponent from './MapComponent';
|
|
11
|
-
import ProvidersLogger from '../../src/providers/ProvidersLogger';
|
|
12
|
-
|
|
13
|
-
ProvidersLogger.enabled = true;
|
|
14
|
-
|
|
15
|
-
class PositioningPoseComponent extends React.Component {
|
|
16
|
-
static propTypes = {positioningHandler: PropTypes.instanceOf(PositioningHandler).isRequired};
|
|
17
|
-
|
|
18
|
-
constructor(props, context) {
|
|
19
|
-
super(props, context);
|
|
20
|
-
this.state = {
|
|
21
|
-
position: null,
|
|
22
|
-
attitude: null,
|
|
23
|
-
errored: false
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
start() {
|
|
28
|
-
const output = this.props.positioningHandler.start(
|
|
29
|
-
[EventType.AbsolutePosition, EventType.AbsoluteAttitude],
|
|
30
|
-
this.onEvents,
|
|
31
|
-
this.onError,
|
|
32
|
-
{
|
|
33
|
-
waitInputPosition: true,
|
|
34
|
-
useMapMatching: true
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
if (!output) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
this.id = output.id;
|
|
43
|
-
|
|
44
|
-
this.props.positioningHandler.setItinerary(this.id, NavigationConfig.ITINERARY);
|
|
45
|
-
this.props.positioningHandler.setNetwork(this.id, NavigationConfig.ITINERARY);
|
|
46
|
-
this.props.positioningHandler.setPosition(this.id, NavigationConfig.INITIAL_POSITION);
|
|
47
|
-
this.props.positioningHandler.setHeading(this.id, NavigationConfig.INITIAL_HEADING);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
stop() {
|
|
51
|
-
this.props.positioningHandler.stop(this.id);
|
|
52
|
-
this.setState({
|
|
53
|
-
position: null,
|
|
54
|
-
attitude: null,
|
|
55
|
-
errored: false
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
onEvents = events => {
|
|
60
|
-
const newState = {};
|
|
61
|
-
events.forEach(event => {
|
|
62
|
-
if (event.dataType === EventType.AbsolutePosition) {
|
|
63
|
-
newState.position = event.data;
|
|
64
|
-
} else if (event.dataType === EventType.AbsoluteAttitude) {
|
|
65
|
-
newState.attitude = event.data;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
if (!isEmpty(newState)) {
|
|
69
|
-
this.setState(newState);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (this.map) {
|
|
73
|
-
this.map.parseEvents(events);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
onError = error => {
|
|
78
|
-
this.setState({
|
|
79
|
-
position: error,
|
|
80
|
-
attitude: error,
|
|
81
|
-
errored: true
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
render() {
|
|
86
|
-
const attitudeRender = Utils.renderAttitude(this.state.attitude);
|
|
87
|
-
const positionRender = Utils.renderPosition(this.state.position);
|
|
88
|
-
|
|
89
|
-
const itineraryRender = Utils.renderItineraryInfo(
|
|
90
|
-
this.state.position && !(this.state.position instanceof Error)
|
|
91
|
-
? NavigationConfig.ITINERARY.getInfo(this.state.position)
|
|
92
|
-
: null
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<div>
|
|
97
|
-
<StartStopComponent
|
|
98
|
-
onStart={() => this.start()}
|
|
99
|
-
onStop={() => this.stop()}
|
|
100
|
-
errored={this.state.errored}
|
|
101
|
-
/>
|
|
102
|
-
|
|
103
|
-
<h3>Position</h3>
|
|
104
|
-
{positionRender}
|
|
105
|
-
<h3>Attitude</h3>
|
|
106
|
-
{attitudeRender}
|
|
107
|
-
<h3>Map</h3>
|
|
108
|
-
<MapComponent ref={map => (this.map = map)}
|
|
109
|
-
network={NavigationConfig.ITINERARY} />
|
|
110
|
-
<h3>ItineraryInfo</h3>
|
|
111
|
-
{itineraryRender}
|
|
112
|
-
</div>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default PositioningPoseComponent;
|
package/dist/attitude.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="utf-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, user-scalable=no">
|
|
7
|
-
<title>Debug Attitude</title>
|
|
8
|
-
<script src="js/providers-components.js"></script>
|
|
9
|
-
</head>
|
|
10
|
-
|
|
11
|
-
<body>
|
|
12
|
-
<div id="app"></div>
|
|
13
|
-
<script>createReactElement(AttitudeComponent, document.getElementById('app'));</script>
|
|
14
|
-
</body>
|
|
15
|
-
|
|
16
|
-
</html>
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import Provider from '../Provider';
|
|
2
|
-
import EventType from '../../events/EventType';
|
|
3
|
-
import Availability from '../../events/Availability';
|
|
4
|
-
import {
|
|
5
|
-
RelativeAttitude, AbsoluteAttitude
|
|
6
|
-
} from '../../Providers';
|
|
7
|
-
|
|
8
|
-
class AttitudeProvider extends Provider {
|
|
9
|
-
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @override
|
|
16
|
-
*/
|
|
17
|
-
static get displayName() {
|
|
18
|
-
return 'Attitude';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @override
|
|
23
|
-
*/
|
|
24
|
-
static get eventsType() {
|
|
25
|
-
return [EventType.Attitude];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @override
|
|
30
|
-
*/
|
|
31
|
-
get _availability() {
|
|
32
|
-
return Availability.union(
|
|
33
|
-
RelativeAttitude.availability,
|
|
34
|
-
AbsoluteAttitude.availability
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @override
|
|
40
|
-
*/
|
|
41
|
-
start() {
|
|
42
|
-
|
|
43
|
-
if (RelativeAttitude.availability.isSupported) {
|
|
44
|
-
this.provider = RelativeAttitude;
|
|
45
|
-
} else {
|
|
46
|
-
this.provider = AbsoluteAttitude;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
this.providerId = this.provider.addEventListener(
|
|
50
|
-
events => this.notify(events[0].clone()),
|
|
51
|
-
error => this.notifyError(error),
|
|
52
|
-
this.name);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @override
|
|
57
|
-
*/
|
|
58
|
-
stop() {
|
|
59
|
-
this.provider.removeEventListener(this.providerId);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default AttitudeProvider;
|